Skip to content

Add offline signing flag - #5059

Open
aaronlew02 wants to merge 2 commits into
sigstore:mainfrom
aaronlew02:offline-flag-2
Open

Add offline signing flag#5059
aaronlew02 wants to merge 2 commits into
sigstore:mainfrom
aaronlew02:offline-flag-2

Conversation

@aaronlew02

@aaronlew02 aaronlew02 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Closes #5013

Summary

This change adds an --offline flag to signing and attestation commands to sign without connectivity to any online services.

This change removes the deprecated --use-signing-config flag.

Release Note

  • A signing config and trusted root are fetched from TUF by default.
  • Either file can instead be provided manually with --signing-config or --trusted-root.
  • --offline will:
    • Prevent either file from being fetched by TUF.
    • Disallow --signing-config, --trusted-root, --issue-certificate, and custom service URLs.
    • Require a private key (--key).

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.64%. Comparing base (2ef6022) to head (df61d1c).
⚠️ Report is 825 commits behind head on main.

Files with missing lines Patch % Lines
cmd/cosign/cli/signcommon/common.go 0.00% 36 Missing ⚠️
cmd/cosign/cli/options/attest.go 0.00% 4 Missing ⚠️
cmd/cosign/cli/options/attest_blob.go 0.00% 4 Missing ⚠️
cmd/cosign/cli/options/sign.go 0.00% 4 Missing ⚠️
cmd/cosign/cli/options/signblob.go 0.00% 4 Missing ⚠️
cmd/cosign/cli/attest.go 0.00% 1 Missing ⚠️
cmd/cosign/cli/attest_blob.go 0.00% 1 Missing ⚠️
cmd/cosign/cli/sign.go 0.00% 1 Missing ⚠️
cmd/cosign/cli/signblob.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5059      +/-   ##
==========================================
- Coverage   40.10%   39.64%   -0.47%     
==========================================
  Files         155      207      +52     
  Lines       10044    13067    +3023     
==========================================
+ Hits         4028     5180    +1152     
- Misses       5530     7153    +1623     
- Partials      486      734     +248     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Aaron Lew <64337293+aaronlew02@users.noreply.github.com>
@aaronlew02 aaronlew02 changed the title Add --offline signing flag Add offline signing flag Aug 14, 2026
@aaronlew02
aaronlew02 marked this pull request as ready for review August 14, 2026 18:48
@aaronlew02
aaronlew02 requested a review from a team as a code owner August 14, 2026 18:48

@Hayden-IO Hayden-IO left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a few small suggestions! Can you also update the README to document this? While we need to do a lot of updates for the main README, I think this is worth calling out.

return fmt.Errorf("cannot specify service URLs when using a signing config")
}
if !tlogUpload {
return fmt.Errorf("--tlog-upload=false is not supported with a signing config. Provide a signing config with --signing-config without a transparency log service, which can be created with `cosign signing-config create` or `curl https://raw.githubusercontent.com/sigstore/root-signing/refs/heads/main/targets/signing_config.v0.2.json | jq 'del(.rekorTlogUrls)'` for the public instance")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this error message be updated to mention the offline flag as an alternative now? Or as the only alternative, rather than mentioning an empty signing config? I think we can remove the mention of deleting just the Rekor URLs because it still logs the certificate issuance, and I think those who would want to skip the tlog upload would also want to skip Fulcio/CT logging too.

return fmt.Errorf("loading trusted root: %w", err)
}
} else {
ko.TrustedMaterial, err = cosign.TrustedRoot()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be cool if we could also have an e2e test that demonstrates signing is offline. Something like, clear the TUF repo directory, call sign, verify the directory is still empty?

"whether to use a TUF-provided signing config for the service URLs")
_ = cmd.Flags().MarkDeprecated("use-signing-config", "an offline signing flag will be added in the future; TUF will continue to provide a signing config by default if one is not provided manually")
cmd.Flags().BoolVar(&o.Offline, "offline", false,
"only allow offline signing with a local key without contacting network services")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the flag's documentation call out that the key usage isn't logged and therefore isn't auditable? I want to convey that the signer is acknowledging that using this flag means they are not mitigating some of the threats outlined in https://docs.sigstore.dev/about/threat-model/.

if serviceURLsSpecified {
return fmt.Errorf("cannot specify service URLs when signing offline")
}
ko.SigningConfig = NewEmptySigningConfig()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, can you add a comment documenting this line? I think it's easy to miss that this is what prevents any network calls.

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.

Offline signing flag

2 participants