Skip to content

fix(pds-core): redact request_uri from CSS middleware log - #80

Merged
aspiers merged 1 commit into
mainfrom
fix/redact-request-uri-in-logs
Aug 6, 2026
Merged

aspiers merged 1 commit into
mainfrom
fix/redact-request-uri-in-logs

Conversation

@aspiers

@aspiers aspiers commented Apr 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Stop logging raw PAR request_uri values in the CSS injection middleware's warn log. Log only presence (hasRequestUri: true) since the URI is an opaque short-lived handle.

Addresses CodeRabbit review comment on PR #48: #48 (comment)

Test plan

  • Existing unit tests pass (19/19 in client-css-injection.test.ts)
  • Verify Railway pds-core logs no longer contain raw request_uri values

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved error logging during client-side CSS injection by avoiding potentially sensitive request URI details while retaining relevant diagnostic information.
  • Chores

    • Updated code coverage thresholds for reporting and failure detection.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, reopen this pull request to trigger a review.

@coderabbitai

coderabbitai Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@aspiers, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e49b26d2-05a3-465a-a6db-06f203a80f95

📥 Commits

Reviewing files that changed from the base of the PR and between 9781ef3 and c4fbbb0.

📒 Files selected for processing (1)
  • packages/pds-core/src/lib/client-css-injection.ts
📝 Walkthrough

Walkthrough

The changes add Coveralls coverage thresholds and replace a logged request URI value with a boolean presence indicator in client CSS injection error handling.

Changes

Coverage configuration

Layer / File(s) Summary
Coveralls thresholds
.coveralls.yml
Adds coverage_decreased_threshold: 0.05 and coverage_threshold_for_failure: 32.3.

Error logging metadata

Layer / File(s) Summary
Request URI logging metadata
packages/pds-core/src/lib/client-css-injection.ts
Changes warning metadata from the request URI value to hasRequestUri: true while retaining the caught error.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main pds-core change: redacting request_uri from the CSS middleware warning log.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/redact-request-uri-in-logs

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vercel

vercel Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
epds-demo Ready Ready Preview Aug 5, 2026 5:20pm

Request Review

@railway-app

railway-app Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the pr-915b6a-80 environment in ePDS

Service Status Web Updated (UTC)
@certified-app/demo untrusted ✅ Success (View Logs) Web Aug 5, 2026 at 5:25 pm
@certified-app/auth-service ✅ Success (View Logs) Web Aug 5, 2026 at 5:24 pm
@certified-app/demo ✅ Success (View Logs) Web Aug 5, 2026 at 5:24 pm
@certified-app/pds-core ✅ Success (View Logs) Web Aug 5, 2026 at 5:24 pm

@coveralls-official

coveralls-official Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 31029709896

Coverage remained the same at 58.051%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 3110
Covered Lines: 1793
Line Coverage: 57.65%
Relevant Branches: 1939
Covered Branches: 1138
Branch Coverage: 58.69%
Branches in Coverage %: Yes
Coverage Strength: 9.78 hits per line

💛 - Coveralls

@sonarqubecloud

Copy link
Copy Markdown

@railway-app
railway-app Bot temporarily deployed to ePDS / ePDS-pr-80 April 14, 2026 15:31 Destroyed
@aspiers
aspiers force-pushed the fix/redact-request-uri-in-logs branch from 5991f75 to 0dfb6cd Compare July 14, 2026 22:03
Copilot AI lite review requested due to automatic review settings July 14, 2026 22:03
@changeset-bot

changeset-bot Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c4fbbb0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens log hygiene in pds-core by ensuring the CSS injection middleware no longer logs opaque PAR request_uri values, while also adding a Coveralls configuration to enforce coverage-related CI thresholds.

Changes:

  • Redact raw PAR request_uri from the CSS middleware warning log (log only presence via hasRequestUri).
  • Add .coveralls.yml to configure Coveralls coverage thresholds for CI reporting.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/pds-core/src/lib/client-css-injection.ts Replaces logging of raw requestUri with a boolean presence flag in the error path.
.coveralls.yml Introduces Coveralls thresholds for coverage decrease tolerance and failure gating.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.coveralls.yml:
- Around line 1-2: Remove the coverage_decreased_threshold and
coverage_threshold_for_failure entries from .coveralls.yml, leaving only
supported Coveralls configuration there. Configure both coverage thresholds
through the Coveralls repository settings or API so the intended coverage gate
is enforced.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 59479769-9c8a-4e7b-95eb-16d97dd157fd

📥 Commits

Reviewing files that changed from the base of the PR and between 78d9769 and 0dfb6cd.

📒 Files selected for processing (2)
  • .coveralls.yml
  • packages/pds-core/src/lib/client-css-injection.ts

Comment thread .coveralls.yml Outdated
@blacksmith-sh

This comment has been minimized.

@aspiers
aspiers force-pushed the fix/redact-request-uri-in-logs branch from 0dfb6cd to 06a30ac Compare August 4, 2026 21:31
Copilot AI review requested due to automatic review settings August 4, 2026 21:31
@railway-app
railway-app Bot temporarily deployed to ePDS / ePDS-pr-80 August 4, 2026 21:32 Destroyed
@aspiers

aspiers commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

(comment generated by Claude Opus 5 via Claude Code)

Split as suggested. This PR is now only the security fix — one commit, one file, +1/-1:

-            { err, requestUri },
+            { err, hasRequestUri: true },

