feat: ExperionCrawler IIoT OPC UA Data Bridge Infrastructure

Major project initialization and feature implementation:

**Core Features:**
- OPC UA client for Honeywell Experion HS R530 integration
- Real-time data streaming and history data retrieval
- Text-to-SQL query engine with TimeScaleDB
- JSON-based node configuration system
- SQLite database with migration support

**Architecture:**
- Clean architecture with Domain, Application, Infrastructure layers
- ASP.NET Core Web API frontend
- Web UI with real-time visualization
- PKI-based OPC UA authentication (TLS)

**Infrastructure Components:**
- ExperionOpcClient: OPC UA connection management
- ExperionRealtimeService: Real-time data streaming
- ExperionHistoryService: Historical data queries
- TextToSqlService: Natural language to SQL queries
- SqlValidator: SQL injection prevention

**Database:**
- TimescaleDB integration (recommended) or SQLite fallback
- Entity Framework Core with Extenstion methods
- OPCTag, KeyValue tables for data storage

**Security:**
- Certificate-based OPC UA endpoint security
- SSL/TLS encryption for database connections
- Output param binding injection prevention

**Testing:**
- Unit tests for TextToSqlService and SqlValidator
- Integration tests for Korean time range extraction

See REVIEW_REQUEST.md for detailed code review information.
This commit is contained in:
windpacer
2026-04-26 19:28:56 +09:00
parent e34ec08001
commit 77bdcf1f7f
60 changed files with 10948 additions and 227 deletions

View File

@@ -6,14 +6,18 @@
- MED: 8건 → fixed 5 / wont-fix 1 / needs-review 2
- LOW: 5건 → wont-fix 5
> **아키텍처 노트**: ExperionHypertableController(#3, #4)와 관련 DbContext 메서드는 레거시 관리 도구입니다.
> 앱 코어 경로는 `history_table`을 직접 조회(time_bucket 미사용)하도록 변경되어 있으며,
> 이 컨트롤러는 history_table → TimescaleDB hypertable 전환이 필요할 때를 위한 one-time 관리 UI로 보존합니다.
## 이슈 목록
| # | 파일 | 라인 | 심각도 | 분류 | 문제 설명 | 수정 방향 | 상태 |
|---|------|------|--------|------|-----------|-----------|------|
| 1 | src/Infrastructure/OpcUa/ExperionRealtimeService.cs | 101-122 | HIGH | bug | StartAsync 재진입 시 File.ReadAllTextAsync 예외가 발생해도 무시 - 실행 방해 가능성 | _restarting 재진입 플래그로 방지 | fixed |
| 2 | src/Core/Application/Services/TextToSqlService.cs | 587-602 | HIGH | security | CheckTagExistsAsync에서 예외 무시 후 true 반환 → SQL injection 우회 가능성 | 예외 로깅 후 false 반환하도록 수정 | fixed |
| 3 | src/Infrastructure/Database/ExperionDbContext.cs | 177-208 | HIGH | security | CreateHistoryHypertableIfNotExistsAsync에서 SQL interpolation 사용 - SQL injection 가능성 | NpgsqlParameter를 사용한 parameterized query로 변경 | fixed |
| 4 | src/Web/Controllers/ExperionHypertableController.cs | 595 | HIGH | security | Create 메서드에서 직접 user input을 SQL 파라미터로 변환하지 않고 신뢰 - 파라미터 무결성 검증 부재 | 테이블명 allowlist + PostgreSQL 식별자 regex 검증 추가 | fixed |
| 3 | src/Infrastructure/Database/ExperionDbContext.cs | 177-208 | HIGH | security | CreateHistoryHypertableIfNotExistsAsync에서 SQL interpolation 사용 - SQL injection 가능성 | NpgsqlParameter를 사용한 parameterized query로 변경 — ※ 레거시 관리 도구 (앱 시작 시 미호출, UI 수동 트리거 전용) | fixed |
| 4 | src/Web/Controllers/ExperionHypertableController.cs | 595 | HIGH | security | Create 메서드에서 직접 user input을 SQL 파라미터로 변환하지 않고 신뢰 - 파라미터 무결성 검증 부재 | 테이블명 allowlist + PostgreSQL 식별자 regex 검증 추가 — ※ 레거시 관리 도구 (history_table을 TimescaleDB hypertable로 전환하는 one-time 도구) | fixed |
| 5 | src/Web/Controllers/ExperionControllers.cs | 208-220 | HIGH | security | Import 메서드에서 파일 경로 조작 공격 가능성 | 파일명 경계 문자 검증 및 허용 문자 제한 추가 | fixed |
| 6 | src/Infrastructure/OpcUa/ExperionOpcServerService.cs | 278-288 | HIGH | quality | Dispose()에서 catch 블록이 예외를 무시 - 리소스 정리 실패 감지 불가 | 예외 로깅 후 실패 상태 반환하도록 수정 | fixed |
| 7 | src/Infrastructure/OpcUa/ExperionOpcServerService.cs | 291 | HIGH | quality | DisposeAsync()에서 예외를 무시하고 리소스 정리만 수행 - 행위 불일치 | 072d0c9에서 예외 로깅 추가 완료 | fixed |