Skip to content

Expose native session identity to application function routes - #833

Merged
jimhoyd merged 1 commit into
mainfrom
codex/authenticated-handler-starter
Sep 28, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
codex/authenticated-handler-starter

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Problem and change

Native auth authorizes ordinary function routes but did not expose their verified session user ID to the handler. Custom business rules therefore needed extra integration code. Auth now projects the opaque ID after authorization, CSRF and principal assignment; sessionUserId(request) reads it without forwarding credentials.

Adds an authenticated-handlers recipe with explicit YAML endpoints, bounded inputs, native account flows and installed-package coverage. Documents the trust boundary and sandbox-local alternative. Resolves #832.

Verification

  • npm run verify passed, including all workspace and installed add-on integration tests.
  • npm run test:package passed; 39 packaged example commands ran from consumer copies.
  • Focused tests cover forged headers, session/CSRF/ownership boundaries, trusted and sandboxed functions, bearer separation, and unchanged recipe imports through packed dependencies.
  • Six precommitted unfamiliar-app trials completed: one candidate and two Fastify trials passed the full frozen build/change sequence. Timeout and boundary-invalid attempts remain in the denominator. A separate probe found an authorization/body error-ordering defect in generated candidate ledger code, not the identity helper; these limited results do not establish a productivity or production-readiness claim.
  • All 32 PR CI checks passed. Follow-ups: [Request]: Make installed authoring validation context executable and discoverable #834 (executable validation context), [Request]: Evaluate conditional state transitions and result-aware idempotency beyond store CRUD #835 (bounded state transitions), and urlcode-benchmarks#108 (checker/contract gaps).

Core archive budgets increase from 860 to 864 KiB packed and 3395 to 3430 KiB unpacked for the shipped recipe and guidance. Measured size: 882184 packed bytes, 3510731 unpacked bytes, 499 entries; entry budget remains 500.

Compatibility and security

Additive auth API and recipe; no new YAML field or core-to-extension import. Native session identity is distinct from bearer authorization. The accessor trusts only URLCode's client-stripped, auth-produced request context; it cannot authenticate arbitrary Requests. Trusted package imports retain ambient Node authority; sandbox: true isolation and credential withholding are preserved. No package publication or deployment is included.

  • Changes match the documented portable contract; docs/examples are updated where needed.
  • Relevant tests and package checks pass, or limitations are explained above.
  • No credentials, customer data or private project material are included.
  • Runtime/starter changes remain aligned where applicable.

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.

[Request]: Simplify verified session identity access for authenticated custom handlers

1 participant