| 1 | /** |
| 2 | * Scopes: what an access token may do on its owner's behalf. Mirrors |
| 3 | * `crates/contracts/src/scopes.rs`, which is the source of truth; a Rust |
| 4 | * test keeps the tables here the same. |
| 5 | * |
| 6 | * A token reaches whatever its owner can reach (a workspace's token, that |
| 7 | * workspace); what a request may do is the intersection of the owner's |
| 8 | * role and the token's scopes. |
| 9 | */ |
| 10 | |
| 11 | export type ScopeResource = |
| 12 | | "repo" |
| 13 | | "code" |
| 14 | | "security" |
| 15 | | "packages" |
| 16 | | "issues" |
| 17 | | "pull_requests" |
| 18 | | "agents" |
| 19 | | "workflows" |
| 20 | | "memory" |
| 21 | | "account" |
| 22 | | "notifications" |
| 23 | | "workspace" |
| 24 | | "billing" |
| 25 | | "access" |
| 26 | | "webhooks" |
| 27 | | "secrets" |
| 28 | | "runners"; |
| 29 | |
| 30 | export type ScopeLevel = "read" | "write" | "run" | "delete" | "admin"; |
| 31 | |
| 32 | /** Every scope, grouped by resource, least first. */ |
| 33 | export const SCOPES = [ |
| 34 | { scope: "repo:read", description: "See repositories, their settings, labels, timelines and security alerts, and search" }, |
| 35 | { scope: "repo:write", description: "Create repositories, rename branches and change how pull requests merge" }, |
| 36 | { scope: "repo:admin", description: "Rename, archive, transfer, delete or change who can see a repository, and dismiss security alerts" }, |
| 37 | { scope: "code:read", description: "Clone and fetch private repositories with git" }, |
| 38 | { scope: "code:write", description: "Push commits with git" }, |
| 39 | { scope: "security:read", description: "See secret scanning, code scanning and vulnerability alerts, custom patterns, the dependency graph and SBOM, and security settings" }, |
| 40 | { scope: "security:write", description: "Dismiss and reopen alerts, bypass push protection, review bypass requests, manage custom patterns, upload SARIF and change security settings" }, |
| 41 | { scope: "packages:read", description: "Pull container images and install private packages" }, |
| 42 | { scope: "packages:write", description: "Push container images and publish packages" }, |
| 43 | { scope: "packages:delete", description: "Delete packages and their versions" }, |
| 44 | { scope: "issues:read", description: "Read issues, comments and plans" }, |
| 45 | { scope: "issues:write", description: "Open, edit, close and comment on issues" }, |
| 46 | { scope: "pull_requests:read", description: "Read pull requests, their changes, sessions and merge queues" }, |
| 47 | { scope: "pull_requests:write", description: "Open, review, close and merge pull requests" }, |
| 48 | { scope: "agents:run", description: "Put g1t agents to work and message them, which uses the workspace's money" }, |
| 49 | { scope: "workflows:read", description: "Read workflows, runs and logs" }, |
| 50 | { scope: "workflows:write", description: "Run, cancel, rerun and turn workflows on or off" }, |
| 51 | { scope: "memory:read", description: "Recall memory and search the workspace's context" }, |
| 52 | { scope: "memory:write", description: "Save memory for the next agent" }, |
| 53 | { scope: "account:read", description: "Read your email addresses, invites, invitations and pinned projects" }, |
| 54 | { scope: "account:write", description: "Change your email addresses, make invites, answer invitations and pin projects" }, |
| 55 | { scope: "notifications:read", description: "See your inbox, its threads, and what you subscribe to and watch" }, |
| 56 | { scope: "notifications:write", description: "Mark notifications read, done, saved or snoozed, subscribe to threads and watch repositories" }, |
| 57 | { scope: "workspace:read", description: "Read workspace invites, integrations, model routes and teams" }, |
| 58 | { scope: "workspace:admin", description: "Create and delete workspaces, invite members, connect integrations, and create, change and delete teams" }, |
| 59 | { scope: "billing:read", description: "See a workspace's usage, budget, AI credit and invoices" }, |
| 60 | { scope: "billing:write", description: "Change a workspace's budget and buy AI credit" }, |
| 61 | { scope: "access:read", description: "See who has access to repositories" }, |
| 62 | { scope: "access:admin", description: "Give and take away access to repositories, a team's included" }, |
| 63 | { scope: "webhooks:read", description: "See webhooks and their deliveries" }, |
| 64 | { scope: "webhooks:admin", description: "Create, change and delete webhooks" }, |
| 65 | { scope: "secrets:read", description: "List secrets (never their values) and read variables" }, |
| 66 | { scope: "secrets:admin", description: "Set and delete secrets and variables" }, |
| 67 | { scope: "runners:read", description: "See self-hosted runners, their groups and where agents run" }, |
| 68 | { scope: "runners:admin", description: "Register and remove self-hosted runners, change their groups and settings" }, |
| 69 | ] as const; |
| 70 | |
| 71 | export type Scope = (typeof SCOPES)[number]["scope"]; |
| 72 | |
| 73 | /** Resources in the order settings show them, with their names for people. */ |
| 74 | export const SCOPE_RESOURCES: { resource: ScopeResource; label: string }[] = [ |
| 75 | { resource: "repo", label: "Repositories" }, |
| 76 | { resource: "code", label: "Code" }, |
| 77 | { resource: "security", label: "Security" }, |
| 78 | { resource: "packages", label: "Packages" }, |
| 79 | { resource: "issues", label: "Issues" }, |
| 80 | { resource: "pull_requests", label: "Pull requests" }, |
| 81 | { resource: "agents", label: "g1t agents" }, |
| 82 | { resource: "workflows", label: "Workflows" }, |
| 83 | { resource: "memory", label: "Memory and context" }, |
| 84 | { resource: "account", label: "Your account" }, |
| 85 | { resource: "notifications", label: "Notifications" }, |
| 86 | { resource: "workspace", label: "Workspaces" }, |
| 87 | { resource: "billing", label: "Billing" }, |
| 88 | { resource: "access", label: "Who has access" }, |
| 89 | { resource: "webhooks", label: "Webhooks" }, |
| 90 | { resource: "secrets", label: "Secrets and variables" }, |
| 91 | { resource: "runners", label: "Self-hosted runners" }, |
| 92 | ]; |
| 93 | |
| 94 | const LEVEL_ORDER: Record<ScopeLevel, number> = { read: 0, write: 1, run: 2, delete: 3, admin: 4 }; |
| 95 | |
| 96 | export function scopeResource(scope: Scope): ScopeResource { |
| 97 | return scope.split(":")[0] as ScopeResource; |
| 98 | } |
| 99 | |
| 100 | export function scopeLevel(scope: Scope): ScopeLevel { |
| 101 | return scope.split(":")[1] as ScopeLevel; |
| 102 | } |
| 103 | |
| 104 | export function isScope(text: string): text is Scope { |
| 105 | return SCOPES.some((row) => row.scope === text); |
| 106 | } |
| 107 | |
| 108 | /** Changes that are hard to undo, or decide who can reach what. */ |
| 109 | export function isDangerous(scope: Scope): boolean { |
| 110 | const level = scopeLevel(scope); |
| 111 | return level === "admin" || level === "delete"; |
| 112 | } |
| 113 | |
| 114 | export function describeScope(scope: Scope): string { |
| 115 | return SCOPES.find((row) => row.scope === scope)?.description ?? scope; |
| 116 | } |
| 117 | |
| 118 | /** Whether holding `held` gives `needed`: the same resource, at its level or lower. */ |
| 119 | export function scopeIncludes(held: Scope, needed: Scope): boolean { |
| 120 | return ( |
| 121 | scopeResource(held) === scopeResource(needed) && |
| 122 | LEVEL_ORDER[scopeLevel(held)] >= LEVEL_ORDER[scopeLevel(needed)] |
| 123 | ); |
| 124 | } |
| 125 | |
| 126 | /** The levels a resource has, least first. */ |
| 127 | export function levelsOf(resource: ScopeResource): ScopeLevel[] { |
| 128 | return SCOPES.filter((row) => scopeResource(row.scope) === resource).map((row) => scopeLevel(row.scope)); |
| 129 | } |
| 130 | |
| 131 | /** Scopes from text separated by spaces or commas, in table order; unknown ones are left out. */ |
| 132 | export function parseScopes(text: string): Scope[] { |
| 133 | const given = new Set(text.split(/[\s,]+/).map((part) => part.trim().toLowerCase())); |
| 134 | return SCOPES.map((row) => row.scope).filter((scope) => given.has(scope)); |
| 135 | } |
| 136 | |
| 137 | /** What a token stores for full access. */ |
| 138 | export const FULL_ACCESS = "*"; |
| 139 | |
| 140 | export type PresetId = "read_only" | "agent" | "ci" | "full"; |
| 141 | |
| 142 | /** Starting points for choosing scopes. `*` is full access. */ |
| 143 | export const PRESET_SCOPES = { |
| 144 | read_only: [ |
| 145 | "repo:read", "code:read", "security:read", "packages:read", "issues:read", "pull_requests:read", "workflows:read", "memory:read", "account:read", "notifications:read", "workspace:read", "billing:read", "access:read", "webhooks:read", "secrets:read", "runners:read", |
| 146 | ] as const, |
| 147 | agent: [ |
| 148 | "repo:read", "code:read", "code:write", "security:read", "packages:read", "issues:read", "issues:write", "pull_requests:read", "pull_requests:write", "agents:run", "workflows:read", "memory:read", "memory:write", "account:read", "notifications:read", "notifications:write", "workspace:read", "billing:read", "access:read", "webhooks:read", "secrets:read", |
| 149 | ] as const, |
| 150 | ci: [ |
| 151 | "repo:read", "code:read", "code:write", "packages:read", "packages:write", "workflows:read", "workflows:write", |
| 152 | ] as const, |
| 153 | full: [ |
| 154 | "*", |
| 155 | ] as const, |
| 156 | }; |
| 157 | |
| 158 | export const PRESETS: { id: PresetId; label: string; description: string }[] = [ |
| 159 | { id: "read_only", label: "Read only", description: "Read everything you can read; change nothing." }, |
| 160 | { id: "agent", label: "Agent", description: "Read everything, work on issues and pull requests, push code and run g1t agents." }, |
| 161 | { id: "ci", label: "CI", description: "Clone and push code, push and pull packages, and run workflows." }, |
| 162 | { id: "full", label: "Full access", description: "Everything you can do, including deleting repositories and changing who has access." }, |
| 163 | ]; |
| 164 | |
| 165 | /** The scopes of a preset, or null for full access. */ |
| 166 | export function presetScopes(id: PresetId): Scope[] | null { |
| 167 | if (id === "full") return null; |
| 168 | return [...PRESET_SCOPES[id]] as Scope[]; |
| 169 | } |
| 170 | |
| 171 | /** What an OAuth client gets when it asks for nothing in particular. */ |
| 172 | export const OAUTH_DEFAULT_SCOPES: Scope[] = [...PRESET_SCOPES.agent]; |
| 173 | |
| 174 | /** The operation each scope gates, by the API's operation names. */ |
| 175 | export const OPERATION_SCOPES = [ |
| 176 | ["list_emails", "account:read"], |
| 177 | ["add_email", "account:write"], |
| 178 | ["remove_email", "account:write"], |
| 179 | ["update_email_settings", "account:write"], |
| 180 | ["list_invites", "account:read"], |
| 181 | ["create_invite", "account:write"], |
| 182 | ["revoke_invite", "account:write"], |
| 183 | ["list_my_repo_invitations", "account:read"], |
| 184 | ["accept_repo_invitation", "account:write"], |
| 185 | ["decline_repo_invitation", "account:write"], |
| 186 | // Your pinned projects: a preference of your account. |
| 187 | ["list_pinned_projects", "account:read"], |
| 188 | ["pin_project", "account:write"], |
| 189 | ["unpin_project", "account:write"], |
| 190 | ["reorder_pinned_projects", "account:write"], |
| 191 | // Your inbox: notifications, subscriptions and watching. |
| 192 | ["list_notifications", "notifications:read"], |
| 193 | ["get_notification_thread", "notifications:read"], |
| 194 | ["get_thread_subscription", "notifications:read"], |
| 195 | ["get_repo_subscription", "notifications:read"], |
| 196 | ["list_watched_repos", "notifications:read"], |
| 197 | ["mark_notifications_read", "notifications:write"], |
| 198 | ["mark_thread_read", "notifications:write"], |
| 199 | ["mark_thread_done", "notifications:write"], |
| 200 | ["save_thread", "notifications:write"], |
| 201 | ["snooze_thread", "notifications:write"], |
| 202 | ["set_thread_subscription", "notifications:write"], |
| 203 | ["delete_thread_subscription", "notifications:write"], |
| 204 | ["set_repo_subscription", "notifications:write"], |
| 205 | ["delete_repo_subscription", "notifications:write"], |
| 206 | ["create_workspace", "workspace:admin"], |
| 207 | ["delete_workspace", "workspace:admin"], |
| 208 | ["update_workspace", "workspace:admin"], |
| 209 | ["list_workspace_invites", "workspace:read"], |
| 210 | ["invite_member", "workspace:admin"], |
| 211 | ["revoke_workspace_invite", "workspace:admin"], |
| 212 | ["list_integrations", "workspace:read"], |
| 213 | ["connect_integration", "workspace:admin"], |
| 214 | ["disconnect_integration", "workspace:admin"], |
| 215 | ["test_integration", "workspace:admin"], |
| 216 | ["get_model_routes", "workspace:read"], |
| 217 | ["set_model_routes", "workspace:admin"], |
| 218 | ["list_teams", "workspace:read"], |
| 219 | ["get_team", "workspace:read"], |
| 220 | ["list_team_members", "workspace:read"], |
| 221 | ["list_child_teams", "workspace:read"], |
| 222 | ["list_team_repos", "workspace:read"], |
| 223 | ["list_user_teams", "workspace:read"], |
| 224 | ["create_team", "workspace:admin"], |
| 225 | ["update_team", "workspace:admin"], |
| 226 | ["delete_team", "workspace:admin"], |
| 227 | ["set_team_member", "workspace:admin"], |
| 228 | ["remove_team_member", "workspace:admin"], |
| 229 | ["set_team_review_assignment", "workspace:admin"], |
| 230 | // A workspace's billing: usage, budget, AI credit and invoices. |
| 231 | ["get_usage", "billing:read"], |
| 232 | ["get_budget", "billing:read"], |
| 233 | ["get_ai_credit", "billing:read"], |
| 234 | ["list_invoices", "billing:read"], |
| 235 | ["get_billing_details", "billing:read"], |
| 236 | ["set_budget", "billing:write"], |
| 237 | ["buy_ai_credit", "billing:write"], |
| 238 | ["list_repos", "repo:read"], |
| 239 | ["get_repo", "repo:read"], |
| 240 | ["search", "repo:read"], |
| 241 | ["list_events", "repo:read"], |
| 242 | ["list_labels", "repo:read"], |
| 243 | ["list_milestones", "repo:read"], |
| 244 | ["get_milestone", "repo:read"], |
| 245 | ["create_label", "issues:write"], |
| 246 | ["update_label", "issues:write"], |
| 247 | ["delete_label", "issues:write"], |
| 248 | ["add_default_labels", "issues:write"], |
| 249 | ["create_milestone", "issues:write"], |
| 250 | ["update_milestone", "issues:write"], |
| 251 | ["delete_milestone", "issues:write"], |
| 252 | ["get_repo_settings", "repo:read"], |
| 253 | ["list_check_names", "repo:read"], |
| 254 | ["list_deleted_repos", "repo:read"], |
| 255 | ["list_security_alerts", "repo:read"], |
| 256 | ["get_codeowners_errors", "repo:read"], |
| 257 | ["create_repo", "repo:write"], |
| 258 | ["update_repo", "repo:write"], |
| 259 | ["update_repo_settings", "repo:write"], |
| 260 | ["rename_branch", "repo:write"], |
| 261 | ["rename_repo", "repo:admin"], |
| 262 | ["transfer_repo", "repo:admin"], |
| 263 | ["archive_repo", "repo:admin"], |
| 264 | ["unarchive_repo", "repo:admin"], |
| 265 | ["set_repo_visibility", "repo:admin"], |
| 266 | ["delete_repo", "repo:admin"], |
| 267 | ["restore_repo", "repo:admin"], |
| 268 | ["purge_repo", "repo:admin"], |
| 269 | ["dismiss_security_alert", "repo:admin"], |
| 270 | ["reopen_security_alert", "repo:admin"], |
| 271 | // The security suite. |
| 272 | ["list_secret_scanning_alerts", "security:read"], |
| 273 | ["get_secret_scanning_alert", "security:read"], |
| 274 | ["list_secret_scanning_locations", "security:read"], |
| 275 | ["list_bypass_requests", "security:read"], |
| 276 | ["list_custom_patterns", "security:read"], |
| 277 | ["list_code_scanning_alerts", "security:read"], |
| 278 | ["get_code_scanning_alert", "security:read"], |
| 279 | ["list_code_scanning_analyses", "security:read"], |
| 280 | ["get_sarif_upload", "security:read"], |
| 281 | ["list_vulnerability_alerts", "security:read"], |
| 282 | ["get_vulnerability_alert", "security:read"], |
| 283 | ["get_dependency_graph", "security:read"], |
| 284 | ["get_sbom", "security:read"], |
| 285 | ["compare_dependencies", "security:read"], |
| 286 | ["get_security_settings", "security:read"], |
| 287 | ["get_workspace_security_settings", "security:read"], |
| 288 | ["get_security_overview", "security:read"], |
| 289 | ["update_secret_scanning_alert", "security:write"], |
| 290 | ["bypass_push_protection", "security:write"], |
| 291 | ["check_secret_validity", "security:write"], |
| 292 | ["review_bypass_request", "security:write"], |
| 293 | ["create_custom_pattern", "security:write"], |
| 294 | ["update_custom_pattern", "security:write"], |
| 295 | ["delete_custom_pattern", "security:write"], |
| 296 | ["dry_run_custom_pattern", "security:write"], |
| 297 | ["update_code_scanning_alert", "security:write"], |
| 298 | ["upload_sarif", "security:write"], |
| 299 | ["update_vulnerability_alert", "security:write"], |
| 300 | ["fix_security_alert", "security:write"], |
| 301 | ["update_security_settings", "security:write"], |
| 302 | ["update_workspace_security_settings", "security:write"], |
| 303 | ["list_issues", "issues:read"], |
| 304 | ["get_issue", "issues:read"], |
| 305 | ["get_plan", "issues:read"], |
| 306 | ["create_issue", "issues:write"], |
| 307 | ["update_issue", "issues:write"], |
| 308 | ["list_issue_labels", "issues:read"], |
| 309 | ["add_issue_labels", "issues:write"], |
| 310 | ["set_issue_labels", "issues:write"], |
| 311 | ["remove_issue_labels", "issues:write"], |
| 312 | ["close_issue", "issues:write"], |
| 313 | ["reopen_issue", "issues:write"], |
| 314 | ["add_comment", "issues:write"], |
| 315 | ["import_issue", "issues:write"], |
| 316 | ["apply_plan", "issues:write"], |
| 317 | ["list_pull_requests", "pull_requests:read"], |
| 318 | ["get_pull_request", "pull_requests:read"], |
| 319 | ["get_pull_request_changes", "pull_requests:read"], |
| 320 | ["read_session", "pull_requests:read"], |
| 321 | ["get_merge_queue", "pull_requests:read"], |
| 322 | ["create_pull_request", "pull_requests:write"], |
| 323 | ["update_pull_request", "pull_requests:write"], |
| 324 | ["record_session", "pull_requests:write"], |
| 325 | ["mark_pull_request_ready", "pull_requests:write"], |
| 326 | ["close_pull_request", "pull_requests:write"], |
| 327 | ["review_pull_request", "pull_requests:write"], |
| 328 | ["merge_pull_request", "pull_requests:write"], |
| 329 | ["request_reviewers", "pull_requests:write"], |
| 330 | ["remove_requested_reviewers", "pull_requests:write"], |
| 331 | ["assign_issue", "agents:run"], |
| 332 | ["delegate", "agents:run"], |
| 333 | ["plan_work", "agents:run"], |
| 334 | ["message_agent", "agents:run"], |
| 335 | ["answer_message", "agents:run"], |
| 336 | ["take_messages", "agents:run"], |
| 337 | ["list_workflows", "workflows:read"], |
| 338 | ["list_workflow_runs", "workflows:read"], |
| 339 | ["get_workflow_run", "workflows:read"], |
| 340 | ["get_job_logs", "workflows:read"], |
| 341 | ["dispatch_workflow", "workflows:write"], |
| 342 | ["cancel_workflow_run", "workflows:write"], |
| 343 | ["rerun_workflow_run", "workflows:write"], |
| 344 | ["update_workflow", "workflows:write"], |
| 345 | ["recall", "memory:read"], |
| 346 | ["search_context", "memory:read"], |
| 347 | ["get_entity", "memory:read"], |
| 348 | ["get_context", "memory:read"], |
| 349 | ["remember", "memory:write"], |
| 350 | ["list_collaborators", "access:read"], |
| 351 | ["get_collaborator_permission", "access:read"], |
| 352 | ["list_repo_invitations", "access:read"], |
| 353 | ["list_outside_collaborators", "access:read"], |
| 354 | ["add_collaborator", "access:admin"], |
| 355 | ["update_collaborator", "access:admin"], |
| 356 | ["remove_collaborator", "access:admin"], |
| 357 | ["revoke_repo_invitation", "access:admin"], |
| 358 | ["set_base_permission", "access:admin"], |
| 359 | ["set_team_repo", "access:admin"], |
| 360 | ["remove_team_repo", "access:admin"], |
| 361 | ["list_webhooks", "webhooks:read"], |
| 362 | ["list_webhook_deliveries", "webhooks:read"], |
| 363 | ["create_webhook", "webhooks:admin"], |
| 364 | ["update_webhook", "webhooks:admin"], |
| 365 | ["delete_webhook", "webhooks:admin"], |
| 366 | ["ping_webhook", "webhooks:admin"], |
| 367 | ["redeliver_webhook", "webhooks:admin"], |
| 368 | ["list_actions_secrets", "secrets:read"], |
| 369 | ["list_actions_variables", "secrets:read"], |
| 370 | ["set_actions_secret", "secrets:admin"], |
| 371 | ["delete_actions_secret", "secrets:admin"], |
| 372 | ["set_actions_variable", "secrets:admin"], |
| 373 | ["delete_actions_variable", "secrets:admin"], |
| 374 | // Self-hosted runners. |
| 375 | ["list_runners", "runners:read"], |
| 376 | ["list_runner_groups", "runners:read"], |
| 377 | ["get_runner_settings", "runners:read"], |
| 378 | ["create_runner_registration_token", "runners:admin"], |
| 379 | ["remove_runner", "runners:admin"], |
| 380 | ["create_runner_group", "runners:admin"], |
| 381 | ["update_runner_group", "runners:admin"], |
| 382 | ["delete_runner_group", "runners:admin"], |
| 383 | ["update_runner_settings", "runners:admin"], |
| 384 | ] as const; |
| 385 | |
| 386 | /** |
| 387 | * The scopes a token or grant holds, as stored: null for full access, or |
| 388 | * the list. `legacy` marks a token made before scopes, which has full |
| 389 | * access until someone narrows it. |
| 390 | */ |
| 391 | export type TokenScopes = { |
| 392 | scopes: Scope[] | null; |
| 393 | legacy: boolean; |
| 394 | }; |
| 395 | |
| 396 | /** |
| 397 | * How settings group scopes into a checklist: each group's scopes, least |
| 398 | * first. Admin scopes are not here; they are under "Dangerous" on their |
| 399 | * own (see `DANGEROUS_SCOPES`). Every other scope is in exactly one group. |
| 400 | */ |
| 401 | export const SCOPE_GROUPS: { id: string; label: string; scopes: Scope[] }[] = [ |
| 402 | { id: "code", label: "Repositories & code", scopes: ["repo:read", "repo:write", "code:read", "code:write"] }, |
| 403 | { id: "security", label: "Security", scopes: ["security:read", "security:write"] }, |
| 404 | { id: "packages", label: "Packages", scopes: ["packages:read", "packages:write"] }, |
| 405 | { id: "work", label: "Issues & pull requests", scopes: ["issues:read", "issues:write", "pull_requests:read", "pull_requests:write"] }, |
| 406 | { id: "agents", label: "Agents", scopes: ["agents:run"] }, |
| 407 | { id: "workflows", label: "Workflows", scopes: ["workflows:read", "workflows:write"] }, |
| 408 | { id: "memory", label: "Memory & search", scopes: ["memory:read", "memory:write"] }, |
| 409 | { id: "account", label: "Account", scopes: ["account:read", "account:write"] }, |
| 410 | { id: "notifications", label: "Notifications", scopes: ["notifications:read", "notifications:write"] }, |
| 411 | { id: "workspace", label: "Workspace", scopes: ["workspace:read", "access:read", "webhooks:read", "secrets:read"] }, |
| 412 | { id: "billing", label: "Billing", scopes: ["billing:read", "billing:write"] }, |
| 413 | { id: "runners", label: "Runners", scopes: ["runners:read"] }, |
| 414 | ]; |
| 415 | |
| 416 | /** The admin and delete scopes, shown under "Dangerous" behind a warning. */ |
| 417 | export const DANGEROUS_SCOPES: Scope[] = SCOPES.map((row) => row.scope).filter(isDangerous); |