AzGovViz version
6.6.1
CodeRunPlatform
GitHub Action
Describe the bug
The check for public repositories incorrectly detects our repository as public because our organization is configured for SSO and redirects unauthenticated web requests for a repository in our org to the SSO provider instead of returning a 404 error.
Testing if repository 'https://github.com/*****/Azure-Governance-Visualizer' is accessible from the public
Test returned statusCode: '200' - 'https://github.com/*****/Azure-Governance-Visualizer' is accessible from the public!
Assuming and insisting that you do not want to publish your tenant insights to the public - throw
Exception: /home/runner/work/Azure-Governance-Visualizer/Azure-Governance-Visualizer/pwsh/prerequisites.ps1:39
Line |
39 | throw
| ~~~~~
| ScriptHalted
Error: Error: The process '/usr/bin/pwsh' failed with exit code 1
Additional context
With SSO configured for our organization which breaks the check as configured. I found that changing from calling the web site to calling the REST api fixes the issue.
Change line 23 of pwsh/prerequisites.ps1 from
$repoUri = "https://github.com/$($env:GITHUB_REPOSITORY)"
to
$repoUri = "https://api.github.com/repos/$($env:GITHUB_REPOSITORY)"
corrects the issue.