Azure / Azure/Azure-Governance-Visualizer

Prequisites.ps1 fails incorrect detect a repository as public when the GitHub organization is configured for SSO

Open
#54 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PowerShell
Stars
184
Forks
72
PR merge metrics
No merged PRs in 30d

Description

**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

```powershell
$repoUri = "https://github.com/$($env:GITHUB_REPOSITORY)"
```

to

```powershell
$repoUri = "https://api.github.com/repos/$($env:GITHUB_REPOSITORY)"
```
corrects the issue.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.