Skip to content

Escape text in auditlog table to mitigate XSS vulnerability#3704

Merged
Simrayz merged 1 commit intomasterfrom
fix/2803-escape-auditlog-comment-text
Dec 16, 2025
Merged

Escape text in auditlog table to mitigate XSS vulnerability#3704
Simrayz merged 1 commit intomasterfrom
fix/2803-escape-auditlog-comment-text

Conversation

@Simrayz
Copy link
Copy Markdown
Contributor

@Simrayz Simrayz commented Dec 16, 2025

Scope and purpose

Fixes #2803

This PR adds HTML escaping to the auditlog table to mitigate the XSS vulnerability.

Screenshots

Before

image

After

image

Contributor Checklist

Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to NAV can be found in the
Hacker's guide to NAV.

  • Added a changelog fragment for towncrier
  • Added/amended tests for new/changed code
  • Added/changed documentation
  • Linted/formatted the code with ruff, easiest by using pre-commit
  • Wrote the commit message so that the first line continues the sentence "If applied, this commit will ...", starts with a capital letter, does not end with punctuation and is 50 characters or less long. See https://cbea.ms/git-commit/
  • Based this pull request on the correct upstream branch: For a patch/bugfix affecting the latest stable version, it should be based on that version's branch (<major>.<minor>.x). For a new feature or other additions, it should be based on master.
  • If applicable: Created new issues if this PR does not fix the issue completely/there is further work to be done
  • If it's not obvious from a linked issue, described how to interact with NAV in order for a reviewer to observe the effects of this change first-hand (commands, URLs, UI interactions)
  • If this results in changes in the UI: Added screenshots of the before and after
  • If this adds a new Python source code file: Added the boilerplate header to that file

@Simrayz Simrayz self-assigned this Dec 16, 2025
@Simrayz Simrayz requested a review from a team December 16, 2025 09:50
@Simrayz Simrayz marked this pull request as ready for review December 16, 2025 09:50
@github-actions
Copy link
Copy Markdown

Test results

    27 files      27 suites   45m 9s ⏱️
 2 733 tests  2 733 ✅ 0 💤 0 ❌
20 254 runs  20 254 ✅ 0 💤 0 ❌

Results for commit c2363fc.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.07%. Comparing base (8d18f3f) to head (e1ae6f1).
⚠️ Report is 367 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3704      +/-   ##
==========================================
- Coverage   63.07%   63.07%   -0.01%     
==========================================
  Files         612      612              
  Lines       45247    45247              
  Branches       43       43              
==========================================
- Hits        28541    28539       -2     
- Misses      16696    16698       +2     
  Partials       10       10              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@hmpf hmpf left a comment

Choose a reason for hiding this comment

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

You need to escape actor, target, object and summary.

@Simrayz Simrayz requested a review from hmpf December 16, 2025 12:43
@hmpf hmpf requested a review from a team December 16, 2025 12:46
Copy link
Copy Markdown
Contributor

@aleksfl aleksfl left a comment

Choose a reason for hiding this comment

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

Looks good!

@Simrayz Simrayz force-pushed the fix/2803-escape-auditlog-comment-text branch from 75fb800 to e1ae6f1 Compare December 16, 2025 12:58
@Simrayz Simrayz merged commit 1ee8e43 into master Dec 16, 2025
14 of 15 checks passed
@Simrayz Simrayz deleted the fix/2803-escape-auditlog-comment-text branch December 16, 2025 12:59
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix XSS in auditlog list

3 participants