Generated plugins (acceptance.json at the root) fail on: HTTP routes not registered through pluginsdk route or a public route reading personal columns; HTML built from unescaped non-constant strings; public POSTs outside route.Form; personal data names in log calls; outbound requests carrying personal data or values the spec does not send to that host. First-party plugins get the same findings as warnings. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
4.0 KiB
Plugin route, output, form, logging and egress rules
The website factory has a model write a custom CMS plugin for a small
business, and automatic checks are the only gate before it runs on the
customer's site. The WO-088 live runs (orchestrator
docs/works/WO-088-custom-plugin-generation.md, concerns 3 to 7) showed
check-safety passing five unsafe patterns: an unauthenticated route returning
stored quote requests, a block writing visitor-submitted rows into HTML
without escaping, a public form taking any POST with no captcha, a log line
carrying an email address, and an outbound request that may carry stored form
data to an approved host.
Add five checks that run on standalone plugin roots only:
- 33
checkPluginRoutes(plugin_routes.go): routes go through pluginsdkroute(v0.3.12), which enforces a declared access level at runtime. Own routers, directHandle/HandleFuncregistrations and anHTTPHandlerthat does not return aroute.Newrouter fail. Aroute.Publicroute whose handler, or a same-package function it calls, reads a table withpersonal_columnsfails. - 34
checkPluginHTML(plugin_html.go): HTML built by concatenation,fmt.Sprintf/Fprintfor writer calls must escape every non-constant string. Values are traced through locals and same-package function returns; parameters, fields, map reads and other packages' results are untrusted. - 35
checkPluginForms(plugin_forms.go): a public POST must useroute.Form, which requires the host-verified captcha and a per-instance submission limit. - 36
checkPluginLogs(plugin_logs.go): log calls must not reference a personal data name. - 37
checkPluginEgress(plugin_egress.go): a function that sends an HTTP request must not reference personal data or stored personal rows, and every non-constant query or form key must be in the host'ssendslist.
The factory writes acceptance.json at the plugin root and the plugin cannot
change it, so its presence marks a factory-generated plugin. Findings there
fail; findings in other plugins warn, because first-party plugins are human
reviewed and several mount Connect handlers on a ServeMux that the host guards
with RBAC. Personal data names come from the spec (table personal_columns
plus fields marked personal); without a spec a short default list applies.
Rejected: type-checking the plugin with go/packages. It needs the plugin's
module graph inside the build sandbox and slows every run; a syntactic,
name-based analysis catches the WO-088 patterns. Rejected: allowing query
keys by name only. A constant value carries no site data, so keys with literal
or constant values are allowed for any host and only non-constant keys must
appear in sends.
Measured on the first-party plugins, the first version warned on Connect
service muxes, asset muxes, time.Format output, append-built slices and
helpers that only ever receive constants. The rules now accept Connect
binding and connect.New*Handler muxes, asset muxes that read no stored personal data, constant-layout
Format, append, range variables over source tables, the SDK BlockNote
renderer and bluemonday, and (first-party only) parameters whose every
same-package call passes a safe value and handlers that call
auth.CaptchaVerified. The WO-088 fixtures fail under the tuned rules.
Consequences:
- Fixtures under
testdata/pluginrules/reproduce the WO-088 quote and weather plugins in failing and fixed form;pluginrules_test.gocovers each rule and the fail/warn split. - The cms and orchestrator targets are not plugin roots and report the five checks as SKIP.
- The analysis is best effort: calls are matched by name within one package and a value laundered through another package is not traced.
Keywords: WO-088, acceptance.json, factory, generated plugin, pluginsdk route, route.Form, route.Public, captcha, HTTPHandler, ServeMux, chi, stored XSS, html.EscapeString, output encoding, personal data, personal_columns, slog, logging, egress, outbound_hosts, sends, open-meteo, checks 33 34 35 36 37