Skip to content

GH-600 · Domain 6: Implement guardrails and accountability · 12% of the exam

Task 6.2: Implement guardrails and human-in-the-loop workflows

Deciding which actions need a person, blocking actions that break policy, least-privilege permissions, controlled paths for irreversible changes, and dropping approvals that add no safety.

Study it

  • Human-in-the-loop: rulesets, code owners, approvals and blocked actions

    Partly covered by: Guardrails

  • Least privilege and controlled paths for irreversible changes

    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

Anyone with write access to a repository could change copilot-setup-steps.yml, the agent profiles or the hooks files, and so change what Copilot cloud agent can do. The security team wants every such change approved by the platform team. What does GitHub recommend?

  1. ARestrict Copilot cloud agent to repository administrators only
  2. BMove the files into the .github-private repository
  3. CAssign those paths to the platform team in CODEOWNERS and require code owner review in a ruleset
  4. DAsk Copilot in custom instructions never to edit those files
Show the answer and why
  • ARestrict Copilot cloud agent to repository administrators only

    Incorrect

    Administrators manage settings, but these files can still be edited by anyone with write access unless protected.

  • BMove the files into the .github-private repository

    Incorrect

    Setup steps, hooks and repository agents must live in the repository itself.

  • CAssign those paths to the platform team in CODEOWNERS and require code owner review in a ruleset

    Correct

    GitHub recommends protecting Copilot and MCP configuration files with CODEOWNERS and the Require review from Code Owners rule.

  • DAsk Copilot in custom instructions never to edit those files

    Incorrect

    Instructions guide the model; they don't stop people changing the files.

When building guardrails for Copilot cloud agent, GitHub suggests protecting important Copilot and MCP configuration files with a CODEOWNERS file and enabling the Require review from Code Owners rule, so edits must be approved by specific teams. Files such as copilot-setup-steps.yml can be edited by anyone with write access by default; the customization cheat sheet lists the paths to target.

Question 2 · choose 2

An enterprise wants a baseline ruleset so that neither people nor agents can apply unvetted changes to production branches or rewrite their history. Which rules does GitHub's governance guidance say to enable at least? (Choose TWO.)

  1. ARequire a pull request before merging, with at least one approval
  2. BRequire linear history
  3. CBlock force pushes
  4. DRestrict file extensions
  5. ERequire deployments to succeed before merging
Show the answer and why
  • ARequire a pull request before merging, with at least one approval

    Correct

    GitHub says to enable at least Require a pull request before merging, requiring at least one approval.

  • BRequire linear history

    Incorrect

    Linear history controls merge commits; it isn't one of the minimum rules named.

  • CBlock force pushes

    Correct

    Block force pushes is the other rule the guidance names as a minimum.

  • DRestrict file extensions

    Incorrect

    File extension limits don't gate unvetted changes or history rewrites.

  • ERequire deployments to succeed before merging

    Incorrect

    That rule ties merging to deployments; it isn't part of the minimum baseline named.

To stop developers or bad actors from unilaterally applying unvetted AI suggestions or agent work to sensitive codebases, GitHub suggests a branch ruleset that enables at least Require a pull request before merging, with at least one approval, and Block force pushes. You can add more rules on top of this baseline.

Question 3 · choose 1

An enterprise's server-managed settings allow Shell(npm *) and Edit(/src/**), while a team's MDM-managed file allows Shell(npm *) and denies Shell(npm publish *). A developer on that team asks Copilot to run npm publish and to edit /docs/readme.md. What happens?

  1. ABoth run, because the enterprise's allow list covers npm
  2. Bnpm publish is blocked, and editing /docs needs approval because it is outside every allowlist
  3. Cnpm publish asks once, then is remembered for the session
  4. DThe /docs edit is allowed, since allowlists from different sources are combined
Show the answer and why
  • ABoth run, because the enterprise's allow list covers npm

    Incorrect

    A deny rule from any source wins over allow rules.

  • Bnpm publish is blocked, and editing /docs needs approval because it is outside every allowlist

    Correct

    A deny from any managed source blocks the operation, and allowlists intersect, so unmatched operations require approval.

  • Cnpm publish asks once, then is remembered for the session

    Incorrect

    Deny blocks the operation outright; it isn't an ask.

  • DThe /docs edit is allowed, since allowlists from different sources are combined

    Incorrect

    The effective allowlist is the intersection of the sources that declare one, not the union.

Managed permissions use deny > ask > allow precedence. A deny rule set by any managed settings source blocks the operation for all users regardless of other sources. The effective allowlist is the intersection of all sources that declare one, not the union, and when any source defines permission rules, an unmatched supported operation defaults to requiring approval.

Question 4 · choose 1

