Skip to content

Potential fix for code scanning alert no. 1: Reflected cross-site scripting - #17

Merged
winkingturtle-vmw merged 1 commit into
masterfrom
alert-autofix-1
Aug 13, 2026
Merged

Potential fix for code scanning alert no. 1: Reflected cross-site scripting#17
winkingturtle-vmw merged 1 commit into
masterfrom
alert-autofix-1

Conversation

@aramprice

Copy link
Copy Markdown
Member

Potential fix for https://github.com/cloudfoundry/go-fetcher/security/code-scanning/1

Use contextual escaping for all untrusted values inserted into HTML attributes before writing them to the response. In Go, the safest minimal fix here is to apply html.EscapeString(...) to dynamic values used inside the content="..." attribute of meta tags.

In handlers/handler.go:

  • Add the standard library import html.
  • In GetMeta, escape:
    • goImportContent before embedding in goImport.
    • goSourceContent before embedding in goSource.
    • h.config.ImportPrefix and repoPath before embedding in the refresh meta tag URL.
      This preserves existing behavior while preventing attribute/context breaking and reflected XSS.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…ipting

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@aramprice
aramprice marked this pull request as ready for review August 6, 2026 17:06
@aramprice

Copy link
Copy Markdown
Member Author

GitHub workers are currently having issues, which is causing the PR checks to timeout:
=> https://www.githubstatus.com/

@winkingturtle-vmw
winkingturtle-vmw merged commit 84bc3ad into master Aug 13, 2026
8 of 12 checks passed
@github-project-automation github-project-automation Bot moved this from Inbox to Done in CF Community Aug 13, 2026
@aramprice
aramprice deleted the alert-autofix-1 branch August 13, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants