Skip to content

Potential fix for code scanning alert no. 65: DOM text reinterpreted as HTML#13

Merged
mokesano merged 5 commits into
mainfrom
alert-autofix-65
Jun 2, 2026
Merged

Potential fix for code scanning alert no. 65: DOM text reinterpreted as HTML#13
mokesano merged 5 commits into
mainfrom
alert-autofix-65

Conversation

@mokesano

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/mokesano/editorial-pro/security/code-scanning/65

To fix this safely, validate/sanitize the URL before restoring it to href, and fall back to a safe value (#) when invalid.
Best approach here: add a small helper in plugins/themes/sangiapub/js/gabungan.js near the external-link delay block that only allows safe protocols (http:, https:, mailto:, tel:) and same-page/hash or relative URLs. Then replace line 294 assignment to use this helper.

This keeps existing functionality (restoring legitimate external links after load) while blocking dangerous schemes such as javascript:.

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

@mokesano mokesano self-assigned this Apr 28, 2026
@mokesano mokesano requested a review from archoun April 28, 2026 10:25
@mokesano mokesano added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Apr 28, 2026
@mokesano mokesano marked this pull request as ready for review April 28, 2026 10:26
var link = $(this);
// Mengembalikan href asli dari data-href
link.attr('href', link.attr('data-href'));
link.attr('href', getSafeHref(link.attr('data-href')));

@archoun archoun left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

mokesano and others added 2 commits April 29, 2026 21:24
…as HTML

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ed as HTML'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@mokesano mokesano merged commit 099b629 into main Jun 2, 2026
10 of 11 checks passed
@mokesano mokesano deleted the alert-autofix-65 branch June 2, 2026 12:17
@github-project-automation github-project-automation Bot moved this from Todo to Done in wizdam-fork Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants