GH-100 · Domain 4: Manage GitHub Actions · 24% of the exam
Task 4.3: Manage encrypted secrets
Who and what can read a secret, secrets at organization, repository and environment level, and reaching external vaults with OpenID Connect instead of stored credentials.
Organization, repository and environment secrets, and OpenID Connect to external vaults
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
In an organization repository, the release team has the Write role. The team must create and rotate the secrets of the repository's production environment. The security team won't give it the Admin role, and the team must not gain access to the repository's other settings. What should an organization owner do?
ANothing; with the Write role the team can already create and update the environment's secrets
BAssign a custom repository role that inherits Write and adds "Manage environments"
CAssign a custom repository role that inherits Write and adds "Manage secrets"
DMake the release team the production environment's required reviewers, which lets it manage the environment
Show the answer and why
ANothing; with the Write role the team can already create and update the environment's secrets
Incorrect
Creating secrets for an environment in an organization repository requires admin access.
BAssign a custom repository role that inherits Write and adds "Manage environments"
Correct
That permission covers environment secrets and variables, so the team needs neither the Admin role nor other settings.
CAssign a custom repository role that inherits Write and adds "Manage secrets"
Incorrect
Environment secrets come with the separate "Manage environments" permission.
DMake the release team the production environment's required reviewers, which lets it manage the environment
Incorrect
Required reviewers approve jobs that use the environment; managing its secrets needs admin access or the matching permission.
Creating secrets or variables for an environment in an organization repository requires admin access, while repository secrets need only write access. A custom repository role starts from an inherited role and adds permissions; among the Actions permissions, "Manage environments" includes environment secrets and variables, separately from "Manage secrets". A role that inherits Write and adds "Manage environments" lets the team handle the production environment's secrets without the Admin role.
A secrets team of four people, none of them organization owners, must create and rotate organization-level GitHub Actions secrets in each of the enterprise's 12 organizations. They need no other administrative access. What should be set up?
AA custom organization role with the "Manage organization Actions secrets" permission, assigned in each organization
BA custom repository role that adds "Manage secrets", assigned to the team on every repository
CAdmin access for the team on every repository of the 12 organizations
DThe security manager role for the team in each of the organizations
Show the answer and why
AA custom organization role with the "Manage organization Actions secrets" permission, assigned in each organization
Correct
Organization owners and users with that permission can create secrets at the organization level.
BA custom repository role that adds "Manage secrets", assigned to the team on every repository
Incorrect
That repository permission covers repository secrets, not organization secrets.
CAdmin access for the team on every repository of the 12 organizations
Incorrect
Repository admins create repository and environment secrets, not organization secrets.
DThe security manager role for the team in each of the organizations
Incorrect
Security managers view security alerts and manage security settings, not Actions secrets.
Organization owners, and users with the "Manage organization Actions secrets" permission from a custom organization role, can create secrets at the organization level. Repository admins can create repository and environment secrets. Organization secrets are created in each organization, so the role is assigned in all 12.
Workflows authenticate to HashiCorp Vault with OpenID Connect. Vault's JWT auth method uses bound_issuer and oidc_discovery_url set to https://token.actions.githubusercontent.com, and each role has bound_claims on a repository. After an enterprise administrator calls the OIDC issuer customization endpoint with include_enterprise_slug set to true, every Vault login from the enterprise's workflows fails. What fixes it?
AAdd the enterprise claim to the bound_claims of each Vault role
BSet bound_issuer and oidc_discovery_url to the enterprise's unique URL under token.actions.githubusercontent.com
CChange the bound_audiences of each Vault role to the enterprise's slug
DAsk organization owners to customize the subject claim template
Show the answer and why
AAdd the enterprise claim to the bound_claims of each Vault role
Incorrect
The roles' claims still match; what no longer matches is the token's issuer.
BSet bound_issuer and oidc_discovery_url to the enterprise's unique URL under token.actions.githubusercontent.com
Correct
The tokens now carry the enterprise's unique issuer, and Vault's issuer settings must match that URL.
CChange the bound_audiences of each Vault role to the enterprise's slug
Incorrect
The setting changes the issuer claim, not the audience.
DAsk organization owners to customize the subject claim template
Incorrect
A subject template changes the sub claim; the failure comes from the issuer.
Enterprise administrators can make their enterprise receive OIDC tokens from a unique URL, https://token.actions.githubusercontent.com followed by the enterprise slug, so that cloud providers can accept tokens only from that issuer. The tokens' iss value then changes, and Vault's bound_issuer and oidc_discovery_url must match the unique URL.
Workflows in a repository get secrets from HashiCorp Vault through OpenID Connect, and the Vault role's bound_claims accept tokens from that repository. Dependabot update jobs in the repository can also request OIDC tokens, and the security team wants the role to serve only the workflows. Which claim value marks the tokens of Dependabot update jobs?
Aevent_name set to pull_request
Bevent_name set to dynamic
Cevent_name set to dependabot
Devent_name set to schedule
Show the answer and why
Aevent_name set to pull_request
Incorrect
Tokens requested for Dependabot update jobs carry the event_name value dynamic.
Bevent_name set to dynamic
Correct
OIDC tokens requested for Dependabot update jobs use dynamic as the event_name value.
Cevent_name set to dependabot
Incorrect
The value for Dependabot update jobs is dynamic, not the product's name.
Devent_name set to schedule
Incorrect
Tokens requested for Dependabot update jobs carry the event_name value dynamic.
The event_name claim names the event that triggered the workflow run, and OIDC tokens requested for Dependabot update jobs use dynamic as its value. If a trust policy should authorize only GitHub Actions workflows and the provider supports conditions on event_name, GitHub advises allowing only the event names the workflows expect.
An organization owner wants to create organization secrets with GitHub CLI. She has authenticated with gh auth login using the default scopes, and gh secret set --org fails. What should she do?
AAuthorize the admin:org scope, for example with gh auth login --scopes "admin:org"
BUse the workflow scope instead of repo
CCreate the secrets as repository secrets instead
DAsk GitHub Support to enable CLI access for the organization
Show the answer and why
AAuthorize the admin:org scope, for example with gh auth login --scopes "admin:org"
Correct
Managing organization secrets with GitHub CLI needs the admin:org scope.
BUse the workflow scope instead of repo
Incorrect
Organization secrets need the admin:org scope.
CCreate the secrets as repository secrets instead
Incorrect
That changes their scope; the CLI only needs an extra token scope.
DAsk GitHub Support to enable CLI access for the organization
Incorrect
No such enablement exists; the scope is missing.
By default, GitHub CLI authenticates with the repo and read:org scopes. To manage organization secrets, you must additionally authorize the admin:org scope, for example with gh auth login --scopes "admin:org".
Workflows must read secrets from a HashiCorp Vault server that isn't reachable from the public network. What does GitHub suggest?
AUse GitHub-hosted runners with OIDC to the Vault's private address
BCopy all Vault secrets into organization secrets
COpen Vault to the internet for the duration of each job
DUse a self-hosted runner with one of Vault's other auth methods
Show the answer and why
AUse GitHub-hosted runners with OIDC to the Vault's private address
Incorrect
GitHub-hosted runners reach the public network; the Vault isn't reachable from there.
BCopy all Vault secrets into organization secrets
Incorrect
That abandons the vault rather than reaching it.
COpen Vault to the internet for the duration of each job
Incorrect
GitHub's guidance is a self-hosted runner, not exposing the server.
DUse a self-hosted runner with one of Vault's other auth methods
Correct
For a Vault not accessible from the public network, GitHub suggests self-hosted runners.
With OIDC, workflows exchange a GitHub token for a Vault token through Vault's JWT auth method. If the Vault server isn't accessible from the public network, GitHub suggests using a self-hosted runner with other available Vault auth methods.