Skip to content

Fix escapeAttr XSS, ExtensionAuth double fetch, and candidate page title#248

Merged
bd73-com merged 4 commits intomainfrom
claude/fix-github-issues-69Kwf
Mar 22, 2026
Merged

Fix escapeAttr XSS, ExtensionAuth double fetch, and candidate page title#248
bd73-com merged 4 commits intomainfrom
claude/fix-github-issues-69Kwf

Conversation

@bd73-com
Copy link
Owner

Summary

Fixes three browser extension and extension auth bugs reported in issues #242, #243, and #244. The escapeAttr function was missing ampersand escaping (XSS vector), the ExtensionAuth page fired duplicate POST requests on token fetch failure, and the candidate "Track this" button used the popup's own document.title instead of the target page's title.

Additionally hardens the ExtensionAuth error guard, extracts popup utilities into a testable module with 10 new tests, and rebuilds the extension ZIP as v1.0.3.

Changes

Bug fixes:

Refactoring:

  • Extracted escapeAttr and sanitizeTier into extension/src/popup/utils.ts for testability
  • Added sync comment for KNOWN_TIERS referencing shared/models/auth.ts

Tests:

  • Added extension/src/popup/utils.test.ts with 10 tests covering escapeAttr edge cases and sanitizeTier

Extension release:

  • Bumped extension version to 1.0.3
  • Rebuilt fetchthechange-extension.zip

Closes #242, closes #243, closes #244

How to test

  1. Run npm run check && npm run test — 62 test files, 1717 tests pass
  2. Install the rebuilt extension (extension/fetchthechange-extension.zip) in Chrome
  3. Navigate to a page with & in the title, open popup, click "Track this" on a candidate — verify the monitor name input shows the correct page title with ampersands displayed properly
  4. Navigate to /extension-auth while the token endpoint is returning errors — verify only one POST request is made (check Network tab)
  5. Verify the default monitor name matches the target page's title, not "FetchTheChange" or empty

https://claude.ai/code/session_01AmZyEy5PWRPk34fqgyyUQ9

claude added 4 commits March 19, 2026 12:51
…didate page title

- #244: Escape `&` to `&` before other replacements in escapeAttr()
- #243: Remove `error` from useEffect dependency array to prevent
  double POST on token fetch failure
- #242: Use stored tab title from chrome.tabs.query instead of
  popup's document.title for candidate "Track this" button

Closes #242, closes #243, closes #244

https://claude.ai/code/session_01AmZyEy5PWRPk34fqgyyUQ9
Move pure utility functions from popup.ts into popup/utils.ts for
testability. Add comprehensive test coverage for escapeAttr (including
ampersand escaping) and sanitizeTier. Move import to top of file
following codebase conventions.

https://claude.ai/code/session_01AmZyEy5PWRPk34fqgyyUQ9
- Add error check to useEffect guard to prevent implicit retries when
  user object reference changes after a failed token fetch
- Add comment documenting KNOWN_TIERS sync dependency on
  shared/models/auth.ts TIER_LIMITS

https://claude.ai/code/session_01AmZyEy5PWRPk34fqgyyUQ9
Version bump for popup bug fixes: escapeAttr ampersand encoding,
candidate page title source, and utils module extraction.

https://claude.ai/code/session_01AmZyEy5PWRPk34fqgyyUQ9
@coderabbitai
Copy link

coderabbitai bot commented Mar 19, 2026

Warning

Rate limit exceeded

@bd73-com has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 37 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 19dffe1a-018b-4e2d-ab39-8b180a708f4f

📥 Commits

Reviewing files that changed from the base of the PR and between 2527235 and d269e63.

⛔ Files ignored due to path filters (1)
  • extension/fetchthechange-extension.zip is excluded by !**/*.zip
📒 Files selected for processing (5)
  • client/src/pages/ExtensionAuth.tsx
  • extension/manifest.json
  • extension/src/popup/popup.ts
  • extension/src/popup/utils.test.ts
  • extension/src/popup/utils.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/fix-github-issues-69Kwf
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

@github-actions github-actions bot added the fix label Mar 19, 2026
@bd73-com bd73-com added the fix label Mar 19, 2026
@bd73-com bd73-com merged commit 74c91ee into main Mar 22, 2026
8 checks passed
@bd73-com bd73-com deleted the claude/fix-github-issues-69Kwf branch March 22, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

2 participants