Skip to content

fix: validate template paths and document the LSP server - #1716

Merged
megha-narayanan merged 3 commits into
aws:feat/cdk-lspfrom
megha-narayanan:security-fixes
Jul 9, 2026
Merged

fix: validate template paths and document the LSP server#1716
megha-narayanan merged 3 commits into
aws:feat/cdk-lspfrom
megha-narayanan:security-fixes

Conversation

@megha-narayanan

Copy link
Copy Markdown
Contributor
  • onDefinition now bounds the client-supplied *.template.json path to the project's cdk.out (realpath on both sides) before reading, matching the file-read discipline used elsewhere in the package. Prevents reading arbitrary files via a crafted textDocument/definition request.
  • Replace the placeholder README with real content: purpose, how to launch (cdk lsp / startLspServer), features, a security note that auto-synth and 'Synth now' run the cdk.json app command with your credentials on save (enable only on trusted projects), and editor-integration notes.
  • Remove the unused express / @types/express dependencies; the web interface is not part of this branch.

Fixes #

Checklist

  • This change contains a major version upgrade for a dependency and I confirm all breaking changes are addressed
    • Release notes for the new version:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

- onDefinition now bounds the client-supplied *.template.json path to the
  project's cdk.out (realpath on both sides) before reading, matching the
  file-read discipline used elsewhere in the package. Prevents reading
  arbitrary files via a crafted textDocument/definition request.
- Replace the placeholder README with real content: purpose, how to launch
  (cdk lsp / startLspServer), features, a security note that auto-synth and
  'Synth now' run the cdk.json app command with your credentials on save
  (enable only on trusted projects), and editor-integration notes.
- Remove the unused express / @types/express dependencies; the web interface
  is not part of this branch.
@aws-cdk-automation
aws-cdk-automation requested a review from a team July 8, 2026 17:33
@github-actions github-actions Bot added the p2 label Jul 8, 2026
@megha-narayanan
megha-narayanan marked this pull request as ready for review July 8, 2026 17:53
import { startLspServer } from '@aws-cdk/cdk-explorer';
startLspServer();

## Features

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section seems a bit weird to me, why are we advertising codelens as the primary feature here, can you maybe reorganize this so we have a list of the features? - mostly so we are not projecting one feature as being more important than the others

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, will just include the synth triggering and the resource codelenses both in a flat list.


## Status

This release ships the LSP server only. The web interface is not part of this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to mention that the web interface is not here yet, we don't need to mention it in the README, once it arrives, we can add it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, will do. can just add that as a note in the ticket then, i know they asked about whether the web explorer was part of this yet

…s note

Address README review: present features as one equal list rather than
leading with code lenses, and remove the LSP-only status note.
generated template.
- Go to definition: from a position in a synthesized `*.template.json` back to the
construct source that produced it.
- Diagnostics: policy validation report findings appear as squiggles in source.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify a bit more how this works, since we don't just show the squiggles, I think there is also a hover that explains how to fix it. Also don't the squiggles appear on the same line as the construct, not the actual source of the problem (since we don't have that info through the validator)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, I'll expand this. I'll make both explicit, lmk if the new wording looks good

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somewhere in here I think we want to mention that we pull this information from a user's cdk.out directory

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding to the intro paragraph

Expand the diagnostics feature description: the rule description and any
suggested fix appear in the diagnostic message (on hover and in the problems
list), and squiggles anchor on the construct-creation line since the
validation report identifies a violating construct, not a source line. Also
name the cdk.out directory as the source the server reads.
@megha-narayanan
megha-narayanan merged commit 52a3635 into aws:feat/cdk-lsp Jul 9, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants