Commit 7c60c69
Eliminated double JSON encoding that could allow XSS attacks.
Security improvements:
- Pass dicts to template instead of pre-serialized JSON
- Use Jinja2's tojson filter for proper JavaScript escaping
- Remove unnecessary JSON.parse() calls
- Prevent malicious data from breaking JavaScript context
CVSS Score: 7.1 (High) → Resolved
Attack Vector: Malicious repository metadata in HTML reports
Mitigation: Single-encoding with Jinja2's safe tojson filter
Technical Details:
- Changed assessment_json → assessment_dict (dict, not string)
- Changed available_themes_json → available_themes_dict
- Updated template to use tojson without JSON.parse()
- Jinja2 autoescape + tojson provides comprehensive protection
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2bf052d commit 7c60c69
2 files changed
+10
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| |||
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
71 | | - | |
72 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
713 | 713 | | |
714 | 714 | | |
715 | 715 | | |
716 | | - | |
717 | | - | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
718 | 719 | | |
719 | | - | |
720 | | - | |
| 720 | + | |
| 721 | + | |
721 | 722 | | |
722 | 723 | | |
723 | 724 | | |
| |||
0 commit comments