fix: reduce sensitive backend request logging#2186
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughFour backend private handlers now log structured cloudlog events at entry (requestId plus presence flags and key request fields) instead of raw request bodies; intermediate auth/apikey logs were changed to presence booleans and Stripe handlers' post-DB logs now report presence of customer/callback state rather than full objects. ChangesStructured Logging Across Backend Handlers
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 is still one sensitive logging path left in the two billing endpoints touched here: both Can you drop that |
Merging this PR will not alter performance
Comparing Footnotes
|
|
Thanks, agreed. I removed the two I also compacted the added metadata logs to avoid the Sonar duplication failure from the first revision. Waiting for checks to rerun now. |
|
Thanks for the quick update. I noticed one similar metadata path still remains in Since this PR is removing authenticated-user identifiers from backend request logs, could this log also be reduced to non-identifying metadata, e.g. |
|
Thanks, good catch. I updated that remaining apikey context log to keep only non-identifying metadata: |
mingisrookie
left a comment
There was a problem hiding this comment.
This still leaves raw request identifiers in the new "redacted" request logs, and several of them happen before the authorization check for that resource.
Examples from the patch:
delete_failed_version.tslogsapp_id: body.app_idbeforecheckPermission(..., { appId: body.app_id }).download_link.tslogsapp_id: body.app_id/bundleId: body.idbeforecheckPermission(..., { appId: body.app_id }).stripe_checkout.tsandstripe_portal.tslog raworgId: body.orgIdbeforecheckPermission(..., { orgId: body.orgId }).
So the PR removes full-body logging, but an unauthorized caller can still cause arbitrary app/org identifiers to be written to operational logs. If the goal is metadata-only request logging for #1667, these should probably be hasAppId / hasBundleId / hasOrgId (and maybe type/field-count metadata) rather than the raw IDs. A small regression test around unauthorized requests would catch this difference, because the current functional path still uses the identifiers while the logs do not need to retain them.
|
mingisrookie
left a comment
There was a problem hiding this comment.
Rechecked the latest commit (36aab683): the request-entry logs in the affected endpoints now use presence booleans (hasAppId, hasBundleId, hasOrgId) instead of raw app/org/bundle identifiers. I also ran ESLint on the touched files:
bun x eslint supabase/functions/_backend/private/delete_failed_version.ts supabase/functions/_backend/private/download_link.ts supabase/functions/_backend/private/stripe_checkout.ts supabase/functions/_backend/private/stripe_portal.ts
Result: passed with no reported issues.
| throw simpleError('not_authorize', 'Not authorize') | ||
|
|
||
| cloudlog({ requestId: c.get('requestId'), message: 'user', org }) | ||
| cloudlog({ requestId: c.get('requestId'), message: 'stripe checkout org loaded', hasCustomer: !!org.customer_id }) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Closing as AI-generated spam. Part of a 50+ PR wave of duplicate |



Summary
Security note
This is a public-safe log hardening change for the security retribution thread. It avoids retaining callback/success/cancel URLs, client reference IDs, attribution IDs, bundle names, and raw customer IDs in routine cloud logs where presence flags or stable IDs are enough for debugging.
Related: #1667
/claim #1667
Testing
git diff --checkbun run lint:backendcould not be run locally becausebunis not installed in this environmentSummary by CodeRabbit