fix: add security hardening for media text attachments#3700
Merged
shakkernerd merged 2 commits intomainfrom Jan 29, 2026
Merged
fix: add security hardening for media text attachments#3700shakkernerd merged 2 commits intomainfrom
shakkernerd merged 2 commits intomainfrom
Conversation
…n file name and MIME type attributes.
7e37431 to
2257d69
Compare
Contributor
|
Hey @shakkernerd — the new test "escapes XML special characters in filenames to prevent injection" is failing on Windows CI because Quick fix: use - const filePath = path.join(dir, "file<test>.txt");
+ const filePath = path.join(dir, "file&test.txt");And update the assertions: - expect(ctx.Body).toContain("<");
- expect(ctx.Body).toContain(">");
- expect(ctx.Body).not.toMatch(/name="[^"]*<[^"]*"/);
+ expect(ctx.Body).toContain("&");
+ expect(ctx.Body).not.toMatch(/name="[^"]*&[^"]*"/); |
This was referenced Jan 29, 2026
Member
Author
|
@conroywhitney Oops! (Mac users). Thanks for pointing out. |
Contributor
|
@shakkernerd np. Put up an issue & PR for the fix: |
3 tasks
HirokiKobayashi-R
pushed a commit
to HirokiKobayashi-R/moltbot
that referenced
this pull request
Jan 29, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Jan 31, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Feb 1, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Feb 1, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Feb 1, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Feb 1, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
YuriNachos
pushed a commit
to YuriNachos/clawdbot-fork
that referenced
this pull request
Feb 1, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
uxcu
pushed a commit
to uxcu/kook-openclaw
that referenced
this pull request
Feb 5, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
bestNiu
pushed a commit
to bestNiu/clawdbot
that referenced
this pull request
Feb 5, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
* fix: Prevent XML attribute injection by escaping special characters in file name and MIME type attributes. * fix: text attachment MIME misclassification with security hardening (openclaw#3628) - Fix CSV/TSV inference from content heuristics - Add UTF-16 detection and BOM handling - Add XML attribute escaping for file output (security) - Add MIME override logging for auditability - Add comprehensive test coverage for edge cases Thanks @frankekn
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.
Follow-up to #3628 - adds security hardening:
xmlEscapeAttrfunction to escape XML special characters in filenames and MIME typesThis ensures the media text attachment feature is safe against injection attacks.