3.4 KiB
3.4 KiB
Layer-SBOM Cache with Hash-Based Reuse
Module
Scanner
Status
VERIFIED
Description
Layer-level SBOM caching is implemented with a dedicated cache store, cache entries, put requests, maintenance service, and a LayerSbomService that integrates with the scanner pipeline.
Implementation Details
- Cache Abstractions:
src/Scanner/__Libraries/StellaOps.Scanner.Cache/Abstractions/ILayerCacheStore.cs-ILayerCacheStoreinterface defining cache operations (get, put, evict)src/Scanner/__Libraries/StellaOps.Scanner.Cache/Abstractions/LayerCacheEntry.cs-LayerCacheEntrymodel for cached layer SBOM data keyed by layer hashsrc/Scanner/__Libraries/StellaOps.Scanner.Cache/Abstractions/LayerCachePutRequest.cs-LayerCachePutRequestmodel for inserting new cache entries
- Cache Store:
src/Scanner/__Libraries/StellaOps.Scanner.Cache/LayerCache/LayerCacheStore.cs-LayerCacheStoreimplementation with hash-based lookup and TTL-based eviction
- Content-Addressable Storage:
src/Scanner/__Libraries/StellaOps.Scanner.Cache/LayerSbomCas/ILayerSbomCas.cs-ILayerSbomCasinterface for content-addressable SBOM storagesrc/Scanner/__Libraries/StellaOps.Scanner.Cache/LayerSbomCas/PostgresLayerSbomCas.cs-PostgresLayerSbomCasPostgreSQL-backed content-addressable store for layer SBOMs
- Maintenance:
src/Scanner/__Libraries/StellaOps.Scanner.Cache/Maintenance/ScannerCacheMaintenanceService.cs-ScannerCacheMaintenanceServicehandles cache cleanup, TTL-based eviction, and storage management
- DI Registration:
src/Scanner/__Libraries/StellaOps.Scanner.Cache/ScannerCacheServiceCollectionExtensions.cs - WebService Integration:
src/Scanner/StellaOps.Scanner.WebService/Services/ILayerSbomService.cs-ILayerSbomServiceinterface for layer SBOM operationssrc/Scanner/StellaOps.Scanner.WebService/Services/LayerSbomService.cs-LayerSbomServiceintegrates cache with the scanner pipelinesrc/Scanner/StellaOps.Scanner.WebService/Endpoints/LayerSbomEndpoints.cs- REST endpoints for layer SBOM retrieval
- Layer Composition:
src/Scanner/__Libraries/StellaOps.Scanner.Emit/Composition/LayerSbomComposer.cs- Composes per-layer SBOMssrc/Scanner/__Libraries/StellaOps.Scanner.Emit/Composition/ILayerSbomWriter.cs- Interface for writing per-layer SBOMssrc/Scanner/__Libraries/StellaOps.Scanner.Emit/Composition/SpdxLayerWriter.cs- SPDX format layer writersrc/Scanner/__Libraries/StellaOps.Scanner.Emit/Composition/CycloneDxLayerWriter.cs- CycloneDX format layer writer
E2E Test Plan
- Scan an image and verify layer SBOMs are cached by layer hash in the content-addressable store
- Rescan an image sharing cached layers and verify cached layer SBOMs are reused (cache hit) without re-analysis
- Verify cache entries include correct TTL metadata and are evicted after expiry by the maintenance service
- Retrieve a per-layer SBOM via the
LayerSbomEndpointsREST API and verify it contains the correct components for that layer - Verify cache put requests correctly store new layer SBOM data with content-addressed keys
- Verify the maintenance service runs periodic cleanup and removes stale cache entries
Verification
| Check | Result |
|---|---|
| Tier 0 - Source files exist | PASS |
| Tier 1 - Build + code review | PASS |
| Tier 2 - Integration tests | PASS |
| Verified | 2026-02-13T18:10:00Z |