Skip to content

003 · Domain 2: Vault policies · 13% of the exam

Task 2.3: Describe Vault policy syntax: capabilities

create, read, update, patch, delete and list mapped to HTTP verbs, sudo for root-protected paths, deny that overrides everything, and parameter constraints.

Study it

  • Capabilities: HTTP verbs, sudo, deny and parameter constraints

    Lesson coming

Sample questions

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

Question 1 · choose 2

An application must generate credentials from database/creds/report and renew the leases it receives through sys/leases/renew. Which two capabilities does its policy need? (Choose TWO.)

  1. Aread on database/creds/report
  2. Bcreate on database/creds/report
  3. Cupdate on sys/leases/renew
  4. Dsudo on sys/leases/renew
  5. Elist on database/creds/report
Show the answer and why
  • Aread on database/creds/report

    Correct

    Generating credentials is an HTTP GET, and capabilities map to the verb, so it needs read.

  • Bcreate on database/creds/report

    Incorrect

    Although credentials are created in the database, the request is a GET, which create does not cover.

  • Cupdate on sys/leases/renew

    Correct

    The renew endpoint takes a POST or PUT, which maps to update.

  • Dsudo on sys/leases/renew

    Incorrect

    sudo is for root-protected paths; renewing a lease is not one of them.

  • Elist on database/creds/report

    Incorrect

    list allows LIST requests that return keys; it does not generate credentials.

Capabilities follow the HTTP verb, not the effect: reading a dynamic secret path creates a credential but needs only read.

Question 2 · choose 1

An incident team needs a policy that lets it revoke, in one call, every lease issued under aws/creds, and nothing else under sys/. Which stanza meets the requirement?

  1. Apath "sys/leases/revoke-prefix/aws/creds" { capabilities = ["update"] }
  2. Bpath "sys/leases/revoke-prefix/aws/creds" { capabilities = ["update", "sudo"] }
  3. Cpath "sys/leases/revoke-prefix/aws/creds" { capabilities = ["sudo"] }
  4. Dpath "sys/leases/revoke/aws/creds/*" { capabilities = ["update", "sudo"] }
Show the answer and why
  • Apath "sys/leases/revoke-prefix/aws/creds" { capabilities = ["update"] }

    Incorrect

    sys/leases/revoke-prefix is a root-protected path, so update alone is refused.

  • Bpath "sys/leases/revoke-prefix/aws/creds" { capabilities = ["update", "sudo"] }

    Correct

    revoke-prefix revokes a whole prefix in one call, is root-protected so it needs sudo with update, and this path covers only aws/creds.

  • Cpath "sys/leases/revoke-prefix/aws/creds" { capabilities = ["sudo"] }

    Incorrect

    sudo grants access to a root-protected path only together with the capability for the operation, here update.

  • Dpath "sys/leases/revoke/aws/creds/*" { capabilities = ["update", "sudo"] }

    Incorrect

    This endpoint revokes one lease ID per call, so it cannot clear every aws/creds lease at once.

Root-protected endpoints need sudo in addition to the capability for the verb. Scoping the path to the prefix keeps the grant to aws/creds only.

Question 3 · choose 1

An application must write new secrets and overwrite existing ones under kv/app/ on a KV version 1 mount. Which capabilities should its policy grant?

  1. Acreate only
  2. Bcreate and update
  3. Cupdate and sudo
  4. Dwrite and read
Show the answer and why
  • Acreate only

    Incorrect

    create alone does not cover overwriting an existing value.

  • Bcreate and update

    Correct

    Few parts of Vault distinguish create from update, so most writes need both.

  • Cupdate and sudo

    Incorrect

    sudo is only for root-protected paths.

  • Dwrite and read

    Incorrect

    There is no write capability; writes map to create and update.

Capabilities follow HTTP verbs: POST and PUT map to create and update, GET to read, DELETE to delete and LIST to list.

Question 4 · choose 1

One policy grants ["read", "sudo"] on sys/audit, and another policy on the same token sets ["deny"] on sys/audit. Can the token read sys/audit?

  1. AYes, because sudo overrides deny
  2. BYes, because the policy with more capabilities wins
  3. COnly with a root token, which deny does not affect
  4. DNo, because deny takes precedence over all other capabilities
Show the answer and why
  • AYes, because sudo overrides deny

    Incorrect

    sudo does not override deny.

  • BYes, because the policy with more capabilities wins

    Incorrect

    The count of capabilities is irrelevant; deny is absolute.

  • COnly with a root token, which deny does not affect

    Incorrect

    The question is about this token, whose deny applies.

  • DNo, because deny takes precedence over all other capabilities

    Correct

    deny always wins, regardless of any other capability, including sudo.

Use deny to carve exceptions out of broad grants; nothing in the same token can undo it.

Question 5 · choose 1

A team names KV keys after customers' tax IDs. A token has list on the folder but read on only one secret in it. What does a LIST of the folder return?

  1. AEvery key name under it, since list results are not filtered by policy
  2. BOnly the one key the token can read, since Vault trims lists to readable keys
  3. CAn error, because list requires read on every key under the prefix
  4. DThe keys with their values masked
Show the answer and why
  • AEvery key name under it, since list results are not filtered by policy

    Correct

    Keys returned by a list are not filtered, so sensitive data must not be encoded in key names.

  • BOnly the one key the token can read, since Vault trims lists to readable keys

    Incorrect

    Vault does not trim list results to readable keys.

  • CAn error, because list requires read on every key under the prefix

    Incorrect

    list needs only the list capability on the prefix.

  • DThe keys with their values masked

    Incorrect

    list returns names only, never values.

Treat key names as visible to anyone with list on the prefix.

Question 6 · choose 1

A token's policy grants read and patch on secret/data/app/* of a KV v2 mount, and nothing else. Which of these commands is denied?

  1. Avault kv patch -mount=secret app/config port=8443
  2. Bvault kv get -mount=secret app/config
  3. Cvault kv put -mount=secret app/config port=8443
  4. Dvault kv get -mount=secret -version=1 app/config
Show the answer and why
  • Avault kv patch -mount=secret app/config port=8443

    Incorrect

    kv patch sends an HTTP PATCH, which the patch capability allows.

  • Bvault kv get -mount=secret app/config

    Incorrect

    Reading the latest version needs read on the data path, which is granted.

  • Cvault kv put -mount=secret app/config port=8443

    Correct

    put writes a whole new version, which patch does not cover, and the policy grants nothing else that writes.

  • Dvault kv get -mount=secret -version=1 app/config

    Incorrect

    Reading an older version goes through the same data path with read.

The patch capability covers partial updates only; a full kv put needs other capabilities, while read covers reading any version.

Practice domain 2 →Practice all domains →