fix(sagemaker): Validate clusterId format in open-notebook extension#281
Open
aakashmandavilli96 wants to merge 1 commit into
Open
fix(sagemaker): Validate clusterId format in open-notebook extension#281aakashmandavilli96 wants to merge 1 commit into
aakashmandavilli96 wants to merge 1 commit into
Conversation
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.
sachinh-amazon
approved these changes
Jul 16, 2026
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.
Issue
D316398873
Description of Changes
Adds input validation for the
clusterIdURL parameter in thesagemaker-open-notebook extension. Previously only
regionwas validated(via
isValidRegion); this change adds an equivalentisValidClusterIdcheck so
clusterIdis restricted to alphanumeric characters, hyphens, andunderscores before it is used to generate notebook cell content. Malformed
values are rejected with a user-facing error.
Since
extension.tsis generated at build time from the quilt patch series,the change is made in
patches/sagemaker/sagemaker-open-notebook-extension.diffand regenerated with
quilt refresh(no other files change).Testing
scripts/prepare-src.sh; the full patchseries applies cleanly and the generated
extension.tscontains the newisValidClusterIdvalidator and the guard inloadAndDisplayNotebook.tsc --noEmit; no errors on thechange (only environmental module-resolution messages from the uninstalled
toolchain).
ml-cluster-123) are accepted and valuescontaining shell metacharacters, spaces, or newlines are rejected.
Screenshots/Videos
N/A
Additional Notes
Minimal, low-risk input-validation change that mirrors the existing
isValidRegionpattern already in the extension.Backporting
This change applies to the other active version branches. Separate PRs will be
raised for
main,1.2, and1.0.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.