Skip to content

feat(container): surface provenance attestations behind feature flag [PRIM-100] - #7047

Open
bdemeo12 wants to merge 2 commits into
mainfrom
PRIM-100/cli-provenance-attestations-ff
Open

feat(container): surface provenance attestations behind feature flag [PRIM-100]#7047
bdemeo12 wants to merge 2 commits into
mainfrom
PRIM-100/cli-provenance-attestations-ff

Conversation

@bdemeo12

@bdemeo12 bdemeo12 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What

Surfaces container image provenance attestations through the CLI, gated behind a feature flag.

  • Bumps snyk-docker-plugin ^9.16.0^9.18.0, which adds provenance attestation extraction (emits the provenanceMetadata fact).
  • Gates that fact behind the surfaceProvenanceAttestations feature flag in filterDockerFacts, mirroring the existing allowNewContainerFacts pattern. When the flag is off, provenanceMetadata is filtered out before facts are sent downstream; when on, it is forwarded to Registry for upsert.

The provenance flag is independent of allowNewContainerFacts so it can be rolled out separately.

Changes

  • package.json / package-lock.json — bump snyk-docker-plugin to ^9.18.0.
  • src/cli/commands/constants.ts — add SURFACE_PROVENANCE_ATTESTATIONS_FEATURE_FLAG = 'surfaceProvenanceAttestations'.
  • src/lib/ecosystems/common.ts — in filterDockerFacts, filter provenanceMetadata unless the flag is enabled.

Feature flag

surfaceProvenanceAttestations — defined in registry (snyk/registry#44819).

Downstream

This is the CLI half of the end-to-end provenance work. Registry relays the fact and assets-api persists it.

Notes

n/a

…[PRIM-100]

Bump snyk-docker-plugin to ^9.18.0 (adds provenance attestation extraction)
and gate the provenanceMetadata fact behind the surfaceProvenanceAttestations
feature flag in filterDockerFacts, mirroring the allowNewContainerFacts pattern.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@snyk-io

snyk-io Bot commented Jul 28, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor
Warnings
⚠️

You've modified files in src/ directory, but haven't updated anything in test folder. Is there something that could be tested?

⚠️ There are multiple commits on your branch, please squash them locally before merging!
⚠️

"[feat(container): surface provenance attestations behind feature flag PRIM-100](#7047)" is too long. Keep the first line of your commit message under 72 characters.

⚠️

"[feat(container): surface provenance attestations behind feature flag PRIM-100](https://api.github.com/repos/snyk/cli/git/commits/a9a23fd0ae4f60e13f968babafad44716df71ab6)" is too long. Keep the first line of your commit message under 72 characters.

Generated by 🚫 dangerJS against df31acd

@bdemeo12
bdemeo12 marked this pull request as ready for review July 28, 2026 14:50
@bdemeo12
bdemeo12 requested a review from a team as a code owner July 28, 2026 14:50
@snyk-pr-review-bot

This comment has been minimized.

Picks up snyk-docker-plugin 9.19.0, which falls back to BuildKit's
vcs.source for buildConfigSourceUri on local builds
(snyk/snyk-docker-plugin#889) so locally-built images still surface their
source repository in the provenanceMetadata fact. Registry maps that field
to repository_uri when relaying the asset upsert.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@snyk-pr-review-bot

Copy link
Copy Markdown

PR Reviewer Guide 🔍

🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Performance Regression 🟡 [minor]

The original implementation allowed an early return of the pluginResponse if includeAllFacts was true. The new logic now forces a full map and filter pass across all scanResults and their facts whenever includeProvenanceAttestations is false, even if includeAllFacts is true. For large container images with thousands of facts, this adds unnecessary iteration overhead to the scan pipeline for a flag that will be disabled for most users initially.

if (includeAllFacts && includeProvenanceAttestations) {
  return pluginResponse;
}
// At least one flag is disabled = filter out the corresponding facts
return {
  ...pluginResponse,
  scanResults: pluginResponse.scanResults.map(
    (scanResult: ScanResult, index: number) => ({
      ...scanResult,
      facts: scanResult.facts.filter((fact) => {
        // Provenance attestations are only surfaced when their flag is on,
        // independently of the new-facts flag.
        if (fact.type === PROVENANCE_METADATA_FACT_TYPE) {
          return includeProvenanceAttestations;
        }
        // When the new-facts flag is on, keep all remaining facts.
        if (includeAllFacts) {
          return true;
        }
        return !shouldFilterFact(fact, index === 0);
      }),
📚 Repository Context Analyzed

This review considered 7 relevant code sections from 4 files (average relevance: 0.56)

🤖 Repository instructions applied (from AGENTS.md)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants