Skip to content

Potential fix for code scanning alert no. 25: DOM text reinterpreted as HTML#208

Merged
lmrodriguezr merged 1 commit intomainfrom
alert-autofix-25
Sep 21, 2025
Merged

Potential fix for code scanning alert no. 25: DOM text reinterpreted as HTML#208
lmrodriguezr merged 1 commit intomainfrom
alert-autofix-25

Conversation

@lmrodriguezr
Copy link
Copy Markdown
Member

Potential fix for https://github.com/seq-code/registry/security/code-scanning/25

To fix the error, we must ensure that any value read from $(this).attr('name') is properly escaped before being inserted into the DOM as part of an attribute value. For this case (fragment identifier), we should sanitize the name so that only valid fragment identifiers are used, ideally restricting the set to a safe subset (e.g., [A-Za-z0-9\-_:.]+). The best way is to filter and encode the fragment identifier using JavaScript’s encodeURIComponent. This prevents " and other unsafe characters from being misinterpreted or injected into the HTML context. The fix should be applied only to line 23 in app/views/page/seqcode.html.erb, wrapping the value of $(this).attr('name') in encodeURIComponent(). No external dependencies are required for this fix.


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

…as HTML

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@lmrodriguezr lmrodriguezr marked this pull request as ready for review September 21, 2025 13:34
@lmrodriguezr lmrodriguezr merged commit fcadd35 into main Sep 21, 2025
3 checks passed
@lmrodriguezr lmrodriguezr deleted the alert-autofix-25 branch February 3, 2026 12:15
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.

1 participant