Skip to content

Verify XSS fix for reflected cacheTimeout parameter (issue #2779)#2909

Closed
Copilot wants to merge 1 commit intomasterfrom
copilot/fix-issue-2779
Closed

Verify XSS fix for reflected cacheTimeout parameter (issue #2779)#2909
Copilot wants to merge 1 commit intomasterfrom
copilot/fix-issue-2779

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 17, 2026

Issue #2779 reported a reflected XSS vulnerability at /render/?cacheTimeout=<payload> — when cacheTimeout is non-integer, Python's int() error message includes the raw user input, which was reflected unsanitized in the HTTP response.

Status

The fix is already present in the codebase via the handleInputParameterError decorator in webapp/graphite/errors.py, which applies htmlEscape() before returning any HttpResponseBadRequest:

def handleInputParameterError(f):
    def new_f(*args, **kwargs):
        try:
            return f(*args, **kwargs)
        except InputParameterError as e:
            msgStr = str(e)
            log.warning('%s', msgStr)
            return HttpResponseBadRequest(htmlEscape(msgStr))  # XSS safe
    return new_f

Error flow

  • parseOptions()int(queryParams.get('cacheTimeout', ...)) raises ValueError
  • renderView() catches → re-raises as InputParameterError(str(e))
  • @handleInputParameterError → returns HttpResponseBadRequest(htmlEscape(msgStr))

Test coverage

RenderXSSTest.test_render_xss in webapp/tests/test_xss.py directly exercises this path with a crafted XSS string across cacheTimeout, from, and until parameters, asserting a clean 400 response with no unescaped HTML. All 5 XSS tests pass.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] [GH-2779] Fix the issue with graphite-web Verify XSS fix for reflected cacheTimeout parameter (issue #2779) Mar 17, 2026
Copilot AI requested a review from deniszh March 17, 2026 22:13
@deniszh deniszh marked this pull request as ready for review March 17, 2026 22:17
@deniszh deniszh mentioned this pull request Mar 17, 2026
@deniszh
Copy link
Copy Markdown
Member

deniszh commented Mar 17, 2026

Empty commit, no need to merge

@deniszh deniszh closed this Mar 17, 2026
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