patchdrill 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/.patchdrill.yml +33 -0
  2. package/CHANGELOG.md +150 -0
  3. package/CONTRIBUTING.md +59 -0
  4. package/LICENSE +21 -0
  5. package/README.md +601 -0
  6. package/SECURITY.md +28 -0
  7. package/action.yml +338 -0
  8. package/dist/baseline.d.ts +9 -0
  9. package/dist/baseline.js +38 -0
  10. package/dist/baseline.js.map +1 -0
  11. package/dist/cli.d.ts +19 -0
  12. package/dist/cli.js +662 -0
  13. package/dist/cli.js.map +1 -0
  14. package/dist/codeowners.d.ts +14 -0
  15. package/dist/codeowners.js +104 -0
  16. package/dist/codeowners.js.map +1 -0
  17. package/dist/command-plan.d.ts +3 -0
  18. package/dist/command-plan.js +26 -0
  19. package/dist/command-plan.js.map +1 -0
  20. package/dist/demo.d.ts +5 -0
  21. package/dist/demo.js +525 -0
  22. package/dist/demo.js.map +1 -0
  23. package/dist/dependency.d.ts +4 -0
  24. package/dist/dependency.js +1424 -0
  25. package/dist/dependency.js.map +1 -0
  26. package/dist/doctor.d.ts +26 -0
  27. package/dist/doctor.js +183 -0
  28. package/dist/doctor.js.map +1 -0
  29. package/dist/evidence.d.ts +64 -0
  30. package/dist/evidence.js +352 -0
  31. package/dist/evidence.js.map +1 -0
  32. package/dist/git.d.ts +16 -0
  33. package/dist/git.js +349 -0
  34. package/dist/git.js.map +1 -0
  35. package/dist/i18n-catalog.d.ts +8 -0
  36. package/dist/i18n-catalog.js +446 -0
  37. package/dist/i18n-catalog.js.map +1 -0
  38. package/dist/i18n.d.ts +20 -0
  39. package/dist/i18n.js +67 -0
  40. package/dist/i18n.js.map +1 -0
  41. package/dist/init.d.ts +13 -0
  42. package/dist/init.js +312 -0
  43. package/dist/init.js.map +1 -0
  44. package/dist/markdown-links.d.ts +18 -0
  45. package/dist/markdown-links.js +180 -0
  46. package/dist/markdown-links.js.map +1 -0
  47. package/dist/package-scripts.d.ts +3 -0
  48. package/dist/package-scripts.js +55 -0
  49. package/dist/package-scripts.js.map +1 -0
  50. package/dist/planner.d.ts +8 -0
  51. package/dist/planner.js +2351 -0
  52. package/dist/planner.js.map +1 -0
  53. package/dist/policy.d.ts +12 -0
  54. package/dist/policy.js +255 -0
  55. package/dist/policy.js.map +1 -0
  56. package/dist/project.d.ts +2 -0
  57. package/dist/project.js +1085 -0
  58. package/dist/project.js.map +1 -0
  59. package/dist/release-readiness.d.ts +25 -0
  60. package/dist/release-readiness.js +426 -0
  61. package/dist/release-readiness.js.map +1 -0
  62. package/dist/report-annotations.d.ts +3 -0
  63. package/dist/report-annotations.js +28 -0
  64. package/dist/report-annotations.js.map +1 -0
  65. package/dist/report-contract.d.ts +2 -0
  66. package/dist/report-contract.js +82 -0
  67. package/dist/report-contract.js.map +1 -0
  68. package/dist/report-html.d.ts +7 -0
  69. package/dist/report-html.js +706 -0
  70. package/dist/report-html.js.map +1 -0
  71. package/dist/report-sarif.d.ts +2 -0
  72. package/dist/report-sarif.js +90 -0
  73. package/dist/report-sarif.js.map +1 -0
  74. package/dist/report.d.ts +14 -0
  75. package/dist/report.js +310 -0
  76. package/dist/report.js.map +1 -0
  77. package/dist/risk.d.ts +19 -0
  78. package/dist/risk.js +1226 -0
  79. package/dist/risk.js.map +1 -0
  80. package/dist/runner.d.ts +8 -0
  81. package/dist/runner.js +113 -0
  82. package/dist/runner.js.map +1 -0
  83. package/dist/scan.d.ts +2 -0
  84. package/dist/scan.js +195 -0
  85. package/dist/scan.js.map +1 -0
  86. package/dist/schema.d.ts +12 -0
  87. package/dist/schema.js +30 -0
  88. package/dist/schema.js.map +1 -0
  89. package/dist/stack-coverage.d.ts +8 -0
  90. package/dist/stack-coverage.js +94 -0
  91. package/dist/stack-coverage.js.map +1 -0
  92. package/dist/types.d.ts +206 -0
  93. package/dist/types.js +2 -0
  94. package/dist/types.js.map +1 -0
  95. package/dist/verification.d.ts +11 -0
  96. package/dist/verification.js +108 -0
  97. package/dist/verification.js.map +1 -0
  98. package/docs/ANNOTATIONS.md +34 -0
  99. package/docs/ARCHITECTURE.md +79 -0
  100. package/docs/BASELINES.md +32 -0
  101. package/docs/CASE_STUDIES.md +106 -0
  102. package/docs/CODEOWNERS.md +23 -0
  103. package/docs/DASHBOARD.md +87 -0
  104. package/docs/EVIDENCE.md +55 -0
  105. package/docs/LAUNCH_PLAYBOOK.md +103 -0
  106. package/docs/MONOREPOS.md +74 -0
  107. package/docs/POLICY.md +98 -0
  108. package/docs/PROOF_PACKS.md +57 -0
  109. package/docs/PR_COMMENTS.md +56 -0
  110. package/docs/RELEASE.md +35 -0
  111. package/docs/ROADMAP.md +152 -0
  112. package/docs/RULE_CATALOG.md +90 -0
  113. package/docs/SARIF.md +74 -0
  114. package/docs/SCHEMAS.md +49 -0
  115. package/docs/SECURITY_POSTURE.md +32 -0
  116. package/docs/STACK_COVERAGE.md +20 -0
  117. package/docs/assets/patchdrill-demo.svg +21 -0
  118. package/docs/media/patchdrill-dashboard.png +0 -0
  119. package/docs/media/patchdrill-demo.gif +0 -0
  120. package/examples/case-studies/README.md +20 -0
  121. package/examples/demo/README.md +21 -0
  122. package/examples/demo/patchdrill-demo-summary.md +35 -0
  123. package/examples/demo/patchdrill-demo.html +623 -0
  124. package/examples/demo/patchdrill-demo.json +355 -0
  125. package/examples/demo/patchdrill-demo.md +120 -0
  126. package/examples/demo/patchdrill-demo.sarif +195 -0
  127. package/examples/report.md +128 -0
  128. package/examples/risky-agent-pr/README.md +15 -0
  129. package/examples/risky-agent-pr/patchdrill-demo-summary.md +41 -0
  130. package/examples/risky-agent-pr/patchdrill-demo.html +681 -0
  131. package/examples/risky-agent-pr/patchdrill-demo.json +483 -0
  132. package/examples/risky-agent-pr/patchdrill-demo.md +140 -0
  133. package/examples/risky-agent-pr/patchdrill-demo.sarif +398 -0
  134. package/fixtures/stacks/README.md +4 -0
  135. package/fixtures/stacks/android-gradle/fixture.json +33 -0
  136. package/fixtures/stacks/aspnet-core-service/fixture.json +36 -0
  137. package/fixtures/stacks/bazel-workspace/fixture.json +30 -0
  138. package/fixtures/stacks/buck2-workspace/fixture.json +30 -0
  139. package/fixtures/stacks/cargo-workspace/fixture.json +48 -0
  140. package/fixtures/stacks/django-app/fixture.json +25 -0
  141. package/fixtures/stacks/docker-compose/fixture.json +17 -0
  142. package/fixtures/stacks/dockerfile-service/fixture.json +17 -0
  143. package/fixtures/stacks/dotnet-service/fixture.json +36 -0
  144. package/fixtures/stacks/dotnet-solution-filter/fixture.json +62 -0
  145. package/fixtures/stacks/fastapi-app/fixture.json +29 -0
  146. package/fixtures/stacks/go-workspace/fixture.json +48 -0
  147. package/fixtures/stacks/java-gradle/fixture.json +29 -0
  148. package/fixtures/stacks/java-maven/fixture.json +32 -0
  149. package/fixtures/stacks/kubernetes-helm/fixture.json +25 -0
  150. package/fixtures/stacks/kubernetes-kustomize/fixture.json +21 -0
  151. package/fixtures/stacks/nested-go-workspace/fixture.json +51 -0
  152. package/fixtures/stacks/nextjs-app/fixture.json +34 -0
  153. package/fixtures/stacks/node-turbo-workspace/fixture.json +39 -0
  154. package/fixtures/stacks/pants-python/fixture.json +33 -0
  155. package/fixtures/stacks/php-composer/fixture.json +31 -0
  156. package/fixtures/stacks/python-service/fixture.json +21 -0
  157. package/fixtures/stacks/rails-app/fixture.json +25 -0
  158. package/fixtures/stacks/spring-boot-gradle/fixture.json +29 -0
  159. package/fixtures/stacks/spring-boot-maven/fixture.json +43 -0
  160. package/fixtures/stacks/swift-package/fixture.json +21 -0
  161. package/fixtures/stacks/terraform-module/fixture.json +17 -0
  162. package/fixtures/stacks/uv-python-service/fixture.json +47 -0
  163. package/fixtures/stacks/xcode-app/fixture.json +72 -0
  164. package/package.json +80 -0
  165. package/schemas/patchdrill-doctor.schema.json +171 -0
  166. package/schemas/patchdrill-evidence.schema.json +239 -0
  167. package/schemas/patchdrill-policy.schema.json +170 -0
  168. package/schemas/patchdrill-release-check.schema.json +78 -0
  169. package/schemas/patchdrill-report.schema.json +647 -0