Developers complain that Copilot CLI interrupts them constantly, and some have started using --allow-all to cope. The security team wants fewer prompts without giving up control over risky actions. Which approach fits GitHub's guidance?

  1. APre-approve low-risk tools such as shell(npm test) and keep prompts for the rest
  2. BStandardize on --allow-all through a shell alias so prompts never appear
  3. CRequire approval for every read and search as well, so that nothing at all slips through
  4. DTurn off the CLI's permission system and rely on code review afterwards
Show the answer and why
  • APre-approve low-risk tools such as shell(npm test) and keep prompts for the rest

    Correct

    Read-only operations already run without prompts; narrow allow rules remove prompts that add little safety.

  • BStandardize on --allow-all through a shell alias so prompts never appear

    Incorrect

    GitHub strongly advises against an alias that applies allow-all every time.

  • CRequire approval for every read and search as well, so that nothing at all slips through

    Incorrect

    Approving read-only operations adds friction without materially reducing risk.

  • DTurn off the CLI's permission system and rely on code review afterwards

    Incorrect

    Review afterwards doesn't stop destructive commands at the moment they run.

In Copilot CLI, read-only operations such as searching, reading files and read-only shell commands are allowed automatically, while tools that can modify the system need approval. To cut needless prompts, allow specific tools or subcommand patterns with --allow-tool, or approve them for a location, keeping approvals where they reduce risk. GitHub cautions against aliasing allow-all options so they apply to every session.

Question 5 · choose 1

Which ruleset option guards against someone adding unreviewed changes to a pull request after it was approved?

  1. ADismiss stale pull request approvals when new commits are pushed
  2. BRequire linear history
  3. CRestrict file size
  4. DRequire signed commits
Show the answer and why
  • ADismiss stale pull request approvals when new commits are pushed

    Correct

    Approvals are dismissed when the diff changes, so new changes need approval again.

  • BRequire linear history

    Incorrect

    That controls merge commits, not approvals.

  • CRestrict file size

    Incorrect

    That limits file sizes, not approvals.

  • DRequire signed commits

    Incorrect

    Signing shows who committed; it doesn't reset approvals.

With Dismiss stale pull request approvals when new commits are pushed, an approval is dismissed when the approved diff changes, and the pull request needs approving again. GitHub suggests it if you're concerned about pull requests being hijacked.

Question 6 · choose 1

Which action can Copilot cloud agent take on its own draft pull request?

  1. AMark it ready for review
  2. BApprove it
  3. CMerge it
  4. DPush commits to the pull request's branch
Show the answer and why
  • AMark it ready for review

    Incorrect

    The agent cannot mark its pull requests ready for review.

  • BApprove it

    Incorrect

    The agent cannot approve pull requests.

  • CMerge it

    Incorrect

    The agent cannot merge pull requests.

  • DPush commits to the pull request's branch

    Correct

    The agent can push to its branch; marking ready, approving and merging need a person.

Draft pull requests created by Copilot cloud agent must be reviewed and merged by a human. The agent can push to its branch, but it cannot mark its pull requests ready for review and cannot approve or merge a pull request.

Question 7 · choose 1

Which practice is part of GitHub's security guidance for writing hooks?

  1. ATrust hook input, since it comes from Copilot
  2. BBuild commands by joining strings without escaping
  3. CNever log sensitive data such as tokens or passwords
  4. DAvoid timeouts so checks always finish
Show the answer and why
  • ATrust hook input, since it comes from Copilot

    Incorrect

    Validate and sanitize all input processed by hooks.

  • BBuild commands by joining strings without escaping

    Incorrect

    Use proper shell escaping to prevent injection.

  • CNever log sensitive data such as tokens or passwords

    Correct

    Hooks should never log secrets.

  • DAvoid timeouts so checks always finish

    Incorrect

    Set appropriate timeouts to avoid blocking the agent.

GitHub's security considerations for hooks are: validate and sanitize hook input, use proper shell escaping, never log sensitive data such as tokens or passwords, give scripts and logs appropriate permissions, be cautious with external network calls, and set timeouts to prevent resource exhaustion.

Question 8 · choose 1

Before installing a community agent skill with gh skill install, what does GitHub tell you to do?

  1. ANothing; gh skill only lists verified skills
  2. BInspect it with gh skill preview
  3. CRun it once in Autopilot to see what it does
  4. DPin it with --pin, which scans it for malware
Show the answer and why
  • ANothing; gh skill only lists verified skills

    Incorrect

    Skills are not verified by GitHub.

  • BInspect it with gh skill preview

    Correct

    Skills aren't verified by GitHub, so preview the content before installing.

  • CRun it once in Autopilot to see what it does

    Incorrect

    Running an untrusted skill is the risk to avoid.

  • DPin it with --pin, which scans it for malware

    Incorrect

    --pin locks a version; it doesn't scan.

Skills are not verified by GitHub and may contain prompt injections, hidden instructions or malicious scripts. Always inspect a skill before installing it; gh skill preview renders its SKILL.md and file tree in your terminal without installing anything.

Practise domain 6 →Practise all domains →