Skip to content

files: provision-user CLI + anonymous public HTTP serving#58

Merged
ralyodio merged 2 commits into
mainfrom
feat/files-store-provisioning
Jun 25, 2026
Merged

files: provision-user CLI + anonymous public HTTP serving#58
ralyodio merged 2 commits into
mainfrom
feat/files-store-provisioning

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Why

The TronBrowser extension store (profullstack/tronbrowser.dev#5) needs to host publishers' .crx/.zip bundles on files.profullstack.com without making every dev run ssh join@ and use an SCP client. Two small additions make AgentBBS Files usable as that host.

What

  1. agentbbs provision-user CLI — registers a member from an SSH public key (an account is just handle + key fingerprint). Reuses SanitizeUsername (same rules as join@) + EnsureUser; Files/SFTP access is free for members, so the account can immediately:
    scp dist.crx files@files.profullstack.com:/public/extensions/<slug>/
    
    JSON output ({ok,name,fingerprint,store_id}); refuses on key/handle collision. New auth.FingerprintAuthorizedKey() parses an authorized_keys line to the same SHA256 fp as a live session key.
  2. Anonymous public HTTP — the files.<host> Caddy site (in setup.sh) now serves the shared /public area as unauthenticated, read-only static files (handle_path /public/*), so download links work for anyone. Maps 1:1 to the SFTP path; non-/public paths still hit the auth'd web manager. (Today's fileweb requires login even to download — wrong for shared artifacts.)
  3. Tests for the fingerprint helper; docs/files.md updated.

Provisioning trigger

The store SSHes to this host and runs provision-user with an operator key when a publisher submits their pubkey (decided with @chovy). No new HTTP endpoint — fits the existing CLI-subcommand pattern (grant-pod, mint-token, …).

⚠️ Build note

Not compiled in CI-of-record here: go.mod requires go 1.26 and my sandbox has 1.22.2, so go build/go test can't run. Changes pass gofmt parse + format checks and reuse existing store/auth APIs (EnsureUser, UserByFingerprint, ErrKeyMismatch, SanitizeUsername). Please run go build ./... && go test ./internal/auth/... before merge.

🤖 Generated with Claude Code

Lets external services (the TronBrowser extension store) host files on
files.profullstack.com without the interactive `ssh join@` onboarding.

- `agentbbs provision-user --name <h> --pubkey "<ssh key>"`: registers a member
  from an SSH *public* key (account = handle + key fingerprint). Reuses
  SanitizeUsername (same rules as join@) + EnsureUser; Files/SFTP access is free
  for members, so the account can immediately
  `scp … files@host:/public/extensions/<slug>/`. JSON output; refuses on key/
  handle collision. New auth.FingerprintAuthorizedKey() parses an
  authorized_keys line to the same SHA256 fp as a live session key (tested).
- setup.sh: the files.<host> Caddy site now serves the shared /public area as
  unauthenticated, read-only static files (handle_path /public/*), so .crx/.zip
  download links work for anyone — mapping 1:1 to the SFTP path. Non-/public
  paths still hit the auth'd web file manager.
- docs/files.md updated.

Note: not compiled here — repo go.mod requires go 1.26 and this sandbox has
1.22.2; changes pass gofmt parse/format checks. Reuses existing store/auth APIs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

`go test ./...` / `go vet ./...` fail on `wish.Println(… "…\n")` — Println
already appends a newline. Pre-existing on main (its CI is red for the same two
lines); surfaced here. Switched both to `wish.Print` with an explicit trailing
"\n\n" so output bytes are unchanged and vet is satisfied.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ralyodio ralyodio merged commit eb8ef54 into main Jun 25, 2026
5 checks passed
@ralyodio ralyodio deleted the feat/files-store-provisioning branch June 25, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant