-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add additional check to prevent false positive endpoints #93
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #93 +/- ##
=======================================
Coverage 94.51% 94.51%
=======================================
Files 6 6
Lines 875 875
=======================================
Hits 827 827
Misses 48 48
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@hanslovsky Thanks for pursuing a solution! But I would have thought the |
@ctrueden I am not sure that this is a bug and if There is also a similar check to the one I added in endpoint_elements[0].startswith("-") going back to 3c57718 (2018 is 5 years ago btw 😱) There is also a pattern check for the entrypoint candidate:
Maybe we should change this to
or maybe even to
Unfortunately, the maven naming guides are not very helpful for what we can exclude. |
I added |
Bumping this, @ctrueden @hanslovsky. I'm running into this when using jgo with arguments that contain s3:// paths. I liked @hanslovsky original proposal of catching things with a URL shape instead of going protocol by protocol. |
Maybe the best option would be to change this PR to use (.*://.*|[a-zA-Z]:\\.*) and investigate double dash ( @kephale this could be a temporary workaround: I was able to fix the issue that I had by changing the URL shape input from a positional argument of my Java CLI to an option that I could specify like
This, of course, works only if you own the code for the CLI that you would like to run, and can change the CLI without breaking anyone else's programs. |
@hanslovsky aha! I tried the generalized regex, but only now realize what you were saying with the |
@@ -271,7 +271,7 @@ def run_and_combine_outputs(command, *args): | |||
|
|||
def find_endpoint(argv, shortcuts={}): | |||
# endpoint is first positional argument | |||
pattern = re.compile("(.*https?://.*|[a-zA-Z]:\\.*)") | |||
pattern = re.compile("(.*(https?|grpc)://.*|[a-zA-Z]:\\.*)") |
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.
IMO this just kicks the can down the road. Another protocol will hit this problem, and be needed to be added to the regex.
For the case mentioned in #92 , the problem is that the --
isnt being treat with sufficient priority. Everything after the --
should be ignored.
Addresses #92
This works because it specifically addresses my use case described in #92 (some string of the form
A:/B:C
in the arguments). I am not too happy with the solution because it opens the door to just adding more and more special case checks. Maybe a regular expression check would be better inEndpoint.is_endpoint
, e.g. something along the lines ofUnfortunately, maven is not very specific with their naming conventions