Skip to content

feat(addons): log the reason behind a generic denial - #12875

Merged
mudler merged 1 commit into
masterfrom
feat/addon-denial-log
Oct 23, 2026
Merged

mudler merged 1 commit into
masterfrom
feat/addon-denial-log

Conversation

@mudler-agent

Copy link
Copy Markdown
Collaborator

What

The addon routes answer 403 "Addon request denied" for every error that is not a named type. The server logged only the status code, so an operator could not tell which check refused a request.

This adds one Warn line at each place that returns the generic denial:

  • resultError fall-through (used by dispatch, relay and the other addon routes): logs the action (or the route pattern when the request has no parsed action), the add-on ID, the error kind (ErrForbidden, ErrUnavailable, or the Go type) and the innermost message of the errors.Unwrap chain.
  • Fixed refusals: the dispatch rule that sends recovery and update actions to their own routes, and the invalid add-on ID / digest / path checks in the app, recovery, update and asset routes. These log the rule name.

What is not logged

The request body, arguments, API key, session cookie, Authorization header and credential references. Only the action and addonId of an already parsed request are used.

Response

Unchanged: same status, same generic message, same JSON shape.

Tests

A new spec in installrefusal_test.go checks that the response body is exactly the generic JSON, that one log line is written with the action, add-on ID, kind and reason, that the fixed-rule path logs the rule, and that the token, Bearer and the request arguments are absent from the log.

go vet -tags auth ./core/http/endpoints/addons/ is clean. CGO_ENABLED=1 go test -tags auth ./core/http/endpoints/addons/: 111 of 111 specs passed, 0 failed. No spec needs Docker or Postgres.

Not run

The full repository build and the other packages' tests. Documentation is not changed because no user-facing behavior or API changes.

The dispatch and sibling addon routes answer 403 "Addon request
denied" for every error that is not a named type, and the server
logged only the status code. An operator could not tell which check
refused a request.

Write one Warn line at each fall-through to the generic denial: the
action (or route pattern), the add-on ID, the typed error kind and the
innermost message of the error chain. Fixed refusals (the recovery and
update action rule, an invalid add-on ID, digest or path) log the rule
name. The request body, arguments, headers, cookies and credential
references are never logged. The response is unchanged.

Assisted-by: Claude:claude-sonnet-5-5 [Claude Code]
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
@mudler
mudler merged commit 98e3f2e into master Oct 23, 2026
19 of 23 checks passed
@mudler
mudler deleted the feat/addon-denial-log branch October 23, 2026 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants