Files
OpenShell/docs/observability
krishicks 321b93a898 feat(auth): emit OCSF events for SSH session and sandbox token checks (#4762)
Some credentials are checked by handlers rather than by the gateway's
authenticators, so their rejections only reached the caller and plain
logs. They now emit the same OCSF events as the router's checks:

- SSH session tokens. A ForwardTcp SSH connection whose token is
  missing, unknown, revoked, minted for another sandbox, or expired
  emits an Authentication failure with protocol ssh_session_token and a
  reason category. An accepted token logs on once, like other
  credentials. The router has already authenticated the caller, so these
  events name that caller.
- IssueSandboxToken. A compute-driver identity that no longer matches
  the sandbox's recorded runtime emits an Authentication failure
  (stale_identity); a sandbox with no record, or no usable recorded
  identity, emits unknown_identity. A sandbox calling it with a gateway
  JWT is refused with method_not_permitted and raises the sandbox
  boundary finding.
- RefreshSandboxToken. A caller that is not a gateway-JWT sandbox is
  refused with method_not_permitted. A request for an extension service
  the sandbox policy does not select is refused with the new
  extension_service_not_selected reason, without a finding, because a
  policy update can race the supervisor's request.
- Sandbox logons on IssueSandboxToken and RefreshSandboxToken. The
  router logged a compute-driver credential on IssueSandboxToken, or a
  gateway JWT on RefreshSandboxToken, before the handler finished
  checking the recorded runtime or the token lineage, so a credential
  that failed that check recorded a success and then a failure. Those
  handlers now record the logon once their check passes. Other
  credentials on these methods are fully verified by the router and
  still log on there, even when authorization then refuses them.
- GetCurrentUser. A non-user principal is refused with
  method_not_permitted. The router already blocks such callers, so this
  is defense in depth.

Callers receive the same status codes and messages as before, and the
events never include the tokens.

Refs #2912

Signed-off-by: Kris Hicks <khicks@nvidia.com>
2026-10-21 14:32:35 +00:00
..