5465 ajax success replace - #5466
Draft
christinach wants to merge 2 commits into
Draft
Conversation
- Use native fetch and remove ajax:success - dont rely on rails ujs related to #5465
christinach
commented
Dec 24, 2025
| document.querySelector('.blacklight-modal') || | ||
| document.getElementById('blacklight-modal'); | ||
| if (modalEl) { | ||
| modalEl.innerHTML = body; |
Member
Author
There was a problem hiding this comment.
address semgrep failure
app/assets/javascripts/application.js
❯❯❱ javascript.browser.security.insecure-document-method.insecure-document-method
User controlled data in methods like `innerHTML`, `outerHTML` or `document.write` is an anti-pattern
that can lead to XSS vulnerabilities
Details: https://sg.run/LwA9
55┆ modalEl.innerHTML = body;
⋮┆----------------------------------------
59┆ wrapper.innerHTML = body;
BLOCKING CODE RULES FIRED:
javascript.browser.security.insecure-document-method.insecure-document-method
Member
Author
There was a problem hiding this comment.
same failure for bearer
Replicate some of the rails ujs login in csrf_form_helper: - read the csrf meta tags with getCsrfToken() and getCsrfParam() - normalizeOptions sets method and credentials - adds X-CSRF_Token and X-Requested-With and Accept - fetchWithCsrf() -> equivelant to rails ajax call - refreshCSRFTokens() -> updates hidden authenticity token in forms. we hook it with DOMContentLoaded - a public API Orangelight.CsrfFormHelper and window.CsrfFormHelper similar to rails ajax related to #5465
christinach
force-pushed
the
5465-ajax-success-replace
branch
from
December 24, 2025 19:19
d0bf2da to
11553b5
Compare
christinach
marked this pull request as ready for review
January 13, 2026 16:13
christinach
marked this pull request as draft
January 13, 2026 16:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.