detect-secrets icon indicating copy to clipboard operation
detect-secrets copied to clipboard

Check netloc in urlparse result if path is empty

Open a-weiss-programmer opened this issue 4 months ago • 1 comments

  • Please check if the PR fulfills these requirements
  • [x] Tests for the changes have been added
  • [ ] Docs have been added / updated
  • [x] All CI checks are green
  • What kind of change does this PR introduce?

This fixes a bug where certain versions of urllib will put the results of a parsed file (e.g. file://testing/custom_filters.py::is_invalid_secret) into the netloc property of urlparse instead of the path property.

  • What is the current behavior?

https://github.com/Yelp/detect-secrets/issues/715

  • What is the new behavior (if this is a feature change)? The custom filter parser will now check netloc if path is not populated

  • Does this PR introduce a breaking change?

Users should have to make no changes, as it prefers path over netloc

  • Other information:

a-weiss-programmer avatar Apr 04 '24 21:04 a-weiss-programmer

@a-weiss-programmer thank you for your contribution! Could you advice me on which version have one or the other behaviour?

lorenzodb1 avatar Apr 29 '24 22:04 lorenzodb1