Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/sonar-token-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Sonar Token Check

Check failure

Code scanning / Scorecard

Token-Permissions

score is 0: no topLevel permission defined Remediation tip: Visit [https://app.stepsecurity.io/secureworkflow](https://app.stepsecurity.io/secureworkflow//sonar-token-check.yml/?enable=permissions). Tick the 'Restrict permissions for GITHUB_TOKEN' Untick other options NOTE: If you want to resolve multiple issues at once, you can visit [https://app.stepsecurity.io/securerepo](https://app.stepsecurity.io/securerepo) instead. Click Remediation section below for further remediation help
on:
workflow_dispatch:
pull_request:
branches:
- chore/sonar-token-check

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Show token owner (login only)
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
curl -fsS -u "${SONAR_TOKEN}:" https://sonarcloud.io/api/users/current \
| jq -r '.login'

- name: Check org visibility
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
ORG: academysoftwarefoundation
run: |
curl -fsS -u "${SONAR_TOKEN}:" \
"https://sonarcloud.io/api/organizations/search?query=${ORG}" \
| jq -r '.organizations[].key'

- name: Check project access
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
PROJECT_KEY: AcademySoftwareFoundation_OpenImageIO
run: |
curl -fsS -u "${SONAR_TOKEN}:" \
"https://sonarcloud.io/api/projects/search?projects=${PROJECT_KEY}" \
| jq -r '.components[].key'