fix(ci): narrow Auth.js subject and extend disposable P05 verification
This commit is contained in:
1 parent
42adaba004
commit
c27fe3d323
23 files changed
+415
-45
No files matched your search
@@ -53,9 +53,18 @@ def check_security_boundaries() -> None:
|
||||
src = (ACCOUNT / "src/auth.ts").read_text(encoding="utf-8")
|
||||
endpoint = (ACCOUNT / "src/app/api/account/me/route.ts").read_text(encoding="utf-8")
|
||||
identity = (ACCOUNT / "src/lib/identity.ts").read_text(encoding="utf-8")
|
||||
for flag in ('checks: ["pkce", "state", "nonce"]', 'zitadelTokenExpiresAt', 'token.zitadelSubject'):
|
||||
for flag in (
|
||||
'checks: ["pkce", "state", "nonce"]',
|
||||
'typeof token.zitadelSubject === "string"',
|
||||
'const subject: string',
|
||||
'typeof token.zitadelTokenExpiresAt === "number"',
|
||||
'token.zitadelTokenExpiresAt * 1000 > Date.now()',
|
||||
'id: valid ? subject : ""',
|
||||
):
|
||||
if flag not in src:
|
||||
fail(f"Missing reviewed OIDC source contract: {flag}")
|
||||
fail(f"Missing reviewed fail-closed OIDC source contract: {flag}")
|
||||
if "token.zitadelSubject!" in src or "as any" in src:
|
||||
fail("Unsafe subject assertion or cast is not allowed")
|
||||
if "session?.user?.id" not in endpoint or "session?.user?.id" not in identity:
|
||||
fail("Protected source must gate on valid user id")
|
||||
print("ZITPLANE_SOURCE_GUARD_CONTRACT_PASS")
|
||||
|
||||
Reference in new issue
Block a user