Skip to content

fix(phase6): harden createAuthTicket exception handling and stage diagnostics - #54

Merged
spandreou merged 1 commit into
mainfrom
antigravity/phase6-auth-ticket-internal-fix
Sep 5, 2026
Merged

fix(phase6): harden createAuthTicket exception handling and stage diagnostics#54
spandreou merged 1 commit into
mainfrom
antigravity/phase6-auth-ticket-internal-fix

Conversation

@spandreou

Copy link
Copy Markdown
Owner

Summary

This PR hardens the production createAuthTicket callable function and aligns auth broker test assertions.

Key Changes

  1. Safe Stage Diagnostics & Error Handling (functions/src/index.js):
    • Wraps createAuthTicket execution in structured try/catch tracking discrete stages (origin_validation, auth_validation, input_validation, tenant_lookup, membership_lookup, ticket_creation, ticket_storage, response_build).
    • Preserves all known HttpsError throws directly so legitimate client rejections retain exact reason codes.
    • Catches unexpected internal runtime exceptions, logs structured diagnostic telemetry (stage, reason, correlationId, event: 'auth_broker_create_failed') safely without logging tickets, tokens, credentials, or emails.
    • Re-throws a standard generic HttpsError('internal', 'Δεν ήταν δυνατή η ασφαλής μεταφορά σύνδεσης.', { reason: 'internal-create-failure' }).
  2. Aligned Emulator Test Matrix (scripts/test-auth-broker-emulator.mjs):
    • Updates cross-tenant ticket exchange test expectation to reflect the actual rejection reason (ticket-origin-mismatch).

Invariants Maintained

  • VITE_ENABLE_AUTH_BROKER=true and VITE_ENABLE_TENANT_GATE=false preserved.
  • Zero secrets, credentials, ID tokens, auth tickets, or PII logged.
  • Zero new dependencies; package-lock.json clean and untouched.
  • All QA suites passing (qa:tenant-authorization, qa:saas-foundation, qa:auth-broker, qa:registration-tokens, qa:tenant-provisioning, qa:phase5-portal, qa:auth-broker-negative, qa:multi-tenant, qa:central-portal-isolation, qa:product-terminology, qa:vercel-spa-routing, test:auth-broker:emulator).

@strix-security

strix-security Bot commented Sep 5, 2026

Copy link
Copy Markdown

Strix is installed on this repository, but we couldn't run this PR security review because this workspace's trial has ended. Add a card to resume code reviews here.

@vercel

vercel Bot commented Sep 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
shiftoryx Ready Ready Preview Sep 5, 2026 1:49pm UTC

@spandreou
spandreou merged commit aa7c807 into main Sep 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant