fix(config url): Hardening fetch options. - #5985
Merged
Merged
Conversation
✅ Deploy Preview for ohif-dev canceled.
|
sedghi
approved these changes
Apr 28, 2026
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.
Context
Hardened fetch of
DicomJSONandDicomWebProxyconfig url fetching.Changes & Results
Use stricter fetch options.
Checklist
PR
semantic-release format and guidelines.
Code
etc.)
Public Documentation Updates
additions or removals.
Tested Environment
System:
OS: Windows 11 10.0.26200
CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
Memory: 3.86 GB / 31.68 GB
Binaries:
Node: 22.17.0 - C:\Users\joebo\AppData\Local\fnm_multishells\7300_1777381936598\node.EXE
Yarn: 1.22.22 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 11.6.2 - C:\Users\joebo\AppData\Local\fnm_multishells\7300_1777381936598\npm.CMD
bun: 1.2.23 - C:\Users\joebo.bun\bin\bun.EXE
Browsers:
Chrome: 147.0.7727.117
Edge: Chromium (146.0.3856.84)
Internet Explorer: 11.0.26100.8115
Greptile Summary
This PR simplifies
fetchConfigJsonto apply a single set of hardened fetch options (credentials: 'same-origin',redirect: 'error',referrerPolicy: 'no-referrer') to all config URL fetches instead of branching onisAuthenticated/isSameOrigin. Tests are updated accordingly.redirect: 'error'is a behavioural change: authenticated and same-origin requests previously used barefetch()(i.e.redirect: 'follow'), so any deployment whose config URL involves a redirect on those paths will now fail.Confidence Score: 4/5
Safe to merge with the awareness that
redirect: 'error'now covers previously unrestricted paths.One P2 finding: extending
redirect: 'error'to authenticated/same-origin requests is an intentional hardening but could silently break deployments using redirecting config URLs. No P0/P1 issues found; tests are correctly updated.extensions/default/src/utils/secureConfigFetch.js — review the redirect behaviour change for authenticated/same-origin paths.
Important Files Changed
redirect: 'error'now also covers authenticated/same-origin paths (previouslyredirect: 'follow'), which is a breaking change for redirecting config URLs.isAuthenticated/isSameOriginstill returned but unused infetchConfigJson.credentials: 'same-origin'; all threefetchConfigJsontest paths now assert the hardened options object.Comments Outside Diff (1)
extensions/default/src/utils/secureConfigFetch.js, line 91-96 (link)resolveConfigFetchPolicyisAuthenticated(line 94) andisSameOrigin(line 95) are still computed and returned byresolveConfigFetchPolicy, butfetchConfigJsonno longer destructures or uses them. These two fields in the returned object are now unused dead code. Consider removing them from the return value (the variables themselves are still needed internally for the origin-check guard at line 82).Prompt To Fix With AI
Prompt To Fix All With AI
Reviews (2): Last reviewed commit: "Update unit tests." | Re-trigger Greptile