@@ -0,0 +1,152 @@
1
+ # Roadmap
2
+
3
+ ## Near Term
4
+
5
+ - Expand first-party fixtures toward the full top 20 open-source stacks.
6
+ - Expand native affected-task integrations beyond Turborepo, Nx, Pants, Cargo, Go, Bazel, and Buck workspaces.
7
+ - Add anonymized real-repository Proof Pack case studies for common AI-agent PR failures.
8
+ - Split large planner and dependency modules into ecosystem-focused adapters without changing the public report schema.
9
+
10
+ ## Later
11
+
12
+ - Expand language-aware changed-test matching with more framework-specific conventions.
13
+ - Optional MCP server for coding agents.
14
+ - Optional LLM summarization that can only summarize deterministic findings.
15
+ - Rule confidence calibration from anonymized fixture corpora.
16
+ - Local TUI for interactively accepting or rejecting inferred verification commands.
17
+ - `patchdrill doctor` for explaining weak project detection, missing scripts, and why a command was or was not inferred.
18
+
19
+ ## Completed In 0.1.x
20
+
21
+ - SARIF output for GitHub code scanning.
22
+ - Policy file support: `.patchdrill.yml`.
23
+ - Added-line scanning for secret-looking values.
24
+ - Prompt-injection detection for agent-visible files.
25
+ - Agent-control and MCP configuration risk rules.
26
+ - SARIF partial fingerprints for stable GitHub code scanning alerts.
27
+ - CodeQL, OpenSSF Scorecard, and Dependabot repository posture.
28
+ - Direct Node workspace package targeting.
29
+ - npm trusted publishing and provenance release workflow.
30
+ - package.json dependency diff summaries.
31
+ - Pull request comment upsert mode for the GitHub Action.
32
+ - JSON Schemas for policy, report, evidence, doctor, and release-check contracts.
33
+ - Workspace dependency graph expansion for downstream package testing.
34
+ - npm `package-lock.json` dependency diff summaries.
35
+ - `pnpm-lock.yaml` dependency diff summaries.
36
+ - `yarn.lock` dependency diff summaries.
37
+ - `go.mod` dependency diff summaries.
38
+ - `go.sum` dependency diff summaries.
39
+ - `Cargo.toml` dependency diff summaries.
40
+ - `Cargo.lock` dependency diff summaries.
41
+ - Maven `pom.xml` dependency diff summaries.
42
+ - Gradle `build.gradle` and `build.gradle.kts` dependency diff summaries.
43
+ - Gradle `libs.versions.toml` version catalog dependency diff summaries.
44
+ - `requirements.txt` dependency diff summaries.
45
+ - `poetry.lock` dependency diff summaries.
46
+ - `uv.lock` dependency diff summaries.
47
+ - `Pipfile.lock` dependency diff summaries.
48
+ - `bun.lock` dependency diff summaries.
49
+ - `Gemfile` dependency diff summaries.
50
+ - `Gemfile.lock` dependency diff summaries.
51
+ - `composer.lock` dependency diff summaries.
52
+ - `composer.json` dependency diff summaries.
53
+ - CODEOWNERS owner hints for changed files.
54
+ - Baseline comparison against previous JSON reports.
55
+ - `--max-risk-delta` gating for baseline regressions.
56
+ - `patchdrill init --policy` starter policy generation.
57
+ - npm package metadata for repository discovery.
58
+ - Architecture docs and action examples for the public package path.
59
+ - CI dogfooding with PatchDrill SARIF and report artifacts.
60
+ - Current-format example report covering Markdown sections.
61
+ - GitHub issue forms and pull request template for contributor intake.
62
+ - `schemaVersion` in JSON and Markdown reports.
63
+ - `pyproject.toml` PEP 621 and Poetry dependency diff summaries.
64
+ - Native Turborepo and Nx task-runner plans for affected Node workspaces.
65
+ - Binary `bun.lockb` migration guidance for legacy Bun projects.
66
+ - Organization policy packs for regulated and agentic-code teams.
67
+ - Cargo workspace task plans for affected crates and downstream dependents.
68
+ - Go workspace task plans for affected modules and downstream dependents.
69
+ - First-party stack fixture harness covering Node/Turborepo, Next.js, Python, Rails, PHP/Composer, Terraform, Docker/Compose, Pants, Cargo, and Go services.
70
+ - Native Pants changed-target task plans.
71
+ - Language-aware source-to-test matching for risk scoring.
72
+ - Static HTML dashboard generation from scan output and saved JSON reports.
73
+ - Composite GitHub Action support for HTML dashboard artifacts.
74
+ - Kubernetes and Helm manifest verification planning.
75
+ - First-party stack fixtures for Kustomize, Java/Gradle, and .NET services.
76
+ - Bazel and Buck2 workspace detection with graph-wide verification planning.
77
+ - Swift Package Manager verification planning.
78
+ - Xcode project/workspace detection with shared-scheme verification planning.
79
+ - Django framework detection with `manage.py test` and `manage.py check` planning.
80
+ - Spring Boot framework detection with Gradle `bootJar` packaging plans.
81
+ - Android Gradle detection with debug unit test, assemble, and lint planning.
82
+ - ASP.NET Core detection with .NET build and publish planning.
83
+ - FastAPI app entrypoint detection with import-smoke planning.
84
+ - FastAPI changed router/dependency module import-smoke planning.
85
+ - GitHub Actions supply-chain findings for unpinned actions, remote script pipes, and untrusted PR metadata interpolation.
86
+ - Bazel and Buck2 changed-package target narrowing with graph-wide fallback for root metadata changes.
87
+ - Bazel/Buck reverse-dependency query commands for downstream affected-target discovery.
88
+ - Bazel/Buck downstream reverse-dependency query promotion into optional executable test plans.
89
+ - .NET project-aware test, build, and ASP.NET Core publish planning through `ProjectReference` relationships.
90
+ - Android Gradle variant-aware test, assemble, and lint planning from changed source sets.
91
+ - Android product-flavor source set parsing for debug variant task planning.
92
+ - Context-aware GitHub Actions finding for `pull_request_target` workflows that check out pull request head code.
93
+ - Python and FastAPI changed-test targeting for matching pytest files with whole-suite fallback.
94
+ - Whole-file GitHub Actions context analysis for changed workflows with pre-existing privileged triggers or checkout steps.
95
+ - NuGet PackageReference and central PackageVersion dependency change summaries.
96
+ - Workflow trust-boundary findings for reusable workflows that use `secrets: inherit`, including mutable remote reusable workflow refs.
97
+ - Workflow trust-boundary findings for `pull_request_target` OIDC token minting, environment-scoped OIDC jobs, and remote reusable workflows receiving caller OIDC permissions.
98
+ - .NET solution filter targeting for very large solutions.
99
+ - FastAPI dependency override test targeting for changed dependency helper functions.
100
+ - .NET solution-filter selection for changed projects when multiple overlapping `.slnf` files exist.
101
+ - Xcode `.xctestplan` detection from shared schemes and `xcodebuild test -testPlan` planning.
102
+ - Android generated-source variant detection and `variantFilter` disabled-variant avoidance.
103
+ - Nested local reusable workflow loading for downstream reusable workflow secret and OIDC trust-boundary findings.
104
+ - Cloud OIDC credential exchange findings for AWS, Azure, GCP, and Vault auth jobs without GitHub environment protection.
105
+ - Xcode scheme target-platform detection with macOS test destinations, mobile generic build destinations, and destination discovery planning.
106
+ - Rails, RSpec, Composer script, Laravel, PHPUnit, and PHP syntax fallback command planning.
107
+ - Multi-run static dashboard trends for CI artifact history.
108
+ - GitHub Action `dashboard-history` input for re-rendering trend dashboards from previous JSON report artifacts.
109
+ - Framework-specific changed-test matching for Rails/RSpec, Python app packages, JVM source sets, and Laravel unit/feature tests.
110
+ - Node script alias planning for typecheck, unit, and optional browser/e2e verification scripts.
111
+ - uv-managed Python fixture and optional Ruff, mypy, and Pyright static-analysis planning.
112
+ - Nested Python package-root detection with scoped pytest, compile, and optional static-analysis plans.
113
+ - Nested Cargo workspace detection with `--manifest-path` crate and downstream-dependent verification plans.
114
+ - Nested Go module and workspace detection with scoped `go test` and `go vet` plans.
115
+ - `--run-optional` CLI and GitHub Action opt-in for executing optional verification commands.
116
+ - `patchdrill demo` plus committed synchronized first-run sample Markdown, JSON, SARIF, and HTML artifacts.
117
+ - GitHub Actions annotation output and documentation for findings.
118
+ - Generated workflow templates that explicitly enable annotations and step summaries.
119
+ - Compact Markdown summaries for GitHub step summaries and pull request comments.
120
+ - First-party Maven and Spring Boot Maven stack fixtures.
121
+ - Audit evidence manifests with report, artifact, and command-output digests.
122
+ - Evidence manifest verification against generated artifact hashes.
123
+ - Evidence manifest verification against JSON report summary and count metadata.
124
+ - Evidence manifest verification against JSON report internal summary consistency.
125
+ - Evidence manifest verification against JSON report command metadata and command-output digests.
126
+ - Launch packaging with 30-second demo guidance, public case studies, and stack coverage matrix.
127
+ - `patchdrill doctor` for first-run repository readiness diagnosis.
128
+ - `patchdrill release-check` for local npm/GitHub Action release readiness checks.
129
+ - Named dependency analyzer registry and planner ecosystem introspection for coverage and architecture reporting.
130
+ - Evidence manifests record the PatchDrill tool version.
131
+ - Evidence manifest regeneration for finalized artifacts and CI verification before upload.
132
+ - Fail-state `risky-agent-pr` demo scenario for quick product evaluation.
133
+ - Fork-safe PR comment handling that does not fail verification when comment permissions are unavailable.
134
+ - Compact PR comment preview artifacts in demo output.
135
+ - Generated PR workflows execute required verification commands with bounded per-command timeout.
136
+ - Package automation script risk findings for lifecycle hooks, removed verification scripts, no-op checks, and remote shell pipes.
137
+ - Structured package script change summaries in JSON, Markdown, and HTML reports.
138
+ - Clearer `patchdrill explain` first-run guidance for teams comparing deterministic evidence with AI PR reviewers.
139
+ - Explicit boolean CLI flag values so `--run=false` and related safety flags are not treated as enabled.
140
+ - GitHub Action boolean inputs now share the CLI boolean vocabulary for execution, annotations, summaries, and PR comments.
141
+ - Command-plan normalization so policy-required checks can promote matching inferred optional checks.
142
+ - Policy loader fail-fast checks for duplicate command IDs, duplicate command strings, and conflicting aliases.
143
+ - Missing-evidence risk findings when required verification commands were planned but not run.
144
+ - Dependency proof-gap findings for manifest-only dependency changes and lockfile-only resolution drift.
145
+ - Repository hygiene for default generated report artifacts after local scans.
146
+ - Mutable `docker://` GitHub Action image findings with digest-pinned allowlisting.
147
+
148
+ ## Contribution Targets
149
+
150
+ PatchDrill needs real-world fixtures from:
151
+
152
+ - Xcode simulator and device fixture corpora for concrete iOS, visionOS, watchOS, and tvOS test destination naming.
@@ -0,0 +1,90 @@
1
+ # Rule Catalog
2
+
3
+ Every PatchDrill risk score increase maps to a human-readable finding. This catalog lists the built-in rule IDs so teams can understand reports, write policy exceptions, and decide which findings should block merges.
4
+
5
+ Policy rules from `.patchdrill.yml` use dynamic IDs in the form `policy.<rule-id>`.
6
+
7
+ ## Patch Size and Shape
8
+
9
+ | Rule ID | What it means |
10
+ | --- | --- |
11
+ | `patch.changed-files` | The patch changes repository files and needs review evidence. |
12
+ | `patch.medium` | The patch changes more than 500 lines. |
13
+ | `patch.large` | The patch changes more than 2000 lines. |
14
+ | `file.deleted` | A file was deleted. |
15
+ | `file.binary` | A binary file changed. |
16
+
17
+ ## Sensitive Files
18
+
19
+ | Rule ID | What it means |
20
+ | --- | --- |
21
+ | `file.secret-bearing` | A file path commonly used for credentials changed. |
22
+ | `file.high-impact-area` | Auth, billing, migration, or security-sensitive code changed. |
23
+ | `file.infrastructure` | Infrastructure, CI, build, or deployment behavior changed. |
24
+ | `file.lockfile` | A dependency lockfile changed. |
25
+ | `file.bun-lockb` | A legacy binary Bun lockfile changed. |
26
+ | `file.dependency-manifest` | A dependency manifest changed. |
27
+
28
+ ## Secret Patterns
29
+
30
+ | Rule ID | What it means |
31
+ | --- | --- |
32
+ | `secret.private-key` | Private key material was added. |
33
+ | `secret.aws-access-key` | An AWS access key-looking value was added. |
34
+ | `secret.github-token` | A GitHub token-looking value was added. |
35
+ | `secret.openai-key` | An OpenAI API key-looking value was added. |
36
+ | `secret.generic-assignment` | A secret-looking assignment was added. |
37
+
38
+ ## Agentic AI Surfaces
39
+
40
+ | Rule ID | What it means |
41
+ | --- | --- |
42
+ | `agent.control-file` | Agent instruction or control files changed. |
43
+ | `agent.mcp-config` | MCP or agent tool configuration changed. |
44
+ | `agent.prompt-injection` | Prompt-injection-like content was added. |
45
+ | `agent.tool-abuse-instruction` | Agent-visible content appears to encourage destructive commands or tool misuse. |
46
+
47
+ ## GitHub Actions Trust Boundaries
48
+
49
+ | Rule ID | What it means |
50
+ | --- | --- |
51
+ | `workflow.pull-request-target` | A `pull_request_target` trigger was added. |
52
+ | `workflow.write-all` | Broad `permissions: write-all` was added. |
53
+ | `workflow.write-scope` | A GitHub token write scope was added. |
54
+ | `workflow.inherited-secrets` | `secrets: inherit` was added. |
55
+ | `workflow.unpinned-action` | A GitHub Action reference is mutable or missing a full commit SHA. |
56
+ | `workflow.mutable-docker-action` | A `docker://` action image is tag-based or implicitly latest instead of digest-pinned. |
57
+ | `workflow.remote-script-pipe` | A workflow pipes remote downloads directly into an interpreter. |
58
+ | `workflow.untrusted-pr-context` | A workflow interpolates untrusted pull request metadata. |
59
+ | `workflow.pull-request-target-head-checkout` | A privileged `pull_request_target` workflow checks out pull request head code. |
60
+ | `workflow.reusable-inherited-secrets` | A reusable workflow job inherits all caller secrets. |
61
+ | `workflow.reusable-unpinned-secret-call` | A mutable remote reusable workflow receives inherited secrets. |
62
+ | `workflow.pull-request-target-oidc` | A fork-triggerable `pull_request_target` workflow can mint OIDC tokens. |
63
+ | `workflow.environment-oidc-token` | A job targeting a GitHub environment can mint OIDC tokens. |
64
+ | `workflow.cloud-oidc-without-environment` | A cloud credential exchange can mint OIDC tokens without a GitHub environment gate. |
65
+ | `workflow.reusable-oidc-token-boundary` | A remote reusable workflow can mint caller OIDC tokens. |
66
+ | `workflow.reusable-unpinned-oidc-call` | A mutable remote reusable workflow can mint caller OIDC tokens. |
67
+
68
+ ## Package Scripts
69
+
70
+ | Rule ID | What it means |
71
+ | --- | --- |
72
+ | `package-script.remote-script-pipe` | A package script downloads remote code directly into an interpreter. |
73
+ | `package-script.lifecycle` | An install, prepare, pack, publish, or related lifecycle script changed. |
74
+ | `package-script.disabled-verification` | A verification script appears to have been replaced with a no-op. |
75
+ | `package-script.removed-verification` | A conventional verification script was removed. |
76
+
77
+ ## Dependency Proof Gaps
78
+
79
+ | Rule ID | What it means |
80
+ | --- | --- |
81
+ | `dependency.manifest-without-lockfile` | Direct dependency intent changed without matching lockfile evidence. |
82
+ | `dependency.lockfile-without-manifest` | Lockfile resolution drift occurred without matching direct dependency intent. |
83
+
84
+ ## Verification Evidence
85
+
86
+ | Rule ID | What it means |
87
+ | --- | --- |
88
+ | `verification.required-not-run` | Required verification commands were planned but not executed. |
89
+ | `command.failed` | A verification command failed. |
90
+ | `test.source-without-test-change` | Source files changed without matching test files in the patch. |
package/docs/SARIF.md ADDED
@@ -0,0 +1,74 @@
1
+ # SARIF Output
2
+
3
+ PatchDrill can emit SARIF 2.1.0 for GitHub code scanning:
4
+
5
+ ```bash
6
+ patchdrill scan --base origin/main \
7
+ --evidence patchdrill-evidence.json \
8
+ --summary-markdown patchdrill-summary.md \
9
+ --markdown patchdrill-report.md \
10
+ --json patchdrill-report.json \
11
+ --sarif patchdrill.sarif \
12
+ --html patchdrill-dashboard.html \
13
+ --run
14
+ patchdrill verify --evidence patchdrill-evidence.json
15
+ ```
16
+
17
+ Each file-scoped finding becomes a SARIF result with:
18
+
19
+ - `ruleId`: deterministic finding or policy rule ID.
20
+ - `level`: mapped from severity.
21
+ - `location`: file and line when available.
22
+ - `properties`: severity and tags.
23
+ - `partialFingerprints`: stable PatchDrill fingerprints for GitHub alert tracking.
24
+
25
+ ## GitHub Actions
26
+
27
+ ```yaml
28
+ permissions:
29
+ contents: read
30
+ security-events: write
31
+
32
+ steps:
33
+ - uses: actions/checkout@v6
34
+ with:
35
+ fetch-depth: 0
36
+ - uses: seungdori/patchdrill@v0
37
+ id: patchdrill
38
+ with:
39
+ base: origin/${{ github.base_ref }}
40
+ evidence: patchdrill-evidence.json
41
+ summary: patchdrill-summary.md
42
+ markdown: patchdrill-report.md
43
+ json: patchdrill-report.json
44
+ sarif: patchdrill.sarif
45
+ html: patchdrill-dashboard.html
46
+ run: "true"
47
+ fail-on: high
48
+ max-risk: "69"
49
+ - uses: github/codeql-action/upload-sarif@v4
50
+ if: always()
51
+ with:
52
+ sarif_file: ${{ steps.patchdrill.outputs.report-sarif }}
53
+ - uses: actions/upload-artifact@v7
54
+ if: always()
55
+ with:
56
+ name: patchdrill-report
57
+ path: |
58
+ ${{ steps.patchdrill.outputs.report-evidence }}
59
+ ${{ steps.patchdrill.outputs.report-markdown }}
60
+ ${{ steps.patchdrill.outputs.report-html }}
61
+ ${{ steps.patchdrill.outputs.report-json }}
62
+ ${{ steps.patchdrill.outputs.report-sarif }}
63
+ ${{ steps.patchdrill.outputs.report-summary }}
64
+ ```
65
+
66
+ ## Severity Mapping
67
+
68
+ | PatchDrill | SARIF |
69
+ | --- | --- |
70
+ | `critical` | `error` |
71
+ | `high` | `error` |
72
+ | `medium` | `warning` |
73
+ | `low` | `note` |
74
+ | `info` | `note` |
@@ -0,0 +1,49 @@
1
+ # JSON Schemas
2
+
3
+ PatchDrill ships JSON Schema draft 2020-12 contracts for policy files, machine-readable reports, audit evidence manifests, and readiness automation output.
4
+
5
+ ```bash
6
+ patchdrill schema policy > patchdrill-policy.schema.json
7
+ patchdrill schema report > patchdrill-report.schema.json
8
+ patchdrill schema evidence > patchdrill-evidence.schema.json
9
+ patchdrill schema doctor > patchdrill-doctor.schema.json
10
+ patchdrill schema release-check > patchdrill-release-check.schema.json
11
+ ```
12
+
13
+ Write a schema to a file:
14
+
15
+ ```bash
16
+ patchdrill schema report --output schemas/patchdrill-report.schema.json
17
+ ```
18
+
19
+ List available schemas:
20
+
21
+ ```bash
22
+ patchdrill schema --list
23
+ ```
24
+
25
+ ## Policy Schema
26
+
27
+ Use `schemas/patchdrill-policy.schema.json` to validate `.patchdrill.yml`, `.patchdrill.yaml`, or `.patchdrill.json`. The schema covers ignored paths, risk gates, policy commands, and path-matched rules.
28
+
29
+ For editor completion in YAML, add a language-server schema comment:
30
+
31
+ ```yaml
32
+ # yaml-language-server: $schema=./schemas/patchdrill-policy.schema.json
33
+ ```
34
+
35
+ ## Report Schema
36
+
37
+ Use `schemas/patchdrill-report.schema.json` for bots and dashboards that consume `patchdrill scan --json`. The report includes `schemaVersion: "1"` and the schema covers summary scores, changed files, project signals, workspace package impact, dependency changes, package script changes, findings, verification plans, command results, and the required computed `verification` section that joins plans with results. Human-facing reports render the same verification matrix from the same fields. `patchdrill verify --evidence` also checks report consistency that JSON Schema cannot express, such as changed-file totals, failed-command counts, missing verification status, and verification status drift.
38
+
39
+ ## Evidence Schema
40
+
41
+ Use `schemas/patchdrill-evidence.schema.json` for audit storage that consumes `patchdrill scan --evidence`. The manifest records the PatchDrill tool version, report digest, generated artifact digests, command-output digests, command result metadata, and local git refs without embedding raw stdout or stderr. `scan --evidence` requires `--json`, and `patchdrill verify` cross-checks those command digests and the JSON report's internal summary counts against the JSON report artifact.
42
+
43
+ ## Doctor Schema
44
+
45
+ Use `schemas/patchdrill-doctor.schema.json` for onboarding bots and repository bootstrap checks that consume `patchdrill doctor --format json`. The report includes `schemaVersion: "1"`, readiness summary counts, detected project signals, diagnostic checks, and suggested next commands without mutating the repository.
46
+
47
+ ## Release-Check Schema
48
+
49
+ Use `schemas/patchdrill-release-check.schema.json` for release automation that consumes `patchdrill release-check --format json`. The report includes `schemaVersion: "1"`, a top-level `ok` flag, summary counts, and local release-readiness checks for package metadata, action wiring, provenance workflow settings, launch docs, pull request and README Proof Pack commands, parseable shipped schema contracts, synchronized stack-coverage docs, stack fixture contracts, committed demo artifacts, and Markdown links.
@@ -0,0 +1,32 @@
1
+ # Security Posture
2
+
3
+ PatchDrill is meant to be installed in CI and sometimes executed locally against sensitive diffs. The repository should therefore carry the same trust signals it asks users to expect from their own projects.
4
+
5
+ ## Automated Checks
6
+
7
+ | Check | File | Purpose |
8
+ | --- | --- | --- |
9
+ | TypeScript build and Vitest | `.github/workflows/ci.yml` | Verifies deterministic scanner behavior and package readiness. |
10
+ | PatchDrill self-scan | `.github/workflows/ci.yml` | Dogfoods pull request diff scanning, verifies evidence hashes, uploads SARIF, and preserves Markdown/JSON/HTML/evidence report artifacts. |
11
+ | CodeQL | `.github/workflows/codeql.yml` | Adds GitHub-native static analysis for the TypeScript codebase. |
12
+ | OpenSSF Scorecard | `.github/workflows/scorecard.yml` | Tracks open-source security posture and uploads SARIF results. |
13
+ | Dependabot | `.github/dependabot.yml` | Keeps npm and GitHub Actions dependencies current. |
14
+ | Release provenance | `.github/workflows/release.yml` | Publishes through npm trusted publishing and provenance. |
15
+ | Hardened Action inputs | `action.yml` | Passes composite Action inputs through step environment variables and a bash array so optional paths and thresholds are not re-tokenized by the shell. |
16
+
17
+ ## Repository Rules To Enable On GitHub
18
+
19
+ - Require pull request review before merging to `main`.
20
+ - Require status checks: CI, CodeQL, OpenSSF Scorecard.
21
+ - Require signed commits or vigilant mode if the maintainers use it consistently.
22
+ - Restrict GitHub Actions permissions to least privilege by default.
23
+ - Enable private vulnerability reporting.
24
+ - Enable secret scanning and push protection where available.
25
+
26
+ ## Release Hygiene
27
+
28
+ - Run `npm pack --dry-run` before publishing.
29
+ - Review the tarball file list before every release.
30
+ - Publish from GitHub Actions trusted publishing with provenance.
31
+ - Keep generated reports out of git through `.gitignore`.
32
+ - Avoid storing any real secret-like fixture in tests; synthesize test values at runtime.
@@ -0,0 +1,20 @@
1
+ # Stack Coverage
2
+
3
+ PatchDrill coverage is fixture-backed and deterministic. This matrix describes what the current v0.1 engine can detect, plan, and explain before merge.
4
+
5
+ | Stack | Detects | Command Plans | Proof Signals |
6
+ | --- | --- | --- | --- |
7
+ | Node, npm, pnpm, Yarn, Bun | package.json scripts, package managers, workspaces, Turborepo, Nx, package automation scripts, JS lockfiles | typecheck, lint, unit, build, optional browser/e2e, package-scoped workspace commands, downstream dependents | dependency intent, lifecycle-script risk, no-op/removed verification scripts, manifest/lockfile proof gaps |
8
+ | Python, uv, Django, FastAPI | pyproject.toml, requirements.txt, uv.lock, manage.py, FastAPI app entrypoints, nested Python roots | scoped pytest, Django test/check, FastAPI import smoke, optional Ruff, mypy, Pyright | changed-test matching, dependency diffs, app entrypoint smoke evidence |
9
+ | Rust and Cargo | Cargo.toml, Cargo.lock, workspaces, nested crates, downstream local dependents | cargo test, cargo clippy, manifest-path scoped crate checks | Cargo dependency diffs, workspace impact, lockfile drift |
10
+ | Go | go.mod, go.sum, go.work, nested modules, local replace/workspace relationships | scoped go test, go vet, downstream module checks | module dependency diffs, go.sum resolution drift |
11
+ | Java, Maven, Gradle, Spring Boot | pom.xml, Gradle build files, version catalogs, Spring Boot manifests | Maven/Gradle tests, Gradle build, Spring Boot packaging | Maven/Gradle dependency diffs, JVM source-set test matching |
12
+ | Android Gradle | Android Gradle plugin projects, product flavors, generated sources, disabled variant filters | debug/flavor unit tests, assemble, lint with disabled-variant avoidance | variant-aware command plans and source-set impact |
13
+ | .NET and ASP.NET Core | .sln, .slnf, .csproj, ProjectReference graphs, central PackageVersion files, ASP.NET Core projects | solution-filter or project-scoped dotnet test, dotnet build, ASP.NET Core publish | NuGet dependency diffs and project-reference impact |
14
+ | Ruby, Rails, PHP, Laravel | Gemfile, Gemfile.lock, Rails apps, composer.json, composer.lock, Laravel artisan | RSpec/Rails tests, Composer scripts, PHPUnit, Laravel unit/feature tests, PHP syntax fallback | Bundler/Composer dependency diffs and framework-specific test matching |
15
+ | SwiftPM and Xcode | Package.swift, Xcode projects/workspaces, shared schemes, xctestplan files, target platforms | swift test, xcodebuild test/build with scheme, test plan, and destination guidance | Apple platform verification planning without running device-only flows by default |
16
+ | Terraform, Docker, Kubernetes, Helm, Kustomize | Terraform files, Dockerfile/compose files, Kubernetes manifests, Helm charts, Kustomize overlays | terraform fmt/validate, docker build, docker compose config, kubectl/helm/kustomize validation | infra review findings and deployment-manifest proof requirements |
17
+ | GitHub Actions and reusable workflows | workflow files, local reusable workflow references, OIDC, secrets inheritance, mutable actions, pull_request_target boundaries | workflow diff review and optional evidence for changed workflow surfaces | trust-boundary findings, SARIF/annotation output, release/OIDC risk evidence |
18
+ | Bazel, Buck2, Pants | workspace metadata, package targets, changed target scopes, reverse-dependency queries | targeted test/build commands plus optional downstream rdeps queries | graph-aware fallback when root metadata changes |
19
+
20
+ Use this as a public support matrix, not a claim that PatchDrill replaces stack-specific CI. PatchDrill plans the evidence that should exist; the repository still owns the actual commands and runtime dependencies.
@@ -0,0 +1,21 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="980" height="520" viewBox="0 0 980 520" role="img" aria-labelledby="title desc">
2
+ <title id="title">PatchDrill terminal demo</title>
3
+ <desc id="desc">A terminal showing PatchDrill turning an auth diff into deterministic risk findings and required verification commands.</desc>
4
+ <rect width="980" height="520" rx="14" fill="#0b1020"/>
5
+ <rect x="24" y="24" width="932" height="472" rx="10" fill="#111827" stroke="#334155"/>
6
+ <circle cx="52" cy="50" r="7" fill="#ef4444"/>
7
+ <circle cx="76" cy="50" r="7" fill="#f59e0b"/>
8
+ <circle cx="100" cy="50" r="7" fill="#22c55e"/>
9
+ <text x="126" y="55" fill="#94a3b8" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="14">patchdrill scan</text>
10
+ <text x="48" y="98" fill="#e5e7eb" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18">$ patchdrill scan --base origin/main</text>
11
+ <text x="48" y="136" fill="#86efac" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18">PatchDrill Gate PASS</text>
12
+ <text x="268" y="136" fill="#facc15" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18">assessment WARN</text>
13
+ <text x="48" y="174" fill="#e5e7eb" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18">risk 44/100 confidence 56/100</text>
14
+ <text x="48" y="212" fill="#cbd5e1" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18">Changed files: 1, +1/-1</text>
15
+ <text x="48" y="250" fill="#cbd5e1" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18">Required commands: 2</text>
16
+ <text x="48" y="300" fill="#fca5a5" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18">Top findings:</text>
17
+ <text x="72" y="338" fill="#fecaca" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="17">[high] High-impact product area changed</text>
18
+ <text x="72" y="372" fill="#fed7aa" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="17">[medium] Source changed without matching test changes</text>
19
+ <text x="48" y="430" fill="#93c5fd" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18">Reports: Markdown + JSON + SARIF + self-contained HTML</text>
20
+ <text x="48" y="464" fill="#94a3b8" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="16">No LLM required. Same diff, same evidence, every run.</text>
21
+ </svg>
Binary file
@@ -0,0 +1,20 @@
1
+ # PatchDrill Case Studies
2
+
3
+ This directory points launch readers at concrete Proof Pack scenarios.
4
+
5
+ ## Included
6
+
7
+ | Case | Evidence | What to inspect |
8
+ | --- | --- | --- |
9
+ | Risky agent PR | `../risky-agent-pr` | Critical workflow boundary, secret-looking value, package lifecycle script, PR summary, SARIF, HTML |
10
+ | Review-ready PR | `../demo` | Normal Proof Pack output with Markdown, JSON, SARIF, HTML, and compact summary |
11
+
12
+ ## Suggested Demo Flow
13
+
14
+ ```bash
15
+ patchdrill demo --scenario risky-agent-pr --output patchdrill-risky-demo
16
+ open patchdrill-risky-demo/patchdrill-demo.html
17
+ cat patchdrill-risky-demo/patchdrill-demo-summary.md
18
+ ```
19
+
20
+ The point is not that PatchDrill replaces review. The point is that every reviewer receives the same deterministic evidence bundle before deciding whether the patch is acceptable.
@@ -0,0 +1,21 @@
1
+ # PatchDrill Demo Artifacts
2
+
3
+ These files are generated by:
4
+
5
+ ```bash
6
+ patchdrill demo --output examples/demo
7
+ ```
8
+
9
+ - `patchdrill-demo-summary.md`: compact PR comment and step-summary preview.
10
+ - `patchdrill-demo.md`: reviewer-facing Markdown report.
11
+ - `patchdrill-demo.json`: machine-readable report contract.
12
+ - `patchdrill-demo.sarif`: GitHub code scanning upload format.
13
+ - `patchdrill-demo.html`: self-contained static dashboard.
14
+
15
+ The test suite keeps these committed examples synchronized with the demo renderer.
16
+
17
+ For a fail-state demo that shows privileged workflow, secret, agent-instruction, and billing-test findings:
18
+
19
+ ```bash
20
+ patchdrill demo --scenario risky-agent-pr --output examples/risky-agent-pr
21
+ ```
@@ -0,0 +1,35 @@
1
+ # PatchDrill Summary
2
+
3
+ **WARN** - risk 58/100, confidence 82/100
4
+
5
+ - Changed files: 5 (+186 / -42)
6
+ - Verification plan: 3 required, 1 optional
7
+ - Verification evidence: 3 run, 3 passed, 0 failed, 0 timed out, 0 missing required, 1 optional skipped
8
+ - Baseline risk delta: +14 (2 new findings)
9
+
10
+ ## Changed Files
11
+
12
+ - `apps/api/src/auth/session.ts` (modified, +54 / -16)
13
+ - `apps/api/src/auth/session.test.ts` (modified, +48 / -4)
14
+ - `packages/db/migrations/20260601090000_add_session_rotation.sql` (added, +38 / -0)
15
+ - `.github/workflows/deploy.yml` (modified, +22 / -12)
16
+ - `package-lock.json` (modified, +24 / -10)
17
+
18
+ ## Top Findings
19
+
20
+ | Severity | Finding | Location |
21
+ | --- | --- | --- |
22
+ | high | High-impact product area changed | apps/api/src/auth/session.ts |
23
+ | high | Data migration review required | packages/db/migrations/20260601090000_add_session_rotation.sql |
24
+ | medium | OIDC deployment job should use a protected environment | .github/workflows/deploy.yml:34 |
25
+ | low | Dependency lockfile changed | package-lock.json |
26
+
27
+ ## Required Checks
28
+
29
+ | Command | Result |
30
+ | --- | --- |
31
+ | `pnpm exec turbo run typecheck --filter=@acme/api` | passed |
32
+ | `pnpm exec turbo run test --filter=@acme/api` | passed |
33
+ | `pnpm run test:contracts` | passed |
34
+
35
+ Full Markdown, JSON, SARIF, and HTML reports remain available as CI artifacts when configured.