Repository navigation
fix(ra-rpc): pin swagger-ui with SRI on the api-docs page - #1475
Merged
Merged
Conversation
kvinwang
force-pushed
the
fix/swagger-ui-sri
branch
from
October 23, 2026 04:22
9ace24c to
29fb998
Compare
Signed-off-by: Kevin Wang <wy721@qq.com>
kvinwang
force-pushed
the
fix/swagger-ui-sri
branch
from
October 23, 2026 04:39
29fb998 to
36aa495
Compare
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
The
/api-docspage (mounted by dstack-vmm) loadsswagger-ui-dist@5from jsDelivr with nointegrityattribute, so the version floats within major 5 and any CDN or npm-package compromise runs script on a page that shares an origin with the VMM API.Fix
Pin
swagger-ui-dist@5.32.15(last of the 5.32 line, published 2026-09-04, so it has had time in the wild) and addintegrity+crossorigin="anonymous"to the CSS and both scripts. The SRI hashes are computed from the files in the npm tarball (whose sha512 matches the registry'sintegrity), and match what jsDelivr serves.SwaggerUiConfig::swagger_ui_distis removed: the hashes now pin specific files at a specific version, so a free-form base URL could only point at those same files, and the only caller (vmm/src/openapi.rs) uses the default anyway.Verification
cargo test -p ra-rpc --all-featurespasses;cargo clippy -p ra-rpc -p dstack-vmm --all-features -- -D warnings -D clippy::unwrap_used -D clippy::expect_usedclean.