Repository navigation
Conversation
|
🌿 Preview your docs: https://nvidia-preview-pr-5624.docs.buildwithfern.com/openshell |
|
Label |
elezar
left a comment
There was a problem hiding this comment.
Thanks for the thorough mapping table. The ported coverage doesn't duplicate what's already in conformance (filesystem_policy.rs, credential_gating.rs) or transparent_tcp.rs, and the testkit additions are small. CI is red, though, and I have a few structural questions.
CI failures (k3s and k3s-ha; I haven't checked the other lanes)
policy_enforcement::landlock_enforces_filesystem_policy: the probe callspwd.getpwuid(os.getuid()). On k3s the exec runs as uid 10001, which has no passwd entry (KeyError). The Kubernetes driver's fallback uid isDEFAULT_SANDBOX_UID = 10001, so the exec user may not be the policy'srun_as_user: sandboxthere. Is "exec runs as the policy user" meant to be a conformance contract? If so, the Kubernetes driver may need a look. If not, resolve the name tolerantly and assert only the Landlock behaviour.provider_credentials::google_metadata_serves_placeholder_tokenandprovider_credentials_are_not_stored_in_sandbox_spec:provider create --type google-cloudand--type claude-codefail withprovider profile '…' not found; import a matching profile. They rely on profiles already being on the gateway. The two placement tests in the same file import an inline profile withinstall_provider, which works on every lane. Please do the same here.gateway-mtls::foreign_client_certificate_is_rejectedfails onubuntu-docker-rootful. I haven't looked at the cause.
Structure and direction
e2e/rust/tests/oidc_authz.rsadds about 1.2k lines to the legacye2e/rusttree, on rawopenshell-sdk, behinde2e-oidc-pkce. The direction elsewhere (#4891, #5137) is testkit-basedtests/suites/features/*suites on Keycloak, andkeycloak-provider-refreshalready exists there. Is the legacy location deliberate? Also, e2e/rust clippy doesn't enablee2e-oidc-pkce, so this file isn't linted in CI.- The mTLS refusal tests pass on any connect failure. A wrong port or a down gateway would also pass them. Please assert the specific TLS or gRPC error.
e2e/workload/is next toe2e/gpu/(task namese2e:workload:buildande2e:workloads:build), which is easy to confuse. A README line, or a clearer name, would help. The Dockerfile also still installscloudpickle,google-auth,requestsand a uv venv, which served the removed SDK tests. Trimming it would shrink an image that is loaded into every environment.- #5442 edits
testkit/src/context.rs,conformance/src/lib.rs,e2e-suites.yml,TESTING.mdand the testkit README. Whichever merges second will need a rebase.
On lane cost: only about four of the new conformance tests start sandboxes (about 16–19s each on k3s), and the rest take milliseconds. I don't see a problem there.
@matthewgrossman: could you take a look at points 1 and 4? They concern where the OIDC tests belong (legacy e2e/rust or a testkit features suite) and whether "exec runs as the policy user" is a conformance contract.
a5bb28b to
f0e945f
Compare
|
Thanks for taking this on. Answering Evan's two questions for me, plus one coordination note. 1. Is "exec runs as the policy user" a conformance contract? No, not across drivers. The Sandbox User Identity docs say Docker and Podman take Separately, those docs say the Kubernetes default is UID 1000, but the driver falls back to 10001. That's a docs and driver mismatch, not something this PR needs to fix. 4. Where the OIDC tests go. Please don't add them to #5731 (PR7 in the #5297 plan) has started. It ports the existing Shared helpers. #5691 merged. It moved the in-sandbox client layer into testkit and
testkit also rejects sandbox names over 19 characters (5 for the suffix after Also, #5665 dropped its config-push environment, so #5622 owns that one. |
…ored spec Suites that check the gateway's TLS boundary need the CA and client certificate testkit already found for the gateway, and suites that check what the gateway persists need the stored sandbox spec. Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
… suites Ports the cases from e2e/python that had no Rust coverage into the conformance suite, so they run on every compute driver instead of only the Docker Python lane: - policy_validation: create refuses root, path traversal, a writable / and ambiguous endpoint pinning; MCP endpoints get the default version. - policy_enforcement: Landlock read/write/deny matrix, the policy user, cross-directory renames (Landlock refer), and EPERM/EACCES for connections no rule allows. - provider_credentials: credentials refused outside their profile placement, the Google Cloud metadata server's placeholder token, unknown providers, and credentials kept out of the stored spec. Refs #5435 Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Ports e2e/python/test_security_tls.py: a client certificate from the gateway's CA authenticates a user, a CA-only client reaches only Health, and a foreign certificate or plaintext connection is refused. Refs #5435 Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Every case in e2e/python now maps to Rust coverage or an explicit drop (#5435). The SDK-client suites (exec admission, sandbox API, exec_python, workspace API) run in ai-openshell/sdk-python against published core gateways. - Delete e2e/python and the e2e:python and e2e:oidc-python:docker tasks; e2e no longer depends on python:proto or PYTHONPATH=python. - Move the workload image's Dockerfile to e2e/workload/Dockerfile. The image tag and contents are unchanged; testkit, the Rust harness and tmachine keep using openshell/e2e-python:dev. - Docker E2E: replace the python and oidc-python rows with gateway-mtls, drop the python:proto setup step, and run oidc_authz in the oidc-pkce lanes. Add a gateway-mtls row on the deb tmachine gateway. - Update TESTING.md and the testkit docs. Refs #5435; python/ itself is removed by #5287. Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Import the built-in provider profiles the conformance tests use instead of assuming a gateway has them, run the MCP default-version sandbox from the Python image so Podman finds the policy's user, and make the mTLS refusal tests assert a transport error after a CA-only control reaches Health. Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
… check Build the ported sandboxes with the SandboxBuilder (image, providers, create_ready) instead of a local helper, read probe results with run_python and last_json, probe TCP denials with sandbox_clients_support's connect, and send the placement requests with its http probe. TEST_HOST comes from host_server_support. The Landlock test no longer asserts which user exec runs as. Docker and Podman take it from the policy, but Kubernetes and the VM driver choose it through driver configuration, so it isn't a cross-driver contract. Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
…fusal On loopback, a TLS gateway also serves plaintext HTTP that routes only sandbox services. A plaintext gRPC Health call gets a bare 404, which tonic maps to Unimplemented without a grpc-status header. No RPC ran, so treat exactly that answer as a refusal alongside transport errors. Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
f0e945f to
51173c4
Compare
|
Thanks @matthewgrossman. Rebased onto main and addressed all three:
The Locally against Docker: the three conformance modules pass 10/10 and |
The conformance program check requires every testkit test target to opt out of the libtest harness explicitly, as the other feature suites do. Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com> # Conflicts: # tests/testkit/testkit/src/provider.rs
Drop cloudpickle, google-auth, requests, pip and the python3-pip and python3-venv packages, which only the removed Python SDK tests used. Keep the uv interpreter, the venv and the system python3, whose paths test policies allow. Rename e2e:workload:build to e2e:python-image:build so it no longer differs from the GPU suite's e2e:workloads:build by one letter, and add a README that tells the two apart. Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
|
@elezar, thanks for the review. All seven points are addressed. CI passed on 48758b1; it is running now for ae434ba, which follows 2f13a13's image trim for point 6. The conformance suite passes 87/87 locally against Docker and Podman with the trimmed image. CI failures
Structure and direction
|
The e2e/rust OTLP relay tests post spans with requests and assert on its ConnectionError, so the trim broke them on the Docker and Podman lanes. Install only requests into the venv; cloudpickle, google-auth and pip stay out. Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com> # Conflicts: # tests/suites/features/Cargo.toml
…ct-resolution-f23dad Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com> # Conflicts: # tests/suites/features/Cargo.toml
matthewgrossman
left a comment
There was a problem hiding this comment.
Thanks, the new tests look solid. I checked the JUnit from the last full run: all ten pass on Docker, Podman rootful/rootless, k3s, k3s-ha, IPv6 and VM. The latest merge fixed the features/Cargo.toml conflict. A few things before this can go in:
- Please add README rows to
tests/suites/conformance/README.mdforpolicy-validation,policy-enforcementandprovider-credentials, and addprovider-credentialsto the paragraph about suites that reachhost.openshell.internal. - The sdk-python copies run only against a pinned release (
OPENSHELL_CORE_REF = "v0.1.10"), as a non-required job, and nothing in core triggers them. So for core they're not coverage. Most of those tests check gateway behavior: exec admission reasons, request-id replay, cross-workspace listing, workspaceNOT_FOUND. Could you either port those cases to conformance, or file an issue for them and fix the PR body? - OIDC: after #5787, 14 of the 30 Python OIDC tests still have no E2E coverage, and three (platform admin profile RPCs, platform admin global policy reads, the CI client-credentials token) have no targeted test anywhere. #5787 leaves client credentials to this PR and this PR leaves it to the follow-up. Please file a tracking issue listing the uncovered cases before this merges.
- The mapping table needs a few fixes:
host_gateway_alias.rshas no provider tests, andprovider_readiness.rs,stable_external_placeholders.rsandtransparent_tcp.rsare ine2e/rust, which we're deleting. After that, attach to a running sandbox andx-api-keyplacement have no E2E coverage.
I'd like #5787 and #5657 to land first; both touch gateway.rs (mtls_dir) and conformance/src/lib.rs.
On the current run, the three red checks look unrelated: an HTTP 618 download error (podman-external-driver), a protoc checksum mismatch (kubernetes-external-driver), and openshell-server connect_store_serves_probes_while_the_database_is_unreachable in Rust test, which this PR doesn't touch.
|
|
||
| /// Create a long-running sandbox from the Python image with `policy` and | ||
| /// `providers`. | ||
| async fn python_sandbox( |
There was a problem hiding this comment.
cx.python_sandbox(suffix, policy).providers(..) does this already; same for policy_enforcement.rs:19.
| } | ||
|
|
||
| /// The provider token's placeholder, as the sandbox's environment holds it. | ||
| async fn provider_token(sandbox: &Sandbox) -> Result<String> { |
There was a problem hiding this comment.
Same as credential_gating.rs:497. Could this go in testkit?
|
|
||
| /// Whether `value` is a credential placeholder for the environment variable | ||
| /// `key`: the plain form, or a versioned or stable one ending in `_<key>`. | ||
| fn is_placeholder_for(value: &str, key: &str) -> bool { |
There was a problem hiding this comment.
#5657 adds another is_placeholder_for, and it accepts only v placeholders. Could we move one version, with PLACEHOLDER_PREFIX, into testkit and use it from both?
| /// The built-in profiles these tests need. A gateway starts without profiles, | ||
| /// so each test imports the one it uses. | ||
| const GOOGLE_CLOUD_PROFILE: &str = include_str!("../../../../providers/google-cloud.yaml"); | ||
| const CLAUDE_CODE_PROFILE: &str = include_str!("../../../../providers/claude-code.yaml"); |
There was a problem hiding this comment.
Importing claude-code under its built-in ID means a killed run leaves it behind, and on a gateway that already has it, cleanup deletes the operator's profile. Could this test use a profile with a cx.name() ID? google-cloud has to keep its ID, I know.
| _ => " auth_style: bearer\n header_name: authorization\n", | ||
| }; | ||
| let provider = cx.name(suffix); | ||
| let profile = format!( |
There was a problem hiding this comment.
Could this use testkit::Profile/Credential (adding a query_param setter if needed) instead of YAML by hand?
| .sandbox("mcp") | ||
| .policy(mcp) | ||
| .spec(|spec| spec.image = Some(testkit::python_image())) | ||
| .create() |
There was a problem hiding this comment.
This took about 50s on Podman rootless and about 1s everywhere else. Probably the delete of a sandbox that isn't ready yet. Worth a look.
| let result = |probe: &str| probes.get(probe).and_then(Value::as_str); | ||
| let refused = |probe: &str| { | ||
| result(probe).is_some_and(|result| { | ||
| matches!(result, "EACCES" | "EPERM") || result.starts_with("ERROR:") |
There was a problem hiding this comment.
Can we accept only EACCES or EPERM here? ERROR: takes any errno.
| type: string | ||
| default: >- | ||
| [{"suite":"python","cmd":"mise run --no-deps --skip-deps e2e:python","apt_packages":"","python_proto":true,"mcp":false},{"suite":"oidc-python","cmd":"mise run --no-deps --skip-deps e2e:oidc-python:docker","apt_packages":"","python_proto":true,"mcp":false},{"suite":"oidc-pkce-docker","cmd":"mise run --no-deps --skip-deps e2e:oidc-pkce:docker","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"rust-docker","cmd":"mise run --no-deps --skip-deps e2e:rust","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"rust-docker-push","cmd":"mise run --no-deps --skip-deps e2e:rust:push","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"oci-image","cmd":"mise run --no-deps --skip-deps e2e:oci-image","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"additional-ca","cmd":"OPENSHELL_E2E_DOCKER_TEST=additional_ca mise run --no-deps --skip-deps e2e:docker","apt_packages":"openssh-client","python_proto":false,"mcp":false},{"suite":"middleware-http-hooks","cmd":"mise run --no-deps --skip-deps e2e:middleware-http-hooks","apt_packages":"","python_proto":false,"mcp":false},{"suite":"mcp","cmd":"mise run --no-deps --skip-deps e2e:mcp","apt_packages":"","python_proto":false,"mcp":true}] | ||
| [{"suite":"oidc-pkce-docker","cmd":"mise run --no-deps --skip-deps e2e:oidc-pkce:docker","apt_packages":"openssh-client","mcp":false},{"suite":"rust-docker","cmd":"mise run --no-deps --skip-deps e2e:rust","apt_packages":"openssh-client","mcp":false},{"suite":"gateway-mtls","cmd":"mise run --no-deps --skip-deps e2e:gateway-mtls","apt_packages":"","mcp":false},{"suite":"rust-docker-push","cmd":"mise run --no-deps --skip-deps e2e:rust:push","apt_packages":"openssh-client","mcp":false},{"suite":"oci-image","cmd":"mise run --no-deps --skip-deps e2e:oci-image","apt_packages":"openssh-client","mcp":false},{"suite":"additional-ca","cmd":"OPENSHELL_E2E_DOCKER_TEST=additional_ca mise run --no-deps --skip-deps e2e:docker","apt_packages":"openssh-client","mcp":false},{"suite":"middleware-http-hooks","cmd":"mise run --no-deps --skip-deps e2e:middleware-http-hooks","apt_packages":"","mcp":false},{"suite":"mcp","cmd":"mise run --no-deps --skip-deps e2e:mcp","apt_packages":"","mcp":true}] |
There was a problem hiding this comment.
The tmachine row already runs gateway-mtls, and this row depends on with-docker-gateway.sh, which we're removing. Can we drop it?
…ct-resolution-f23dad Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com> # Conflicts: # TESTING.md # tests/suites/conformance/src/lib.rs # tests/testkit/testkit/src/gateway.rs
Move the provider placeholder check, PLACEHOLDER_PREFIX and reading an environment variable from a sandbox into testkit, and add a query_param setter to testkit::Credential. Use them, and cx.python_sandbox(), in place of per-file copies in provider_credentials, policy_enforcement, credential_gating, providers and corporate_proxy. Build the placement test's profile with testkit::Profile, and give the spec test its own profile ID instead of importing claude-code under its built-in ID. Add the x-api-key header placement case and an attach and detach test, which had E2E coverage only in suites being removed. Accept only EACCES and EPERM as Landlock refusals. Wait until the MCP default-version sandbox is ready, since deleting a provisioning sandbox takes about 50s on rootless Podman. Drop the gateway-mtls Docker E2E row and its mise task, which relied on with-docker-gateway.sh; the tmachine row runs the suite. Add README rows for the new conformance modules. Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Summary
The Python SDK has moved to ai-openshell/sdk-python, and core is removing its copy in
python/(#5287). Core's Python E2E suites still import the SDK frompython/, sopython/can't be removed yet.This PR ports the coverage of those suites to Rust, so core keeps it without depending on Python. It then deletes
e2e/python/. The suites that test SDK client behavior (exec_admission,sandbox_api,sandbox_exec_pythonandworkspace_api) aren't ported. sdk-python already runs copies of them against core gateways.The ported tests cover:
Related Issue
Closes #5435. Unblocks #5287.
Changes
tests/suites/conformancecover policy validation, policy enforcement and provider credentials. They run on every driver lane.tests/suites/features/gateway-mtlssuite covers mTLS.e2e/python/oidc) aren't ported here. They move totests/suites/features/oidc-authin a follow-up, on the Keycloak helpers from test(e2e): port OIDC authorization tests from e2e/rust to features/oidc-auth #5731 (test(oidc-auth): port the OIDC authorization tests to testkit #5787), rather than intoe2e/rust, which is being retired (test(e2e): decide which e2e/rust tests to port and in what order #5297). Until then core has no E2E coverage for them.Gateway::mtls_dir()andSandbox::spec().e2e/python/, its mise tasks and its CI rows. The workload image's Dockerfile moves toe2e/workload/Dockerfile; the Rust tests still use it.Case-by-case mapping
test_policy_validation.pygrpc/policy.rstest_sandbox_policy.pye2e/rust/tests/transparent_tcp.rstest_sandbox_landlock.pyfilesystem_policy.rscovers device paths and path replacementtest_sandbox_venv.pyENVpropagation: driver unit testsPATH(asserts the fixture image, not product behavior);pip/uvinstalls (need live PyPI)test_security_tls.pytest_sandbox_providers.pycredential_gating.rs,provider_auto_create.rs. Attach/detach:provider_readiness.rs. Imported profiles:host_gateway_alias.rs,stable_external_placeholders.rs. Update/merge semantics, the other placement styles (includingpath_subtreefrom #5675), and profile scoping: server and core unit testsgit clone(needs github.com); real google-auth SDK compatibility (needs google-auth in every lane's image)oidc/oidc_auth_test.pyfeatures/oidc-authoidc_pkce.rsoidc/workspace_authz_test.pyfeatures/oidc-authGetSandboxLogswith a spoofed workspace (the same scenario is unit-tested ingrpc/policy.rs)exec_admission,sandbox_api,sandbox_exec_python,workspace_apitests/e2eTesting
mise run pre-commitpasses (the pre-commit hook ranrust:formatandrust:linton each commit; I didn't run the full task)Local runs against a Docker gateway, after rebasing onto current main:
policy_enforcement,policy_validation,provider_credentials): 10/10gateway-mtls: 4/4Clippy with
-D warningspasses on the conformance andgateway-mtlsworkspaces. The Podman, Kubernetes, VM and tmachine lanes haven't run locally, so CI covers them.Known limit: a plaintext client counts as refused when the connection fails, or when the gateway's loopback plaintext router answers with a bare HTTP 404. That router serves only sandbox services, so no RPC runs.
Checklist