Skip to content

SCM Token Permissions Matrix ​

The definitive reference for token permissions. Get PR Decoration and Commit Scanning working on the first try.

IMPORTANT

Role Alert: Users with "Guest" or "Reporter" roles on GitLab will fail webhook creation. Minimum required role is Developer.


GitHub ​

Classic Personal Access Tokens ​

FeatureRequired ScopeWhy?
Repo LinkingrepoRead and clone repositories
Webhooksadmin:repo_hookCreate/manage webhooks for PR triggers
PR Commentswrite:discussionPost scan results as PR comments

Setup Steps ​

  1. GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic)
  2. Generate new token (classic)
  3. Required scopes:
    • ✅ repo (Full control of private repositories)
    • ✅ admin:repo_hook (Full control of repository hooks)
    • ✅ write:discussion (Read and write team discussions)

Fine-Grained Personal Access Tokens ⭐ ​

FeatureRequired PermissionLevelWhy?
Repo AccessContentsReadAccess code and files
PR ManagementPull requestsRead & WriteCreate PR comments and decorations
WebhooksWebhooksRead & WriteAutomatically create scan triggers
Status ChecksCommit statusesRead & WriteUpdate quality gate status on PRs

Setup Steps ​

  1. GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens
  2. Generate new token
  3. Repository access: Selected repositories (choose your target repos)
  4. Required permissions:
    • ✅ Contents: Read
    • ✅ Pull requests: Read and write
    • ✅ Webhooks: Read and write
    • ✅ Commit statuses: Read and write

GitLab ​

FeatureRequired ScopeWhy?
Repo Linkingread_repositoryClone and read repository contents
API AccessapiFull API access for webhooks and comments
Repo Managementwrite_repositoryUpdate repository settings (webhooks)

Setup Steps ​

  1. GitLab → User Settings → Access Tokens
  2. Create personal access token
  3. Required scopes:
    • ✅ api (Complete read/write access to the API)
    • ✅ read_repository (Read access to repositories)
    • ✅ write_repository (Write access to repositories)

WARNING

Role Requirement: Your GitLab account must have Developer role or higher on target repositories. "Guest" and "Reporter" roles lack webhook creation permissions.


Bitbucket Cloud ​

FeatureRequired PermissionWhy?
WebhookswebhookCreate repository webhooks for automation
Repository Accessrepository:writeRead repository data and manage settings
PR ManagementpullrequestComment on and update pull requests

Setup Steps ​

  1. Bitbucket → Personal Settings → App passwords
  2. Create app password
  3. Required permissions:
    • ✅ webhook (Manage repository webhooks)
    • ✅ repository:write (Write access to repositories)
    • ✅ pullrequest (Read and write access to pull requests)

Azure DevOps ​

FeatureRequired ScopeWhy?
Code AccessCode (Read & Write)Access repositories and manage webhooks
Project InfoProject & Team (Read)Read project metadata and team information

Setup Steps ​

  1. Azure DevOps → User Settings → Personal access tokens
  2. New Token
  3. Required scopes:
    • ✅ Code → Read & write
    • ✅ Project and Team → Read

WARNING

Azure DevOps Limitation: Commit-level status updates are not supported. Only Pull Request status checks are available.


Manual Webhook Configuration ​

If your token lacks webhook permissions, configure webhooks manually:

Webhook Payload URL ​

{{base_url}}/api/views/repositories/pullrequests/webhooks

Replace with your BrowserStack Code Quality server URL:

  • Example: https://your-server.com/api/views/repositories/pullrequests/webhooks

Required Events ​

SCM ProviderEvents to Enable
GitHubPull requests, Push
GitLabMerge request events, Push events
BitbucketPull request created/updated, Repository push
Azure DevOpsPull request created/updated, Git push

Common Webhook Errors ​

Error CodeCauseSolution
401 UnauthorizedInvalid or expired tokenRegenerate token with correct scopes
403 ForbiddenInsufficient permissionsVerify role (Developer+) and token scopes
422 Unprocessable EntityInvalid repository URL or network issueCheck repository accessibility and network connectivity
404 Not FoundRepository not accessibleConfirm repository exists and token has read access

Best Practices ​

Security ​

  • Minimal Scopes: Grant only required permissions
  • Token Rotation: Regenerate annually or when team members leave
  • Environment Variables: Never hardcode tokens in repositories
  • Network Security: Use HTTPS-only connections

️ Limitations ​

  • File Limit: Scans limited to 100 files per PR/commit
  • Commit Limit: Maximum 300 commits per webhook payload
  • Network Access: BrowserStack Code Quality must reach your SCM provider

Troubleshooting ​

  1. Connection Test: Use VCA connection test to verify permissions
  2. Webhook Logs: Check SCM provider's webhook delivery logs
  3. Role Verification: Confirm Developer+ roles on GitLab/Bitbucket
  4. Token Expiry: Check token expiration dates regularly

Next Steps ​

After configuring tokens:

  1. Set up Version Control Account – Connect your SCM with proper tokens
  2. Enable SCM Workflows – Activate automatic commit and PR analysis
  3. Configure Quality Gates – Set merge approval standards

TIP

Pro Tip: Test with a single repository first. Once PR decoration works correctly, scale to your full repository portfolio.