mirror of
https://gitcode.com/gh_mirrors/gh/gh-action-pypi-publish.git
synced 2026-07-02 10:25:13 +00:00
oidc-exchange: fix padding
Signed-off-by: William Woodruff <william@trailofbits.com>
This commit is contained in:
+5
-1
@@ -144,6 +144,9 @@ def assert_successful_audience_call(resp: requests.Response, domain: str):
|
||||
|
||||
def render_claims(token: str) -> str:
|
||||
_, payload, _ = token.split(".", 2)
|
||||
|
||||
# urlsafe_b64decode needs padding; JWT payloads don't contain any.
|
||||
payload += "=" * (4 - (len(payload) % 4))
|
||||
claims = json.loads(base64.urlsafe_b64decode(payload))
|
||||
|
||||
def _get(name: str) -> str: # noqa: WPS430
|
||||
@@ -207,7 +210,8 @@ if not mint_token_resp.ok:
|
||||
|
||||
die(
|
||||
_SERVER_REFUSED_TOKEN_EXCHANGE_MESSAGE.format(
|
||||
reasons=reasons, rendered_claims=rendered_claims,
|
||||
reasons=reasons,
|
||||
rendered_claims=rendered_claims,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user