Skip to content

Commit c8e5857

Browse files
johnstcnCopilot
andauthored
chore: attempt to nudge agents away from dbauthz.AsSystemRestricted (coder#23326)
Adds a warning comment to dbauthz.AsSystemRestricted to hopefully nudge agents away from it. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent d8cad81 commit c8e5857

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

coderd/database/dbauthz/dbauthz.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,9 @@ func AsSubAgentAPI(ctx context.Context, orgID uuid.UUID, userID uuid.UUID) conte
769769

770770
// AsSystemRestricted returns a context with an actor that has permissions
771771
// required for various system operations (login, logout, metrics cache).
772+
// DO NOT USE THIS UNLESS YOU HAVE ABSOLUTELY NO OTHER CHOICE. Prefer using a
773+
// more specific As* helper above (or adding a new, narrowly-scoped one) so
774+
// that permissions remain limited to the operation you need.
772775
func AsSystemRestricted(ctx context.Context) context.Context {
773776
return As(ctx, subjectSystemRestricted)
774777
}

0 commit comments

Comments
 (0)