Skip to content

fix(kubernetes): reject dot names, redact delete results, stop echoing test bodies (#391) - #497

Open
mblaauw wants to merge 1 commit into
mainfrom
fix/391-kubernetes-names-redaction
Open

mblaauw wants to merge 1 commit into
mainfrom
fix/391-kubernetes-names-redaction

Conversation

@mblaauw

@mblaauw mblaauw commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Closes #391.

Summary

  • Object names must be DNS-1123 subdomains and namespaces DNS-1123 labels, so ".", ".."
    and empty values never reach a request path (the URL parser turned pods/. into the
    collection and pods/.. into the namespace, bypassing env-value redaction and letting
    pods.delete target a collection).
  • pods.delete returns {deleted, namespace, name} instead of the deleted Pod; pod and
    deployment results are redacted both as an object and as a list.
  • The connection test passes on only Kubernetes Status messages (error_message), also for
    the namespace probe; defaultNamespace and namespaces[] are validated when a connection
    is saved or imported and when it is parsed ("*" only as a standalone entry).
  • pods.delete sends no grace period unless the agent sets one, so the pod's own
    terminationGracePeriodSeconds applies as with kubectl; descriptions no longer say
    "read-only" or rely on "stuck pod" prompt text.
  • The outbound policy is stored on the client config, which lets unit tests drive a
    plain-HTTP mock API server.

Testing

  • cargo fmt --check, clippy -D warnings: clean
  • cargo test --workspace with a database: 767 passed, 0 failed (Kubernetes API test ran)
  • Mock apiserver tests: list-shaped pods.get, pods.delete with env values, 403/500 bodies with {"secret":"x"}, delete without gracePeriodSeconds
  • pnpm docs:check: passed

Not tested against a real cluster (the live kind test was skipped). Behaviour change: saved connections with namespaces that are not DNS-1123 labels (uppercase, underscores) now fail to parse; Kubernetes never allows such namespaces. validate_connection_urls is renamed validate_connection_config.

🤖 Generated with Claude Code

…g test bodies (#391)

- Object names must be DNS-1123 subdomains and namespaces DNS-1123 labels, so ".", ".."
  and empty values never reach a request path (the URL parser turned pods/. into the
  collection and pods/.. into the namespace, bypassing env-value redaction and letting
  pods.delete target a collection).
- pods.delete returns {deleted, namespace, name} instead of the deleted Pod; pod and
  deployment results are redacted both as an object and as a list.
- The connection test passes on only Kubernetes Status messages (error_message), also for
  the namespace probe; defaultNamespace and namespaces[] are validated when a connection
  is saved or imported and when it is parsed ("*" only as a standalone entry).
- pods.delete sends no grace period unless the agent sets one, so the pod's own
  terminationGracePeriodSeconds applies as with kubectl; descriptions no longer say
  "read-only" or rely on "stuck pod" prompt text.
- The outbound policy is stored on the client config, which lets unit tests drive a
  plain-HTTP mock API server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Kubernetes connector: "." and ".." names bypass redaction, pods.delete returns the Pod unredacted, connection test reflects response bodies

1 participant