Skip to content

Commit c7f4e19

Browse files
authored
bump sigstore-protobuf-specs (#1013)
1 parent a86b7cb commit c7f4e19

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ dependencies = [
3535
"requests",
3636
"rich ~= 13.0",
3737
"rfc8785 ~= 0.1.2",
38-
"sigstore-protobuf-specs ~= 0.3.1",
38+
"sigstore-protobuf-specs ~= 0.3.2",
3939
# NOTE(ww): Under active development, so strictly pinned.
4040
"sigstore-rekor-types == 0.0.13",
4141
"tuf ~= 4.0",

sigstore/_internal/trustroot.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ def __init__(self, public_key: _PublicKey) -> None:
105105
Construct a key from the given Sigstore PublicKey message.
106106
"""
107107

108+
# NOTE: `raw_bytes` is marked as `optional` in the `PublicKey` message,
109+
# for unclear reasons.
110+
if not public_key.raw_bytes:
111+
raise VerificationError("public key is empty")
112+
108113
hash_algorithm: hashes.HashAlgorithm
109114
if public_key.key_details in self._RSA_SHA_256_DETAILS:
110115
hash_algorithm = hashes.SHA256()

sigstore/dsse.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@ def to_json(self) -> str:
187187
"""
188188
Return a JSON string with this DSSE envelope's contents.
189189
"""
190-
# TODO: Unclear why mypy thinks this is returning `Any`.
191-
return self._inner.to_json() # type: ignore[no-any-return]
190+
return self._inner.to_json()
192191

193192

194193
def _pae(type_: str, body: bytes) -> bytes:
@@ -217,7 +216,7 @@ def _sign(key: ec.EllipticCurvePrivateKey, stmt: Statement) -> Envelope:
217216
_Envelope(
218217
payload=stmt._contents,
219218
payload_type=Envelope._TYPE,
220-
signatures=[Signature(sig=signature, keyid=None)],
219+
signatures=[Signature(sig=signature)],
221220
)
222221
)
223222

@@ -244,6 +243,4 @@ def _verify(key: ec.EllipticCurvePublicKey, evp: Envelope) -> bytes:
244243
except InvalidSignature:
245244
raise VerificationError("DSSE: invalid signature")
246245

247-
# TODO: Remove ignore when protobuf-specs contains a py.typed marker.
248-
# See: <https://github.com/sigstore/protobuf-specs/pull/287>
249-
return evp._inner.payload # type: ignore[no-any-return]
246+
return evp._inner.payload

sigstore/models.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def _to_dict_rekor(self) -> dict[str, Any]:
243243
log_index=self.log_index,
244244
log_id=common_v1.LogId(key_id=bytes.fromhex(self.log_id)),
245245
integrated_time=self.integrated_time,
246-
inclusion_promise=inclusion_promise,
246+
inclusion_promise=inclusion_promise, # type: ignore[arg-type]
247247
inclusion_proof=inclusion_proof,
248248
canonicalized_body=base64.b64decode(self.body),
249249
)
@@ -494,8 +494,7 @@ def to_json(self) -> str:
494494
"""
495495
Return a JSON encoding of this bundle.
496496
"""
497-
# TODO: Unclear why mypy doesn't like this.
498-
return self._inner.to_json() # type: ignore[no-any-return]
497+
return self._inner.to_json()
499498

500499
@classmethod
501500
def from_parts(cls, cert: Certificate, sig: bytes, log_entry: LogEntry) -> Bundle:

0 commit comments

Comments
 (0)