Skip to content

sodejm/kubernetes-assessment-workbench

v0.1.0PolyForm-Noncommercial-1.0.0

Reconcile an approved Kubernetes context with a sanitized local observation without cluster access.

COPS Kubernetes Assessment Workbench

Reconcile an approved Kubernetes context and namespace scope against a sanitized local observation before deciding what evidence to collect next. This experimental package checks whether the two records agree and makes missing access explicit. It reads no kubeconfig, calls no cluster API, and does not authorize execution.

Start here

Use Python 3.14 or newer. Run these commands from the repository root:

python3 -m cops info kubernetes-assessment-workbench
python3 -m cops demo kubernetes-assessment-workbench
python3 -m cops check kubernetes-assessment-workbench

The demo runs matching, limited-evidence, and rejected context-switch cases through the public importer. It asserts each result and repeats the matching case. Follow the practitioner playback to inspect an individual report, or use the verification playbook to record qualification evidence.

Why context reconciliation comes first

A context name alone cannot establish which cluster or identity supplied evidence. The importer compares the selected name, cluster, and user with the observation's context inventory. An optional Namespace UID provides a second identity anchor. matched_sanitized_export means that two local assertions agree on that object; it does not prove a universal cluster identity or fresh live access.

The report keeps identity, namespace access, surface access, and cluster facts separate. A denied namespace cannot become accessible because the API server is reachable. Missing observations stay unknown. Managed control-plane restrictions remain limitations, even when the selected namespace is accessible. Every report sets live_execution_ready to false and network_requests to 0.

Data contracts

The complete synthetic input is a runnable example. The importer enforces the versioned context contract.

Record or fieldPurpose and producerConsumer and validation
Input schema_version, modeOperator identifies contract 1.0 and offline processingImporter rejects unsupported versions and modes
plan.approval_referenceOperator records the applicable approval identifierRetained as an assertion; no signature or authority is verified
plan.contextExact name, cluster, and user to reconcileMust match the observation without ambiguous duplicate contexts
plan.namespaces, plan.surfacesExplicit scope; surfaces are api_server, namespaced_resources, control_plane, nodes, networkImporter rejects wildcard scope and unsupported surfaces
plan.identity_anchorOptional Namespace name and UIDCompared with observation.identity_anchor; conflict rejects the record, absence remains unresolved
observation.current_context, contextsSanitized exported context selection and inventoryMust support the exact selected context
namespace_access, surface_accessObserved access assertionsaccessible, denied, unknown; surfaces also accept unavailable; omitted evidence becomes unknown
cluster_factsVersion, distribution, runtime, node OS, network, admission controls, control-plane and node accessMissing facts stay unknown; restricted control-plane or node access becomes a limitation
Report cluster_identity, namespaces, surfacesImporter explains the reconciled evidenceAnalyst uses these alongside the original record; no live finding is established
Report blockers, limitationsImporter identifies missing identity, incomplete access, and unavailable surfacesAnalyst determines the next authorized collection step

Inputs are bounded to 128 KiB, nesting depth 16, and bounded inventories. Duplicate JSON keys, non-finite numbers, credential fields, and unsupported fields fail closed. Use opaque identifiers; omit server URLs, credentials, kubeconfig, and workload data.

Failure and operational limits

A mismatched context exits with code 2 and a stable error code. A valid but incomplete record produces a report with blockers; it is not a successful assessment of those surfaces. Fix the source or obtain the missing evidence, then rerun the importer. Do not remove blockers by inventing observations.

The package has no cluster collector, node probe, admission-controller integration, or exploitation capability. Host installation and live integration remain unverified. Local fixture evidence cannot promote those support states.