Fix reflected XSS in /metrics/find via from/until parameters#2907
Merged
Fix reflected XSS in /metrics/find via from/until parameters#2907
from/until parameters#2907Conversation
…fix is_unsafe_str Co-authored-by: deniszh <1227222+deniszh@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [2870] Fix issue with Graphite Web functionality
Fix reflected XSS in /metrics/find via Mar 17, 2026
from/until parameters
deniszh
approved these changes
Mar 17, 2026
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2907 +/- ##
==========================================
+ Coverage 76.42% 76.80% +0.37%
==========================================
Files 88 88
Lines 9688 9700 +12
Branches 1802 1805 +3
==========================================
+ Hits 7404 7450 +46
+ Misses 2024 1983 -41
- Partials 260 267 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
User-supplied
fromanduntilparameters were reflected unescaped in error messages from the/metrics/findendpoint, allowing script injection via malformed date values (e.g.?from=<script>alert('XSS')</script>).The
htmlEscape()call inhandleInputParameterErrorwas already present, but test coverage had gaps and the test assertion helper itself was broken.Changes
tests/base.py— Fix two bugs inis_unsafe_str()that made XSS assertions unreliable:return Falsewas indented inside theforloop, so>was never checked> 0should be>= 0(missed characters at position 0)tests/test_xss.py:untilto bothFindXSSTestandRenderXSSTest— it was tested forfrombut notuntiltest_find_xss_script_tagcovering the exact issue payload (<script>alert('XSS')</script>) against bothfromanduntil📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.