Conversation
Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com> * fix: mask secrets in the exact form url.format() embeds them in git URLs The authenticated repository URL is built with the legacy url.format(), which encodes the auth field like encodeURIComponent() except that ":" separators are kept as is. A GIT_CREDENTIALS value such as "user:abc@def-secret" therefore appears as "user:abc%40def-secret" in a failing git command, a form matched by neither the raw value, encodeURI(), nor encodeURIComponent() candidates, and leaked unmasked. Add the colon-preserving encoded form to the redaction candidates, assert the unit tests against URLs built the same way get-git-auth-url.js builds them, and add an integration test reproducing the leak end-to-end with a git remote on a closed loopback port. --------- Co-authored-by: Matt Travi <programmer@travi.org>
Co-authored-by: Semantic Release Bot <32174276+semantic-release-bot@users.noreply.github.com>
|
🎉 This PR is included in version 1.0.0-beta.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
This pull request introduces several important security and feature improvements, primarily focused on preventing argument injection vulnerabilities in git operations, enhancing sensitive information masking, and expanding logger functionality. It also adds comprehensive tests to ensure these changes are robust.
Security and Input Validation Improvements:
gitcommands that accept arepositoryUrlnow explicitly separate options from positional arguments by inserting--, preventing malicious URLs from being interpreted as git command-line options (e.g.,--upload-packor--receive-pack). (lib/git.js) [1] [2] [3] [4] [5] [6] [7] [8]verifyfunction now rejects anyrepositoryUrlthat starts with a dash (-), which could otherwise be interpreted as a command-line option by git, and returns a newEINVALIDREPOURLerror. (lib/verify.js,lib/definitions/errors.js) [1] [2]Sensitive Data Masking Enhancements:
hide-sensitivelogic now masks secrets in all encoded forms, including those embedded in git URLs (such as those generated byurl.format()), and covers more edge cases with reserved characters. (lib/hide-sensitive.js,test/hide-sensitive.test.js) [1] [2] [3]Logger and Test Suite Improvements:
start,skip, andcomplete, and tests were added to verify their outputs. (lib/get-logger.js,test/get-logger.test.js,README.md) [1] [2] [3]test/git.test.js,test/integration.test.js,test/verify.test.js) [1] [2] [3]These changes significantly harden the codebase against a class of command injection attacks, improve log hygiene, and expand logging features for better CI/CD observability.