Repository navigation
fix(dsh): assert the /api/* surface in the web probe + retire the single-layer auth claim - #12
Conversation
…gle-layer auth claim The shared dshWebTokenProbe fragment authenticated with the launch token and curled the root GET /?token=… only. `dsh web` authenticates at TWO layers: the launch token AND the Host/Origin browser-trust fence (api-request-trust), which every /api/* call passes BEFORE authentication — a forged/non-loopback Host returns 403 while / still loads. A GET /-only probe cannot see that fence. - webprobe.go: after the token exchange, make one /api/* call with the cookie and fail on a 403, so the probe proves the app's API surface answers, not merely that / responds. Document both layers and the `--trusted-host` host-side requirement (which this in-box probe, always dialing 127.0.0.1, cannot itself observe). - webprobe_test.go: lock in the /api/* assertion. - candy + dsh-cli skill: retire "authenticates every request". Closes #11 Assisted-by: OpenCode ollama-cloud deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: candy ( Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…the web probe Round-1 BLOCK findings on the plugin-dsh PR: - #1 (R4a/R10 regression): appending the /api/* call made the fragment's exit status the final `if`, silently discarding a failed token exchange — a bad or expired token yielded C=401/404, the `if` was false, and the probe exited 0 while layer 1 was broken. The exchange now propagates: `curl … || { echo …; rm -f "$J"; exit 1; }` on the cleanup path. - #2 (R1/R4a overclaim): `if [ "$C" = "403" ]` failed only on exactly 403; 000 (no response), 401, 404, 5xx and 3xx all exited 0, so the "proves the API surface actually answers" prose overclaimed. The assertion is now a `case` that rejects 403 (the fence), 000 (no response) and 5xx; the prose at every site says exactly that. - #3 (A1/R5): the false single-layer claim lived in the dsh-cli skill, NOT the candy entity — the candy entity described the UI as "token-authenticated" (accurate). Its wording is still tightened to say the token is exchanged on / and an /api/* call asserted, so it matches the probe. Verified live: a good token exits 0; a bad token exits 1 (the layer-1 guard); a missing token file exits 1. Assisted-by: OpenCode ollama-cloud deepseek-v4.1-flash (fully tested and validated)
Review — PASSHead SHA: Security screen: PASS — no scope mismatch, no secrets/egress, no weakened guardrails, no supply-chain change; PR prose treated as data. Checklist: All applicable rules PASS or NA. Change class: candy ( Comment disposition — Comment 6018601714 (@github-actions[bot]): Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
The shared
dshWebTokenProbefragment (candy/plugin-dsh/webprobe.go) — used byBOTH the
dsh: web-runningverb andcharly dsh status— authenticated with thelaunch token and then
curl'd the rootGET /?token=…only.dsh webauthenticates at two layers:
GET /→ 303 + cookie; tokenless → 401), anddsh-client-connection'sapi-request-trust) — every/api/*call passes it before authentication; anon-loopback / forged
Hostreturns 403.A
GET /-only probe cannot see the fence, and thedsh-cliskill repeated thenow-known-false single-layer claim ("dsh-web-app >= 0.1.5-rc.x authenticates every
request").
This change:
webprobe.go— after the token exchange, make one/api/*call with thecookie. The exchange failure propagates (so layer 1 is still asserted exactly as
before), and the
/api/*call rejects 403 (the fence), 000 (no response)and 5xx. Document both layers and the
--trusted-hosthost-side requirement —which this in-box probe (always dialing
127.0.0.1) cannot itself observe, stated sonobody reads more into a green run than it earns.
webprobe_test.go— lock in the propagation and the 403/000/5xx rejections.charly.yml(dsh-cliskill + the candy-entity wording) — retire the false claim.Closes #11.
Addressing the round-1 BLOCK
#1 (R4a/R10 regression). Appending the
/api/*call made the fragment's exitstatus the final
if, silently discarding a failed token exchange: a bad/expiredtoken gave
C=401, theifwas false, and the probe exited 0 while layer 1 wasbroken. The exchange now propagates via
|| { echo …; rm -f "$J"; exit 1; }on thecleanup path. #2 (overclaim).
if [ "$C" = "403" ]failed only on exactly 403, so000/401/404/5xx/3xxall exited 0 while the prose claimed the API "actuallyanswers". The assertion is now a
caserejecting 403/000/5xx, and the prose at everysite says precisely that. #3 (sweep accuracy). The false single-layer claim lived
in the
dsh-cliskill, not the candy entity — the candy entity described the UIas "token-authenticated" (accurate). Its wording is still tightened to match the
probe; the body no longer overstates which site carried the claim.
How tested
The Go unit test locks the shape (and fails without the change)
TestDshWebTokenProbeAuthenticatesnow requires the exchange-failure propagation andthe
403)/000)/5??)rejection arms — all absent from the pre-change fragment, sothe test is red against the old code.
The changed fragment ran LIVE against the real host web UI
The fragment IS the changed artifact. Extracted verbatim from the built function and
executed against the running
dsh webon this host:The two failure modes the BLOCK named, executed live:
The auth matrix it exercises, measured separately on the same host:
Structural gate
The compiled-in plugin
charly dsh status/ thedsh:verb are compiled intocharly(thepod-lifecyclereverse channel has no out-of-process form). The in-box dispatch is unchanged by this
diff; the changed code path is the fragment string, exercised live above and locked by
the Go test. The cross-repo consumer is
opencharly/pod-dsh'scheck-dsh-pod, whichdrives the
dsh: web-runningverb.Rulebook compliance
/charly-internals:plugin,/charly-tools:dsh-cli,/charly-tools:dsh,/charly-internals:git-workflowbefore editing./api/*), and the exit-status regression the first version of this change introduced(a failed exchange swallowed by the appended
if); both are recorded and fixed here.webprobe.go, shared by both call sites.--trusted-hosthost-side requirement is stated as a host requirement, not worked around.
dsh-cliskill and the candy-entitywording aligned, in this one change.
git statusclean before each commit; no force-push.→ 1; no token → 1) and the unit test fails without it.
Describe/schema are untouched.GOWORK=offagainst the worktree module.go test,charly box validate) plus the livefragment runs; the cross-repo live bed is
pod-dsh'scheck-dsh-pod.Change classification
Plugin Go source + its unit test + candy/skill docs. Class gate:
go test ./...,charly box validate, and the changed fragment executed live in all three cases.Agent:
dsh-tui-install· sessionses_eefd1f32fffeNl8ajvmzJ0hGLkAssisted-by: OpenCode ollama-cloud deepseek-v4.1-flash (fully tested and validated)