fix: Resolve CodeQL security findings#15
Merged
raifdmueller merged 2 commits intomainfrom Feb 20, 2026
Merged
Conversation
- anchor-modal.js: Validate anchorId against safe pattern before use in fetch() URLs (fixes js/client-side-request-forgery x3) Also validate lang code before use in URL - router.js: Validate anchorId from URL hash before passing to showAnchorDetails (fixes js/unvalidated-dynamic-method-call) - website.spec.js: Anchor GitHub URL regex to prevent partial host matching (fixes js/regex/missing-regexp-anchor) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all 5 CodeQL security findings found after enabling CodeQL (LLM-Coding#84).
Findings fixed
anchor-modal.jsjs/client-side-request-forgeryanchorIdwith regex before fetchrouter.jsjs/unvalidated-dynamic-method-callanchorIdfrom URL hash before passing onwebsite.spec.jsjs/regex/missing-regexp-anchor^https://prefixDetails
anchor-modal.js:
anchorIdfrom the URL hash was used directly infetch()calls. Now validated against/^[a-z0-9]+(?:-[a-z0-9]+)*$/— only lowercase alphanumeric + hyphens allowed. Invalid IDs show an error message instead. Also validateslangcode before use.router.js: Same validation applied to
anchorIdextracted from the route path before passing toshowAnchorDetails().website.spec.js:
/github\.com.*edit/→/^https:\/\/github\.com\/.+\/edit\/.+/to prevent partial host matching.Test plan
npm run lint— 0 errorsnpm run test— 70 unit tests pass🤖 Generated with Claude Code