Skip to content

GH-100 · Domain 3: Implement secure software development and compliance · 30% of the exam

Task 3.3: Manage API access and integrations

Fine-grained and classic personal access tokens and their policies, rate limits for tokens and GitHub Apps, GitHub Apps against OAuth apps, and approving or blocking apps by policy.

Study it

  • Personal access token policies, rate limits, GitHub Apps and OAuth apps

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the GitHub documentation page that proves it.

Question 1 · choose 1

An enterprise owner sets a maximum lifetime of 90 days for personal access tokens (classic). A developer's nightly job calls the API of an organization in the enterprise with a classic token that was created two years ago without an expiration date. What happens to the job?

  1. AIt keeps working, because the policy applies only to tokens created after it was set
  2. BIts calls are rejected, but the token isn't revoked; it needs a compliant token
  3. CGitHub revokes the token and emails the developer to create a new one
  4. DIt keeps working until the token's SSO authorization is next attempted
Show the answer and why
  • AIt keeps working, because the policy applies only to tokens created after it was set

    Incorrect

    Tokens with non-compliant lifetimes are blocked from the organization, whenever they were created.

  • BIts calls are rejected, but the token isn't revoked; it needs a compliant token

    Correct

    The policy doesn't revoke tokens; it blocks non-compliant ones from the organization when they're used.

  • CGitHub revokes the token and emails the developer to create a new one

    Incorrect

    Setting a lifetime policy doesn't revoke or disable existing tokens.

  • DIt keeps working until the token's SSO authorization is next attempted

    Incorrect

    For classic tokens the policy is enforced when the token is used, as well as at SSO authorization.

Enterprise owners can set maximum lifetimes for fine-grained and classic personal access tokens. Setting the policy doesn't revoke or disable tokens: tokens with non-compliant lifetimes that belong to members are blocked from the organization, and users find out when API calls are rejected. For classic tokens, enforcement happens when the token is used and when SSO credential authorization is attempted.

Question 2 · choose 1

In an organization on GitHub Enterprise Cloud, the service account svc-inventory runs scripts with a personal access token that make about 3,000 REST API requests an hour. A new sync job will make about 9,000 requests an hour across the organization's repositories, and the existing scripts must keep running. Which credential should the sync job use?

  1. AA fine-grained personal access token of svc-inventory
  2. BUser access tokens for svc-inventory from a GitHub App that the organization owns
  3. CInstallation access tokens of a GitHub App installed on the organization
  4. DTokens of an OAuth app approved by the organization, acting for svc-inventory
Show the answer and why
  • AA fine-grained personal access token of svc-inventory

    Incorrect

    Personal access tokens share the account's limit of 5,000 requests an hour.

  • BUser access tokens for svc-inventory from a GitHub App that the organization owns

    Incorrect

    Requests made on the account's behalf, even at a higher limit, use up its budget for personal access tokens.

  • CInstallation access tokens of a GitHub App installed on the organization

    Correct

    An installation on a GitHub Enterprise Cloud organization has its own limit of 15,000 requests an hour.

  • DTokens of an OAuth app approved by the organization, acting for svc-inventory

    Incorrect

    Requests on the account's behalf draw on the same budget that its personal access tokens need.

Requests made with personal access tokens, and by apps on a user's behalf, count toward that user's rate limit of 5,000 requests an hour. Apps owned or approved by a GitHub Enterprise Cloud organization get 15,000 for requests on the user's behalf, but those requests reduce the budget left for the user's personal access tokens. A GitHub App's installation access token on a GitHub Enterprise Cloud organization has its own limit of 15,000 requests an hour.

Question 3 · choose 1

An organization owns four GitHub App registrations that its internal tools use. The platform team, whose members aren't organization owners, must be able to change those apps' settings, such as their webhook URLs and permissions, without receiving any other owner powers. What should an owner do?

  1. AMake the platform team GitHub App managers for those four app registrations
  2. BGive the platform team admin access to the repositories where the apps are installed
  3. CAssign the security manager role to the platform team
  4. DMake the platform team's members billing managers of the organization
Show the answer and why
  • AMake the platform team GitHub App managers for those four app registrations

    Correct

    App managers can manage the settings of app registrations owned by the organization.

  • BGive the platform team admin access to the repositories where the apps are installed

    Incorrect

    By default only organization owners can manage the settings of the organization's GitHub Apps.

  • CAssign the security manager role to the platform team

    Incorrect

    Security managers view security alerts and manage security settings, not app registrations.

  • DMake the platform team's members billing managers of the organization

    Incorrect

    Billing managers manage billing settings such as payment information.

By default, only organization owners can manage the settings of GitHub Apps owned by an organization. Owners can designate users or teams as GitHub App managers for some or all of those app registrations; the role doesn't let them install or uninstall apps.

Question 4 · choose 1

An organization owner restricts GitHub App installation to organization owners, and app access requests stay enabled. What changes for repository administrators?

  1. AThey can still add their repositories to GitHub Apps that the organization has already installed
  2. BThey can neither install apps nor add repositories to installations, so they must request them
  3. CThey can approve OAuth apps for their own repositories instead
  4. DOutside collaborators who are repository admins can still install GitHub Apps
Show the answer and why
  • AThey can still add their repositories to GitHub Apps that the organization has already installed

    Incorrect

    Under the restriction, repository admins can't add their repositories to existing installations.

  • BThey can neither install apps nor add repositories to installations, so they must request them

    Correct

    Repository admins must use the request flow to ask organization owners to install apps.

  • CThey can approve OAuth apps for their own repositories instead

    Incorrect

    OAuth apps need organization approval and can't be approved for a single repository.

  • DOutside collaborators who are repository admins can still install GitHub Apps

    Incorrect

    The restriction covers repository admins who are outside collaborators too.

