Repository navigation
Sanitize public auth and scrape failure messages - #1041
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Architecture diagram
sequenceDiagram
participant Client as External Client
participant Auth as Auth Helper (getAuthenticatedAccountId)
participant Projects as Projects API Route
participant BatchRoute as Batch Scrape Route
participant SingleRoute as Single Scrape Route
participant ScrapeOp as Shared Scrape Operation (scrapeProfileUrl)
participant Provider as Provider Client (e.g., LinkedIn)
participant DB as Database
participant Logger as Server Logger
Note over Client,Logger: Auth Failure Path (Projects 401)
Client->>Projects: GET /api/projects/{projectId}
Projects->>Auth: getAuthenticatedAccountId()
Auth->>DB: getOrCreateAccountIdByAuthToken()
DB-->>Auth: Throws error (internal message)
Auth->>Auth: Catch - log exception details
Auth-->>Projects: 401 generic message (no exception detail)
Projects-->>Client: 401 {"status":"error","message":"Failed to verify authentication token"}
Note over Client,Logger: Scrape Start Failure (Provider Error)
Client->>BatchRoute: POST /api/artist/socials/scrape
BatchRoute->>ScrapeOp: scrapeProfileUrl()
ScrapeOp->>Provider: startLinkedinProfileScraping()
Provider-->>ScrapeOp: Throws error (internal message)
ScrapeOp->>ScrapeOp: Catch - log generic failure event
ScrapeOp->>ScrapeOp: Return failed state (generic message)
ScrapeOp-->>BatchRoute: {state:"failed", error:"Failed to start scrape"}
BatchRoute-->>Client: 200 [{runId:null, datasetId:null, error:"Failed to start scrape"}]
Client->>SingleRoute: POST /api/socials/{id}/scrape
SingleRoute->>ScrapeOp: scrapeProfileUrl()
ScrapeOp->>Provider: startLinkedinProfileScraping()
Provider-->>ScrapeOp: Throws error (internal message)
ScrapeOp->>ScrapeOp: Catch - log generic failure event
ScrapeOp-->>SingleRoute: {state:"failed", error:"Failed to start scrape"}
SingleRoute-->>Client: 500 {"status":"error","error":"Failed to start scrape"}
Note over Client,Logger: Unexpected DB Error (No Charge)
Client->>BatchRoute: POST /api/artist/socials/scrape
BatchRoute->>DB: selectSocials()
DB-->>BatchRoute: Throws error (internal message)
BatchRoute->>BatchRoute: Catch - log exception details
BatchRoute-->>Client: 500 {"status":"error","message":"Internal server error"}
Note over BatchRoute: No credit deduction
Client->>SingleRoute: POST /api/socials/{id}/scrape
SingleRoute->>DB: selectAccountSocials()
DB-->>SingleRoute: Throws error (internal message)
SingleRoute->>SingleRoute: Catch - log exception details
SingleRoute-->>Client: 500 {"status":"error","error":"Internal server error"}
Note over SingleRoute: No credit deduction
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
0 issues found across 5 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Sanitizes public auth and scrape failure responses so they return generic messages instead of internal exception strings, while retaining server-side error logging; canary tests confirm no leak and route status/body shapes are preserved.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Sanitizes public auth and scrape failure responses so they return generic messages instead of internal exception strings, while retaining server-side error logging; canary tests confirm no leak and route status/body shapes are preserved.
View guided diff | Turn on auto-fix | Re-trigger cubic
Caught authentication exceptions and scrape-start/provider exceptions could expose internal details to clients. Return stable public messages from the existing auth helper and shared scrape operation, and from the batch/single route catch blocks. Preserve Projects 401
message, each scrape route's status/body shape, and existing started/failed charging rules.Follow-up to #1038 and #1039 under recoupable/mono#360; hosted verification remains separately tracked in recoupable/mono#361. This PR does not close either broader tracker.
Validation:
pnpm run typecheck:response-contracts,pnpm lint:check, changed-file formatting andgit diff --checkpass.Production effect after an approved merge/release: these failure responses use generic messages instead of internal exception strings. No schema, access policy, provider dispatch or charging change is intended. No live provider calls, customer/production writes, charges, migrations, credential changes or manual deployment were performed. Current evidence is synthetic source verification; review, final-head CI and normal release verification remain required. No merge is requested by this implementation assignment.
Final-head follow-up: the first completed full CI execution at bd05d15 had 6,544 passing tests and two old raw-message expectations in socialScrapeBillingRoutes. Commit 39adac4 changes only those two expectations; all 118 affected tests now pass locally. Final-head CI must complete before this PR is considered green.
Final readback at 39adac4: all six checks pass. Unit workflow 39288428233 reports 1,211 suites / 6,546 tests passed, 11 suites / 13 tests skipped; response-contract typechecking also passes. Cubic approves this exact head with zero findings. PR remains open and unmerged.