fix: use hashed chunk names for hash map#5144
Open
zhangyx1998 wants to merge 2 commits intovuejs:mainfrom
Open
fix: use hashed chunk names for hash map#5144zhangyx1998 wants to merge 2 commits intovuejs:mainfrom
zhangyx1998 wants to merge 2 commits intovuejs:mainfrom
Conversation
15a0278 to
09af6c7
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.
Description
Major changes
This update refactors page-chunk resolution to fix both problems in issue #5143: path-name collisions and unintentional route leakage.
/→_) with deterministic hashed keys.canonicalPath->assetKey->lookupKey->hash) so clients no longer have reversible page identifiers.[name].[hash].jsto[assetKey].[hash].js.caseSensitive: booleanconfig entry.flowchart LR Canonical("<small>Maybe Private</small><br>Canonical Path _foo/bar_"):::orange AssetKey("<small>DERIVED</small><br>Asset Key"):::yellow subgraph Hashmap["<small>Client Hash Map</small>"] LookupKey("<small>PUBLIC</small><br>Lookup Key"):::green FileHash("<small>PUBLIC</small><br>FileHash"):::green LookupKey --> FileHash --> LookupKey end subgraph Server["<small>Static File Server</small>"] Asset[("🔒 [AssetKey].[FileHash].js")]:::orange Bundler([🔨 Vitepress Bundler]):::blue Gateway((☁️)):::node Gateway --> Asset end Canonical --> AssetKey --> LookupKey AssetKey --> Gateway FileHash --> Gateway linkStyle default stroke:gray,stroke-width:2px; classDef node fill:#0004,stroke:currentColor,color:gray; classDef green fill:#0004,stroke:currentColor,color:#AF0; classDef orange fill:#0004,stroke:currentColor,color:#FA0; classDef yellow fill:#0004,stroke:currentColor,color:#FF0; classDef blue fill:#0004,stroke:currentColor,color:#0AF; style Hashmap fill:#0001,stroke:gray,stroke-width:1px,stroke-dasharray:6 4,color:gray,opacity:0.6; style Server fill:#0001,stroke:gray,stroke-width:1px,stroke-dasharray:6 4,color:gray,opacity:0.6;Tip
Asset keys are never shared with the client. To resolve an asset key and load a chunk, the client must provide the correct canonical path. Since the client doesn't know the paths for unlisted pages, it cannot easily discover their asset URLs. This aligns with the expectation that unlisted files should not be trivially exposed, though it is not a 'cryptographically secure' solution.
Linked Issues
fixes #5143
/publish