Add /api/raw-query (read-only ClickHouse) + hud sql#8161
Conversation
hud CLI (tools/hud-cli/hud): wraps HUD APIs for humans (tables) and agents (--json). Commands: login (gh + gcx), trunk, pr, user, and a generic query over saved ClickHouse queries. Authed shim (pages/api/authed/[...path].ts): mirrors /api/* but validates a GitHub token, then forwards with the internal bypass header. Needs two Vercel firewall bypass rules (see README).
POST /api/raw-query runs an arbitrary read-only ClickHouse SELECT, gated by the internal bot token (so it's only reachable with a user identity via the /api/authed shim). Read-only enforced by the HUD read client, ClickHouse readonly=2, and a SELECT/WITH single-statement check; results capped. queryClickhouse gains an optional extraSettings arg (reused, backward compatible). hud CLI gets 'hud sql "SELECT ..."'.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Hi @wdvr! Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours needs attention. You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Stacked on #8156.
Adds an arbitrary read-only ClickHouse query endpoint and a
hud sqlcommand.POST /api/raw-query{ sql, params? }checkAuthWithApiToken), which only the/api/authedshim supplies after validating pytorch/pytorch write access. So the user-facing path is/api/authed/raw-query.readonly=2, and a SELECT/WITH single-statement check. Capped at 60s / 10k rows.hud sqlhud sql "SELECT name, conclusion FROM default.workflow_job ORDER BY completed_at DESC LIMIT 10"lib
queryClickhousegains an optionalextraSettingsarg (backward compatible) to passreadonlyetc.Note: gcx already offers raw read-only ClickHouse via the Grafana datasource; this makes the
hudCLI self-contained. Base is #8156's branch; will retarget to main once that merges.