python-gitlab icon indicating copy to clipboard operation
python-gitlab copied to clipboard

Vulnerabilities and vulnerability exports API

Open srisaravananwt opened this issue 3 years ago • 6 comments

Description of the problem, including code/CLI snippet

Need modules for https://docs.gitlab.com/ee/api/vulnerabilities.html and https://docs.gitlab.com/ee/api/vulnerability_exports.html

Expected Behavior

Option to use Vulerabilities and vulnerability_export api.

Actual Behavior

No option to use Vulerabilities and vulnerability_export api.

Specifications

  • python-gitlab version:
  • API version you are using (v3/v4):
  • Gitlab server version (or gitlab.com): 15.x

srisaravananwt avatar Oct 16 '22 14:10 srisaravananwt

Hi @srisaravananwt, thanks for the report. I've added the help wanted label here as this is an Ultimate plan feature.

nejch avatar Oct 16 '22 14:10 nejch

@nejch Thanks. Could you please point me to the similar MR for any other features like this? I will try to contribute.

srisaravananwt avatar Oct 16 '22 16:10 srisaravananwt

Awesome! Since vulnerabilities is mostly an instance-level endpoint, (e.g. you will likely do vuln = gl.vulnerabilities.get(vuln_id), I think the closest might be the Topics API, see this commit here: https://github.com/python-gitlab/python-gitlab/pull/1740/commits/91cd74de9a7f1c65c5a9779e1b48cb26904d60d8. This should give you a basic idea.

Now I see it has a lot of custom endpoints for confirm, dismiss, etc. These will be methods on the object itself, not the manager (e.g. vuln.dismiss()). For these, I'd maybe take a look at https://github.com/python-gitlab/python-gitlab/pull/2064.

Also keep in mind I just noticed they are deprecating this REST endpoint in favor of GraphQL. But that will probably take years, so if you need it now it probably makes sense still :)

nejch avatar Oct 16 '22 17:10 nejch

Hey @srisaravananwt , any work on this? I need this as well and can help out on the fork.

Rewdog avatar Jan 19 '23 22:01 Rewdog

@Rewdog I have used GraphQL to export the vulnerability report.

srisaravananwt avatar Jan 20 '23 01:01 srisaravananwt

@Rewdog I have used GraphQL to export the vulnerability report.

I think this is the only way forward, the REST APIs (Vulnerabilities and Vulnerability Findings) are deprecated and have issues (i.e., pagination doesn't currently work).

That said, pagination is also currently broken in the GraphQL securityReportFindings connection. I'm currently working with their tech support to figure it out.

irishismyname avatar Jan 02 '24 22:01 irishismyname