Context does not cross the wasm ABI, so requireAdmin's
auth.GetUserFromContext only sees claims if the guest rebuilds them from
the host-stamped X-Bn-Verified-* headers. 2.0.3 never mounted
auth.TrustedHeaderMiddleware, so every admin endpoint (settings save,
event-types, test, rotate) returned 401 for real admins — the settings
panel could not store the Cal.com API key. Mount the middleware on the
router and pin the contract with a header-driven test (viewer headers
must reach requireAdmin and 403, never 401): the existing admin tests
injected claims straight into context, which is exactly the path wasm
does not have.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two wasm-era regressions fixed:
Routes: the wasm host forwards the FULL request path with no prefix
strip, but every route was registered relative — the plugin's entire
HTTP surface (slots/book/cancel/date-grid/admin) 404'd at runtime on
every instance since 2.0.0. All routes now register under
/api/plugins/calcomblock (testplugin's httpBase convention), pinned by
a route-matching test.
Captcha requirement: blockConfig was hardcoded nil (no capability
exposed published block content), so bookingRequiresCaptcha always
reported false — the widget never rendered and the gate never ran.
publishedBlockResolver now answers it via pluginsdk v0.2.4's
content.published_block_configs: any currently-published calcom:booking
block matching the posted username+eventTypeSlug with
captchaEnabled=true demands the host-stamped X-Bn-Verified-Captcha
header; an empty config username applies to any posted username.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- plugin.mod: scope normalized to @ninja (via ninja plugin init against the
dev registry).
- Track web/pnpm-lock.yaml for reproducible admin-frontend installs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Convert the bundled backend/internal/plugins/calcomblock package into a
standalone reactor-mode wasm plugin, dropping every git.dev.alexdunmow.com/block/cms
import (forbidden in standalone plugins):
- package calcomblock -> package main; add wasip1 main.go with
wasmguest.Serve(Registration). go.mod module
git.dev.alexdunmow.com/block/calcomblock, block/core v0.18.2, no replace
directives.
- Settings persistence: replace the pool-backed poolQuerier (direct SQL against
the public-schema `settings` table, which a sandboxed plugin role cannot read)
with capabilityQuerier over the SDK settings.Settings / settings.Updater
capabilities. GetSiteTimezone now resolves via GetSiteSettings host-side.
- Vendor the small CMS-internal helpers the plugin used into internal/helpers
(GetRealIP, StartCleanupLoop, MaskSecret, GetStringOr, the PluginSettingsQuerier
settings helpers, PluginCrypto for tests) and internal/db (minimal Setting /
UpsertSettingParams), each with a provenance header.
- Inline the captcha widget: vendor blocks.CaptchaWidget as a local
CaptchaWidget templ (captcha_widget.templ) and regenerate templ; drop the
block/cms/blocks import from booking.templ.
- blockConfig (server-authoritative captcha requirement via a
page_block_snapshots scan) has no wasm-ABI capability, so it is left nil:
honeypot + per-IP rate limit still apply. Documented as a follow-up.
- web: @block-ninja/ui workspace:* -> ^0.1.0 registry version; eslint.config.js
repointed at ../../../cms/web/eslint.config.js; rebuild web/dist.
- Rewrite CLAUDE.md for the standalone wasm reality; add .gitignore.
Full test suite preserved and passing; builds to calcomblock-2.0.0.bnp;
check-safety passes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>