-
-
Notifications
You must be signed in to change notification settings - Fork 1
Claude/fix article link navigation #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -323,6 +323,9 @@ | |||||
| gtag('js', new Date()); | ||||||
| gtag('config', 'G-LWN1RSPQMJ'); | ||||||
| </script> | ||||||
|
|
||||||
| <!-- DOMPurify for XSS protection --> | ||||||
| <script src="https://cdn.jsdelivr.net/npm/dompurify@3.0.8/dist/purify.min.js"></script> | ||||||
| </head> | ||||||
| <body> | ||||||
| <!-- Hero Section --> | ||||||
|
|
@@ -521,11 +524,23 @@ <h2 class="section-title"> | |||||
| const card = document.createElement('div'); | ||||||
| card.className = 'project-card'; | ||||||
|
|
||||||
| // Sanitize strings to prevent XSS | ||||||
| const name = escapeHtml(repo.name || 'Untitled'); | ||||||
| const description = escapeHtml(repo.description || 'No description available'); | ||||||
| const language = escapeHtml(repo.language || 'Unknown'); | ||||||
| const url = escapeHtml(repo.html_url || '#'); | ||||||
| // Sanitize strings to prevent XSS using DOMPurify | ||||||
| const name = DOMPurify.sanitize(repo.name || 'Untitled'); | ||||||
| const description = DOMPurify.sanitize(repo.description || 'No description available'); | ||||||
| const language = DOMPurify.sanitize(repo.language || 'Unknown'); | ||||||
|
|
||||||
| // Validate URL scheme | ||||||
| let url = '#'; | ||||||
| if (repo.html_url) { | ||||||
| try { | ||||||
| const urlObj = new URL(repo.html_url); | ||||||
| if (urlObj.protocol === 'http:' || urlObj.protocol === 'https:') { | ||||||
| url = DOMPurify.sanitize(repo.html_url); | ||||||
|
||||||
| url = DOMPurify.sanitize(repo.html_url); | |
| url = urlObj.href; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -349,6 +349,9 @@ | |||||
| gtag('js', new Date()); | ||||||
| gtag('config', 'G-LWN1RSPQMJ'); | ||||||
| </script> | ||||||
|
|
||||||
| <!-- DOMPurify for XSS protection --> | ||||||
| <script src="https://cdn.jsdelivr.net/npm/dompurify@3.0.8/dist/purify.min.js"></script> | ||||||
|
||||||
| <script src="https://cdn.jsdelivr.net/npm/dompurify@3.0.8/dist/purify.min.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/dompurify@3.3.1/dist/purify.min.js"></script> |
Copilot
AI
Jan 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The URL validation logic only checks for http: and https: protocols, but does not protect against other XSS vectors. While the validation prevents javascript: URLs from being used, the validated articleUrl is still used directly in href and iframe.src assignments (lines 488-489, 496) without further sanitization. The validation should be followed by using the validated URL object's href property to ensure the URL is properly normalized.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -267,6 +267,9 @@ | |||||
| gtag('js', new Date()); | ||||||
| gtag('config', 'G-LWN1RSPQMJ'); | ||||||
| </script> | ||||||
|
|
||||||
| <!-- DOMPurify for XSS protection --> | ||||||
| <script src="https://cdn.jsdelivr.net/npm/dompurify@3.0.8/dist/purify.min.js"></script> | ||||||
|
||||||
| <script src="https://cdn.jsdelivr.net/npm/dompurify@3.0.8/dist/purify.min.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/dompurify@3.3.1/dist/purify.min.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a version mismatch between the DOMPurify CDN version (3.0.8) being loaded and the package.json dependency version (3.3.1). This inconsistency could lead to unexpected behavior or missing security patches. Consider updating the CDN URL to use version 3.3.1 or use a caret/tilde version specifier to automatically get the latest patch version.