Skip to content

Comments

Sanitized query in on-demand query list#778

Merged
javuto merged 3 commits intomainfrom
query-list-sanitized
Feb 23, 2026
Merged

Sanitized query in on-demand query list#778
javuto merged 3 commits intomainfrom
query-list-sanitized

Conversation

@javuto
Copy link
Collaborator

@javuto javuto commented Feb 23, 2026

Preventing unsanitized queries in the query list, that may lead to XSS.

@javuto javuto requested a review from Copilot February 23, 2026 10:56
@javuto javuto added osctrl-admin osctrl-admin related changes 🚧 bugfix Fix for an existing bug 🔐 security Security related issues labels Feb 23, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a cross-site scripting (XSS) vulnerability in the on-demand query list by sanitizing user-controlled query data before rendering it in the DataTables interface. The fix prevents malicious queries from executing arbitrary JavaScript when displayed in the admin interface.

Changes:

  • Added escapeHTML() and safeHref() helper functions in query.js to sanitize text content and validate URLs
  • Refactored the DataTables render function in queries.html to use jQuery DOM creation methods instead of string concatenation, ensuring automatic XSS protection
  • Fixed typo in external link target attribute (_targettarget)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
cmd/admin/static/js/query.js Added escapeHTML() and safeHref() sanitization functions; updated queryResultLink() to use these functions; fixed typo in target attribute
cmd/admin/templates/queries.html Refactored query column render function to use secure jQuery DOM creation methods instead of calling queryResultLink() with string concatenation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

javuto and others added 2 commits February 23, 2026 12:12
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@javuto javuto merged commit 1be602b into main Feb 23, 2026
54 checks passed
@javuto javuto deleted the query-list-sanitized branch February 23, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚧 bugfix Fix for an existing bug osctrl-admin osctrl-admin related changes 🔐 security Security related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant