fix(dicom-pdf): guarantee the type of encapsulated documents and release 3.12.15 (#6228) - #6258
Merged
Merged
Conversation
* fix(dicom-pdf): guarantee the type of encapsulated documents MIMETypeOfEncapsulatedDocument is supplied by whoever produced the instance, and a blob: URL inherits the origin of the document that created it, so a spoofed text/html payload executed same-origin with the viewer and could read its localStorage. The `type` attribute on <object> is only a hint - the browser keys off the resource's actual Content-Type - so it never filtered anything. Documents are now always read into memory and re-wrapped in a Blob whose type comes from an allowlist, so neither the instance nor the origin server's Content-Type can steer how the browser interprets the bytes. PDF payloads additionally have to satisfy a %PDF- signature check. This also closes the case where a raw WADO-RS URL reached the element directly and the PACS chose the Content-Type. The allowlist maps each canonical type to how it is embedded: application/pdf -> <object type="application/pdf"> text/html, xhtml, xml, plain -> <iframe sandbox=""> anything else -> not rendered The split is forced by the browsers rather than chosen: Chrome renders a PDF under no sandbox at all and under none of the token combinations, including the fully permissive `allow-scripts allow-same-origin`, so PDFs cannot be sandboxed and rely on the type guarantee instead. Markup types render correctly inside a sandbox, so they get one with no tokens. Non-standard spellings (application/html, application/x-pdf, application/acrobat, text/pdf, application/xhtml) fold onto their canonical entry, which is safe because the canonical entry - not the declared spelling - decides both the Blob type and the signature. This extension had neither a jest nor a babel config, so the root extensions/*/jest.config.js project glob never collected its tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * refactor(dicom-pdf): load documents through the data source The previous commit reached the payload with its own fetch(), which bypassed the data source and needed CORS on a cross-origin WADO URL. Documents are now read the way every other bulkdata value is read: inline content when the metadata carries it, otherwise the data source's own retrieveBulkData, preferring the buffer it caches on value.Value. This mirrors resolveBulkDataTags and matches the path the video display sets take, so authentication, bulkdata URI resolution and caching all behave the same here. The type guarantee is unchanged - the bytes are still wrapped in a Blob whose type comes from the allowlist, and PDF payloads still have to satisfy the %PDF- signature check - but it no longer depends on re-fetching a URL whose Content-Type was never trustworthy. The SOP class handler now hands the display set a getDocument loader instead of renderedUrl/getRenderedUrl. Those were consumed only by this viewport, and directURL eagerly created an object URL per DOC instance at metadata time that nothing revoked. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(dicom-pdf): move document viewport strings into i18n The viewport's status and fallback strings were hardcoded English. They now come from a new EncapsulatedDocument namespace via useTranslation, registered in both the en-US and test-LNG locale indexes. react-i18next is declared as a peer dependency, matching how the other extensions that use useTranslation declare it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(security): bump browserslist and fast-uri past new high advisories The CircleCI security audit gate runs whenever pnpm-lock.yaml changes. Newly published advisories put two build-time transitive deps over the high threshold: - browserslist <=4.28.6 (GHSA-c83g-rgw3-j3cx, GHSA-73wf-gq98-2v4g), reached via @babel/helper-compilation-targets. Override to 4.28.8. - fast-uri <3.1.6 (GHSA-5jgf-p345-68v8, GHSA-f65p-4m7j-42xc, GHSA-fph4-wmhf-6fwf, GHSA-jqff-g426-hqxp), reached via babel-loader > webpack > schema-utils > ajv. Widen the existing override to 3.1.6. fast-uri 3.1.7 exists but was published today and trips the repo's 2-day minimumReleaseAge gate. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(dicom-pdf): accept a valid pdf whose header is not at byte 0 The signature check required %PDF- at offset 0, which rejects legitimate documents that carry a UTF-8 BOM or other leading bytes before the header. Adobe's implementation note allows the header anywhere in the first 1024 bytes and mainstream readers follow it, so scan that same bounded window. The check still does its actual job: a payload declared as PDF that is really markup carries no %PDF- anywhere and is still refused. --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The chore(version) release commits bump every package.json to the new workspace version but never regenerate bun.lock, and bun's incremental update only rewrote the 47 "version" fields plus a handful of dependency maps when this branch ran an install. That left 110 @ohif/@externals specifiers in bun.lock still pointing at 3.12.13 while the package.json files they mirror all say 3.12.14. Every mismatch was verified to be exactly 3.12.13 -> 3.12.14 against the referring package.json, with no missing entries and no other divergence, so all 110 are synced. bun install --frozen-lockfile now resolves without rewriting the lockfile, and bun audit at the CI gate's level is unchanged because no third-party resolution moved. Also re-indents the isCancelled block in the PDF viewport, which was the only substantive divergence from the same file as merged on master. Left as-is, lint-staged prettier would rewrite it on the next commit touching the file and make future cross-branch cherry-picks conflict for no reason. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
wayfarer3130
approved these changes
Sep 8, 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.
More or less a cherry-pick of #6228 with edits to version.txt for the release and postcss.config.js to turn off the prefixer which was giving warnings since the list of supported browsers no longer needs prefixes.