In short
GitHub Advanced Security configuration export: the file GitHub Advanced Security writes of its own settings, which a configuration review reads setting by setting without connecting to GitHub Advanced Security.
How to export the GitHub Advanced Security configuration, step by step, what the review checks in the file (20 checks run), and what it does not read.
| The file | JSON, one github-security.json for one repository: GitHub’s answers, each as returned, under repository, organization, default_branch, branch_protection, code_scanning_default_setup, private_vulnerability_reporting, actions_workflow_permissions, code_scanning_alerts, secret_scanning_alerts and dependabot_alerts |
|---|---|
| Checks run on it | 20 |
| Highest grade its findings reach | PROVEN |
| Feeds attack paths | No |
| Not read from this export | 4 areas, listed below |
Sources: GitHub Advanced Security documentation (1); GitHub Advanced Security documentation (2); GitHub Advanced Security documentation (3); the vendor table.
How to export it
- Who can pull it
- Admin access to the repository, used through a fine-grained personal access token with read access to four repository permissions (step 1). GitHub returns the repository’s security_and_analysis settings to people with admin permissions for the repository and to owners and security managers of the organization, and it lists secret-scanning alerts for administrators of the repository or of the organization. With less access the script still runs and leaves out what it cannot see. GitHub gives the full details of an organization to organization owners; when the answer does not carry the two-factor value, the script leaves it out.
- Time
- About 10 minutes for the opening run (creating the token, installing gh and jq, deleting the token afterwards); about 1 minute for each further repository.
- The file
- JSON, one github-security.json for one repository: GitHub’s answers, each as returned, under repository, organization, default_branch, branch_protection, code_scanning_default_setup, private_vulnerability_reporting, actions_workflow_permissions, code_scanning_alerts, secret_scanning_alerts and dependabot_alerts
No console export: This guide gives no website export: the settings and the three alert lists come from the GitHub REST API (application programming interface), which the script below calls with GET requests.
From the command line
On github.com: your profile picture → Settings → Developer settings → Personal access tokens → Fine-grained tokens → Generate new token. Under Token name enter a name, for example security-export. Under Expiration select a short expiration: GitHub revokes the token by itself on that date. Under Resource owner select the organization that owns the repository. Under Repository access choose Only select repositories, then select the repository. Under Permissions give read access to four repository permissions: Administration, Code scanning alerts, Dependabot alerts and Secret scanning alerts. Click Generate token and copy the token. If the organization requires approval for fine-grained personal access tokens, the token is marked pending and reads public resources until an organization administrator approves it
The vendor's page, checked 2026-11-11
The vendor's page, checked 2026-11-11export GH_TOKEN=<the token you copied>(in a bash terminal: Terminal on macOS or Linux, WSL or Git Bash on Windows; the GitHub CLI then uses this token ahead of any stored sign-in. gh and jq must be installed: see the Installation section of github.com/cli/cli, and jqlang.org/download for jq)Save github-security-export.sh (the download link with these steps) into a folder and open the terminal in that folder. In the next line, <owner>/<repo> is the part of the repository’s address after github.com/, for example octo-org/payments-api. The script makes up to ten GET requests: the repository (with its security_and_analysis block), the organization, the default branch, the protection of the default branch (asked only when the branch answer says it is protected), the code-scanning default setup, private vulnerability reporting, the default workflow permissions of the Actions token, and the code-scanning, secret-scanning and Dependabot alert lists. It keeps each answer whole in github-security.json, under one name per call, and leaves out an answer GitHub refuses. It sends no state filter, so each list holds the alerts in every state GitHub returns
The vendor's page, checked 2026-11-11
The vendor's page, checked 2026-11-11GH_REPO=<owner>/<repo> bash github-security-export.sh→ github-security.jsonAfter the upload has gone through, delete the token: on github.com, your profile picture → Settings → Developer settings → Personal access tokens → Fine-grained tokens, and to the right of the token click Delete. Then run
The vendor's page, checked 2026-11-11unset GH_TOKENin the terminal
The script the steps run: GitHub security settings and alerts (gh api + jq, read-only).
What the file looks like
JSON, one github-security.json for one repository: GitHub’s answers, each as returned, under repository, organization, default_branch, branch_protection, code_scanning_default_setup, private_vulnerability_reporting, actions_workflow_permissions, code_scanning_alerts, secret_scanning_alerts and dependabot_alerts. It varies with the number of alerts in the repository. The upload takes files up to 10 MB.
What it holds: GitHub’s answers, each kept whole: the repository with its security_and_analysis settings, the organization’s two-factor authentication (2FA) requirement, the default branch and its protection, the code-scanning default setup, private vulnerability reporting, the default permissions of the Actions GITHUB_TOKEN, and the code-scanning, secret-scanning and Dependabot alerts in every state.
A sample of the file, on a made-up system: github-security-export.json.
Leaked secret values are dropped from the file; the alerts stay. An answer your token cannot read is left out, never replaced by an empty one, so each finding points to the line of the setting in GitHub’s own answer.
Afterwards
Delete the token: profile picture → Settings → Developer settings → Personal access tokens → Fine-grained tokens, then click Delete to the right of the token. Run unset GH_TOKEN or close the terminal window. Delete github-security.json once it is uploaded, and github-security-export.sh if you no longer need it.
If the export goes wrong
| What you see | The fix |
|---|---|
| The terminal says "gh: command not found" or "jq: command not found". | Install the GitHub CLI (the Installation section of github.com/cli/cli) and jq (jqlang.org/download), open a new terminal, and run the export GH_TOKEN line and the script line again. |
| In github-security.json the code_scanning_alerts, dependabot_alerts or secret_scanning_alerts list is missing or empty, although the repository has such alerts on github.com. | The token cannot read them. Check step 1: the token must include this repository and have read access to Code scanning alerts, Dependabot alerts and Secret scanning alerts. If your organization requires approval, the token reads public resources until it is approved. The list of secret-scanning alerts also needs an administrator of the repository or the organization, and GitHub answers 404 for it when the repository is public or the feature is disabled. |
| The upload says "This GitHub export holds no repository answer". | The file did not come from the script (for example a CSV or a single API answer). Upload the github-security.json the script line writes. |
What we read from it
- Checks run
- 20
- Formats read
- GitHub Advanced Security combined JSON · GitHub REST API answers (repository settings and alerts)
- Releases
- 2023-Q1 to 2026-Q2
Checks run is the number of checks that reached a result on this system's own export in our tests, as the vendor table shows it.
The areas checked
- Repository settings: secret scanning, secret-scanning push protection, Dependabot security updates (from security_and_analysis), code-scanning default setup, private vulnerability reporting
- The org two-factor rule and the Actions token default
- Default branch: whether it is protected, and its protection’s required reviews and enforcement for admins
- Code-scanning, secret-scanning and Dependabot alerts in every state GitHub returns (open, dismissed, fixed or resolved): the script sends no state filter
The grade its findings reach
Proven A finding from this file can reach PROVEN: the stored file is read a second time by a separate reader, and the finding is found at the setting it names.
Its findings stay in the review and its reports. GitHub Advanced Security does not feed attack paths.
Attack paths, the one change and dollar figures are MODELED. How each grade is worked out is on the method page.
What we do not read from this export
- Other repositories: one repository per file
- Enterprise and organisation-level push-protection settings
- Leaked secret values: they are dropped from the file
- Whether Dependabot alerts are on: GitHub answers that call with a status and no body, so the file holds nothing for it
Limits of the reader
- Findings name the setting they come from, not its line number.
- If your export leaves a section out, the review does not flag it as partial.
- Findings stay in the review. They do not feed attack paths.
- The checks of this system are not counted: a check counts once a test shows it firing on a file in the layout the vendor documents.
A finding never comes from what the file does not hold: live traffic, running hosts and logs are not in a configuration export.
Questions
Who can export the GitHub Advanced Security configuration?
Admin access to the repository, used through a fine-grained personal access token with read access to four repository permissions (step 1). GitHub returns the repository’s security_and_analysis settings to people with admin permissions for the repository and to owners and security managers of the organization, and it lists secret-scanning alerts for administrators of the repository or of the organization. With less access the script still runs and leaves out what it cannot see. GitHub gives the full details of an organization to organization owners; when the answer does not carry the two-factor value, the script leaves it out.
Does the export change anything?
The calls are GET requests made with a token that has read access, so they send no change to the repository or the organization. The steps create one fine-grained personal access token on your GitHub account (plus a pending request where the organization requires approval) and install gh and jq if missing.
Does the file hold passwords or keys?
The leaked values are not in the file: GitHub returns each one in a field named secret and the script deletes that field. Each alert keeps the kind of secret, its state, the file path, line and commit where it was found, links, and the login names and comments of people who handled it. While the script runs, the full answer from GitHub, with the values, sits in a temporary folder that the script deletes when it ends. With redaction on (the default), the passwords, keys and tokens the review recognises are replaced with a placeholder before anything is stored; the check before upload shows how many it found.