Add support for new RepositoryAdvisories API 🎉#2483
Add support for new RepositoryAdvisories API 🎉#2483JLLeitschuh merged 2 commits intoPyGithub:masterfrom
Conversation
9cd7af4 to
5e1afde
Compare
5e1afde to
e7a5d60
Compare
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## master #2483 +/- ##
==========================================
- Coverage 98.57% 98.45% -0.13%
==========================================
Files 118 124 +6
Lines 11981 12407 +426
==========================================
+ Hits 11810 12215 +405
- Misses 171 192 +21
☔ View full report in Codecov by Sentry. |
| vulnerabilities: typing.Optional[ | ||
| typing.Iterable[ | ||
| github.RepositoryAdvisoryVulnerability.AdvisoryVulnerability | ||
| ] | ||
| ] = None, |
There was a problem hiding this comment.
According to the GitHub team I'm chatting with, this should not be optional. At least one must be supplied.
That GitHub's API currently supports passing an empty list, is a bug.
There was a problem hiding this comment.
Turns out this isn't a bug. It's implemented as-designed
48924fb to
f4e1dc8
Compare
|
CI passes. Linting passses. AFAIK, everything has solid unit test coverage. Seeking code reviews! |
rthorpeii
left a comment
There was a problem hiding this comment.
The structure of the API objects and calls looks good to me!
31820e2 to
884f1c4
Compare
| self._requester, headers, data, completed=True | ||
| ) | ||
|
|
||
| def create_repository_advisory( |
There was a problem hiding this comment.
since this is on Repository, this could read:
| def create_repository_advisory( | |
| def create_advisory( |
Or are there other methods that imply this naming convention?
| private_vulnerability_reporting=False, | ||
| ) | ||
|
|
||
| def report_security_vulnerability( |
There was a problem hiding this comment.
I think this should read:
| def report_security_vulnerability( | |
| def report_security_advisory( |
or
| def report_security_vulnerability( | |
| def create_security_advisory( |
There was a problem hiding this comment.
This API is used by reporters, not by maintainers, to report vulnerabilities.
I was trying to figure out a way to differentiate the create which is something only a repository admin can take, from the report which is an action any GitHub user can take.
There was a problem hiding this comment.
right, the link to the docs confused me, I think it is linking to creating an advisory, where it should link to creating a vulnerability
| ), | ||
| } | ||
|
|
||
| def get_repository_advisories( |
There was a problem hiding this comment.
Here, repository could also be removed, but on the other hand, it returns a `RepositoryAdvisory.
There was a problem hiding this comment.
So does the one above. Which naming convention would you like to see used here?
There was a problem hiding this comment.
Unless you have a strong preference, I think we should opt to use the naming convention in the GitHub API docs here.
github/Repository.py
Outdated
| ] = None, | ||
| ) -> github.RepositoryAdvisory.RepositoryAdvisory: | ||
| """ | ||
| :calls: `POST /repos/{owner}/{repo}/security-advisories/reports <https://docs.github.com/en/rest/security-advisories/repository-advisories#create-a-repository-security-advisory>`_ |
There was a problem hiding this comment.
I think the link should point to
https://docs.github.com/en/rest/security-advisories/repository-advisories#privately-report-a-security-vulnerability
| private_vulnerability_reporting=False, | ||
| ) | ||
|
|
||
| def report_security_vulnerability( |
There was a problem hiding this comment.
right, the link to the docs confused me, I think it is linking to creating an advisory, where it should link to creating a vulnerability
|
@JLLeitschuh happy to approve, please rebase and correct the doc links |
|
Will do, just been bogged down in other work |
884f1c4 to
94d10ac
Compare
Related: - https://github.blog/changelog/2023-03-30-repository-security-advisories-rest-api/ - https://docs.github.com/en/rest/security-advisories/repository-advisories Signed-off-by: Jonathan Leitschuh <Jonathan.Leitschuh@gmail.com>
94d10ac to
c34ead0
Compare
Related:
Signed-off-by: Jonathan Leitschuh Jonathan.Leitschuh@gmail.com