The .coveralls.yml commit moved to #240, where its key names can be settled without holding this up. Rebased onto current main (it was based on a three-week-old tree, which is why the last e2e run predated everything merged since).

All four gates pass locally: format, lint, typecheck, test (1120).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

aspiers added a commit that referenced this pull request Aug 4, 2026
The PR #80 preview environment was serving a demo build predating
epds_handle_login_url in client-metadata.json, so the sign-in page
rendered no .btn-atproto and 71 of 83 e2e scenarios failed on a
change that only alters one log field in pds-core.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@aspiers

aspiers commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

(comment generated by Claude Opus 5 via Claude Code)

The e2e failure is a stale preview environment, not this change. 71 of 83 scenarios failed on a diff that alters one log field in pds-core.

Traced it rather than just re-running:

  • Failing locator is .btn-atproto. This PR's preview serves zero occurrences of it; ci(coveralls): add delta tolerance and absolute floor #240's preview serves 2 — same base, same code.
  • That button renders only when the client's metadata supplies epds_handle_login_url (login-page.ts:534).
  • This PR's demo preview serves client-metadata.json without that field, while ci(coveralls): add delta tolerance and absolute floor #240's includes it.
  • The field is emitted unconditionally in current source (packages/demo/src/app/client-metadata.json/route.ts:80, added 2026-04-27), so any current build must include it.

The scope value corroborates the age:

scope
PR #80 preview atproto transition:generic
PR #240 preview atproto include:org.hypercerts.authWrite include:app.certified.authWrite

transition:generic was replaced in c7b7771 on 2026-07-07. Both markers point to a demo build predating 2026-04-27 — which matches this branch's original April base, even though it is now rebased onto current main.

I pushed an empty commit to force a redeploy. Railway reported the demo deploy as successful, but the served metadata is unchanged, so it appears to be reusing a cached build for this PR's environment rather than rebuilding from the rebased branch.

This needs someone with Railway access to delete or force-rebuild the ePDS-pr-80 demo service. Nothing in the branch can fix it — the diff cannot affect what the demo advertises.

The change itself is sound: format, lint, typecheck and test (1120) all pass, and the other three deploys are healthy.

request_uri is an opaque PAR handle that should not be logged
verbatim. Log only its presence for debugging.

Addresses CodeRabbit review on PR #48.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aspiers

aspiers commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Closing and immediately reopening to retrigger the Railway preview deploy — no code change intended.

The run (e2e) check failed 71 of 83 scenarios, but the pattern points at the preview environment rather than this one-line change. Every failure is a missing element (waiting for locator('.otp-box'), element(s) not found) across unrelated features — account recovery, account settings, the AT Protocol login button — none of which this PR touches.

#41 had the same signature (its e2e aborted because a preview service never came up) and went green after a close/reopen provisioned a fresh Railway environment. This branch is older still, so its preview has most likely drifted the same way.

Also worth noting: this branch is 3 commits behind main, and every other open PR is current. A rebase may be needed regardless.

One overlap to flag — #241 now redacts this same log line as part of splitting #148. It uses hasRequestUri: typeof query.request_uri === 'string' rather than the hardcoded true here, because the refactor moved the log outside the if (requestUri) guard so presence is no longer implied. Whichever lands first, the other is a small rebase.

Reopening momentarily.

@aspiers aspiers closed this Aug 5, 2026
@aspiers aspiers reopened this Aug 5, 2026
@railway-app
railway-app Bot temporarily deployed to ePDS / pr-915b6a-80 August 5, 2026 17:22 Destroyed
@sonarqubecloud

sonarqubecloud Bot commented Aug 5, 2026

Copy link
Copy Markdown

aspiers added a commit that referenced this pull request Aug 5, 2026
request_uri is a short-lived bearer reference to the PAR entry, so a
log line carrying its value is replayable by anyone who can read the
logs. Log whether it was present instead.

Raised independently by CodeRabbit and Copilot on #241. The value was
already being logged before this series; hoisting the resolution out
of the request_uri guard promoted the line from warn to error, which
made it more visible without making it safe. #80 fixes the same leak
on the pre-refactor code.

typeof rather than a hardcoded true: the log now sits outside the
`if (requestUri)` guard, so presence is no longer implied by reaching
it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@aspiers
aspiers merged commit 2b10346 into main Aug 6, 2026
40 of 41 checks passed
@aspiers
aspiers deleted the fix/redact-request-uri-in-logs branch August 6, 2026 09:10
aspiers added a commit that referenced this pull request Aug 6, 2026
request_uri is a short-lived bearer reference to the PAR entry, so a
log line carrying its value is replayable by anyone who can read the
logs. Log whether it was present instead.

Raised independently by CodeRabbit and Copilot on #241. The value was
already being logged before this series; hoisting the resolution out
of the request_uri guard promoted the line from warn to error, which
made it more visible without making it safe. #80 fixes the same leak
on the pre-refactor code.

typeof rather than a hardcoded true: the log now sits outside the
`if (requestUri)` guard, so presence is no longer implied by reaching
it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
ePDS / pr-915b6a-80 — c4fbbb09 Deployed Aug 5, 2026 by railway-app[bot]
Preview — c4fbbb09 Deployed Aug 5, 2026 by vercel[bot]
ePDS / ePDS-pr-80 — c4fbbb09 Deployed Aug 5, 2026 by railway-app[bot]
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.

2 participants