Skip to content

fix(sagemaker): Validate clusterId format in open-notebook extension#281

Open
aakashmandavilli96 wants to merge 1 commit into
aws:1.1from
aakashmandavilli96:1.1
Open

fix(sagemaker): Validate clusterId format in open-notebook extension#281
aakashmandavilli96 wants to merge 1 commit into
aws:1.1from
aakashmandavilli96:1.1

Conversation

@aakashmandavilli96

Copy link
Copy Markdown
Contributor

Issue

D316398873

Description of Changes

Adds input validation for the clusterId URL parameter in the
sagemaker-open-notebook extension. Previously only region was validated
(via isValidRegion); this change adds an equivalent isValidClusterId
check so clusterId is restricted to alphanumeric characters, hyphens, and
underscores before it is used to generate notebook cell content. Malformed
values are rejected with a user-facing error.

Since extension.ts is generated at build time from the quilt patch series,
the change is made in patches/sagemaker/sagemaker-open-notebook-extension.diff
and regenerated with quilt refresh (no other files change).

Testing

  • Regenerated the patched source via scripts/prepare-src.sh; the full patch
    series applies cleanly and the generated extension.ts contains the new
    isValidClusterId validator and the guard in loadAndDisplayNotebook.
  • Type-checked the edited extension with tsc --noEmit; no errors on the
    change (only environmental module-resolution messages from the uninstalled
    toolchain).
  • Confirmed valid IDs (e.g. ml-cluster-123) are accepted and values
    containing shell metacharacters, spaces, or newlines are rejected.

Screenshots/Videos

N/A

Additional Notes

Minimal, low-risk input-validation change that mirrors the existing
isValidRegion pattern already in the extension.

Backporting

This change applies to the other active version branches. Separate PRs will be
raised for main, 1.2, and 1.0.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Add input validation for the clusterId URL parameter in the sagemaker-open-notebook extension. Previously only region was validated (isValidRegion); this adds an equivalent isValidClusterId check so clusterId is restricted to alphanumeric characters, hyphens, and underscores before it is used to generate notebook cell content. Malformed values are rejected with a user-facing error.
@aakashmandavilli96 aakashmandavilli96 requested review from a team as code owners July 15, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants