Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Copy pysdk v3 notebooks to default branch and remove 7 obviously redu…#4898

Open
lucasjia-aws wants to merge 2 commits into
aws:defaultaws/amazon-sagemaker-examples:defaultfrom
lucasjia-aws:move-from-pysdklucasjia-aws/amazon-sagemaker-examples-lucas:move-from-pysdkCopy head branch name to clipboard
Open

Copy pysdk v3 notebooks to default branch and remove 7 obviously redu…#4898
lucasjia-aws wants to merge 2 commits into
aws:defaultaws/amazon-sagemaker-examples:defaultfrom
lucasjia-aws:move-from-pysdklucasjia-aws/amazon-sagemaker-examples-lucas:move-from-pysdkCopy head branch name to clipboard

Conversation

@lucasjia-aws

@lucasjia-aws lucasjia-aws commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

…ndant and outdated versions

Issue #, if available:

Description of changes:

Testing done:

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

  • I have verified that my PR does not contain any new notebook/s which demonstrate a SageMaker functionality already showcased by another existing notebook in the repository
  • I have read the CONTRIBUTING doc and adhered to the guidelines regarding folder placement, notebook naming convention and example notebook best practices
  • I have updated the necessary documentation, including the README of the appropriate folder as well as the index.rst file
  • I have tested my notebook(s) and ensured it runs end-to-end
  • I have linted my notebook(s) and code using python3 -m black -l 100 {path}/{notebook-name}.ipynb

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

@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@lucasjia-aws

Copy link
Copy Markdown
Collaborator Author

All 13 comments are automated CodeGuru findings on companion .py scripts (mnist.py, aws_batch_resource_management.py, log_helpers.py, preprocessing.py) that were copied verbatim from upstream aws/sagemaker-python-sdk. Not making changes — breakdown below.

False positives — no such attack surface:

  • RAG / embedding access controls (preprocessing.py): it's a HuggingFace tokenizer preprocessing script. No RAG, no vector store.
  • NoSQL injection (mnist.py): MNIST training script, no DynamoDB/MongoDB anywhere.
  • OS command injection (mnist.py): the flagged line is os.environ["WORLD_SIZE"] = str(world_size) — setting an env var, no shell call.
  • Path traversal (mnist.py, x2): model_dir is the SageMaker-managed SM_MODEL_DIR env var, not untrusted input.
  • XSS (aws_batch_resource_management.py, x2): a boto3 helper that logs via json.dumps. No web/HTML output.

Already done in the code — the bot missed it:

  • Missing random seed (mnist.py): torch.manual_seed(args.seed) / torch.cuda.manual_seed are already called in train().
  • Missing eval() mode (mnist.py): test() calls model.eval() on its first line.

Style-only suggestions on upstream code:

  • Cyclomatic complexity / too many return values (log_helpers.py) and torch.inference_mode() vs torch.no_grad() (mnist.py): these files are byte-for-byte copies of the upstream SDK source. Refactoring them here forks them from their source of truth, so leaving as-is.

Bring in migration batches 1-3 (aws#4895, aws#4896, aws#4897) from default.
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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.