Skip to content

GitHub Authentication

DRACO for GitHub supports several authentication types.

Common Setup

Authentication Methods Overview

DRACO offers these authentication methods. For an organization, the GitHub App DRACO creates for you is recommended (see Connect with the GitHub App); a fine-grained token stays the way to read members' two-factor status.

Method Best For Key Benefit
GitHub App DRACO creates Organizations (recommended) Made for you on GitHub, read-only, key only on your DRACO server, never expires
Fine-Grained Personal Access Token Individual users, quick setup Simple, user-scoped access
GitHub App Organizations, automation, CI/CD Organization-scoped, no personal account dependency
OAuth App Token Delegated user authorization User-consented access flows

Note

Which should I choose?

  • Personal scanning or quick setup: Use Fine-Grained PAT
  • Organization-wide scanning or CI/CD pipelines: Use GitHub App (recommended for production)
  • Building apps with user authorization: Use OAuth App

Warning

Classic Personal Access Tokens

GitHub recommends fine-grained tokens: they are limited to one organization, chosen repositories and exact permissions, while classic tokens are less secure. Use a fine-grained token.

Required Permissions

Required permissions depend on the scan scope: user repositories, organization repositories, or both.

Repository Permissions

Required for scanning repository security settings:

Permission Access Level Purpose Checks Enabled
Administration Read Branch protection, security and Actions settings All branch protection checks, secret scanning status, repository_default_workflow_permissions_read_only
Contents Read File existence checks repository_public_has_securitymd_file, repository_has_codeowners_file
Metadata Read Basic repository information All checks (automatically granted)
Dependabot alerts Read Dependency vulnerability scanning repository_dependency_scanning_enabled

Note

Pull requests permission is optional. It's only needed if you want to audit PR-specific settings beyond what branch protection provides.

Organization Permissions

Required for scanning organization-level security settings:

Note

For Fine-Grained PATs: Organization permissions only appear when the Resource Owner is set to an organization (not your personal account).

For GitHub Apps: Organization permissions are configured during app creation and apply to all organizations where the app is installed.

Permission Access Level Purpose Checks Enabled
Administration Read Organization security policies and Actions settings organization_members_mfa_required, organization_repository_creation_limited, organization_default_repository_permission_strict, organization_default_workflow_permissions_read_only, organization_actions_pull_request_approval_disabled
Members Read Member access reviews Organization membership auditing

Account Permissions

None: DRACO needs no account permission.

Permissions and Check Coverage

With the Read-only permissions listed above, DRACO can run:

Check Category Coverage Notes
Branch protection checks (12 checks) ✅ Full Signed commits, status checks, PR reviews, etc.
Repository security checks ✅ Full Secret scanning, Dependabot, SECURITY.md, CODEOWNERS, default workflow permissions
Organization checks (5 checks) ✅ Full MFA, repo creation policies, default permissions, Actions workflow permissions
Compliance frameworks ✅ Full CIS GitHub Benchmark and others
Merge settings (delete_branch_on_merge) ⚠️ MANUAL Requires write permission (see below)

Check that returns MANUAL status with Read-only permissions: - repository_branch_delete_on_merge_enabled

Warning

About Write Permissions

The delete_branch_on_merge setting is only returned by the GitHub API when the token has Administration: Read and write permission.

Granting Write permissions is not recommended under any circumstances: - Token can modify repository settings - Token can change branch protection rules - Violates the principle of least privilege

Recommendation: Accept MANUAL status for this single check rather than granting write access. This limitation applies equally to Fine-Grained PATs and GitHub Apps.

Step-by-Step Permission Assignment

Benefits of Fine-Grained Tokens

Fine-Grained Personal Access Tokens are ideal for: - Individual users scanning their own repositories - Quick setup without app registration overhead - Temporary access with mandatory expiration - Repository-specific access when you only need to scan certain repos

Create a Fine-Grained Token:

Tip

Quick Setup: Use these pre-configured links to create a token with the required permissions already selected:

For organization scanning, change the Resource Owner to the target organization after the page loads. Organization permissions only appear when an organization is selected.

  1. Navigate to GitHub Settings > Developer settings.

  2. Click Personal access tokens > Fine-grained tokens > Generate new token.

  3. Configure basic settings:

  4. Token name: Descriptive name (e.g., "DRACO Security Scanner")
  5. Expiration: 90 days or less (recommended)
  6. Resource owner:
    • Personal account (for user repositories)
    • Organization name (for organization scanning - requires admin approval)
  7. Repository access: "All repositories" (recommended)

  8. Configure Repository permissions:

  9. Administration: Read
  10. Contents: Read
  11. Metadata: Read (auto-selected)
  12. Dependabot alerts: Read

  13. Configure Organization permissions (only appears when Resource owner is an organization):

  14. Administration: Read
  15. Members: Read

  16. Leave Account permissions empty: DRACO needs none.

  17. Click Generate token and copy the token immediately.

Warning

GitHub shows the token only once. Store it securely.

OAuth App Token

Recommended OAuth App Use Cases:

Use OAuth App Tokens when building applications that need delegated user permissions and explicit user authorization.

OAuth Scopes:

  • repo: Full control of repositories
  • read:org: Read organization and team membership
  • admin:org: Required by organization_default_workflow_permissions_read_only and organization_actions_pull_request_approval_disabled to read the organization Actions workflow permissions
  • read:user: Read user profile data

