New AST check scans handler render functions that build site settings (getSiteSettings + doc["site_settings"]) and fails if they don't also set siteSettings["toolbar"], so admin-toolbar injection can't silently regress when a new public page type is added. - toolbar.go: AST scanner; exempts renderListingPage (auto SEO pages) and renderVersionPreview (carries its own preview banner). - check_toolbar.go: registration at Seq 280 (ID "28"). - registry_test.go: +1 expected check; golden fixtures regenerated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
114 lines
5.0 KiB
Plaintext
114 lines
5.0 KiB
Plaintext
(running checks in FIXTURE_DIR)
|
|
|
|
=== Check 1: Secret env var reads outside config.Load() ===
|
|
FAIL: internal/service/handler.go:17 — os.Getenv("JWT_SECRET")
|
|
|
|
1 violation(s). Secrets must flow through Config → DI.
|
|
|
|
=== Check 2: RPC methods registered in RBAC interceptor ===
|
|
SKIP: no proto-backed RPC procedures found in scanned target(s)
|
|
|
|
=== Check 2b: Plugin proto ownership ===
|
|
OK: Plugin proto ownership is clean
|
|
|
|
=== Check 2c: Standalone plugin SDK import boundaries ===
|
|
FAIL: 1 CMS backend go.mod violation(s):
|
|
FIXTURE_DIR/go.mod [missing-go-mod] missing go.mod
|
|
|
|
Fix: CMS backend must not replace git.dev.alexdunmow.com/block/core locally, and standalone plugins must use git.dev.alexdunmow.com/block/core imports, require git.dev.alexdunmow.com/block/core <SDK_VERSION>, and declare no replace directives.
|
|
|
|
=== Check 2d: sqlc UUID overrides in plugins and cmd ===
|
|
SKIP: no plugin or cmd sqlc configs found
|
|
|
|
=== Check 2e: Warn on any usage in Go and TypeScript ===
|
|
OK: No any usage found in scanned Go or TypeScript sources
|
|
|
|
=== Check 2f: sqlc compile and buf generate ===
|
|
SKIP: no sqlc or buf codegen targets found
|
|
|
|
=== Check 3: Go code compiles and passes go fix, golangci-lint --fix, go vet, and strict lint ===
|
|
SKIP: . (no go.mod found)
|
|
SKIP: no Go modules found
|
|
|
|
=== Check 3b: Orchestrator backend tests ===
|
|
SKIP: orchestrator backend not found or not part of this scan
|
|
|
|
=== Check 4: Frontend auto-format, lint, and typecheck ===
|
|
SKIP: no frontend sources found
|
|
|
|
=== Check 5: Frontend uses generated ConnectRPC hooks ===
|
|
SKIP: no frontend sources found
|
|
|
|
=== Check 6: No hardcoded colors in frontend (use theme tokens) ===
|
|
OK: No hardcoded colors in .templ files
|
|
|
|
=== Check 7: No useState for tab state in routes (use URL ?tab= params) ===
|
|
SKIP: no frontend sources found
|
|
|
|
=== Check 8: Import @block-ninja/api from subpaths only ===
|
|
SKIP: no frontend sources found
|
|
|
|
=== Check 9: No npm/yarn lockfiles (pnpm only) ===
|
|
OK: Only pnpm lockfiles present
|
|
|
|
=== Check 10: Button automation attributes ===
|
|
SKIP: no frontend sources found
|
|
|
|
=== Check 10b: No eslint-disable-next-line comments ===
|
|
SKIP: no frontend sources found
|
|
|
|
=== Check 11: No placeholder code; only shipped features ===
|
|
OK: No placeholder code found
|
|
|
|
=== Check 12: No reinvented utilities (use helpers) ===
|
|
OK: No reinvented utilities detected
|
|
|
|
=== Check 13: RPC query/mutation error handling ===
|
|
SKIP: no frontend sources found
|
|
|
|
=== Check 14: No raw SQL outside sqlc/Bob ===
|
|
FAIL: 1 raw SQL statement(s) found outside sqlc/Bob:
|
|
internal/service/handler.go:22 SELECT id, name FROM users WHERE active = true
|
|
|
|
Use sqlc for static queries or Bob for dynamic queries:
|
|
┌───────────────────┬─────────────────────────────────────────────────────┐
|
|
│ Need │ Use │
|
|
├───────────────────┼─────────────────────────────────────────────────────┤
|
|
│ Static queries │ sqlc (sql/queries/*.sql → internal/db/*.go) │
|
|
│ Dynamic queries │ Bob (github.com/stephenafamo/bob) │
|
|
└───────────────────┴─────────────────────────────────────────────────────┘
|
|
Raw SQL causes bugs when schema changes. sqlc catches these at compile time.
|
|
|
|
=== Check 15: No err.Error() leaked to HTTP clients ===
|
|
FAIL: 1 err.Error() leak(s) to HTTP clients:
|
|
internal/service/handler.go:27 http.Error(w, err.Error(), ...) — leaks internal error
|
|
|
|
Fix: Log the error with slog.Error() and return a user-friendly message: http.Error(w, "failed to open repository", status)
|
|
|
|
=== Check 16: Services and handlers in correct directories ===
|
|
OK: All services and handlers in correct directories
|
|
|
|
=== Check 17: No TODO markers in production code ===
|
|
FAIL: 1 TODO marker(s) found:
|
|
internal/service/handler.go:14 // TODO: add proper initialisation
|
|
|
|
Fix: Remove TODO markers and ship explicit behavior instead of placeholders.
|
|
|
|
=== Check 18: Plugin segmentation (safety-rules.yml) ===
|
|
OK: No plugins define safety-rules.yml segmentation rules
|
|
|
|
=== Check 19: Bearer token precedence over cookies in auth middleware ===
|
|
OK: Bearer token takes precedence over cookies in all auth extraction
|
|
|
|
=== Check 20: Tailwind v4 configuration (PostCSS, CSS directives, @config) ===
|
|
SKIP: no frontend sources found
|
|
|
|
=== Check 21: Plugin presets.json validation ===
|
|
OK: No presets.json files found in scanned targets
|
|
|
|
=== Check 22: No hand-rolled HTML sanitization (use bluemonday) ===
|
|
OK: No hand-rolled HTML sanitization detected
|
|
=== Check 28: Public page handlers inject admin toolbar data ===
|
|
OK: All public page handlers inject admin toolbar data
|
|
|