Skip to content

Potential fix for code scanning alert no. 5: DOM text reinterpreted as HTML#32

Merged
aquie00t merged 1 commit intomainfrom
alert-autofix-5
Apr 25, 2026
Merged

Potential fix for code scanning alert no. 5: DOM text reinterpreted as HTML#32
aquie00t merged 1 commit intomainfrom
alert-autofix-5

Conversation

@aquie00t
Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/the-developer-network/tdn-client/security/code-scanning/5

To fix this safely without changing intended functionality, validate avatar URL values before binding them to <img src>, and only allow trusted schemes (blob:, http:, https:) or root-relative URLs. If validation fails, fall back to a safe default avatar URL. This should be done in EditProfileModal.tsx where currentAvatar is constructed, so the sink always receives a sanitized URL string.

Best implementation in shown code:

  • In src/features/profile/components/EditProfileModal.tsx, add a small local helper (e.g. getSafeImageSrc) above currentAvatar.
  • Use it when assigning currentAvatar.
  • Keep existing preview/upload behavior unchanged; only gate what gets rendered.

No dependency changes are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…s HTML

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown
Contributor

cloudflare-workers-and-pages Bot commented Apr 25, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tdn-client 775fd0f Commit Preview URL

Branch Preview URL
Apr 25 2026, 09:37 AM

@aquie00t aquie00t marked this pull request as ready for review April 25, 2026 09:37
@aquie00t aquie00t merged commit 8542a46 into main Apr 25, 2026
6 checks passed
@aquie00t aquie00t deleted the alert-autofix-5 branch April 25, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant