Repository navigation
Description
Problem or use case
The initial store scaffold is a complete unauthenticated mutation surface. urlcode init todo-site --with store emits POST, PUT, PATCH and DELETE on /api/todos/*; --with ui,store also emits the same-origin editing screen. Auth protection is added only when auth is included in the set. docs/STORE.md warns that the unauthenticated mount is public, but neither the command nor generated YAML makes an author choose that exposure.
This is especially risky for the AI-first path: an agent can reasonably use the shortest documented initializer, validate it locally, and leave a publicly writable endpoint when the site is later deployed. It is not a flaw in the store primitive—some projects genuinely need public submissions—but it is a dangerous default for a generated persistent CRUD application.
Proposed behavior and alternatives
Keep hand-authored public store routes possible and do not auto-install auth or infer an identity model. Change the scaffold flow so a generated writable collection requires an explicit operator decision when no access-control extension/policy protects it (for example, an intentional --allow-public-write acknowledgement or a clearly named public starter choice). The generated README and route fragment should state the selected access model prominently.
Acceptance:
- The ordinary protected composition remains concise (
--with ui,auth,store) and protects both API and CRUD screen. - A no-auth writable scaffold cannot be produced accidentally; it requires an explicit public-write selection that is visible in command history and generated documentation.
- A deliberately hand-authored public writable mount remains supported for operators who need it; no auth package, credentials, provider configuration or ownership semantics are silently added.
- The implementation keeps portability and the current origin/CSRF protections, and states plainly that public write is not rate limiting, abuse protection or multi-tenant isolation.
An alternative is generating read-only data by default, but that weakens the first CRUD experience. The decision should weigh that tradeoff deliberately rather than treating a README warning as the safety control.
Activity
jimhoyd commentedon Sep 20, 2026
Decision (maintainer): require an explicit --allow-public-write to scaffold a writable store mount that no access-control extension protects. An agent has started on this; a PR will be linked here when it opens.
jimhoyd commentedon Sep 20, 2026
Progress: PR #343 opened: --allow-public-write. A no-auth writable store scaffold refuses before writing; with the flag it scaffolds and states the public-write access model in the README and routes; --with ui,auth,store is unchanged.
jimhoyd commentedon Sep 20, 2026
AI-first audit note: the refusal-before-write and explicit acknowledgement are the right safety experience. Follow-up #345 is about keeping its transport generic: extension-specific acknowledgement names should be emitted by the refusing scaffold and consumed by that scaffold, while core only carries/rejects opaque acknowledgements. That avoids turning each future risky extension action into another framework-specific CLI flag agents must memorize.
Require --allow-public-write to scaffold a store mount no auth protec…
jimhoyd commentedon Sep 20, 2026
Fixed in #343: a store scaffold that no access-control extension protects refuses before writing anything unless --allow-public-write is passed; with it, the README and routes state the public-write access model (not rate limiting, abuse protection or multi-tenant isolation). --with ui,auth,store is unchanged in any order. The flag is rejected when it has no effect. Scaffolds get allowPublicWrite in the request and may return publicWrite and routeNotes (documented in docs/EXTENSIONS.md). Note: the release smoke passes the flag for its standalone store run, which would fail against an older published store that ignores it.