Skip to content

Commit 4274f9b

Browse files
authored
Merge branch 'main' into kindversion
2 parents c090d97 + 4b388c3 commit 4274f9b

File tree

6 files changed

+61
-11
lines changed

6 files changed

+61
-11
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ jobs:
7878
7979
# Ensure Timestamp Authority tests are not skipped by
8080
# having pytest show skipped tests and verifying ours are running
81+
set -o pipefail
8182
make test TEST_ARGS="-m timestamp_authority -rs" | tee output
8283
! grep -q "skipping test that requires a Timestamp Authority" output || (echo "ERROR: Found skip message" && exit 1)
8384
env:

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ All versions prior to 0.9.0 are untracked.
4040
[sigstore/timestamp-authority](https://github.com/sigstore/timestamp-authority)
4141
[#1377](https://github.com/sigstore/sigstore-python/pull/1377)
4242

43+
* Tests: Updated the `staging` and `sign_ctx_and_ident_for_env` fixtures to use the new methods
44+
for generating a `SigningContext`.
45+
[#1409](https://github.com/sigstore/sigstore-python/pull/1409)
46+
4347
### Changed
4448

4549
* API:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ lint = [
6262
"mypy ~= 1.1",
6363
# NOTE(ww): ruff is under active development, so we pin conservatively here
6464
# and let Dependabot periodically perform this update.
65-
"ruff < 0.11.11",
65+
"ruff < 0.11.12",
6666
"types-requests",
6767
"types-pyOpenSSL",
6868
]

test/assets/tsa/trust_config.json

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,39 @@
113113
]
114114
},
115115
"signing_config": {
116-
"ca_url": "https://fulcio.sigstage.dev",
117-
"tlog_urls": [
118-
"https://rekor.sigstage.dev"
116+
"mediaType": "application/vnd.dev.sigstore.signingconfig.v0.2+json",
117+
"caUrls": [
118+
{
119+
"url": "https://fulcio.sigstage.dev",
120+
"majorApiVersion": 1,
121+
"validFor": {
122+
"start": "2022-04-14T21:38:40.000Z"
123+
}
124+
}
119125
],
120-
"tsa_urls": [
121-
"placeholder-value"
122-
]
126+
"rekorTlogUrls": [
127+
{
128+
"url": "https://rekor.sigstage.dev",
129+
"majorApiVersion": 1,
130+
"validFor": {
131+
"start": "2021-01-12T11:53:27.000Z"
132+
}
133+
}
134+
],
135+
"tsaUrls": [
136+
{
137+
"url": "placeholder",
138+
"majorApiVersion": 1,
139+
"validFor": {
140+
"start": "2024-11-07T14:59:40.000Z"
141+
}
142+
}
143+
],
144+
"rekorTlogConfig": {
145+
"selector": "ANY"
146+
},
147+
"tsaConfig": {
148+
"selector": "ANY"
149+
}
123150
}
124151
}

test/unit/conftest.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from sigstore._internal import tuf
3838
from sigstore._internal.rekor import _hashedrekord_from_parts
3939
from sigstore._internal.rekor.client import RekorClient
40+
from sigstore._internal.trust import ClientTrustConfig
4041
from sigstore._utils import sha256_digest
4142
from sigstore.models import Bundle
4243
from sigstore.oidc import _DEFAULT_AUDIENCE, IdentityToken
@@ -188,10 +189,20 @@ def sign_ctx_and_ident_for_env(
188189
pytestconfig,
189190
env: str,
190191
) -> tuple[type[SigningContext], type[IdentityToken]]:
192+
"""
193+
Returns a SigningContext and IdentityToken for the given environment.
194+
The SigningContext is behind a callable so that it may be lazily evaluated.
195+
"""
191196
if env == "staging":
192-
ctx_cls = SigningContext.staging
197+
198+
def ctx_cls():
199+
return SigningContext.from_trust_config(ClientTrustConfig.staging())
200+
193201
elif env == "production":
194-
ctx_cls = SigningContext.production
202+
203+
def ctx_cls():
204+
return SigningContext.from_trust_config(ClientTrustConfig.production())
205+
195206
else:
196207
raise ValueError(f"Unknown env {env}")
197208

@@ -205,7 +216,14 @@ def sign_ctx_and_ident_for_env(
205216

206217
@pytest.fixture
207218
def staging() -> tuple[type[SigningContext], type[Verifier], IdentityToken]:
208-
signer = SigningContext.staging
219+
"""
220+
Returns a SigningContext, Verifier, and IdentityToken for the staging environment.
221+
The SigningContext and Verifier are both behind callables so that they may be lazily evaluated.
222+
"""
223+
224+
def signer():
225+
return SigningContext.from_trust_config(ClientTrustConfig.staging())
226+
209227
verifier = Verifier.staging
210228

211229
# Detect env variable for local interactive tests.

test/unit/test_sign.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def sig_ctx(self, asset, tsa_url) -> SigningContext:
174174
asset("tsa/trust_config.json").read_text()
175175
)
176176

177-
trust_config._inner.signing_config.tsa_urls[0] = tsa_url
177+
trust_config._inner.signing_config.tsa_urls[0].url = tsa_url
178178

179179
return SigningContext.from_trust_config(trust_config)
180180

0 commit comments

Comments
 (0)