Skip to content

feat: add cosign verification acceptance tests with private Sigstore stack - #814

Open
trevor-vaughan wants to merge 1 commit into
mainfrom
opsx/678-policy-complypack-acceptance-tests
Open

feat: add cosign verification acceptance tests with private Sigstore stack#814
trevor-vaughan wants to merge 1 commit into
mainfrom
opsx/678-policy-complypack-acceptance-tests

Conversation

@trevor-vaughan

@trevor-vaughan trevor-vaughan commented Aug 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Add container-based acceptance tests for complyctl get signature verification against a real zot OCI registry with a full private Sigstore stack (Dex, Fulcio fileca, CTFE CT log, Rekor+Trillian+MySQL), covering 8 scenarios: keyed happy path, wrong key, keyless happy path, wrong identity, --skip-verify, per-entry skip_verify, per-entry override, and unsigned artifact rejection
  • Fix four defects in internal/cache/verify.go exposed by the live stack: plain-HTTP registry scheme support (insecure flag), PublicKey verification material for keyed bundles, hex-decode of Rekor logID (was base64), and use of signature-layer digest (simplesigning payload) instead of manifest digest for the message-signature artifact digest
  • Add Makefile targets (test-acceptance-verify, test-acceptance-verify-clean, test-acceptance-all), CI workflow (acceptance_verify_test.yml), and documentation updates (AGENTS.md, CHANGELOG.md, TESTING_ENVIRONMENT.md)

Related Issues

Review Hints

  • Start with tests/acceptance/verification_test.go for the 8 test scenarios and their assertions, then tests/acceptance/verification_helpers_test.go for the shared test utilities (writeVerificationConfig, readPolicyState, clearPolicyCache)

  • Review internal/cache/verify.go for the four production bug fixes — each has an inline comment explaining the root cause. The corresponding unit test changes are in internal/cache/verify_test.go and internal/cache/sync_test.go (TestSync_RegistryHost_SchemeStripped)

  • tests/acceptance/compose.yaml defines the Sigstore service topology under the verification profile — sign-seed.sh is the most complex new script (pushes, signs keyed+keyless, builds trusted_root.json)

  • Test PKI under tests/acceptance/testdata/sigstore/ is test-only with zero security value (see README.md there); passphrases are fulcio and ctfe

  • The VerifyFunc signature changed from 2 to 3 parameters (added insecure bool), so all mock verifiers in *_test.go files were updated mechanically

@trevor-vaughan trevor-vaughan added enhancement New feature or request llm_assisted Filed or drafted with LLM assistance labels Aug 10, 2026
Comment thread tests/acceptance/Dockerfile.createtree Fixed
Comment thread tests/acceptance/Dockerfile.sign-seed Fixed
Comment thread tests/acceptance/Dockerfile.sign-seed Fixed
Comment thread tests/acceptance/Dockerfile.verify-sut Fixed
Comment thread tests/acceptance/Dockerfile.createtree Fixed
Comment thread tests/acceptance/Dockerfile.sign-seed Fixed
Comment thread tests/acceptance/Dockerfile.verify-sut Fixed
Comment thread tests/acceptance/Dockerfile.sign-seed Dismissed
Comment thread tests/acceptance/Dockerfile.verify-sut Dismissed
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

✅ CRAP Load Analysis: PASS

Summary

Metric Value
Functions analysed 197
Avg complexity 4
Avg line coverage 58.7%
Avg CRAP score 8.3
CRAPload (>= 15) 22
Avg contract coverage 45.8%
Avg GazeCRAP score 7
GazeCRAPload (>= 15) 2
Regressions 4
Improvements 3
New functions 17

Quadrant Distribution

Quadrant Count
Q1 Safe 10
Q2 Complex but Tested 0
Q3 Simple but Underspecified 2
Q4 Dangerous 0

Regressions

Function Baseline CRAP Current CRAP Delta Baseline GazeCRAP Current GazeCRAP Delta
cmd/complyctl/cli/doctor.go:doctorCmd 2 4.10546875 2.10546875 N/A N/A N/A
internal/cache/sync.go:BuildLookupRef 4 5 1 N/A N/A N/A
internal/cache/sync.go:(*Sync).SyncPolicy 15.439453125 17.47058823529412 2.0311351102941195 N/A N/A N/A
internal/cache/verify.go:buildVerificationMaterial 5.072886297376093 6.0703125 0.9974262026239069 N/A N/A N/A

Improvements

Function Baseline CRAP Current CRAP Delta Baseline GazeCRAP Current GazeCRAP Delta
cmd/complyctl/cli/doctor.go:printDiagnostics 8.006910700788252 1 -7.006910700788252 N/A N/A N/A
internal/cache/complypack_sync.go:(*ComplypackSync).SyncComplypack 40.90168939548137 33.51745400565568 -7.38423538982569 N/A N/A N/A
internal/cache/verify.go:NewKeylessVerifier 42 11.880466472303205 -30.119533527696795 N/A 8 N/A

New Functions

