Skip to content

Add REST API, password protection, and test suite#2

Merged
cmer merged 2 commits intomainfrom
cmer/rest-api
Mar 7, 2026
Merged

Add REST API, password protection, and test suite#2
cmer merged 2 commits intomainfrom
cmer/rest-api

Conversation

@cmer
Copy link
Owner

@cmer cmer commented Mar 7, 2026

Summary

  • REST API — Add full CRUD API under /_/api/ for programmatic access to captured webhooks, with API.md documentation
  • Password protection — Add --password <value> flag for HTTP Basic Auth on remote dashboard/API access. Localhost is never challenged, so local development stays frictionless. Uses crypto.timingSafeEqual for constant-time comparison
  • Rename flag--allow-dashboard-from-remote--allow-remote-access
  • Test suite — 16 tests using Node.js built-in test runner (node:test), covering auth scenarios for localhost, proxied/remote, and combined flag behavior
  • CI — GitHub Actions workflow running tests on Node 18, 20, and 22

Test plan

  • ./scripts/test.sh — all 16 tests pass locally
  • node cli.js --password secret — localhost dashboard loads without auth prompt
  • curl -u api:secret localhost:3000/_/api/webhooks — API works with Basic Auth
  • curl -X POST localhost:3000/test -d '{"hello":"world"}' — webhook captured without auth
  • Without --password flag — everything works as before

🤖 Generated with Claude Code

cmer and others added 2 commits March 7, 2026 11:14
…te-access

Add GET /_/api/webhooks/:id and GET /_/api/public_url endpoints. Rename
the --allow-dashboard-from-remote flag to --allow-remote-access since it
now covers both dashboard and API access. Document the full API in API.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Password protection only applies to remote/proxied requests — localhost
is never challenged. Uses crypto.timingSafeEqual for constant-time
comparison. Includes test suite (node:test) and GitHub Actions CI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cmer cmer changed the title Add password protection via HTTP Basic Auth Add REST API, password protection, and test suite Mar 7, 2026
@cmer cmer merged commit 9f89e96 into main Mar 7, 2026
3 checks passed
@cmer cmer deleted the cmer/rest-api branch March 7, 2026 17:49
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