Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
254 changes: 210 additions & 44 deletions doc/feature_bill-of-materials.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,47 +33,157 @@ A detailed inventory of all NuGet dependencies across the solution.
- Version
- Direct vs. transitive
- Target frameworks
- License type
- License type with link to the package license
- Vendor/maintainer
- Repository URL
- Last update date
- Known vulnerabilities
- Advisory database links
- Open source vs. Closed Source
- Commercial package with links to pricing pages


### Value
- Detect abandoned or risky packages
- Identify version inconsistencies across projects
- Provide upgrade recommendations
- Report changes in licenses between current used version and newer versions that are available

---

# 2. Framework & Platform Feature BOM
# 2. Framework & Platform Feature BOM ✅ **IMPLEMENTED**
Identifies which .NET platform features and frameworks the repository uses.

### Examples
- ASP.NET Core MVC
- Minimal APIs
- Entity Framework Core
- gRPC
- SignalR
- System.Text.Json
- HttpClientFactory
- BackgroundService / HostedService
- Azure SDKs
- Identity / Authorization
- Logging providers

### Detection Methods
- Using statements
- Base classes
- Attributes
- DI registrations
- Project references
## Implementation Status

### ✅ Completed Features

#### **Project Configuration Analysis**
- Target framework detection (single and multi-targeting)
- SDK type identification (Microsoft.NET.Sdk, Microsoft.NET.Sdk.Web, etc.)
- Project feature detection (Nullable, ImplicitUsings, ASP.NET hosting models)
- Test project identification

#### **Package-Based Framework Detection** (Extensible Plugin Architecture)
Implemented using the **Single Responsibility Principle** with individual detector classes:

1. **Web Framework Features** (11+ features detected)
- ASP.NET Core MVC
- Razor Pages
- Blazor Server & WebAssembly
- SignalR (Server & Client)
- gRPC
- Health Checks
- Swagger/OpenAPI (Swashbuckle, NSwag)
- API Versioning

2. **Data Access** (9+ features detected)
- Entity Framework Core
- EF Core Providers: SQL Server, PostgreSQL, SQLite, InMemory, Cosmos DB
- Dapper
- MongoDB Driver

3. **Authentication & Security** (6+ features detected)
- ASP.NET Core Identity
- JWT Bearer Authentication
- OpenID Connect
- Microsoft Identity (Azure AD)
- IdentityServer/Duende
- Auth0

4. **Cloud Services** (8+ services detected)
- Azure: Blob Storage, Service Bus, Key Vault, Cosmos DB
- AWS SDK packages (dynamic detection)
- Redis (StackExchange.Redis)
- RabbitMQ
- Apache Kafka

5. **Logging & Monitoring** (5+ features detected)
- Serilog
- NLog
- Application Insights
- OpenTelemetry
- Seq

6. **Testing Frameworks** (6+ features detected)
- xUnit, NUnit, MSTest
- Moq
- FluentAssertions
- Bogus (fake data generation)

### Detection Methods Implemented
- ✅ NuGet package analysis (primary method)
- ✅ Project SDK attribute detection
- ✅ Multi-targeting detection
- ✅ Project file property analysis
- ⚠️ Using statements (not yet implemented - future enhancement)
- ⚠️ Base classes (not yet implemented - future enhancement)
- ⚠️ Attributes (not yet implemented - future enhancement)

### Architecture
- **Extensible plugin system** - Each category has its own detector class implementing `IFrameworkFeatureDetector`
- **Single Responsibility** - Easy to add new detectors without modifying existing code
- **Testable** - 35+ unit tests covering detection logic
- **Ordered output** - Categories appear in logical order (Web → Data → Auth → Cloud → Logging → Testing)

### Output Format
Framework features are displayed in categorized tables showing:
- Feature name
- Package providing the feature
- Version
- Projects using the feature

### Additional Features to Implement

#### **High Priority**
- **Background Processing Detection**
- Hangfire
- Quartz.NET
- MassTransit
- Rebus
- IHostedService implementations

- **Serialization & API Technologies**
- System.Text.Json (built-in detection)
- Newtonsoft.Json (legacy detection)
- Protobuf
- MessagePack

- **Dependency Injection Extensions**
- Autofac
- Scrutor
- Custom DI containers

#### **Medium Priority**
- **HTTP Client & API Communication**
- HttpClient patterns
- Refit
- RestSharp
- Polly (resilience patterns)

- **Caching**
- In-memory caching
- Distributed caching
- Output caching

- **Real-time & Messaging**
- Event buses
- Message brokers
- Pub/sub patterns

