Skip to content

Commit a2eb492

Browse files
woodruffwjku
andauthored
chore: remove an unused nonce from OAuth flow (#1649)
Co-authored-by: Jussi Kukkonen <[email protected]>
1 parent 6ea9424 commit a2eb492

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

sigstore/_internal/oidc/oauth.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def __exit__(
130130

131131

132132
class _OAuthRedirectHandler(http.server.BaseHTTPRequestHandler):
133-
def log_message(self, _format: str, *_args: Any) -> None:
133+
def log_message(self, format: str, *_args: Any) -> None:
134134
pass
135135

136136
def do_GET(self) -> None:
@@ -177,7 +177,6 @@ def __init__(self, client_id: str, client_secret: str, issuer: Issuer):
177177
self._client_secret = client_secret
178178
self._issuer = issuer
179179
self._state = str(uuid.uuid4())
180-
self._nonce = str(uuid.uuid4())
181180

182181
self.code_verifier = B64Str(
183182
base64.urlsafe_b64encode(os.urandom(32)).rstrip(b"=").decode()
@@ -197,7 +196,7 @@ def auth_endpoint(self, redirect_uri: str) -> str:
197196
# Defensive programming: we don't have a nice way to limit the
198197
# lifetime of the OAuth session here, so we use the internal
199198
# "poison" flag to check if we're attempting to reuse it in a way
200-
# that would compromise the flow's security (i.e. nonce reuse).
199+
# that would compromise the flow's security (i.e. state reuse).
201200
if self.__poison:
202201
raise IdentityError("internal error: OAuth endpoint misuse")
203202
else:
@@ -216,7 +215,6 @@ def _auth_params(self, redirect_uri: str) -> dict[str, Any]:
216215
"code_challenge": self.code_challenge,
217216
"code_challenge_method": "S256",
218217
"state": self._state,
219-
"nonce": self._nonce,
220218
}
221219

222220

sigstore/_internal/sct.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def verify_sct(
211211
f"SCT verify: Invalid issuer pubkey basicConstraint (not a CA): {issuer_pubkey}"
212212
)
213213

214-
if not isinstance(issuer_pubkey, (rsa.RSAPublicKey, ec.EllipticCurvePublicKey)):
214+
if not isinstance(issuer_pubkey, rsa.RSAPublicKey | ec.EllipticCurvePublicKey):
215215
raise VerificationError(
216216
f"SCT verify: invalid issuer pubkey format (not ECDSA or RSA): {issuer_pubkey}"
217217
)

sigstore/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def _from_v1_response(cls, dict_: dict[str, Any]) -> TransparencyLogEntry:
128128
body_entry: ProposedEntry = TypeAdapter(ProposedEntry).validate_json(
129129
base64.b64decode(entry["body"])
130130
)
131-
if not isinstance(body_entry, (Hashedrekord, Dsse)):
131+
if not isinstance(body_entry, Hashedrekord | Dsse):
132132
raise InvalidBundle("log entry is not of expected type")
133133

134134
raw_inclusion_proof = entry["verification"]["inclusionProof"]

0 commit comments

Comments
 (0)