feat(pem): add authenticated direct-query gRPC endpoint - #2401
Open
entlein wants to merge 1 commit into
Open
Conversation
entlein
had a problem deploying
to
pr-actions-approval
August 10, 2026 14:22 — with
GitHub Actions
Error
Exposes VizierService.ExecuteScript directly on the normal PEM over
a dedicated port (:50305 default), so node-local clients can query
Carnot without a broker hop or cloud dependency.
The feature is opt-in (--direct_query_enabled=false by default) so
existing PEM deployments are byte-for-byte unchanged until opted in.
A compile-time kill switch (--//src/vizier/services/agent/pem:direct_query=disabled)
removes the feature entirely from the binary.
Changes:
direct_query_server.{h,cc} (new)
- DirectQueryServer implements api::vizierpb::VizierService::ExecuteScript
against the live PEM Carnot (reusing its table_store + metadata callback).
- AuthenticateRequest: HS256 JWT verifier via BoringSSL HMAC + rapidjson.
Requires aud=vizier, iss=PL, Scopes=service, valid exp.
Defends against alg:none, wrong-key, expired, tampered-payload attacks.
- Fail-soft startup: init failure never brings the PEM data plane down.
- ExecuteScript only; mutations return UNIMPLEMENTED.
direct_query_server_test.cc (new)
- In-process gRPC fixture exercises the full auth metadata flow.
- Auth-negative cases: no token, wrong key, expired, alg:none, truncated,
tampered header/payload/sig, wrong aud/iss/scope.
- Execution cases: trivial query, projection, time-range, join, concurrent.
BUILD.bazel (modified)
- config_setting(:direct_query_disabled) for compile-time kill switch.
- New deps on //src/carnot, @boringssl//:crypto, @rapidjson.
- New pl_cc_test(:direct_query_server_test).
pem_manager.{h,cc} (modified)
- MaybeStartDirectQueryServer() builds and starts the gRPC server after
broker registration; StopImpl tears it down.
- Flags: --direct_query_enabled (default false), --direct_query_port
(default 50305), --direct_query_jwt_signing_key.
shared/manager/manager.cc (modified)
- Empty-key guard at Manager::Init: refuses an empty PL_JWT_SIGNING_KEY
rather than crashing mid-stream on the first service call.
DIRECT_QUERY_CONTRACT.md, DIRECT_QUERY_SECURITY.md (new)
- Behavioral spec, auth requirements, threat model, key-flow diagram,
tampering test matrix, TLS transport details, disable instructions.
Signed-off-by: entlein <einentlein@gmail.com>
entlein
force-pushed
the
feat/pem-direct-query
branch
from
August 10, 2026 14:27
86713e2 to
7f63749
Compare
entlein
requested a deployment
to
pr-actions-approval
August 10, 2026 14:28 — with
GitHub Actions
Waiting
entlein
marked this pull request as ready for review
August 11, 2026 09:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Exposes VizierService.ExecuteScript directly on the normal PEM over a dedicated port (:50305 default), so node-local clients can query Carnot without a broker hop or cloud dependency.
The feature is opt-in (--direct_query_enabled=false by default) so existing PEM deployments are byte-for-byte unchanged until opted in. A compile-time kill switch (--//src/vizier/services/agent/pem:direct_query=disabled) removes the feature entirely from the binary.
Changes:
direct_query_server.{h,cc} (new)
direct_query_server_test.cc (new)
BUILD.bazel (modified)
pem_manager.{h,cc} (modified)
shared/manager/manager.cc (modified)
DIRECT_QUERY_CONTRACT.md, DIRECT_QUERY_SECURITY.md (new)