vault/audit
Vault Automation 2ef4c50221
Add audit log entries for new token type (#12747) (#12908)
* Add audit log entries for enterprise JWT token fields



* Reduce enterprise token field comment detail

- simplify enterprise token comments in sdk/logical/request.go
- remove verbose wording about issuer/audience/authorization semantics



* Fix TestAudit_JWT_DelegationToken permission denied error

The test was failing with 'permission denied' when using a delegation token
(JWT with act claim) to access cubbyhole. The root causes were:

1. RAR (Rich Authorization Request) check: The JWT contained
   'authorization_details' constraints that only allowed access to
   'secret/data/users/alice' and 'secret/data/config/general', but the
   test was attempting to access 'cubbyhole/test'. The RAR check in
   PerformRARCheck() was correctly denying this mismatch.

2. Missing entity policies for actor ACL: For delegation tokens, the
   actor's ACL is built solely from entity identity policies (not token
   policies like 'default'). Without explicit policies on the actor
   entity, the delegation ACL intersection check would fail.

Fixes:
- Removed 'authorization_details' from the test JWT since the test is
  about verifying audit log entries for delegation tokens, not RAR
  constraints
- Added 'default' policy to both subject and actor entities to ensure
  both ACLs allow cubbyhole access for the delegation token intersection
- Updated test assertions to match the simplified JWT (removed
  authorization_details verification)



* Use require.NoError instead of t.Fatalf for error check



* Add explicit checks for auth field presence before type assertion

Adds separate checks to verify the 'auth' and 'metadata' fields exist in
the map before attempting type assertion, preventing potential panics
and improving test clarity.



* test: tighten request metadata merge assertions



* test: simplify enterprise metadata assertions



* test: split enterprise metadata merge coverage



* style: apply gofumpt to entry formatter tests



* test: add godoc for enterprise token metadata test



---------

Co-authored-by: Bianca <48203644+biazmoreira@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-11 19:21:10 +01:00
..
backend.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
backend_ce.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
backend_ce_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
backend_config.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
backend_config_ce.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
backend_file.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
backend_file_ce_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
backend_file_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
backend_noop.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
backend_socket.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
backend_socket_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
backend_syslog.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
backend_syslog_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
backend_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
broker.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
broker_ce.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
broker_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
entry_filter.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
entry_filter_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
entry_formatter.go Add audit log entries for new token type (#12747) (#12908) 2026-03-11 19:21:10 +01:00
entry_formatter_ce.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
entry_formatter_ce_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
entry_formatter_config.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
entry_formatter_config_ce.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
entry_formatter_test.go Add audit log entries for new token type (#12747) (#12908) 2026-03-11 19:21:10 +01:00
errors.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
errors_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
event.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
event_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
hashstructure.go Add the ability for a plugin to specify extra fields for auditing purposes (#11018) (#12167) 2026-02-04 15:41:54 +00:00
hashstructure_test.go Add audit log entries for new token type (#12747) (#12908) 2026-03-11 19:21:10 +01:00
headers.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
headers_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
nodes.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
nodes_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
options.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
options_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sink_metric_labeler.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sink_metric_labeler_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sink_metric_timer.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sink_metric_timer_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
types.go Add the ability for a plugin to specify extra fields for auditing purposes (#11018) (#12167) 2026-02-04 15:41:54 +00:00