Create an OAuth App:

  1. Navigate to GitHub Settings > Developer settings > OAuth Apps.

  2. Click New OAuth App and complete:

  3. Application name
  4. Homepage URL
  5. Authorization callback URL

  6. Obtain authorization code:

    https://github.com/login/oauth/authorize?client_id={app_id}
    

  7. Exchange authorization code for access token:

    https://github.com/login/oauth/access_token?code={code}&client_id={app_id}&client_secret={secret}
    

GitHub App Credentials

Note

When to Use GitHub Apps

GitHub Apps are ideal for: - Organization-wide scanning without tying access to a personal account - CI/CD pipelines where you need machine identity (not user-based) - Multi-organization setups with centralized app management - Audit compliance where you need to track app-level access separately from users

GitHub Apps use the same permission model as Fine-Grained PATs - both provide full access to all DRACO checks.

GitHub App Permissions:

If a GitHub App is required:

Repository permissions:

Permission Access Level Purpose Checks Enabled
Administration Read Branch protection, security and Actions settings All branch protection checks, repository_secret_scanning_enabled, repository_default_workflow_permissions_read_only
Contents Read File existence checks repository_public_has_securitymd_file, repository_has_codeowners_file
Metadata Read Basic repository information All checks (automatically granted)
Dependabot alerts Read Dependency vulnerability scanning repository_dependency_scanning_enabled

Organization permissions:

Permission Access Level Purpose Checks Enabled
Administration Read Organization security policies and Actions settings organization_members_mfa_required, organization_repository_creation_limited, organization_default_repository_permission_strict, organization_default_workflow_permissions_read_only, organization_actions_pull_request_approval_disabled
Members Read Member access reviews Organization membership auditing

Create a GitHub App:

  1. Navigate to GitHub Settings > Developer settings > GitHub Apps.

  2. Click New GitHub App and complete:

  3. GitHub App name: Descriptive name (e.g., "DRACO Security Scanner")
  4. Homepage URL: Your organization's URL or DRACO documentation
  5. Webhook: Uncheck "Active" (DRACO doesn't need webhooks)

  6. Configure Repository permissions (see table above):

  7. Administration: Read
  8. Contents: Read
  9. Metadata: Read (auto-selected)
  10. Dependabot alerts: Read

  11. Configure Organization permissions (see table above):

  12. Administration: Read
  13. Members: Read

  14. Under Where can this GitHub App be installed?, select:

  15. "Only on this account" for single-organization use
  16. "Any account" if you need to install across multiple organizations

  17. Click Create GitHub App.

  18. On the app settings page:

  19. Record the App ID (displayed at the top)
  20. Click Generate a private key and download the .pem file

  21. Install the GitHub App:

  22. Click Install App in the left sidebar
  23. Select target account/organization
  24. Choose "All repositories" or select specific repositories
  25. Click Install

Warning

Private Key Security

Store the .pem private key securely. Anyone with this key can authenticate as your GitHub App. Never commit it to version control.


DRACO Authentication

For step-by-step setup instructions for DRACO, see the Getting Started Guide.

Using Personal Access Token

  1. In DRACO, open Connectors, click Add connector and pick GitHub: the wizard opens at Link a Provider.

  2. Enter your GitHub Account ID (username or organization name).

  3. Select Personal Access Token as the authentication method.

  4. Enter your Fine-Grained Personal Access Token.

  5. Click Verify to test the connection, then Save.

Using OAuth App Token

  1. Follow the same steps as Personal Access Token.

  2. Select OAuth App Token as the authentication method.

  3. Enter your OAuth App Token.

Choose Create the app on GitHub on the Credentials step: DRACO fills the app in on GitHub (read-only, private to the organization) and keeps its private key on this server. Step by step: Connect with the GitHub App.

Using a GitHub App you already have

  1. Follow the same steps as Personal Access Token.

  2. Select I already have a GitHub App as the authentication method.

  3. Enter your GitHub App ID and paste the private key (.pem file).


Troubleshooting

"Insufficient Permissions" Errors

Symptom: Checks fail or return MANUAL status.

Solutions: 1. Verify token has all required permissions 2. For organization scans, ensure organization approved the Fine-Grained Token 3. For merge settings checks, accept MANUAL status (Write permission not recommended)

"No Organizations Found"

Symptom: DRACO doesn't find organizations even though you're a member.

Cause: Fine-Grained Token's Resource Owner is set to personal account.

Solution: Create a new token with Resource Owner set to the organization and get it approved by an admin.

Organization Checks Return MANUAL

Symptom: Checks like organization_members_mfa_required return MANUAL.

Cause: Token lacks Organization → Administration: Read permission.

Solutions: 1. Edit token and grant Organization → Administration: Read 2. Ensure token's Resource owner is the organization (not personal account) 3. Get organization admin approval

Token Not Showing Organization Permissions

Symptom: Can't find Organization permissions section when creating token.

Cause: Resource owner is set to personal account.

Solution: Change Resource owner dropdown to the organization name. Organization permissions section will appear.

Rate Limiting

Symptom: "API rate limit exceeded" errors.

Solutions: - Schedule the scan for off-peak hours - Limit the token (or GitHub App installation) to the repositories you need scanned

Token Expired or Revoked

Symptom: Authentication fails with valid-looking token.

Solutions: 1. Check token expiration date in GitHub settings 2. Verify token wasn't revoked 3. For Fine-Grained Tokens, check if organization approval was revoked 4. Generate a new token


Additional Resources