Prevent _system user from sending requests#13
Conversation
Co-authored-by: awagner-mainz <2088443+awagner-mainz@users.noreply.github.com>
Co-authored-by: awagner-mainz <2088443+awagner-mainz@users.noreply.github.com>
Co-authored-by: awagner-mainz <2088443+awagner-mainz@users.noreply.github.com>
awagner-mainz
left a comment
There was a problem hiding this comment.
@copilot please use the huma.Error* wrapper in all the error messages. Or can we rely on the err in the various
if err := ValidateNotSystemUser(input.UserHandle); err != nil {
return nil, err
}
checks to be originating from the return huma.Error403Forbidden("_system user cannot send requests - this is a read-only account") in the internal/handlers/validation.go/ValidateNotSystemUser() function?
Yes, we can rely on the error originating from This is intentional and consistent with how Huma handles errors:
This differs from other validation functions like |
The
_systemuser is a read-only account that owns global LLM Service Definitions but should not actively send requests. Previously, no explicit validation prevented this.Changes
Validation Layer
ValidateNotSystemUser()ininternal/handlers/validation.goreturning 403 Forbidden for_systemuserTests
Example
Requests from
_systemnow return:Read operations and admin-managed resources for
_systemremain unchanged.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.