Skip to content

layers: move common-svc's auth into pplx-space-rpc-auth - #1516

Merged
ac-pplx merged 1 commit into
mainfrom
ac/rpc-auth
Nov 6, 2026
Merged

ac-pplx merged 1 commit into
mainfrom
ac/rpc-auth

Conversation

@ac-pplx

@ac-pplx ac-pplx commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Moves common-svc's auth module, template_lookup and the auth_layer_e2e test into a new l40_api crate, pplx-space-rpc-auth (crates/l40_api/rpc/auth). This is the first of three PRs that delete pplx-space-common-svc. The code moves unchanged apart from paths. Dependents import rpc-auth and kube-client directly. Their k8s, test-hooks and test-support features now enable the owning crates' features (rpc-auth/*, api-route/test-support, ecw-credential/test-support). common-svc drops auth, template_lookup, kube_client, and its k8s, test-support and test-hooks features (nothing left in it reads a test hook). Every binary that installs an auth layer needing TokenReview (api, internal-api, node-api, build-manager) gets rpc-auth/k8s in every release and Kind build. credmgr takes rpc-auth without k8s, since nothing it uses is gated on it; node-ctl-server takes SpaceBearerInterceptor from bearer-token and needs no rpc-auth; both take kube-client directly. The isolated-crates job now lints rpc-auth alone (it is added to ALSO in ci/scripts/lib/rust-isolated-crates.sh), which covers its build without k8s.

Event targets change for 19 events without an explicit target: pplx_space_common_svc::auth[::k8s|::build|::build::k8s] → pplx_space_rpc_auth[::…] (k8s.rs 9, build/k8s.rs 5, lib.rs 3, build.rs 1), and pplx_space_common_svc::template_lookup → pplx_space_rpc_auth::template_lookup (1). Metrics, spans, fields and wire format are unchanged.

Validation

  • cargo check --workspace --all-targets, and each touched crate alone with --all-targets.
  • Feature builds: rpc-auth with k8s, test-support, test-hooks and all three; api, internal-api-server and node-ctl-server with kubernetes; node-api-server and build-mgr-server with k8s,test-hooks; internal-api-svc and node-api-svc with k8s.
  • The CI entrypoints on this head against current main: clippy and isolated-crates pass; docs and Python tests pass; Rust tests fail only 40 tests that need process permissions the validation host lacks and that fail the same way on main.
  • Workspace clippy with all targets and all features, and common-svc's two CI clippy runs.
  • nextest: rpc-auth 81/81 with all features, 23/23 with default features. Dependents 7303/7306, and 4554/4555 with the Kubernetes features.
    • Two failures also fail on main at 88f9f3e: api routes::e2b::tests::detail_reports_authoritative_federated_ownership_not_metadata (snapshot) and net-gateway …interception_exemptions_relay_original_tls_only_after_admission.
    • common-svc::logging_process failed once under load and passes when run alone.
  • Dependency graphs are identical to main except for rpc-auth and common-svc's dropped k8s.
  • cargo arch: no required findings and no baseline change.

Severity and risk

Severity: does not apply (refactor). Risk: a feature remap that stops enabling TokenReview auth in a binary. The graph comparison shows rpc-auth/k8s in every binary that installs an auth layer needing TokenReview. Roll back by reverting.

Rollout

A downstream mirror that enables the removed pplx-space-common-svc/k8s feature needs the same one-line change:
drop it. pplx-space-internal-api-server/kubernetes already enables common-svc's k8s before this change and
rpc-auth's k8s after it, so dropping the line first is safe on either side of this change.

Stack

  1. This PR. 2. layers: move common-svc's SQL into postgres-pool and sandbox-residency #1574 (postgres-pool and sandbox-residency). 3. layers: delete pplx-space-common-svc #1575, which deletes common-svc.

AI assistance: Claude Code made the code changes and drafted this description.

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Explain Change →

Automatic approval withheld

Automatic approval is disabled by the configured approval policy for this pull request. Review comments and requests for changes continue normally.

Commit: 40c6a00b1f61.

No actionable comments were generated in the recent review.

Walkthrough

The change moves RPC authentication and template lookup code from common-svc into a dedicated crate. API, build, node, template, sandbox, and credential-manager services update their dependencies and imports. Kubernetes client usage moves to pplx-space-kube-client. Common-svc removes the extracted modules, features, and dependencies. CI paths and source-reference comments are updated.

Possibly related PRs

  • perplexityai/SPACE#1515: Moves authentication and template lookup metrics into common-svc, including modules relocated by this change.
Merge Risk: High · up to 40c6a

RPC privilege checks move to a new crate. The move warrants high-risk handling despite no identified authorization failure.

Security architecture risk: Low · up to 40c6a

The inspected authentication and publication paths preserve their authorization checks. No introduced security regression was established, but verification of release configurations and deployed monitoring remains incomplete.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The relevant security scope spans shared RPC identity decisions, privileged template publication, and artifact transfer, including private releases. Compromise of an authorized service credential or local service identity remains consequential, but the inspected changes do not demonstrate broader caller authority or tenant reach than the base.

Trust Boundaries and Controls

  • observed — Forwarded template export retains two distinct controls. Node API requires authenticated transfer authority and replaces caller-supplied grant metadata before forwarding. Template manager invokes its existing peer allowlist first, then requires the forwarded grant when the authorized principal is node-api. Root and permitted local operators remain separate privileged paths, as before this PR.

Resilience and Maintainability Implications

  • inferred — The extracted TokenReview cache preserves its security-relevant transitions: keys include token digest and audience, expired entries are rejected, same-key reviews coordinate through a claim, and dropping that claim wakes waiters on completion, error, or cancellation. Infrastructure failures are not negative-cached. Cleanup behavior follows guard ownership; concurrency and cancellation tests were not executed in this review.

Hardening Proposals

  • proposed — If deployed authentication alerts or log filters match tracing targets exactly, update them for the rpc-auth namespace. Implicit event targets change with the module path; external consumers were unavailable, so missed security telemetry is a possibility to verify, not an observed regression.
Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title identifies the auth migration and meets the required format.
Description Follows The Pr Template Passed The description includes a summary, validation commands and results, severity and risk, and an AI assistance line that identifies the tool and its contributions.
Bug Fixes Name A Regression Test Passed This PR is a refactor, not an application bug fix. The diff moves authentication code to pplx-space-rpc-auth and updates imports and feature mappings. The regression-test requirement does not apply.
Weakened Safeguards Are Justified Passed The moved tests retain their assertions and test registration. The Kind path changes follow the moved files. The ALSO entry adds isolated lint coverage, with a reason in the adjacent comment.
Public-Safe Content Passed The title, description, and diff contain no identified content that matches the check’s failure conditions. The token references in the diff are code identifiers, not credential values.
Recent review info

Automatic approval policy

Commit: 40c6a00b1f61.

Setting Effective value Source
Automatic approvals Disabled Override 4
Merge risk Low Override 2
Security risk Not set Global configuration

Matching overrides (numbered as in the resolved configuration):

  • Override 2 — any author; paths: **, !ui/**; merge risk: Low.
  • Override 4 — any author; paths: .coderabbit.yaml, .coderabbit.yml, coderabbit.yaml, coderabbit.yml, .coderabbit.config.ts, **/AGENTS.md, **/CLAUDE.md, .agents/**, .claude/**, .claude-plugin/**, CONTRIBUTING.md, docs/versioning.md, docs/rust/space-conventions.md, docs/rust/space-review-lessons.md, .github/**, ci/**, !ci/scripts/setup-nextest-*.sh, scripts/source_guards/**, scripts/check*, clippy.toml, deny.toml, .gitleaks.toml, .pre-commit-config.yaml, lefthook.yaml, rust-toolchain.toml, .cargo/**, supply-chain/**, pyproject.toml, uv.lock, **/package.json, **/package-lock.json, **/go.mod, **/go.sum, **/requirements*.txt, **/requirements*.in, proto/**, db/**, crates/l40_api/api/src/auth.rs, crates/l40_api/api/src/auth/**, crates/l40_api/api/src/middleware/auth*, crates/l40_api/api/src/middleware/auth/**, crates/l40_api/api/src/routes/authz.rs, crates/l10_foundation/bearer/**, crates/l10_foundation/rustls/**, crates/l10_foundation/guest/**, crates/l10_foundation/pii/**, shim/**, docker/**, !docker/Dockerfile.rust-build-kind, templates/**, infra/space/aws/**, infra/space/cluster/**, infra/space/identity/**, infra/space/observability/**, infra/space/packer/**, infra/space/kind/charts/**, LICENSE, SECURITY.md; automatic approvals: disabled.

Any matching disabled override withholds approval, regardless of risk. Otherwise, the strictest explicitly set limit wins for each score. Limits omitted by all matching overrides inherit the global configuration.

Not set means no limit was configured after inheritance. Use @coderabbitai configuration to inspect the resolved settings and their sources.

Run configuration

  • Source mode: Auto
  • Repository: perplexityai/SPACE
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 47f3aa3
  • Layers: Repository YAML; Enforced overrides: Organization
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 64647df4-03c6-41e3-b9de-461521165b5a
Commits

Reviewing files that changed from the base of the PR and between 5e91c88 and 40c6a00.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock, !**/Cargo.lock
Files selected for processing: 96

  • Cargo.toml
  • ci/kind-pull-paths.txt
  • ci/scripts/lib/rust-isolated-crates.sh
  • crates/l40_api/api/Cargo.toml
  • crates/l40_api/api/src/controllers/substrate/kubernetes/caches.rs
  • crates/l40_api/api/src/controllers/substrate/kubernetes/mod.rs
  • crates/l40_api/api/src/controllers/substrate/mod.rs
  • crates/l40_api/api/src/ingress_activation.rs
  • crates/l40_api/build/mgr/engine/Cargo.toml
  • crates/l40_api/build/mgr/engine/src/publish.rs
  • crates/l40_api/build/mgr/engine/src/publish/tests/republication.rs
  • crates/l40_api/build/mgr/engine/src/publish/tests/retry.rs
  • crates/l40_api/build/mgr/server/Cargo.toml
  • crates/l40_api/build/mgr/server/src/lib.rs
  • crates/l40_api/build/mgr/server/src/run.rs
  • crates/l40_api/build/mgr/server/src/tests.rs
  • crates/l40_api/build/mgr/server/src/tests/auth_rpc.rs
  • crates/l40_api/cluster/controller/server/Cargo.toml
  • crates/l40_api/cluster/controller/server/src/lib.rs
  • crates/l40_api/credmgr/server/Cargo.toml
  • crates/l40_api/credmgr/server/src/k8s_identity.rs
  • crates/l40_api/credmgr/server/src/run.rs
  • crates/l40_api/credmgr/server/src/tcp_auth.rs
  • crates/l40_api/internal/api/server/Cargo.toml
  • crates/l40_api/internal/api/server/src/adapter.rs
  • crates/l40_api/internal/api/server/src/data_plane_sessions.rs
  • crates/l40_api/internal/api/server/src/lib.rs
  • crates/l40_api/internal/api/server/src/template_publication.rs
  • crates/l40_api/internal/api/server/src/template_releases_store.rs
  • crates/l40_api/internal/api/server/src/tests.rs
  • crates/l40_api/internal/api/server/src/tests/prefetch_catalog.rs
  • crates/l40_api/internal/api/server/src/tests/publication/direct.rs
  • crates/l40_api/internal/api/server/src/tests/publication/rpc.rs
  • crates/l40_api/internal/api/server/src/tests/template_node_identity.rs
  • crates/l40_api/net/gateway/server/Cargo.toml
  • crates/l40_api/node/api/server/Cargo.toml
  • crates/l40_api/node/api/server/src/builder.rs
  • crates/l40_api/node/api/server/src/clients/build_tests.rs
  • crates/l40_api/node/api/server/src/clients/policy_auth_tests.rs
  • crates/l40_api/node/api/server/src/clients/template_auth_tests.rs
  • crates/l40_api/node/api/server/src/clients/template_transfer_auth_tests.rs
  • crates/l40_api/node/api/server/src/lib.rs
  • crates/l40_api/node/api/server/src/template_lookup.rs
  • crates/l40_api/node/api/server/src/transfer.rs
  • crates/l40_api/node/api/server/src/worker.rs
  • crates/l40_api/node/api/server/src/worker/tests.rs
  • crates/l40_api/node/ctl/server/Cargo.toml
  • crates/l40_api/node/ctl/server/src/kubernetes_controller/mod.rs
  • crates/l40_api/node/ctl/server/src/lib.rs
  • crates/l40_api/rpc/auth/Cargo.toml
  • crates/l40_api/rpc/auth/src/build.rs
  • crates/l40_api/rpc/auth/src/build/direct.rs
  • crates/l40_api/rpc/auth/src/build/k8s.rs
  • crates/l40_api/rpc/auth/src/build/k8s/tests.rs
  • crates/l40_api/rpc/auth/src/build/tests.rs
  • crates/l40_api/rpc/auth/src/k8s.rs
  • crates/l40_api/rpc/auth/src/k8s/review_cache.rs
  • crates/l40_api/rpc/auth/src/k8s/tests.rs
  • crates/l40_api/rpc/auth/src/lib.rs
  • crates/l40_api/rpc/auth/src/node_identity.rs
  • crates/l40_api/rpc/auth/src/template.rs
  • crates/l40_api/rpc/auth/src/template/tests.rs
  • crates/l40_api/rpc/auth/src/template_lookup.rs
  • crates/l40_api/rpc/auth/src/template_transfer.rs
  • crates/l40_api/rpc/auth/src/template_transfer/tests.rs
  • crates/l40_api/rpc/auth/src/test_support.rs
  • crates/l40_api/rpc/auth/src/tests.rs
  • crates/l40_api/rpc/auth/tests/auth_layer_e2e.rs
  • crates/l40_api/sbx/mgr/server/Cargo.toml
  • crates/l40_api/sbx/mgr/server/src/service/create_support.rs
  • crates/l40_api/sbx/mgr/server/src/service/grpc_core.rs
  • crates/l40_api/sbx/mgr/server/src/service/grpc_core/create_after_lookup_tests.rs
  • crates/l40_api/sbx/mgr/server/src/service/grpc_core/create_environment_tests.rs
  • crates/l40_api/sbx/mgr/server/src/service/grpc_core/create_template_lookup_tests.rs
  • crates/l40_api/sbx/mgr/server/src/service/grpc_pool_wait_clone/tests.rs
  • crates/l40_api/sbx/mgr/server/src/service/network_policy.rs
  • crates/l40_api/sbx/mgr/server/src/snapshot_restore/tests.rs
  • crates/l40_api/template/mgr/server/Cargo.toml
  • crates/l40_api/template/mgr/server/src/service/lookup.rs
  • crates/l40_api/template/mgr/server/src/service/tests/lookup_rpc.rs
  • crates/l40_api/template/mgr/server/src/service/transfer.rs
  • crates/l40_api/template/mgr/server/src/volume.rs
  • crates/l40_api/template/mgr/server/src/volume/tests/catalog.rs
  • crates/l50_app/internal/api/svc/Cargo.toml
  • crates/l50_app/node/api/svc/Cargo.toml
  • crates/libs/common/svc/Cargo.toml
  • crates/libs/common/svc/src/lib.rs
  • infra/space/kind/charts/space-api-local/templates/deployment.yaml
  • infra/space/kind/charts/space-api-local/values.yaml
  • infra/space/kind/charts/space-build-manager-local/templates/daemonset.yaml
  • infra/space/kind/charts/space-build-manager-local/values.yaml
  • infra/space/kind/charts/space-internal-api-local/templates/deployment.yaml
  • infra/space/kind/charts/space-node-api-local/templates/daemonset.yaml
  • infra/space/kind/charts/space-node-api-local/values-builder.yaml
  • infra/space/kind/charts/space-node-api-local/values.yaml
  • infra/space/kind/charts/space-node-service/templates/_helpers.tpl
Files with no reviewable changes: 12

  • crates/l40_api/rpc/auth/src/tests.rs
  • crates/libs/common/svc/Cargo.toml
  • crates/l40_api/net/gateway/server/Cargo.toml
  • crates/l40_api/rpc/auth/src/build.rs
  • crates/l40_api/rpc/auth/src/template/tests.rs
  • crates/l40_api/rpc/auth/src/template_lookup.rs
  • crates/l40_api/rpc/auth/src/template.rs
  • crates/l40_api/rpc/auth/src/test_support.rs
  • crates/l40_api/rpc/auth/src/node_identity.rs
  • crates/l40_api/rpc/auth/src/build/tests.rs
  • crates/l40_api/rpc/auth/src/build/direct.rs
  • crates/libs/common/svc/src/lib.rs
Files skipped from review as they are similar to previous changes: 9

  • infra/space/kind/charts/space-node-service/templates/_helpers.tpl
  • infra/space/kind/charts/space-internal-api-local/templates/deployment.yaml
  • infra/space/kind/charts/space-api-local/values.yaml
  • infra/space/kind/charts/space-build-manager-local/templates/daemonset.yaml
  • infra/space/kind/charts/space-api-local/templates/deployment.yaml
  • infra/space/kind/charts/space-build-manager-local/values.yaml
  • infra/space/kind/charts/space-node-api-local/values.yaml
  • infra/space/kind/charts/space-node-api-local/values-builder.yaml
  • infra/space/kind/charts/space-node-api-local/templates/daemonset.yaml

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 0 remain after this review.

@github-actions github-actions Bot added the triage:pending Waiting for a maintainer to triage label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Thanks for opening this pull request! A SPACE maintainer will take a look.

CONTRIBUTING.md explains how we review outside contributions.

@shehan-pplx shehan-pplx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed by Shehan's Review Bot

Comment thread crates/l40_api/rpc/auth/src/lib.rs Resolved
Moves common-svc's `auth` module, `template_lookup` and the
`auth_layer_e2e` test into a new l40_api crate, pplx-space-rpc-auth
(crates/l40_api/rpc/auth), as part of deleting common-svc. The code
moves unchanged apart from paths: `crate::auth::` becomes `crate::`,
`pub(in crate::auth)` and the root module's `pub(super)` become
`pub(crate)`, and the common-svc re-exports it used are replaced by
their owning crates.

common-svc drops the module, its `k8s`, `test-support` and
`test-hooks` features and the `kube_client` re-export; nothing left in
it reads a test hook. Dependents now take:

- `pplx_space_rpc_auth` for the auth layers and `template_lookup`;
- `pplx-space-kube-client` directly (optional behind `kubernetes`
  where kube is optional);
- `rpc-auth/k8s`, `rpc-auth/test-hooks` and `rpc-auth/test-support`
  where they enabled the common-svc features for auth, and
  `api-route/test-support` and `ecw-credential/test-support` where
  their tests use those helpers.

node-ctl-server takes `SpaceBearerInterceptor` from
pplx-space-bearer-token, its owner, instead of through rpc-auth.

The isolated-crates job lints rpc-auth alone (its ALSO list), so its
build without `k8s`, which no release binary uses, is still linted.
@ac-pplx
ac-pplx added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit a491bce Nov 6, 2026
44 checks passed
@ac-pplx
ac-pplx deleted the ac/rpc-auth branch November 6, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage:pending Waiting for a maintainer to triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants