Potential fix for code scanning alert no. 1: DOM text reinterpreted as HTML#1
Merged
stephenlyons18 merged 1 commit intomainfrom Nov 10, 2025
Merged
Potential fix for code scanning alert no. 1: DOM text reinterpreted as HTML#1stephenlyons18 merged 1 commit intomainfrom
stephenlyons18 merged 1 commit intomainfrom
Conversation
…s HTML Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
🔐 Secret Scanning AlertTruffleHog has detected potential secrets in this pull request! Action Required: Please review the findings and:
Common Secret Types:
How to Fix: # Remove secret from git history
git filter-branch --force --index-filter \
"git rm --cached --ignore-unmatch path/to/file" \
--prune-empty --tag-name-filter cat -- --all
# Use environment variables instead
export API_KEY="your-secret-key"
# Or use GitHub Secrets in ActionsPrevention:
View detailed findings in the Actions tab. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/stephenlyons18/stephenlyons18.github.io/security/code-scanning/1
The best way to fix this vulnerability is to prevent user-supplied input from being interpreted as executable HTML by the browser. Specifically:
textContent(or equivalent) instead ofinnerHTMLwhen inserting user input into the DOM, astextContenttreats its content as plain text, escaping any meta-characters.<,>, and&with their HTML entities.Region to change: Lines 65-72. Instead of constructing a string with interpolated user input and assigning it to
formResponse.innerHTML, build the elements using the DOM API. Create and append elements such as<p>,<strong>, etc., and set user data usingtextContent.No new imports are required.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.