Skip to content

feat(observability): describe credential preparation outcomes - #6164

Open
krishicks wants to merge 1 commit into
mainfrom
feat/5395-describe-credential-preparation/krishicks
Open

krishicks wants to merge 1 commit into
mainfrom
feat/5395-describe-credential-preparation/krishicks

Conversation

@krishicks

Copy link
Copy Markdown
Contributor

Summary

Each credential stage now records how it finished: prepared, not needed, refused, failed or stale. For a prepared credential it also records the mechanism and placement. A trace can now tell these outcomes apart without reading logs.

Related Issue

Closes #5395

Changes

  • openshell.credential.prepare records openshell.credential.preparation. When a credential is prepared, it also records openshell.credential.mechanism and openshell.credential.placement, built from what the rewriter reports it substituted.
  • Request-body substitution and SigV4 credential lookup now each get a credential stage. Before, neither had one.
  • A placeholder sent with no resolver bound records failed, which matches the 500 the client receives.
  • Token grants record their bounded failure code and stage.
  • A stage dropped without a result records cancelled.
  • Static, body and SigV4 failures are classified through typed errors, not miette downcasts.
  • docs/observability/traces.mdx gains one paragraph on the new attributes.

Most of the SigV4 change in rest.rs moves an existing nested block into helpers. Hiding whitespace (?w=1) shows the actual change.

Before / After

Each cell shows the openshell.credential.prepare stages for one relayed request, captured from main and from this branch with an always-on sampler.

Request Before After
Header placeholder OK OK · prepared · static · header
Basic auth placeholder OK OK · prepared · basic · header
Path and query placeholders OK OK · prepared · static · path,query
No placeholder OK OK · not_needed
Placeholder in a header its binding doesn't allow ERROR · credential_resolution_refused ERROR · refused · credential_resolution_refused
Placeholder, no resolver bound ERROR · credential_resolution_refused ERROR · failed · credential_resolution_failed
Form body placeholder head: OK; no body stage head: OK · not_needed; body: OK · prepared · static · body
application/octet-stream body placeholder head: OK; no body stage head: OK · not_needed; body: ERROR · refused · credential_resolution_refused
SigV4, signed head: OK; signing: OK head: OK · not_needed; signing: OK · prepared · sigv4 · header
SigV4, AWS keys missing head: OK; no signing stage head: OK · not_needed; lookup: ERROR · failed · credential_unavailable

Token grants aren't in the capture. token_grant_stage_describes_preparation_outcome covers them: prepared · token_grant · header, or refused/failed with openshell.credential.failure_code and openshell.credential.failure_stage. No captured attribute contains a credential value.

Release Notes

Credential preparation spans now say whether a credential was prepared, not needed, refused, failed or stale, and how a prepared credential was placed.

Testing

  • cargo fmt --check; lockfile checks; clippy with --locked for every rust:lint manifest
  • Unit tests added: static, body, SigV4, rotated-during-signing, token-grant and cancelled stage outcomes; header/path/query/basic substitution reporting in openshell-core
  • Targeted openshell-supervisor-network and openshell-core tests pass
  • E2E tests added/updated (not applicable)

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)

Credential preparation appeared in traces as an unlabeled stage, or not
at all for request bodies and SigV4 credential lookup, so a trace could
not tell a prepared credential from one that was not needed, refused,
failed or stale, or say how it was placed.

Each credential stage now records openshell.credential.preparation and,
for a prepared credential, its mechanism and placement, built from what
the rewriter reports it substituted. Static, body, SigV4 and token-grant
preparation classify their own failures through typed errors, and token
grants also record their bounded failure code and stage. A stage dropped
without a result records cancelled. Credential values are never
recorded, and client responses are unchanged.

Closes #5395

Signed-off-by: Kris Hicks <khicks@nvidia.com>
@krishicks krishicks added topic:observability Logs, metrics, traces, telemetry, dashboards, event correlation, and operational data export. area:runtime Sandbox execution, isolation, supervision, policy enforcement, networking, and provider lifecycle. labels Dec 2, 2026
@github-actions github-actions Bot added the state:accepted A maintainer decided OpenShell should pursue this issue label Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:runtime Sandbox execution, isolation, supervision, policy enforcement, networking, and provider lifecycle. state:accepted A maintainer decided OpenShell should pursue this issue topic:observability Logs, metrics, traces, telemetry, dashboards, event correlation, and operational data export.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(observability): describe credential preparation outcomes

1 participant