Skip to content

Potential fix for code scanning alert no. 3: Reflected cross-site scripting - #15

Closed
aramprice wants to merge 1 commit into
masterfrom
alert-autofix-3
Closed

Potential fix for code scanning alert no. 3: Reflected cross-site scripting#15
aramprice wants to merge 1 commit into
masterfrom
alert-autofix-3

Conversation

@aramprice

Copy link
Copy Markdown
Member

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

To fix this safely, apply HTML escaping to any user-influenced string before inserting it into generated HTML markup, especially attribute values.

Best minimal fix (without changing intended behavior): in handlers/handler.go, import Go’s standard html package and escape repoPath right before it is used in the meta refresh output. Specifically:

  • Add html to the existing import block.
  • Introduce an escaped variable (for example escapedRepoPath := html.EscapeString(repoPath)) before the fmt.Fprintf call in the go-get=1 branch.
  • Use escapedRepoPath instead of repoPath in the meta refresh format arguments.

This preserves current response structure and redirect target semantics while neutralizing characters that can break HTML attribute context.

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

@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/

…ipting

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@aramprice

Copy link
Copy Markdown
Member Author

obsolete

@aramprice aramprice closed this Aug 13, 2026
@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-3 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