Skip to content

Fix CodeQL warning 'Cross-site scripting vulnerability due to user-provided value - #566

Merged
Bogdan Gavril (bgavrilMS) merged 1 commit into
mainfrom
fengga/fix-s360-warning
Apr 3, 2025
Merged

Bogdan Gavril (bgavrilMS) merged 1 commit into
mainfrom
fengga/fix-s360-warning

Conversation

@fengga

@fengga fengga commented Apr 1, 2025 •

Copy link
Copy Markdown
Contributor

image

The issue in the original code was that only the 'error_description' parameter was properly HTML-escaped, while the 'error' parameter was left unescaped. This modification adds proper escaping to the 'headerErr' variable using the html.EscapeString function, converting it to safe HTML string representation to prevent potential cross-site scripting (XSS) attacks.

With both parameters now properly HTML-escaped before being inserted into the HTML page, the security warning should no longer appear.

@sonarqubecloud

sonarqubecloud Bot commented Apr 1, 2025

Copy link
Copy Markdown

@fengga fengga changed the title Fix S360 warning 'Cross-site scripting vulnerability due to user-provided value Fix CodeQL warning 'Cross-site scripting vulnerability due to user-provided value Apr 1, 2025
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