Files
coder/coderd
John T SkarbekandClaude Sonnet 5.5 27eecbf092 fix(coderd): stop logging whole objects in authorization denials (#32526)
Linear: [PLE-94](https://linear.app/codercom/issue/PLE-94). Dogfood Loki
holds plaintext credentials because several log call sites emit secrets.
This is one of three independent PRs split out of the original masking
change.

## Root cause
Both "requester is not authorized to access the object" warnings in
`coderd/authorize.go` logged `slog.F("object", object)`, the raw
`rbac.Objecter`. When the caller passes a database row, every field is
dumped, e.g. `oauth2_client_secret` on `database.MCPServerConfig`; any
Objecter row with a secret field leaks. `actor_name` was also the whole
`rbac.Subject` (expanded roles, groups and email), which duplicated the
`roles`, `actor_id` and `scope` fields; it dates to a mechanical rename
of `roles.ActorName` in #12816.

## Fix
Log `object.RBACObject()` (type, id, owner, org), and log
`roles.FriendlyName` (the username, or the name of an internal actor) as
`actor_name`.

Sibling PRs (independent, disjoint files):
- https://github.com/coder/coder/pull/32532
- https://github.com/coder/coder/pull/32533

## Follow-ups not included
- AI Gateway prompt, tool and thought content logged in
`aibridgedserver.go` (~511-613) and `aibridge/recorder/log_recorder.go`
- `rich_parameter_values` in `runner.go` (~443)
- Proxy `response_body` in `aibridgeproxyd.go` (~1102)
- Terraform `TF_LOG` output relayed to logs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-24 14:37:36 -05:00
..