Skip to content

Commit

Permalink
cli: --offline means fully offline
Browse files Browse the repository at this point in the history
With this change, `--offline` also disables TUF
repository updates and not just online log lookups.

Closes #483.

Signed-off-by: William Woodruff <william@trailofbits.com>
  • Loading branch information
woodruffw committed Sep 26, 2024
1 parent 32919e1 commit 0d52bde
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions sigstore/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,12 +996,12 @@ def _collect_verification_state(

if args.staging:
_logger.debug("verify: staging instances requested")
verifier = Verifier.staging()
verifier = Verifier.staging(offline=args.offline)
elif args.trust_config:
trust_config = ClientTrustConfig.from_json(args.trust_config.read_text())
verifier = Verifier._from_trust_config(trust_config)
else:
verifier = Verifier.production()
verifier = Verifier.production(offline=args.offline)

all_materials = []
for file_or_hashed, materials in input_map.items():
Expand Down
8 changes: 4 additions & 4 deletions sigstore/verify/verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,23 @@ def __init__(self, *, rekor: RekorClient, trusted_root: TrustedRoot):
self._trusted_root = trusted_root

@classmethod
def production(cls) -> Verifier:
def production(cls, *, offline: bool = False) -> Verifier:
"""
Return a `Verifier` instance configured against Sigstore's production-level services.
"""
return cls(
rekor=RekorClient.production(),
trusted_root=TrustedRoot.production(),
trusted_root=TrustedRoot.production(offline=offline),
)

@classmethod
def staging(cls) -> Verifier:
def staging(cls, *, offline: bool = False) -> Verifier:
"""
Return a `Verifier` instance configured against Sigstore's staging-level services.
"""
return cls(
rekor=RekorClient.staging(),
trusted_root=TrustedRoot.staging(),
trusted_root=TrustedRoot.staging(offline=offline),
)

@classmethod
Expand Down

0 comments on commit 0d52bde

Please sign in to comment.