[codex] Structure mobile DPoP failures#3307
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved This PR refactors error handling to use structured, typed error classes instead of a generic error class, with no changes to business logic or control flow. The redaction of sensitive URL components from error messages is a security improvement. You can customize Macroscope's approvability policy. Learn more. |
Dismissing prior approval to re-evaluate 04e0d39
Dismissing prior approval to re-evaluate fb138fb
Co-authored-by: codex <codex@users.noreply.github.com>
fb138fb to
283d96f
Compare
Dismissing prior approval to re-evaluate 283d96f
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
283d96f to
22e7600
Compare
Dismissing prior approval to re-evaluate 22e7600
b87e64a to
3167aeb
Compare
Co-authored-by: codex <codex@users.noreply.github.com>
Dismissing prior approval to re-evaluate 3ba6a95
a2c3536
into
codex/redact-dpop-request-target
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Summary
Stack dependency
redactDpopRequestTargethelper used by this PR.Validation
vp test run apps/mobile/src/features/cloud/dpop.test.ts(8 tests)vp run lint:mobilevp check(passes with 20 pre-existing warnings)vp run typecheckOpen PR overlap
Note
Medium Risk
Touches OAuth/DPoP signing and secure-store key handling, but behavior is largely preserved with safer diagnostics and stricter error typing rather than new auth flows.
Overview
Replaces the mobile cloud DPoP generic message-only error with Effect Schema tagged errors for storage, key generation, and proof signing, plus a
CloudDpopErrorunion andisCloudDpopErrorguard.CloudDpopProofErrornow records operation, HTTP method, key thumbprint, and URL length, whilerequestTargetuses sharedredactDpopRequestTarget(scheme/host/path only—no credentials, query, or fragment). Storage and restore paths emitCloudDpopStorageErrorwithoperationandstorageKey; mismatched stored key coordinates surface on restore.Shared
dpopgainsredactDpopRequestTarget(with tests). A newurlDiagnosticsexport provides length/protocol/hostname diagnostics for invalid URLs. Mobile tests assert structured fields, restore failures, and that proof error messages do not leak sensitive URL parts.Reviewed by Cursor Bugbot for commit 3ba6a95. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure DPoP failures with typed error classes and redacted request context
CloudDpopStorageError,CloudDpopKeyError, andCloudDpopProofErrortyped error classes in dpop.ts, each carrying structured metadata (operation, storageKey, thumbprint, etc.) instead of generic messages.isCloudDpopErrortype guard andCloudDpopErrorunion so callers can uniformly identify DPoP-related failures.redactDpopRequestTargetin dpop.ts that strips credentials, query, and fragment from URLs before including them in error context, falling back to"<invalid-url>"for unparseable input.getUrlDiagnosticsin urlDiagnostics.ts to extract non-sensitive URL metadata (length, protocol, hostname) for error diagnostics.createDpopProofnow strips query and fragment components, which changes the normalized URL compared to the previous behavior.Macroscope summarized 3ba6a95.