# Permit reading everything under "secret/bar". An attached token could read
# "secret/bar/zip", "secret/bar/zip/zap", but not "secret/bars/zip".
path "secret/bar/*" {
capabilities = ["read"]
}
Why can my token read secret/db but not secret/db/config? From reading the priority rules, the longer path should have higher priority, so I should have read/list on anything under secret/bar/*.
But that still gives me pause because it I could still guess at other paths and acquire so secrets.
What is the proper way to do this? How do I say (in file system terms, which the docs try to use as an analogy), “let this token walk down the tree, but only showing folders to which they have access?”
I noticed in your first message you mentioned “clicked”, so I’m making an assumption that you are using the UI, and possibly the “vault” cli - it is much more convenient.
I kept getting tripped up with the paths when implementing policies as well - I still do. I recommended you review the API’s. The policies map to the API’s, but the UI and CLI hid it from you. For example the kv-v2 path ( from the API ) starts at the “root” path - so in your case “secret”. It then splits into a few branches: config, data, metadata, delete, undelete, destroy. config holds the config information about the kv store itself, data holds the actual secrets, metadata holds the information about your data (in kv2, this is where version information is kept), delete/undelete are really action (post - or write/update) and destroy is also an action that removes everything about the data.
The CLI ( vault kv put secret/db password=test ) will make a call to secret/data/db - which is why you need the /data/ in the path.
The same for the UI - to show you the list of secrets, it needs the list permissions on that path.
I recommend you get comfortable reading the API - even though it is not straight forward if you are not use to HTTP C.R.U.D API’s.
@alain Thank you. It was a long way around, but yes, I finally figured out the policies are bound to the API, while the UI is “disconnected” from the API, at least semantically.