Skip to content

Security fixes for library/ (SACGF/variantgrid_private#3833)#1513

Open
davmlaw wants to merge 1 commit intomasterfrom
security/library-security-3833
Open

Security fixes for library/ (SACGF/variantgrid_private#3833)#1513
davmlaw wants to merge 1 commit intomasterfrom
security/library-security-3833

Conversation

@davmlaw
Copy link
Copy Markdown
Contributor

@davmlaw davmlaw commented Apr 2, 2026

Summary

Security hardening for the shared library/ utilities, addressing findings from SACGF/variantgrid_private#3833.

  • Remove unused html_link() which had an unescaped URL in its href attribute
  • preview_request: replace javascript:alert(...) fallback with None on NoReverseMatch
  • database_utils: int() cast on batch_size before SQL string interpolation in sql_delete_qs
  • diff_utils: escape(diff.operation_name) in generated CSS class attribute
  • file_utils: downgrade path+stat logging on chmod failure from ERROR to DEBUG

None of these are currently exploitable via user input — see the issue for the full exploitability assessment. These are defence-in-depth fixes.

Test plan

  • Run existing test suite (python3 manage.py test --keepdb)
  • Verify preview cards still render for objects whose get_absolute_url() raises NoReverseMatch (no link shown, no JS executed)
  • Confirm diff views render correctly (no visible change expected)

- Remove html_link() (unused, had unescaped URL XSS potential)
- preview_request: use None instead of javascript: URL for NoReverseMatch
- database_utils: int() cast on batch_size prevents non-integer SQL injection
- diff_utils: escape operation_name in CSS class attribute
- file_utils: downgrade path+stat error logging from ERROR to DEBUG
@davmlaw davmlaw force-pushed the security/library-security-3833 branch from 84a4e1b to fba0040 Compare April 2, 2026 00:28
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