By default, repository admins can install some GitHub Apps on their repositories and add their repositories to apps the organization already installed. When an owner restricts installation to organization owners, repository admins, outside collaborators included, can't install apps or add their repositories to existing installations and must request installations instead. The restriction applies to GitHub Apps only.

Question 5 · choose 1

An enterprise wants every personal access token that can reach its organizations' private resources to be reviewed by an organization owner first. Developers must still be able to use the tokens that pass review, and organization owners must not be able to switch the review off. Which enterprise policies meet this?

  1. ARequire approval of fine-grained tokens, and restrict access via personal access tokens (classic)
  2. BRequire approval of fine-grained tokens, and leave the personal access token (classic) policy at its default
  3. CRestrict access via personal access tokens, for both fine-grained and classic tokens
  4. DLet organizations configure approval, since organizations require approval by default
Show the answer and why
  • ARequire approval of fine-grained tokens, and restrict access via personal access tokens (classic)

    Correct

    Only fine-grained tokens can go through approval, so classic tokens have to be kept out.

  • BRequire approval of fine-grained tokens, and leave the personal access token (classic) policy at its default

    Incorrect

    Classic tokens aren't subject to approval and can access the organizations by default.

  • CRestrict access via personal access tokens, for both fine-grained and classic tokens

    Incorrect

    Then no personal access token can reach the organizations, reviewed or not.

  • DLet organizations configure approval, since organizations require approval by default

    Incorrect

    Organizations can disable the default approval requirement unless the enterprise enforces it.

Enterprise owners can require approval of fine-grained personal access tokens in all organizations, which organizations can't override. Only fine-grained tokens are subject to approval; any personal access token (classic) can access organization resources without approval unless access by classic tokens is restricted.

Question 6 · choose 1

An organization owner learns that a fine-grained personal access token with access to the organization was exposed. She wants to cut off that token's access to the organization immediately. What can she do?

  1. AOnly the token's owner can do anything, by deleting the token
  2. BAsk GitHub Support to revoke it
  3. CRevoke it from Active tokens in the organization's settings
  4. DCall the revocation REST endpoint with her own personal access token
Show the answer and why
  • AOnly the token's owner can do anything, by deleting the token

    Incorrect

    Organization owners can revoke a fine-grained token's access to the organization.

  • BAsk GitHub Support to revoke it

    Incorrect

    Owners can revoke it themselves from the organization's settings.

  • CRevoke it from Active tokens in the organization's settings

    Correct

    Owners can review and revoke the fine-grained tokens that can access the organization.

  • DCall the revocation REST endpoint with her own personal access token

    Incorrect

    Those endpoints can be called only by GitHub Apps.

Organization owners can view all fine-grained personal access tokens that can access the organization's resources and revoke their access, from Active tokens under the organization's Personal access tokens settings; the token's creator is notified by email. The matching REST endpoints can only be called by GitHub Apps.

Question 7 · choose 1

A workflow in a repository of an organization owned by a GitHub Enterprise Cloud enterprise queries the GraphQL API with the GITHUB_TOKEN, about 4,000 points an hour, for resources that belong to the enterprise account. Will it stay within its primary rate limit?

  1. AYes, because the GITHUB_TOKEN gets 15,000 points an hour per repository for enterprise resources
  2. BNo, because the GITHUB_TOKEN is limited to 1,000 points an hour per repository
  3. CNo, because the GITHUB_TOKEN shares the 5,000-point limit of the user who started the run
  4. DYes, because the GITHUB_TOKEN has no GraphQL rate limit at all
Show the answer and why
  • AYes, because the GITHUB_TOKEN gets 15,000 points an hour per repository for enterprise resources

    Correct

    For resources that belong to an enterprise account, the limit is 15,000 points an hour per repository.

  • BNo, because the GITHUB_TOKEN is limited to 1,000 points an hour per repository

    Incorrect

    That limit applies to resources outside an enterprise account; enterprise resources get 15,000.

  • CNo, because the GITHUB_TOKEN shares the 5,000-point limit of the user who started the run

    Incorrect

    The GITHUB_TOKEN has its own per-repository limit.

  • DYes, because the GITHUB_TOKEN has no GraphQL rate limit at all

    Incorrect

    The GITHUB_TOKEN has a GraphQL limit, counted in points per repository.

The GraphQL API limits points per hour. For the GITHUB_TOKEN in GitHub Actions workflows the limit is 1,000 points an hour per repository, and 15,000 points an hour per repository for requests to resources that belong to an enterprise account on GitHub.com.

Question 8 · choose 1

An integration must receive push events from every repository it can access in an organization, including repositories added later, without the integration or anyone else having to configure a webhook. Which kind of app fits?

  1. AAn OAuth app that each repository administrator authorizes
  2. BA GitHub App, with its built-in webhook
  3. CA personal access token polling each repository's events
  4. DAn OAuth app with a long-lived token
Show the answer and why
  • AAn OAuth app that each repository administrator authorizes

    Incorrect

    OAuth apps must configure webhooks individually for each repository and organization.

  • BA GitHub App, with its built-in webhook

    Correct

    A GitHub App receives webhook events for all repositories and organizations it can access.

  • CA personal access token polling each repository's events

    Incorrect

    A token doesn't receive webhooks; polling isn't a webhook.

  • DAn OAuth app with a long-lived token

    Incorrect

    Token lifetime doesn't change how OAuth app webhooks are configured.

GitHub Apps have built-in, centralized webhooks: they receive webhook events for all repositories and organizations the app can access. OAuth apps must configure webhooks individually for each repository and organization.

Practice domain 3 →Practice all domains →