Skip to content

fix: escape HTML special characters in build.sh to prevent HTML injection#1222

Open
pranitaurlam wants to merge 1 commit intographql:mainfrom
pranitaurlam:fix/html-injection-build-sh
Open

fix: escape HTML special characters in build.sh to prevent HTML injection#1222
pranitaurlam wants to merge 1 commit intographql:mainfrom
pranitaurlam:fix/html-injection-build-sh

Conversation

@pranitaurlam
Copy link
Copy Markdown

Summary

  • Adds html_escape() function to sanitize &, <, >, and " characters before interpolating git-derived data into public/index.html
  • Applies escaping to $GITTAG, $TAGTITLE, and $GITDATE used in HTML table rows
  • Fixes unquoted echo $HTMLecho "$HTML" to prevent word splitting

Closes #1220 in graphql/graphql-spec

Test plan

  • Verify build.sh runs successfully on current repo
  • Verify that a git tag containing <script> would be escaped to &lt;script&gt; in the output HTML
  • Verify that a commit date with & would be rendered as &amp; in the output HTML

🤖 Generated with Claude Code

…tion

Add html_escape() function to sanitize git tag names, tag titles, and
commit dates before interpolating them into public/index.html. Also fix
unquoted echo to prevent word splitting.

Closes graphql#1220

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 7, 2026

Deploy Preview for graphql-spec-draft ready!

Name Link
🔨 Latest commit ce5b6fe
🔍 Latest deploy log https://app.netlify.com/projects/graphql-spec-draft/deploys/69d510d6c7a170000828ede3
😎 Deploy Preview https://deploy-preview-1222--graphql-spec-draft.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@linux-foundation-easycla
Copy link
Copy Markdown

CLA Not Signed

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.

Improve HTML generation robustness in build.sh

1 participant