Skip to content

Commit

Permalink
Don't let viewing team errors stop the audit (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
FelicianoTech authored Feb 8, 2023
1 parent e95460c commit a11a9b0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions warden/cmd/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,16 @@ var (
// if access permissions are to be checked...
if len(policy.Access) > 0 {

teams, _, err := client.Repositories.ListTeams(context.Background(), repo.Owner, repo.Name, nil)
if err != nil {
teams, resp, err := client.Repositories.ListTeams(context.Background(), repo.Owner, repo.Name, nil)
if resp.StatusCode == 404 {

// considering this repo worked for other audits but not this, this likely
// means we don't have admin access in order to check teams
fmt.Fprintf(os.Stderr, "Error: couldn't pull the teams for %s.\nThis is likely a permission issue with the token being used to run Warden. If\nthe user whose token is being used doesn't have admin access\nto the repo, teams can't be pulled.\n\n", repoDef.URL)

// skip the rest
policy.Access = nil
} else if err != nil {
return err
}

Expand Down

0 comments on commit a11a9b0

Please sign in to comment.