-
Notifications
You must be signed in to change notification settings - Fork 42
Fix_Incomplete URL substring sanitization #302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
❌ Marketplace Validation Failed Click to view the full reportPre-Build Validation:Click to view details🧩 git_sync
|
|
❌ Integration Tests Failed Click to view the full report🧩 git_sync
❌ Failed Teststests/test_defaults/test_imports.py::test_imports |
|
❌ Marketplace Validation Failed Click to view the full reportPre-Build Validation:Click to view details🧩 git_sync
|
|
❌ Integration Tests Failed Click to view the full report🧩 git_sync
❌ Failed Teststests/test_defaults/test_imports.py::test_imports |
…etplace into GitSync/435105909
|
❌ Integration Tests Failed Click to view the full report🧩 git_sync
❌ Failed Teststests/test_defaults/test_imports.py::test_imports |
0c1304d to
06abfa5
Compare
|
❌ Integration Tests Failed Click to view the full report🧩 git_sync
❌ Failed Teststests/test_defaults/test_imports.py::test_imports |
| netloc = f"x-token-auth:{self.password}@{parsed.hostname}" | ||
| self.repo_url = urlunparse(parsed._replace(netloc=netloc)) | ||
| elif is_bitbucket_host and "x-token-auth" not in self.repo_url: | ||
| # This is now secure AND flexible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the comment
| # This is now secure AND flexible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| integration_version: 43.0 | ||
| item_name: GitSync | ||
| item_type: Integration | ||
| publish_time: '2025-10-29' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the publish time
[Buganizer ID: 435105909] Fix: Resolve credential theft vulnerability in Bitbucket URL check
Description
What problem does this PR solve?
This PR replaces the naive string check with a robust URL parsing and validation process:
The self.repo_url is now parsed at the beginning of the init method using urlparse.
The hostname is safely extracted using parsed_url.hostname or "" to prevent errors on URLs that might not have a host (e.g., relative paths).
A new boolean, is_bitbucket_host, is created. It validates that the hostname is either exactly BITBUCKET_HOST or ends with SUB_BITBUCKET_HOST.
This secure is_bitbucket_host variable is now used in the elif condition, ensuring that the x-token-auth logic only runs for legitimate, validated Bitbucket domains.
The URL reconstruction logic was also updated to correctly use the parsed hostname and parsed_url object.
This fix not only patches the security vulnerability but also correctly handles legitimate Bitbucket subdomains (e.g., my-workspace.bitbucket.org), which a simple == check would have broken.
Checklist:
Please ensure you have completed the following items before submitting your PR.
This helps us review your contribution faster and more efficiently.
General Checks:
Open-Source Specific Checks:
For Google Team Members and Reviewers Only:
Screenshots (If Applicable)
If your changes involve UI or visual elements, please include screenshots or GIFs here.
Ensure any sensitive data is redacted or generalized.
Further Comments / Questions
Any additional comments, questions, or areas where you'd like specific feedback.