DataTables: harden esc() to escape quotes (attribute-safe) - #136
Merged
Conversation
tigerDataTable.esc used text→innerHTML, which escapes & < > but NOT quotes, so dropping row data into a data-* attribute could break out of it (the skills Install/Source JSON-in-attribute bug). Escape & < > " ' in a single pass — matching the other house escapers (tiger.media-picker.js, tiger-upload-list.js) — so a render can put row data straight into an attribute safely. Also drops the skills view's now-redundant local attr() workaround; esc() is attribute-safe on its own. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
tigerDataTable.escescaped& < >(via text→innerHTML) but not quotes, so a column render dropping row data into adata-*attribute could break out of it — the root of the skills grid Install/SourceJSON.parsefailure.esc()to escape& < > " 'in a single pass, so it's safe for both element text and attribute values. Matches the other house escapers (tiger.media-picker.js,tiger-upload-list.js), and drops the jQuery dependency for escaping.attr()workaround —esc()is attribute-safe on its own.Strictly safer for every existing caller (Users, Orgs, Code, CMS, Media, Skills):
"/'render as"/'in text contexts, and are now correct in attribute contexts. Verified single-pass (no double-escaping of&). Deployed to tiger-dev.🤖 Generated with Claude Code