# LoopbackBesideProduction

An OIDCClient registers a loopback redirect or post-logout URI beside an https one; the client is registered and the resource is still Ready=True.

## Meaning

The server holds the client and advises changing it: `spec.redirectUris` or
`spec.postLogoutRedirectUris` hold a loopback URI (`127.0.0.1`, `[::1]`, `localhost` or a
name under it) beside an https URI on another host. That is the shape of a deployed client
someone added a local development callback to. The server accepts it and also returns it
from the admin API as `loopback_beside_production` in the client's `advisories`. A client
whose URIs are all loopback, such as a command-line or desktop app, is never flagged.

## Impact

Nothing breaks, and users still sign in. The exposure is the end users': any program on a
user's machine listening on that loopback port can receive authorization codes issued under
the production client's name and consent screen, and for a public client PKCE does not stop
it, since that program starts the flow itself. The developers using the callback also hold
the production client's credentials.

## Diagnosis

1. `kubectl -n <ns> get oidcclient <name> -o jsonpath='{.spec.redirectUris}{"\n"}{.spec.postLogoutRedirectUris}{"\n"}'`
   lists the URIs; the loopback ones are the local callbacks.
2. `kubectl get oidcclients -A | grep LoopbackBesideProduction` lists every flagged client.
3. `GET /v1/admin/orgs/<slug>/clients/<id>` returns the client with its `advisories`.
4. `nauthera_operator_reconciles_total{kind="OIDCClient",reason="LoopbackBesideProduction"}`
   counts the reconciles that reported it.

## Mitigation

- Declare a second OIDCClient for development: its own `clientId`, only the loopback URIs
  (`http://127.0.0.1/<path>` matches any port the local server picks) and `allowedGroups`
  naming the developers. Template the two from one Helm chart or Kustomize base, so scopes,
  flows and identity providers stay the same.
- Point local development at the new client's id and Secret, then remove the loopback URIs
  from this manifest. The condition returns to Registered.
- If the https URI and the loopback URI belong to the same native app, the advisory can stay:
  nothing is refused.

## Escalation

None while the advisory describes the client. If it is reported for a client whose redirect
and post-logout URIs are all loopback, or all off loopback, open an issue with the resource's
namespace and name, its URIs and the server and operator versions.

---

[Operator failure reasons](https://www.nauthera.io/docs/v1/runbooks/operator) · Generated from [`operator/internal/runbook/conditions.yaml`](https://github.com/nauthera/nauthera-server/blob/main/operator/internal/runbook/conditions.yaml) in nauthera-server.
