Repository navigation
fix: check file names and zip entries when installing the language server - #592
Open
dungdong-aws wants to merge 4 commits into
Open
dungdong-aws wants to merge 4 commits into
dungdong-aws wants to merge 4 commits into
Conversation
…rver Server versions and content file names from the manifest are used as folder and file names under the download location, and zip entries are written under the folder the zip is extracted to. Select a version only when its name is a single path segment, download or reuse a content file only when its name is a single path segment, and extract a zip only when every entry is located inside its destination folder. A content file or zip that does not pass is handled like a failed download.
A file entry in a zip is extracted only when it is located below the destination folder. A directory entry may still be the destination folder itself.
A zip content file is extracted to a folder named after the zip without its extension. Use the content file only when that folder name is a single path segment as well.
The folder a zip is extracted to is named after the zip, also for a zip that is found inside an extracted zip. Extract a zip only when that folder name is a single path segment. Also select the fallback version without reading the name of manifest entries that have none.
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.
Summary
The language server installer uses server versions and content file names from the manifest as folder and file names under the download location, and writes zip entries under the folder a zip is extracted to. This change checks those names before they are used.
Change
RemoteLspFetcher: a version is selected only when its name is a single path segment, and a content file is downloaded or reused from the cache only when its name is a single path segment.RemoteLspFetcher: a zip is extracted to a folder named after the zip, and it is extracted only when that folder name is a single path segment (resolveUnzipFolder). This applies to every zip that is extracted.ArtifactUtils.extractFileandcopyMissingFilesFromZip: every zip entry must be located inside its destination folder, and only a directory entry may be the destination folder itself (ArtifactUtils.resolveZipEntry).Behavior after this change
1.87.0, filesservers.zipandclients.zip) and for pre-release versions such as1.83.0-branch.sha.Testing
ArtifactUtilsTest: entries with relative segments that are located inside the destination are extracted; entries located elsewhere, and file entries at the destination folder itself, fail the extraction and nothing is written for them;copyMissingFilesFromZipkeeps existing files and adds the missing ones.RemoteLspFetcherTest: content file names, zip folder names and server versions that are not a single path segment are not downloaded, not reused from the cache, and not selected; a content file name that starts with a dot installs; fallback works when a manifest entry has no version name.mvn -B clean package: build passes, 562 tests, 0 Checkstyle violations.