VAULT-ASSOCIATE practice question 15 of 15

You have been tasked with writing a policy that will allow read permissions for all secrets at path secret/bar. The users that are assigned this policy should also be able to list the secrets. What should this policy look like?

Full set: 57 questions
Answer options
A:

A. exam question

B:

B. exam question

C:

C. exam question

Correct answer
D:

D. exam question

Correct Answer:
C. C. https://kxbjsyuhceggsyvxdkof.supabase.co/storage/v1/object/public/file-images/Hashicorp_VAULT-ASSOCIATE/page_15_img_1.jpg
Explanation

This policy correctly grants the required permissions for the Key/Value (KV) Version 2 secrets engine, which is the modern default. In KV v2, secret data and metadata are stored on separate API paths. To read the content of secrets under secret/bar, a user needs read capability on the secret/data/bar/ path. To list the available secrets under secret/bar, the user requires the list capability on the secret/metadata/bar path. This policy correctly separates these two concerns into the appropriate stanzas, fulfilling all requirements of the request.

Why Incorrect

A: This policy is missing the list capability and uses an incorrect path (secret/bar) for reading secret data in a KV v2 engine. B: This policy uses an incorrect path for both reading and listing secrets in KV v2. The list capability is required on the metadata path, not the data path. D: This policy applies only to the literal path secret/bar, not the secrets stored under it, and uses incorrect paths for KV v2 operations.

References

1. HashiCorp Vault Documentation, "KV Secrets Engine - Version 2", Policies section: This document explicitly states the pathing requirements for KV v2. It clarifies: "To perform a list on the secrets at a path, the policy must grant list capability on kv/metadata/." and "To read a version of a secret, the policy must grant read capability on kv/data/." The policy in option C directly implements this guidance.

Source: HashiCorp, Vault Documentation, "KV Secrets Engine", Section: "Policies". Available at: https://developer.hashicorp.com/vault/docs/secrets/kv/kv-v2#policies

2. HashiCorp Learn, "Vault Policies" Tutorial: This guide provides practical examples of policy creation. In the "Build a Vault Policy for the KV secrets engine" section, it demonstrates the distinct paths for data and metadata access in KV v2, reinforcing the structure shown in the correct answer.

Source: HashiCorp Learn, Get Started - Vault, "Vault Policies". Available at: https://developer.hashicorp.com/vault/tutorials/policies/policies (Refer to the KV v2 policy example).

3. HashiCorp Vault Documentation, "Policies" Concepts: This page defines the core components of a Vault policy, including the path and capabilities stanzas. It defines the read capability as allowing data to be read from a path and list as allowing the listing of values at a path, which are the fundamental operations required by the question.

Source: HashiCorp, Vault Documentation, "Concepts - Policies". Available at: https://developer.hashicorp.com/vault/docs/concepts/policies

Scroll to Top