-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat: follow indirect repository URLs #629
Conversation
Signed-off-by: Ben Selwyn-Smith <[email protected]>
d5d50e7
to
3df10da
Compare
I'm unsure if redirection should be handled in the It seems like this redirection handling should only happen once at the beginning of the analysis of a target. It may be during/right after repo finding instead (which I guess may be part of your intention, confirmed by the fact that you added some redirection setting fields into the Repo Finder section in the Otherwise, I don't see why we should modify the |
@benmss I think this PR can be considered as a new feature. We should update the documentation for the repo finder too. |
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
tests/slsa_analyzer/test_git_url.py
Outdated
("", ""), | ||
("scm:git:[email protected]:FasterXML/jackson-databind.git", "[email protected]:FasterXML/jackson-databind.git"), | ||
("https://github.com/commons-io/commons-io", "https://github.com/commons-io/commons-io"), | ||
("askjdlkajsdlkajsdlkjasldjlk:scm", ""), | ||
], | ||
) | ||
def test_clean_url(url: str, expected: str) -> None: | ||
"""Test the functionality of the clean_url function.""" | ||
result = git_url.clean_url(url) | ||
if result is None: | ||
assert expected == "" | ||
else: | ||
assert expected == result.geturl() |
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.
Nit: Hmm, why not have the expected results as None
instead of empty strings so that we can avoid this branching in the test?
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.
Hi. I just had one minor comment for the test. Otherwise, it looks good.
Thanks for the PR.
Signed-off-by: Ben Selwyn-Smith <[email protected]>
Signed-off-by: Ben Selwyn-Smith <[email protected]>
This PR adds support for SCM metadata URLs found by the Repo Finder that are indirect links to actual repositories. Signed-off-by: Ben Selwyn-Smith <[email protected]>
This PR allows the Repo Finder to return GitHub, etc. URLs that are initially presented as a redirect URL. URLs that can be considered valid redirects are included within a list in the defaults configuration file. URLs found from redirects are validated as per any other URL. A flag is used to prevent infinite redirect loop shenanigans.
Closes #626