|
| 1 | +# SQL Queries for GitHub Enterprise Server |
| 2 | + |
| 3 | +:warning: Run these directly against your GitHub Enterprise Server database at your own risk. A safer method to run these is outlined [here](USAGE.md). |
| 4 | + |
| 5 | +## Audit queries |
| 6 | + |
| 7 | +The `audit` folder has queries that are all around auditing credentials, webhooks, apps, etc. |
| 8 | + |
| 9 | +- `admin-tokens.sql` - A report of all tokens with the `site_admin` scope and when they were last used. |
| 10 | +- `authorizations.sql` - A report of all personal access tokens and when they were last used. Same as above, but without the `site_admin` scope limitation. This is a big report. |
| 11 | +- `deploy-keys.sql` - A report of all deploy keys, when it was last used, who set it up and when, how long the key is, and what repository it's tied to. |
| 12 | +- `github-apps.sql` - A report of all GitHub apps, who owns them, the scope it's installed at, if it's public or not, and the URL it's sending data to. |
| 13 | +- `hooks-repos.sql` - A report of all repository webhooks used in the past week, who owns it, and where the webhook goes. This is limited to a week based on the length of time these are kept in the `hookshot_delivery_logs` table. |
| 14 | +- `hooks-users.sql` - Same report as above, but for user-owned webhooks. |
| 15 | +- `oauth-apps.sql` - A report of all OAuth apps, who owns it, where it goes, and when it was last used. |
| 16 | +- `user-emails.sql` - A report of all emails that don't match a list of approved domains you define in the `WHERE` clause. This query should be deprecated by [this issue](https://github.com/github/roadmap/issues/204). |
| 17 | +- `user-ssh-keys.sql` - A report of all user SSH keys, when it was last used, when it was set up, and how long the key is. |
| 18 | + |
| 19 | +## Security queries |
| 20 | + |
| 21 | +The `security` folder has queries that are all around dependency alerts and any other security features. |
| 22 | + |
| 23 | +## Usage queries |
| 24 | + |
| 25 | +The `usage` folder has queries that are all around usage of various features in GitHub Enterprise Server. |
0 commit comments