Repository navigation
Import Gitlab projects as DefectDojo products fix Issue #1984 - #2211
Conversation
Param to enable Gitlab project import as product
|
Documented in Documentation PR 86 |
|
Thank you for contributing. Is your setup in such a way that there is a 1-1 mapping between gitlab repositories and defect dojo products? I have a lot of products that have multiple git repositories. For examples a backend repo + front-end repo and sometimes a separate repo with cms plugins etc. So it makes me think that how I could map that onto gitlab, because I like the idea of having some kind of integration there including permissions. Maybe in the future we could add an option to map gitlab groups onto defect dojo products and repositories onto engagements? For now it would be good to have something added as unit test or integration tests. For example, will the UI, metrics etc still work if there are products that have no product type? |
Thanks for your feedback. Now I specify a product type to avoid the ambiguous case where products had no product type. Regarding mapping between Gitlab repositories and Defect Dojo products, I agree that it could be a good thing in the future to manage more complicated cases than the current 1-1 mapping. |
|
Links to #1984 |
bgoareguer
left a comment
There was a problem hiding this comment.
The python-gitlab dependency needs to be added to requirements.txt
|
Python 3.6 or more recent is necessary for the current PR. This is linked with a python-gitlab version issue: in requirements.txt, when I specify an old version of python-gitlab (like 1.15), Snyk tests fail. When I specify the 2.2.0 (or any 2.x) version for python-gitlab, Travis CI build fails, very probably because python-gitlab 2.x need Python 3.6+. |
|
Can you include the python update here in this PR so we can see what Travis thinks? I think travis was doing fine with 3.6 until we added specific sha256 docker image hashes. If you update the Dockerfile(s) likein 2178 we can give it another try and you can check your (this) PR against it. |
add update_product_access to gitlab social auth
|
@valentijnscholten Is there a way to help this PR to be reviewed ? |
I agree, and this is what we do now in pipeline.py, don't we ? |
|
Not that I can see. You are retrieving products 1 by 1 in a for loop. |
|
@valentijnscholten On which line of pipeline.py do you see this issue ? Maybe we don't see the same version, but according to what I see, only lines 84 and 90 call get or get_or_create on Products. Those lines are not executed at each login, but only when you have a new project or you lose an old project. |
|
Oops, didn't realize that query was at the top. One thing though, users can also be authorized on the product type level, so that query should be extended a little to include products for which the user is authorized that way. |
OK, thanks for the suggestion, I think we now include such products |
|
Hello @valentijnscholten, after you closed/reopened the issue, one integration test failed (I don't know why), but know it's OK, all checks have passed. Only 1 review is missing |
|
Hello @madchap, only 1 review is missing for the current PR. If you can help validating this PR, thanks in advance |
|
I think it will help if you describe what the PR does and why this feature is needed, what usecase it is providing/solving. |
Actually, this PR resolves issue #1984 (now closed), here is the original description : It is now possible to use Gitlab for authentication. It would be great to use it for allowing a user to find on DefectDojo a list of products matching his list of Gitlab projects, so that reports imported into DefectDojo can be related to the right product. As a user, when I log with Gitlab, I would like : To find my Gitlab projects as DefectDojo products (products being created automatically) |
|
Please update the PR description. |
I see it already is updated. I removed the template/checklist stuff to make it more clear. And I have asked for reviewers on Slack. Are you on Slack? |
Thanks. I just created an account on Slack |
| Python-jose==3.2.0 | ||
| gitpython>=2.1.13 | ||
| ptvsd==4.3.2 | ||
| ptvsd>=4.3.2 |
There was a problem hiding this comment.
Could you fix a version ? not fixing version will break something in the futur
There was a problem hiding this comment.
dependabot should keep us up to date.
There was a problem hiding this comment.
I agree dependabot is a more reliable system. it test only one upgrade and create the PR
|
I don't have a Gitlab to test this against so I'll defer to @madchap or @damiencarol as they've commented on this already so I'm assuming they are in a better place to eval this than me. |
damiencarol
left a comment
There was a problem hiding this comment.
We will need to fix the requirement ptvsd>=4.3.2 to a fixed version
… (DefectDojo#2211) * Update pipeline.py to fix Issue DefectDojo#1984 * Param to enable Gitlab project import as product * Useless import * create and assign a product type to our product * add python-gitlab requirement * fix python-gitlab version * update to python 3.6 * update to python 3.6 * add update_product_access in social auth pipeline * social auth pipeline: add update_product_access * add comments in pipeline.py * add comment in modify_permissions * Update python-gitlab version to 2.4.0 * Update pipeline.py Add add_test permission * add missing whitespace after , * change comment * Update pipeline.py * Update pipeline.py * Update pipeline.py * Add products with correct product type * Add white space * Modify comment * Fix ptvsd version Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com> Co-authored-by: valentijnscholten <valentijnscholten@gmail.com>
This PR resolves issue #1984 (now closed), here is the original description :
It is now possible to use Gitlab for authentication. It would be great to use it for allowing a user to find on DefectDojo a list of products matching his list of Gitlab projects, so that reports imported into DefectDojo can be related to the right product.
As a user, when I log with Gitlab, I would like :
To find my Gitlab projects as DefectDojo products (products being created automatically)
Have the same visibility on DefectDojo products as on Gitlab projects, i.e.:
If I am authorized to see a Gitlab project, I see the matching DefectDojo product
If I am not authorized anymore to see a Gitlab project, I do not see the matching DefectDojo product