Status Function CRAP GazeCRAP Note
+ cmd/complyctl/cli/doctor.go:summarizeResults 7.036814425244177 N/A new
+ cmd/complyctl/cli/doctor.go:countStatusSummary 4 N/A new
+ cmd/complyctl/cli/doctor.go:statusLabel 4 N/A new
+ cmd/complyctl/cli/doctor.go:resolveFormat 5 N/A new
+ cmd/complyctl/cli/doctor.go:resultLabel 2 N/A new
+ cmd/complyctl/cli/doctor.go:statusEmoji 4 N/A new
+ cmd/complyctl/cli/doctor.go:humanStatusPrefix 1 N/A new
+ cmd/complyctl/cli/doctor.go:textStatusPrefix 1 N/A new
+ cmd/complyctl/cli/doctor.go:renderDiagnostics 9.005184 N/A new
+ cmd/complyctl/cli/doctor.go:printDiagnosticsHuman 1 N/A new
+ cmd/complyctl/cli/doctor.go:printDiagnosticsText 1 N/A new
+ cmd/complyctl/cli/doctor.go:convertResult 2 N/A new
+ cmd/complyctl/cli/doctor.go:printDiagnosticsJSON 4.0092592592592595 N/A new
+ cmd/complyctl/cli/doctor.go:printDiagnosticsTo 4 N/A new
+ internal/cache/verify.go:nameOptions 2 N/A new
+ internal/registry/client.go:NormalizeHost 2 N/A new
+ internal/registry/client.go:SplitHostScheme 2 N/A new

View full analysis logs

@trevor-vaughan
trevor-vaughan force-pushed the opsx/678-policy-complypack-acceptance-tests branch from 43010b4 to a6f3af4 Compare August 10, 2026 23:01
Comment thread tests/acceptance/Dockerfile.generate-pki Fixed
Comment thread tests/acceptance/Dockerfile.generate-pki Fixed
Comment thread tests/acceptance/Dockerfile.generate-pki Fixed
Comment thread tests/acceptance/Dockerfile.generate-pki Dismissed
@trevor-vaughan
trevor-vaughan force-pushed the opsx/678-policy-complypack-acceptance-tests branch from a6f3af4 to ab9e12f Compare August 11, 2026 14:12
@trevor-vaughan trevor-vaughan changed the title Add cosign verification acceptance tests with private Sigstore stack feat: add cosign verification acceptance tests with private Sigstore stack Aug 11, 2026
Container-based acceptance tests for `complyctl get` signature
verification, running against a real zot OCI registry with a
full private Sigstore stack (Dex OIDC, Fulcio fileca, Trillian
CTFE CT log, Rekor transparency log backed by MySQL + Trillian).
Eight test scenarios cover keyed verification (happy path, wrong
key), keyless verification (happy path, wrong identity), and
configuration behavior (--skip-verify, per-entry skip_verify,
per-entry override, unsigned artifact rejection).

- fix(verify): honor http:// plain-HTTP registry scheme in signature resolution
  - go-containerregistry defaults to HTTPS; VerifyFunc gains an insecure
    parameter, and Sync/ComplypackSync strip the scheme via
    registry.SplitHostScheme so cosign lookups work against plain-HTTP
    test registries
- fix(verify): emit PublicKey verification material for keyed bundles
  - sigstore-go rejects bundles with empty VerificationMaterial; keyed
    signatures (no cert, no Rekor bundle) now carry a PublicKeyIdentifier
- fix(verify): hex-decode Rekor bundle logID instead of base64
  - cosign writes logID as hex (SHA-256 of log public key); decoding as
    base64 produced wrong bytes so the entry never matched a trusted tlog
- fix(verify): use signature-layer digest as message-signature artifact digest
  - cosign signs the simplesigning payload, not the policy manifest; the
    signature layer's OCI descriptor digest is the value recorded in the
    Rekor hashedrekord entry
- refactor(registry): add SplitHostScheme and NormalizeHost helpers
- build(acceptance): add Makefile targets test-acceptance-verify,
  test-acceptance-verify-clean, test-acceptance-all
- ci(acceptance): add acceptance_verify_test.yml workflow (20-min timeout)
- docs: update AGENTS.md, CHANGELOG.md, TESTING_ENVIRONMENT.md with
  verification profile, test PKI, and Sigstore service topology
- docs(openspec): add 678-policy-complypack-acceptance-tests design,
  proposal, and tasks

Refs: #678
Assisted-by: Claude Opus 4.8
Signed-off-by: Trevor Vaughan <tvaughan@redhat.com>
@trevor-vaughan
trevor-vaughan force-pushed the opsx/678-policy-complypack-acceptance-tests branch from ab9e12f to 5cfef63 Compare August 11, 2026 14:48
@trevor-vaughan
trevor-vaughan marked this pull request as ready for review August 11, 2026 15:01
@trevor-vaughan
trevor-vaughan requested a review from a team as a code owner August 11, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request llm_assisted Filed or drafted with LLM assistance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add real acceptance test following implementation of sigstore-go verification for policies and complypacks

3 participants