Redact CodeArtifact tokens from pip install logs#5851
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the CodeArtifact-aware requirements installer to redact credentials from logged pip commands while preserving the actual command used for installation.
Changes:
- Adds URL credential redaction for pip command logging.
- Updates
install_requirementslogging to use the redacted command representation. - Adds regression coverage to ensure CodeArtifact tokens are not logged.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
sagemaker-core/src/sagemaker/core/utils/install_requirements.py |
Adds URL credential redaction and applies it to pip command logging. |
sagemaker-core/tests/unit/test_install_requirements.py |
Adds log-capture coverage for CodeArtifact token redaction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if parts.username is not None: | ||
| username = quote(parts.username, safe="") | ||
| netloc = f"{username}:****@{host}" |
There was a problem hiding this comment.
Updated the redaction helper to redact the full URL userinfo instead of preserving the username. This now covers username-only token auth as well as username:password URLs.\n\nTest:\n\n\�ash\npython -m pytest sagemaker-core/tests/unit/test_install_requirements.py -q\n\n\nResult: 24 passed.
02ac171 to
05fcce5
Compare
|
Updated the redaction helper to redact the full URL userinfo instead of preserving the username. This now covers username-only token auth as well as username:password URLs.\n\nTest:\n\n\\�ash\npython -m pytest sagemaker-core/tests/unit/test_install_requirements.py -q\n\\n\nResult: 24 passed. |
Summary
Test