Repository navigation
Conversation
Wrap GET /_ts/admin/ec/{id} and GET /_ts/admin/eids so operators no
longer pass the admin password to curl. Both commands read the password
from TRUSTED_SERVER_ADMIN_PASSWORD only, check the EC ID or cookie values
locally before sending, explain 401/404/501, and print response data to
standard output only.
Extract the admin transport from ts cache purge into a shared
admin_client module (service URL checks, password source, no redirects,
401 hint) and move purge onto it, so #1430's ts keys commands can reuse
it.
Closes #1432
This branch has not been deployed
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.
Summary
ts ec show <ec-id>andts ec eids [--ts-eids] [--shared-id], which wrapGET /_ts/admin/ec/{id}andGET /_ts/admin/eids. Operators no longer pass the shared admin password tocurl, where it lands in shell history andps, and no longer build aCookieheader by hand.ts cache purgeinto a sharedadmin_clientmodule and switch purge to it. The module handles service URL checks, the password fromTRUSTED_SERVER_ADMIN_PASSWORDonly, no redirects, a 30s timeout and the 401 hint. Add ts keys rotate and ts keys deactivate commands #1430 has no PR yet; itsts keyscommands can reuse this client instead of copying it.Changes
crates/trusted-server-cli/src/admin_client.rserror_text()for refusals; URL tests moved here from purgecrates/trusted-server-cli/src/commands/cache/{mod,purge}.rscrates/trusted-server-cli/src/commands/ec/mod.rsts ecsubcommands, args (a clap group requires at least one cookie), shared helperscrates/trusted-server-cli/src/commands/ec/show.rsis_valid_ec_idbefore sending; summary of tombstone state, auction EIDs and skipped IDs with reasons;--jsonpassthrough; 404/501/401 hintscrates/trusted-server-cli/src/commands/ec/eids.rsCookieheader; refuses;, whitespace, control and non-ASCII characters without echoing the value; matched/unmatched summary;--jsoncrates/trusted-server-cli/src/{lib,run}.rs,commands/mod.rsts eccrates/trusted-server-cli/tests/ec_admin.rsdocs/guide/api-reference.mdcurlfallbackdocs/guide/cli.mddocs/superpowers/specs/2026-11-05-1432-ts-ec-admin-commands-design.mdBehavior notes for reviewers:
--jsonvalidates the body's shape. The body is parsed against the expected shape before printing, so a200login page from a proxy is refused rather than printed as the record. A parse failure reports only the line and column, becauseserde_json's message can quote a UID and CLI errors are logged.501hint names both causes. It says that only Fastly holds the identity graph, and only when an EC store is configured. Fastly also returns501withoutec.ec_store.192.0.2.1,2001:db8::1) in the loopback test moved frompurge.rsintoadmin_client.rs. Those lines were already inpurge.rs; moving them made the linter treat them as new.ps.--ts-eidsand--shared-idare flags, as the issue specifies. These are cookie values from the operator's own browser, not the admin password.Closes
Closes #1432
Spec
Spec:
docs/superpowers/specs/2026-11-05-1432-ts-ec-admin-commands-design.md. It has two agent review rounds in its review log; neither found anything blocking.Test plan
cargo test-fastly && cargo test-axum: not run; no adapter or core code changedcargo clippy-fastly && cargo clippy-axum: not run; no adapter or core code changedcargo fmt --all -- --checkcd docs && npm run format, plus the repo-wide Markdown prettier checkcargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1, used for the runtime checkfastly compute servecargo clippy-cliis clean on aarch64-apple-darwin. CI runs the Linux triple.cargo test --package trusted-server-cli --target aarch64-apple-darwin: 962 passed, 0 failed. This includes the newtests/ec_admin.rs(13 tests) and the unchangedtests/cache_purge.rs(9).ts dev lint domains --changed-vs origin/mainis clean.,instead of;fails the cookie-header test, and skipping EC ID validation fails the malformed-ID test.fastly compute serve(Fastly CLI 15.1.0 with its managed Viceroy 0.22.0; the repo pins 16.0.0 / 0.21.0) with seeded EC records, and against the Axum binary. It passed 31/31:showcovers a live record (auction EIDs, plusbidstream_disabledandnot_in_registryskips), a tombstone, a corrupt entry, 404, 401, and a malformed ID that sends no request.--jsonoutput is byte-identical tocurl's body.eidscovers matched and unmatched sources, a cookie-injection refusal and a bad base64 value.cache purge --allagrees withcurl.showreturns the 501 explanation,eidsworks, and purge is refused.Checklist
unwrap()in production code — useexpect("should ...")logmacros (notprintln!)