Skip to content

fix: align browser setup expiry validation with enrollment approval contract #354

Open

Description

@danny-avila

The browser setup client and CodeAPI use different upper bounds for session expiry. parseStatus in packages/code/src/browser-setup.ts rejects expiresAt beyond attempt.request.createdAt + 10 minutes. issueBrowserEnrollment accepts expiry up to server Date.now() + BROWSER_ENROLLMENT_MAX_TTL_MS. Because attempt creation precedes capabilities, setup requests and approval, a valid maximum-lifetime approval can be rejected by the client.

The status parser also accepts any Date.parse-compatible expiry string, whereas the redemption/resume contract requires a canonical ISO timestamp through isBrowserEnrollmentTimestamp. A pending status can pass parsing but fail a later phase or resume.

Align client and server lifetime semantics without removing the upper bound or accepting expired approvals, and apply canonical timestamp validation at the status boundary. Add tests with delayed approval at the supported maximum lifetime and noncanonical-but-parseable expiry values, including resume. Preserve key, request-hash, instance and worker binding checks.

Validated from both implementations during the #342 import after a Bugbot finding.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions