Pular para conteúdo

AUR-006 - OCI bootstrap profile contract

Documento histórico do board. Pode descrever componentes removidos; para uso atual, consulte o guia do produto.

This card defines bootstrap-readonly-v1 as a validation-only profile. The validator parses the profile and its image lock before an engine command can be constructed. It never contacts Docker, Podman, a registry, or the network.

Contract

The JSON Schema is .board/schemas/container-profile.schema.json. It is a strict object with no additional properties. The profile is non-root, privileged-disabled, network-disabled, read-only, no-new-privileges, and drops all capabilities. Host mounts, engine sockets, devices, and added capabilities are represented only by the safe values none in this profile. The checkout may be marked only with checkout_readonly: true when that optional field is present.

Resource fields are bounded before any engine interaction:

Field Range
timeout_seconds 1..120
memory_mb 1..256
cpu_millis 1..1000
pids_limit 1..128
tmpfs_mb 1..128
stdout_limit_bytes, stderr_limit_bytes 1..65536
max_input_files 1..10000
max_input_bytes 1..67108864

The image lock is a separate strict object with schema aurum.oci-image-lock. Its image must have the form name@sha256:<64 lowercase hexadecimal characters>, where every slash- separated name component is non-empty, starts with a lowercase letter or digit, and uses only lowercase letters, digits, ., _, or - separators. Repeated slashes, ./.. components, trailing separators, and tags such as bash:latest are not accepted. The profile lock_digest must equal the SHA-256 digest of the exact lock bytes supplied to validation.

Go API

internal/sandbox/profile.ValidateBootstrapProfile accepts the profile JSON, the schema JSON, and the image-lock JSON as byte slices. It returns a ValidationResult with status, a stable code, the document digest, and engine_invocations. The latter is always zero for this contract. A valid profile returns code: valid; invalid input is rejected before any engine adapter exists.

The stable hostile-input codes are:

Violation Code
root user root_forbidden
privileged mode privileged_forbidden
host mount host_mount_forbidden
Docker/Podman/containerd socket mount engine_socket_forbidden
device device_forbidden
added or incomplete capabilities capability_forbidden
writable checkout checkout_must_be_readonly
external network egress_forbidden
missing, zero, or excessive resource bound resources_must_be_bounded
mutable or malformed image reference image_digest_required

Malformed profile or schema field types are rejected with schema_invalid; malformed lock structure is rejected with lock_manifest_invalid. They are never classified as a hostile-policy violation or treated as valid. In particular, a lock with image: null is structural invalidity, not a mutable image reference. Duplicate JSON keys and unknown fields also fail closed.

Example

{
  "schema": "aurum.container-profile",
  "version": 1,
  "profile": "bootstrap-readonly-v1",
  "lock": ".board/locks/oci/bootstrap-readonly-v1.lock.json",
  "lock_digest": "sha256:acc7d19c12a1dd8dedfa1110976fab1f0883fb3279fd33feb86dca8bd250b406",
  "network": "none",
  "user": "65534:65534",
  "cap_drop": "ALL",
  "cap_add": "none",
  "mounts": "none",
  "devices": "none",
  "pull": "never",
  "tmpfs": "rw,nosuid,nodev",
  "read_only_rootfs": true,
  "no_new_privileges": true,
  "privileged": false,
  "timeout_seconds": 120,
  "memory_mb": 256,
  "cpu_millis": 1000,
  "pids_limit": 128,
  "tmpfs_mb": 128,
  "stdout_limit_bytes": 65536,
  "stderr_limit_bytes": 65536,
  "max_input_files": 10000,
  "max_input_bytes": 67108864
}

The example contains no credential, environment value, or secret.

Diagnostics

Run the focused matrix directly when Go is available:

go test ./tests/contracts/sandbox-profile -run '^(TestContractAUR006|TestAUR006Rejects.*)$' -count=1 -v

The acceptance dispatcher exercises every declared layer. These selectors must resolve to the named entrypoint and fail if its source file or function is absent:

bash tests/acceptance/AUR-006.sh TestAUR006
bash tests/acceptance/AUR-006.sh ContractAUR006
bash tests/acceptance/AUR-006.sh IntegrationAUR006
bash tests/acceptance/AUR-006.sh E2EAUR006

The acceptance wrapper is:

bash tests/acceptance/AUR-006.sh AC-001

Exit 69 with an infrastructure diagnostic means the Go toolchain or its bounded test setup is unavailable. It is inconclusive, not a behavioral RED and not approval. OCI execution is not required by this card because the validator must finish before an engine is invoked.