Repository navigation
feat(cloudformation): harden language server install, caching, cleanup, and startup recovery - #8856
Merged
Merged
Conversation
|
⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done |
|
|
✅ I finished the code review, and didn't find any security or code quality issues. |
…ion, caching, cleanup, and startup recovery while simplifying the installer abstraction layer
Zee2413
reviewed
Sep 24, 2026
dnemec-aws
approved these changes
Sep 24, 2026
dnemec-aws
approved these changes
Sep 24, 2026
dnemec-aws
enabled auto-merge
September 24, 2026 20:13
dnemec-aws
disabled auto-merge
September 24, 2026 21:14
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 CloudFormation language server installer did not recover from common failures: one failed manifest or bundle request aborted startup with no retry, downloads were written without size or hash verification, ZIP entries were extracted without a path-traversal check, a partial install was reused on the next start with no recovery short of deleting the cache by hand, and the manifest lived only in
globalState, so an offline start had no fallback to an installed version. The logic was spread across aManifestProviderhierarchy, a GitHub-releases adapter, and CloudFormation-specific target remapping.Solution
Install and cache. Select the highest compatible, non-delisted version with a target for the current platform and arch (
win32,darwin,linux,linuxglib2.28). Fetch the manifest and bundle with three retries and exponential backoff, accepting only HTTP 200. Cache the parsed manifest atomically at<cache>/aws/language-servers/<name>/manifest.json; when offline, fall back to that file, then to the highest complete installed version. Verify size and hashes before writing, preflight every ZIP entry for traversal, extract one entry at a time with POSIX bits preserved, and validate the server and required files after extraction and again after post-install. A failed install is removed and an installed version is used instead; hash and no-compatible-version failures propagate. After a successful resolve, keep the active version plus the highest complete fallback and remove the rest.Startup recovery.
LspLauncherstarts the client and, if the process fails to start, invalidates the resolved installation and retries once. Known install error codes surface a user-facing message. Restart and deactivation dispose the client session explicitly, and the status bar command is registered once.Structure. The
ManifestProviderhierarchy and GitHub-releases adapter are replaced by aResolveManifestfunction. Channel selection (alpha/beta/prod) lives only in the CloudFormation adapter viaCFN_LSP_ENVIRONMENT(automation defaults to beta, otherwise prod).CFN_LSP_BUNDLEpoints at a local server bundle;SettingsLspServerProviderapplies only in debug and automation. Fetching goes throughcross-fetchso VS Code proxy settings apply. Launch configuration moves intolspClientConfig.ts, where the server runs with its own directory ascwd. Dead Amazon Q-era helpers and types inshared/lspare removed.Behavior changes
<cache>/aws/toolkits/language-servers/to<cache>/aws/language-servers/, shared with the other AWS Toolkits so one download serves every IDE. The first start after upgrade re-downloads the server; the legacy directory is not removed yet.CFN_LSP_ENVIRONMENT=alphato opt in.clientIdis forwarded only when CloudFormation telemetry is enabled and the id is not anonymous.**/*.yml.Tradeoffs made deliberately
globalStateETag + body) that previously turned a 304 with no local body into a setup failure. The on-diskmanifest.jsonis now the single cache and offline fallback.CI
.github/workflows/jscpd.jsonthreshold 3.0% → 3.2%. jscpd 5.3.2 fixed an off-by-one that undercounted every clone by one line, so the same 548 clones now measure 3.12% on this branch and 3.17% on master (2.99% under the old count). None of them touch files in this PR, andfilterDuplicates.jsreports 0 new clones.feature/xbranches will not be squash-merged at release time.