#### **Source Code Analysis (Future Enhancement)**
To detect frameworks used without explicit package references:
- ASP.NET Core Minimal APIs (using statements, endpoint mapping patterns)
- BackgroundService implementations (base class detection)
- Controller/Hub inheritance patterns
- Custom attributes and middleware

### Value
- Helps teams understand architectural patterns
- Supports modernization and migration planning
- Enables feature‑level compliance checks
- ✅ Provides instant visibility into architectural patterns in use
- ✅ Supports modernization and migration planning (e.g., Newtonsoft.Json → System.Text.Json)
- ✅ Enables feature‑level compliance checks
- ✅ Helps new team members understand the tech stack
- ✅ Identifies technology sprawl and opportunities for consolidation

---

Expand Down Expand Up @@ -233,26 +343,82 @@ codemedic bom validate --rules enterprise.json

# 9. Implementation Roadmap (High‑Level)

### Phase 1 — Core BOM Engine
- NuGet package scanning
- Framework feature detection
- JSON + Markdown output

### Phase 2 — Vendor & Service Detection
- Cloud SDK heuristics
- Config‑based service detection
- Vendor metadata linking

### Phase 3 — Environment & Tooling BOM
- Config scanning
- Build pipeline analysis
- Docker + GitHub Actions detection

### Phase 4 — Enterprise Features
- Drift detection
- BOM diffs
- Compliance rules
- Procurement exports
### ✅ Phase 1 — Core BOM Engine (COMPLETED)
- ✅ NuGet package scanning (direct + transitive dependencies)
- ✅ License detection and reporting
- ✅ Latest version checking with update recommendations
- ✅ License change detection between versions
- ✅ Open source vs closed source classification
- ✅ Commercial package identification
- ✅ Framework feature detection (6 categories, 45+ features)
- ✅ Project configuration analysis
- ✅ Console output (rich, color-coded with Spectre.Console)
- ✅ Extensible detector plugin architecture
- ⚠️ JSON output (not yet implemented)
- ⚠️ Markdown export (not yet implemented)

### Phase 2 — Enhanced Framework Detection (IN PROGRESS)
- ✅ Package-based detection (completed)
- ⏳ Background processing frameworks (Hangfire, Quartz, MassTransit)
- ⏳ Serialization technologies (System.Text.Json vs Newtonsoft.Json analysis)
- ⏳ HTTP client patterns and resilience (Refit, Polly)
- ⏳ Caching strategies detection
- ⏳ Source code analysis for built-in frameworks (Minimal APIs, BackgroundService)

### Phase 3 — Vendor & Service Detection (PARTIALLY COMPLETE)
- ✅ Cloud SDK detection (Azure, AWS via packages)
- ⏳ Config-based service detection (appsettings.json analysis)
- ⏳ Connection string analysis
- ⏳ API endpoint detection
- ⏳ Vendor metadata linking (documentation, pricing, status pages)
- ⏳ Third-party service detection (Stripe, Twilio, Auth0, SendGrid)

### Phase 4 — Environment & Tooling BOM
- ⏳ Config scanning (environment variables, secrets, feature flags)
- ⏳ Build pipeline analysis (GitHub Actions, Azure DevOps)
- ⏳ Docker base image detection
- ⏳ .NET SDK version requirements (global.json)
- ⏳ MSBuild custom targets
- ⏳ Code generators (NSwag, EF migrations)

### Phase 5 — Output Formats & Export
- ⏳ JSON export for automation
- ⏳ Markdown export for documentation
- ⏳ SBOM format support (CycloneDX, SPDX)
- ⏳ CSV export for spreadsheet analysis
- ⏳ HTML report generation

### Phase 6 — Enterprise Features
- ⏳ BOM drift detection (changes over time)
- ⏳ BOM diff between branches
- ⏳ Compliance rule validation
- ⏳ License compatibility checks
- ⏳ Vendor approval list validation
- ⏳ Procurement exports
- ⏳ Security posture scoring

---

## Current Implementation Statistics

### Test Coverage
- **138 total unit tests** (all passing)
- **35 tests** specifically for framework feature detection
- **17 tests** for NuGet package analysis
- Coverage across detectors, engines, and integration scenarios

### Detected Technologies
- **45+ framework features** across 6 categories
- **21 NuGet packages** in CodeMedic repository (example scan)
- **2 testing frameworks** (xUnit, Moq)
- Automatic detection of multi-targeting and SDK types

### Architecture Quality
- ✅ Single Responsibility Principle (each detector is independent)
- ✅ Open/Closed Principle (extensible without modification)
- ✅ Dependency Inversion (detectors implement interfaces)
- ✅ Comprehensive XML documentation
- ✅ Cross-platform compatible (Windows, macOS, Linux)

---

Expand Down
Loading