Skip to content
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

fix(cli): git URL parsing for subgroups #7611

Merged
merged 4 commits into from Apr 25, 2023

Conversation

brandonspark
Copy link
Contributor

@brandonspark brandonspark commented Apr 24, 2023

y'all would have thought this was Lagrange's theorem, because today we're talking about subgroups

What:

This PR fixes URL parsing for URLs which have a "subgroup" structure, which is to say that it is in a "nested grouping structure". Previously, we would butcher these URLs, and produce things like https://https//gitlab.com/r2cexamples2/group2/group3/chess-game from https://gitlab.com/r2cexamples2/group2/group3/chess-game.git.

Why:

We want clickable URLs.

How:

Made it such that when parsing the "owner" of a project, it can include slashes (so it might be multiple such entries in the URL, instead of just one).

Test plan:

Added a test suite for git URL parsing, which we can use for the future.

I don't actually know what the end target URL is supposed to look like, but I presume it should look similar to what the working example is (which produces https://gitlab.com/r2cexamples2/webgoat from https://gitlab.com/r2cexamples2/webgoat.git)

Closes PA-2669

PR checklist:

  • Purpose of the code is evident to future readers
  • Tests included or PR comment includes a reproducible test plan
  • Documentation is up-to-date
  • A changelog entry was added to changelog.d for any user-facing change
  • Change has no security implications (otherwise, ping security team)

If you're unsure about any of this, please see:

@brandonspark brandonspark changed the title fix: git URL parsing for subgroups fix(cli): git URL parsing for subgroups Apr 24, 2023
@linear
Copy link

linear bot commented Apr 24, 2023

PA-2669 Hyperlinks don't work when the GitLab repo has two or more groups

Hyperlinks are not working when the GitLab repo has subgroups, example:

https://gitlab.com/r2cexamples2/group2/group3/chess-game.git

Steps to reproduce the issue:

  1. git clone https://gitlab.com/r2cexamples2/group2/group3/chess-game.git

  2. cd chess-game

  3. semgrep ci

  4. Go to Semgrep App and check hyperlinks, the url has not been built correctly.

Note: It doesn't happen for projects with only one group such as: https://gitlab.com/r2cexamples2/webgoat.git

@github-actions
Copy link
Contributor

📸 The pytest shapshots changed in your PR.
Please carefully review these changes and make sure they are intended:

  1. Review the changes at aa93263

  2. Accept the new snapshots with

    git fetch origin && git cherry-pick aa932638ab83329102304ea566577ae36a01cc6b && git push
    

@brandonspark
Copy link
Contributor Author

ignore the snapshot changes, they were from a previous iteration of the PR

@brandonspark brandonspark force-pushed the brandon/fix-subgroup-url-parsing branch from a71b604 to 92beac6 Compare April 25, 2023 15:01
@brandonspark brandonspark merged commit 52d6328 into develop Apr 25, 2023
39 checks passed
@brandonspark brandonspark deleted the brandon/fix-subgroup-url-parsing branch April 25, 2023 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants