2.3 KiB
2.3 KiB
GoldenSet Library Charter
Mission
Provide foundational data models, storage, and validation for Golden Set definitions - ground-truth facts about vulnerability code-level manifestation.
Responsibilities
- Domain Models: GoldenSetDefinition, VulnerableTarget, BasicBlockEdge, WitnessInput, GoldenSetMetadata
- Validation: Schema validation, CVE existence check, edge format validation, sink registry lookup
- Storage: PostgreSQL persistence with content-addressed retrieval
- Serialization: YAML round-trip serialization with snake_case convention
- Sink Registry: Lookup service for known sinks mapped to CWE categories
Key Principles
- Immutability: All models are immutable records with ImmutableArray collections
- Content-Addressing: All golden sets have SHA256-based content digests for deduplication
- Determinism: Serialization and hashing produce deterministic outputs
- Air-Gap Ready: Validation supports offline mode without external lookups
- Human-Readable: YAML as primary format for git-friendliness
DAL Technology
- Primary: EF Core v10 DbContext (
EfCore/Context/GoldenSetDbContext.cs) with 3 entities (definitions, targets, audit_log) ingolden_setsschema. - Compiled model:
EfCore/CompiledModels/GoldenSetDbContextModelgenerated for runtime performance. - Legacy:
PostgresGoldenSetStorestill uses NpgsqlDataSource directly (deferred from EF Core conversion). Mixed DAL acceptable per cutover strategy. - SQL migrations remain authoritative: EF models are scaffolded FROM the SQL schema, never the reverse.
Dependencies
BinaryIndex.Contracts- Shared contracts and DTOsNpgsql- PostgreSQL driverNpgsql.EntityFrameworkCore.PostgreSQL- EF Core Npgsql providerMicrosoft.EntityFrameworkCore- EF Core v10YamlDotNet- YAML serializationMicrosoft.Extensions.*- DI, Options, Logging, Caching
Required Reading
docs/modules/binary-index/golden-set-schema.mddocs-archived/implplan/SPRINT_20260110_012_001_BINDEX_golden_set_foundation.mddocs/db/EF_CORE_MODEL_GENERATION_STANDARDS.md
Test Strategy
- Unit tests in
StellaOps.BinaryIndex.GoldenSet.Tests - Integration tests with Testcontainers PostgreSQL
- Property-based tests for serialization round-trip