Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions promptbook/prompts.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,25 @@
],
"formatNotes": "All three. Point the tool at `application.yml`/`application.properties`, Actuator-related config, and `SecurityFilterChain` / Security config first. Prefer concrete diffs over generic advice.",
"body": "Harden Spring Boot Actuator for the application at the path I provide. Produce a PR-ready lock-down: inventory, severity-ordered findings, and concrete config/security/probe patches.\n\nReview current state and deliver:\n\n1. Inventory\n - Boot version signals (2.x vs 3.x), Actuator dependency presence\n - `management.endpoints.web.exposure.include` / `.exclude`, `base-path`, `management.server.port` / address\n - `management.endpoint.health.show-details` / `show-components`\n - Which endpoints are effectively reachable (health, info, env, heapdump, threaddump, prometheus/metrics, shutdown, custom)\n - Existing Spring Security rules for Actuator (`EndpointRequest`, path matchers, CSRF)\n - Kubernetes/Helm probes and whether management is on a public Service/Ingress\n - Metrics / Prometheus / profiler (e.g. Pyroscope) scrape paths and auth\n\n2. Target design\n - Expose only ops-needed endpoints (typically health + info; metrics/prometheus only with scrape auth)\n - Never leave env / heapdump / threaddump / logfile / shutdown / configprops publicly reachable\n - Prefer a separate management port when the app has a public HTTP surface\n - Health details: `never` anonymously; `when_authorized` only with real operator roles\n - Dedicated management `SecurityFilterChain`; keep CSRF for browser-facing state changes\n - Probes aimed at management health; management not on public Ingress/LoadBalancer\n - Block cloud-metadata leakage via env/info contributors\n\n3. Patches (prefer diffs)\n - `application.yml` / profile-specific properties (Boot 3 exposure keys, base-path, show-details, management port)\n - `SecurityFilterChain` (or XML/adapter equivalent) using `EndpointRequest`\n - Deployment/Service/Ingress or Helm values for probes and port exposure\n - Scrape auth notes (bearer/mTLS) — names only, no real secrets\n\n4. Output format\n - Severity-ordered findings (blocker / major / minor)\n - Exposure matrix: endpoint → anonymous / role / disabled\n - Concrete diffs for each blocker/major\n - Validation steps: curl anonymous vs authenticated, in-cluster probe check, negative tests for env/heapdump/shutdown\n - Residual risks and explicit assumptions if manifests or Security config are missing in-repo\n\nConstraints:\n- Do not invent IdP URLs, passwords, or cluster IPs — use placeholders consistent with repo style.\n- Do not weaken API security to \"fix\" Actuator; do not disable CSRF globally.\n- Keep the diff minimal; no unrelated refactors.\n- Prefer Spring Boot 3 property names when the project is on Boot 3; call out 2.x differences if evidenced.\n\nStart from the files I pointed at (or search for `management.endpoints` and Actuator security). Prefer patches over vague advice."
},
{
"id": "author-safe-flyway-migration",
"title": "Author a Safe Flyway Migration",
"whenToUse": "You need a PR-ready Flyway migration (SQL + verification checklist) for a Spring Boot service, including expand/contract planning and CI/AKS safety notes.",
"tools": [
"copilot",
"claude-code",
"codex"
],
"tags": [
"java",
"spring-boot",
"sql",
"flyway",
"database"
],
"formatNotes": "All three. Point the tool at `db/migration`, `spring.flyway.*` config, and any migrate Job/CI workflow first. Prefer concrete next-version SQL and checklists over generic DDL advice.",
"body": "Author a safe, PR-ready Flyway migration for the Spring Boot app at the path I provide. Produce the next versioned SQL (and any necessary app-tolerance notes), plus a verification checklist suitable for Copilot / Claude Code / Codex.\n\nContext placeholders (fill from the repo or ask only if missing):\n- Service / module path: {{SERVICE_PATH}}\n- Database engine: {{DB_ENGINE}} (e.g. PostgreSQL, MySQL, SQL Server)\n- Migration location: {{MIGRATION_DIR}} (default `src/main/resources/db/migration`)\n- Change intent: {{CHANGE_INTENT}} (add column, new table, backfill, tighten constraint, rename, drop, index)\n- Zero-downtime required: {{ZERO_DOWNTIME}} (yes/no; default yes on AKS/K8s)\n- Current highest version observed: {{CURRENT_VERSION}}\n\nRequirements:\n\n1. Inventory\n - Existing Flyway/Liquibase dependency and `spring.flyway.*` / `spring.liquibase.*`\n - Migration files present; next version number; naming style (`V__` vs timed versions)\n - Whether migrate runs on startup, as a K8s Job, or in CI\n - Any `out-of-order`, `validate-on-migrate`, `clean-disabled`, placeholder, or callback config\n - Evidence of expand/contract history or risky prior `DROP`/`RENAME` patterns\n\n2. Classify and plan\n - Label the change: expand, backfill, contract, or config-only\n - If rename/drop/cutover: split into ordered steps across releases; do not ship destructive contract with the code cutover in one PR\n - Call out N and N-1 pod compatibility when {{ZERO_DOWNTIME}} is yes\n\n3. Author artifacts (prefer concrete files/diffs)\n - Next `V{{NEXT_VERSION}}__{{short_snake_description}}.sql` — additive first; nullable expands; explicit indexes; engine-appropriate lock/statement timeout SET when useful\n - Optional `R__*.sql` only if idempotent view/function refresh is required (explain why)\n - Minimal entity/repository notes so app code tolerates expand before contract\n - CI snippet or test note: `flyway validate` / `info` or Boot test with validate-on-migrate + ephemeral DB\n - AKS/K8s ordering note: migrate-before-rollout or equivalent; no public secrets in SQL\n\n4. Verification checklist\n - Fresh migrate + restart succeeds\n - `flyway validate` clean; checksums of old versions unchanged\n - Old app binary still works against expanded schema (if expand)\n - Grep for secrets in SQL; confirm no `clean` enabled for shared envs\n - Residual risks: long locks, large backfills, repair caveats (repair is not rollback)\n\nConstraints:\n- Forward-only: do not edit already-applied versioned migrations; do not invent fake checksums.\n- Secrets never in SQL — use `{{PLACEHOLDER}}` names only for non-secret identifiers.\n- Do not enable `out-of-order` or `clean` for prod-like profiles unless the repo already has a documented hotfix process (then call it out, do not silently turn on).\n- Do not claim Flyway auto-rollback; prescribe expand/contract instead.\n- Keep the diff minimal; no unrelated refactors.\n- Optimize instructions for GitHub Copilot, Claude Code, and Codex — concrete paths and checklists over essays.\n\nOutput format:\n1. Short plan (classification + version bump)\n2. File diffs / full new SQL\n3. Config/CI/K8s notes (only what changed)\n4. Verification checklist\n5. Residual risks and follow-up contract PR (if any)\n\nStart from {{MIGRATION_DIR}} and Flyway config under {{SERVICE_PATH}}. Prefer patches over vague advice.\n"
}
]
}
Loading
Loading