Commit 8e8d3bd
Add nonce sanitization to prevent XSS attacks
Security improvements:
- Sanitize nonce values to prevent attribute injection attacks
- Only allow base64-safe characters: alphanumeric, +, /, =, -, _
- Add test to verify malicious nonce values are sanitized
- Document the security measure in code comments
Even though Rails content_security_policy_nonce() returns safe values,
this adds defense-in-depth by sanitizing at the JavaScript layer.
All tests passing (101 passed).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 9d3e09f commit 8e8d3bd
File tree
2 files changed
+20
-1
lines changed- packages/react-on-rails
- src
- tests
2 files changed
+20
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
110 | 126 | | |
0 commit comments