-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
679e926
commit 1fc123e
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...ublic/Repositories/Repositories/Disable-GitHubRepositoryPrivateVulnerabilityReporting.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
filter Disable-GitHubRepositoryPrivateVulnerabilityReporting { | ||
<# | ||
.SYNOPSIS | ||
Disable private vulnerability reporting for a repository | ||
.DESCRIPTION | ||
Disables private vulnerability reporting for a repository. The authenticated user must have admin access | ||
to the repository. For more information, see | ||
"[Privately reporting a security vulnerability](https://docs.github.com/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability)". | ||
.EXAMPLE | ||
Disable-GitHubRepositoryPrivateVulnerabilityReporting -Owner 'PSModule' -Repo 'GitHub' | ||
Disables private vulnerability reporting for the PSModule/GitHub repository. | ||
.NOTES | ||
https://docs.github.com/rest/repos/repos#disable-private-vulnerability-reporting-for-a-repository | ||
#> | ||
[CmdletBinding(SupportsShouldProcess)] | ||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Long links')] | ||
param ( | ||
# The account owner of the repository. The name is not case sensitive. | ||
[Parameter()] | ||
[Alias('org')] | ||
[string] $Owner = (Get-GitHubConfig -Name Owner), | ||
|
||
# The name of the repository without the .git extension. The name is not case sensitive. | ||
[Parameter()] | ||
[string] $Repo = (Get-GitHubConfig -Name Repo) | ||
) | ||
|
||
$inputObject = @{ | ||
APIEndpoint = "/repos/$Owner/$Repo/private-vulnerability-reporting" | ||
Method = 'DELETE' | ||
} | ||
|
||
if ($PSCmdlet.ShouldProcess("Private Vulnerability Reporting for [$Owner/$Repo]", 'Disable')) { | ||
Invoke-GitHubAPI @inputObject | ForEach-Object { | ||
Write-Output $_.Response | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...public/Repositories/Repositories/Enable-GitHubRepositoryPrivateVulnerabilityReporting.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
filter Enable-GitHubRepositoryPrivateVulnerabilityReporting { | ||
<# | ||
.SYNOPSIS | ||
Enable private vulnerability reporting for a repository | ||
.DESCRIPTION | ||
Enables private vulnerability reporting for a repository. The authenticated user must have admin access | ||
to the repository. For more information, see | ||
"[Privately reporting a security vulnerability](https://docs.github.com/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability)." | ||
.EXAMPLE | ||
Enable-GitHubRepositoryPrivateVulnerabilityReporting -Owner 'PSModule' -Repo 'GitHub' | ||
Enables private vulnerability reporting for the PSModule/GitHub repository. | ||
.NOTES | ||
https://docs.github.com/rest/repos/repos#enable-private-vulnerability-reporting-for-a-repository | ||
#> | ||
[CmdletBinding(SupportsShouldProcess)] | ||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Long links')] | ||
param ( | ||
# The account owner of the repository. The name is not case sensitive. | ||
[Parameter()] | ||
[Alias('org')] | ||
[string] $Owner = (Get-GitHubConfig -Name Owner), | ||
|
||
# The name of the repository without the .git extension. The name is not case sensitive. | ||
[Parameter()] | ||
[string] $Repo = (Get-GitHubConfig -Name Repo) | ||
) | ||
|
||
$inputObject = @{ | ||
APIEndpoint = "/repos/$Owner/$Repo/private-vulnerability-reporting" | ||
Method = 'PUT' | ||
} | ||
|
||
if ($PSCmdlet.ShouldProcess("Private Vulnerability Reporting for [$Owner/$Repo]", 'Enable')) { | ||
Invoke-GitHubAPI @inputObject | ForEach-Object { | ||
Write-Output $_.Response | ||
} | ||
} | ||
} |