fix: scan-status gate bypassed by /content/$value requests - #510
Closed
cschuerings wants to merge 3 commits into
Closed
fix: scan-status gate bypassed by /content/$value requests#510cschuerings wants to merge 3 commits into
cschuerings wants to merge 3 commits into
Conversation
cschuerings
requested a deployment
to
pr-approval
August 4, 2026 14:54 — with
GitHub Actions
Waiting
Merged
eric-pSAP
added a commit
that referenced
this pull request
Aug 17, 2026
Duplicate of #510 to allow for merging. --------- Co-authored-by: Christian Schuerings <christian.schuerings@sap.com> Co-authored-by: hyperspace-pr-bot[bot] <209611008+hyperspace-pr-bot[bot]@users.noreply.github.com>
Contributor
|
Merged with PR #517 |
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.
Problem
Infected attachments could be downloaded via the OData
/$valuesuffix (GET /content/$value) because the scan-status gate invalidateAttachmentonly checked for/contentand/_contentsuffixes:Both patterns miss the
/$valuesuffix, so the gate was never entered for:/odata/v4/.../content/$value/odata/v4/.../foo_content/$valueThe same blind spot affected
getScanInfowhere the prefix was extracted withsplit('/').pop().replace('_content', '')— for a/$valueURL this returns"$value"instead of the actual field prefix, causing the DB query to look up the wrong column.Fix
Introduce two helper functions in
lib/helper.js:isContentRequest(url)— matches all four content URL variants (/content,/content/$value,/field_content,/field_content/$value) after stripping query string and fragment.extractContentPrefix(url)— strips the/$valuesuffix before extracting the inline-attachment field prefix; returnsundefinedfor the composition-based/contentpattern.Both are used in
validateAttachment,getScanInfo, andreadAttachment, replacing the scattered inline string-matching logic.Tests
tests/unit/contentUrlHelpers.test.js— 23 unit tests covering both helpers directly (true/false cases,/$value, query strings, fragments, null/undefined).tests/unit/status-gate.test.js— 3 integration-style tests that callvalidateAttachmentwith an Infected attachment via/content,/content/$value, and/foo_content/$valueURLs and assertreq.reject(403, ...)is called in all cases.