ai-saas-guard 0.7.0 → 0.8.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.
package/README.md CHANGED
@@ -51,8 +51,8 @@ The CLI is published on npm as `ai-saas-guard`, and the GitHub Action is availab
51
51
  | JSON and SARIF output | Available |
52
52
  | Composite GitHub Action | Available |
53
53
  | Project config | `.ai-saas-guard.json` rule toggles, severity overrides, and fail thresholds |
54
- | Versioned Action tags | `v0.7.0`, `v0` |
55
- | npm package | `ai-saas-guard@0.7.0` |
54
+ | Versioned Action tags | `v0.8.0`, `v0` |
55
+ | npm package | `ai-saas-guard@0.8.0` |
56
56
  | npm publishing | Trusted Publisher/OIDC, no long-lived publish token |
57
57
 
58
58
  ## Quick Start
@@ -178,6 +178,10 @@ Use [docs/launch-readiness-checklist.md](docs/launch-readiness-checklist.md) whe
178
178
 
179
179
  Use [docs/stripe-webhook-replay.md](docs/stripe-webhook-replay.md) after `check-stripe` flags missing signature verification, idempotency, lifecycle handlers, or entitlement updates. The cookbook maps findings to concrete `stripe listen` and `stripe trigger` commands for checkout success, failed renewal, subscription update, cancellation, refund, duplicate delivery, and out-of-order event review.
180
180
 
181
+ ## Hosted GitHub App Design
182
+
183
+ See [docs/github-app-design.md](docs/github-app-design.md) for the proposed hosted GitHub App layer. The note covers least-privilege permissions, webhook verification, PR comments, check runs, privacy, data retention, prompt injection handling, and why the hosted app should not replace the local CLI.
184
+
181
185
  ## Project Configuration
182
186
 
183
187
  Add `.ai-saas-guard.json` at the repository root to tune findings without changing scanner code. The CLI auto-loads this file from `--root` when it exists. Use `--config <file>` to point to a different JSON file.
@@ -208,7 +212,7 @@ Use `suppressions` for narrower false-positive handling when one rule is noisy o
208
212
 
209
213
  ## GitHub Action
210
214
 
211
- The repo includes a composite Action. Use `v0` for the latest compatible pre-1.0 Action, a specific release tag such as `v0.7.0` for controlled upgrades, or pin a reviewed commit SHA for stricter supply-chain control:
215
+ The repo includes a composite Action. Use `v0` for the latest compatible pre-1.0 Action, a specific release tag such as `v0.8.0` for controlled upgrades, or pin a reviewed commit SHA for stricter supply-chain control:
212
216
 
213
217
  ```yaml
214
218
  name: ai-saas-guard
@@ -337,7 +341,7 @@ Open-source core:
337
341
 
338
342
  Near-term priorities:
339
343
 
340
- - GitHub App design note for the potential hosted layer
344
+ - GitHub App implementation should wait until the hosted design note's open questions and implementation gate are answered.
341
345
 
342
346
  Potential paid layer later:
343
347
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  `ai-saas-guard` ships as a composite GitHub Action for pull request and code scanning workflows.
4
4
 
5
- Use `zr9959/ai-saas-guard@v0` for the latest compatible pre-1.0 Action. Use a specific tag such as `v0.7.0` or a reviewed commit SHA when reproducibility is more important than automatic minor updates.
5
+ Use `zr9959/ai-saas-guard@v0` for the latest compatible pre-1.0 Action. Use a specific tag such as `v0.8.0` or a reviewed commit SHA when reproducibility is more important than automatic minor updates.
6
6
 
7
7
  ## PR Summary
8
8
 
@@ -0,0 +1,262 @@
1
+ # GitHub App Design Note
2
+
3
+ This note describes a possible hosted GitHub App layer for `ai-saas-guard`. It is a product and security design note, not an implementation announcement. The current project remains a local-first CLI and composite GitHub Action.
4
+
5
+ The hosted GitHub App should save review time for teams that want PR comments, saved reports, policy settings, and scan history. It does not replace the local CLI. The CLI must remain useful on its own for private repositories, offline review, and users who do not want source code processed by a hosted service.
6
+
7
+ ## Product Goal
8
+
9
+ The hosted app should answer the same narrow product question as the CLI:
10
+
11
+ > What changed in auth, billing, data access, secrets, MCP tools, or deploy config that deserves human review first?
12
+
13
+ The hosted layer adds workflow convenience:
14
+
15
+ - PR comments with a concise review-first summary.
16
+ - Check runs that point to findings without blocking every PR by default.
17
+ - Saved reports for launch-readiness history.
18
+ - Team policy settings for fail thresholds, suppressions, and stability preferences.
19
+ - Optional human launch-readiness review for teams that want an expert pass.
20
+
21
+ It should not become a broad SAST platform, pentest claim, or automatic security certification.
22
+
23
+ ## Non-Goals
24
+
25
+ Do not build these into the first GitHub App version:
26
+
27
+ - Full production infrastructure scanning.
28
+ - Automatic code rewrites.
29
+ - Secret rotation.
30
+ - Direct deploy, billing, or database mutation.
31
+ - Long-lived raw source archives.
32
+ - Broad organization-wide installation by default.
33
+ - AI-generated comments that treat untrusted PR text as instructions.
34
+
35
+ ## Recommended First Version
36
+
37
+ Start with a PR review assistant that runs the same deterministic scanner logic as the CLI:
38
+
39
+ 1. A repository installs the GitHub App on selected repositories.
40
+ 2. A pull request event queues a scan job.
41
+ 3. The worker checks out or fetches the PR diff in an isolated job.
42
+ 4. The scanner runs in read-only mode.
43
+ 5. The app publishes a short check run summary.
44
+ 6. If enabled by policy, the app posts one PR comment with review-first files and required manual verification.
45
+ 7. The app stores a compact report record, not a full source copy.
46
+
47
+ The first version should prefer check runs over noisy PR comments. PR comments should be opt-in per repository.
48
+
49
+ ## Least-Privilege Permissions
50
+
51
+ Use least-privilege permissions and install on selected repositories only.
52
+
53
+ Recommended initial permission set:
54
+
55
+ | Permission | Access | Why |
56
+ | --- | --- | --- |
57
+ | repository contents: read | Read | Fetch files or diffs needed for deterministic scans. |
58
+ | pull requests: read | Read | Read PR metadata, changed files, and base/head refs. |
59
+ | checks: write | Write | Publish a check run with summary, findings count, and report link. |
60
+ | metadata: read | Read | Required by GitHub Apps for repository identity. |
61
+
62
+ Optional permissions, disabled by default:
63
+
64
+ | Permission | Access | Why |
65
+ | --- | --- | --- |
66
+ | pull requests: write | Write | Post PR comments when a team explicitly enables comments. |
67
+ | issues: write | Write | Only if GitHub represents PR comments through issue comment APIs for a chosen workflow. |
68
+
69
+ Avoid broad permissions:
70
+
71
+ - No administration permission for the first version.
72
+ - No secrets permission.
73
+ - No deployments permission.
74
+ - No actions write permission.
75
+ - No organization-wide install requirement.
76
+
77
+ ## Event Model
78
+
79
+ Accept only the events needed for review:
80
+
81
+ - `pull_request` for opened, reopened, synchronized, and ready-for-review PRs.
82
+ - `check_suite` or `check_run` only if needed for rerun behavior.
83
+ - Installation events for setup and repository selection changes.
84
+
85
+ Do not use `pull_request_target` semantics in the app worker. Treat PR title, body, comments, branch names, and code contents as untrusted data.
86
+
87
+ ## Webhook Security
88
+
89
+ Every inbound GitHub webhook must pass webhook signature verification before any queue write or repository lookup.
90
+
91
+ Additional requirements:
92
+
93
+ - Reject requests with missing or invalid signatures.
94
+ - Enforce timestamp or delivery replay checks when available.
95
+ - Store GitHub delivery IDs for idempotency.
96
+ - Make scan jobs idempotent by installation, repository, PR, head SHA, and scanner version.
97
+ - Rate-limit repeated events for the same PR and commit.
98
+
99
+ ## Data Flow
100
+
101
+ The hosted app should keep the data flow simple and inspectable:
102
+
103
+ 1. GitHub sends a signed webhook.
104
+ 2. The API verifies the signature and writes a small scan request to a queue.
105
+ 3. A worker fetches repository content or PR diff using an installation token.
106
+ 4. The worker runs the same scanner package version recorded in the scan request.
107
+ 5. Findings are converted into a compact report.
108
+ 6. The app writes a check run and optional PR comment.
109
+ 7. The report is retained according to team policy.
110
+
111
+ Prefer storing:
112
+
113
+ - repository ID and name
114
+ - PR number
115
+ - head SHA and base SHA
116
+ - scanner version
117
+ - summary counts
118
+ - rule IDs
119
+ - evidence file paths and line numbers
120
+ - reviewer checklist
121
+ - suppression policy version
122
+
123
+ Avoid storing by default:
124
+
125
+ - full file contents
126
+ - raw diffs
127
+ - secrets or matched secret values
128
+ - generated logs with unredacted code snippets
129
+ - customer data copied from application fixtures
130
+
131
+ ## Privacy And Data Retention
132
+
133
+ Privacy should be a first-version feature, not a later add-on.
134
+
135
+ Default data retention:
136
+
137
+ - Keep compact scan reports for 30 days.
138
+ - Keep check run and PR comment content in GitHub as controlled by the customer's repository settings.
139
+ - Delete raw worker checkout directories immediately after scan completion.
140
+ - Do not train models on customer code or findings.
141
+ - Provide repository uninstall cleanup for stored app-side records.
142
+
143
+ Team admins should be able to shorten retention. Longer retention should be explicit and tied to paid audit history.
144
+
145
+ ## Prompt Injection Handling
146
+
147
+ If future versions use AI to summarize findings, prompt injection handling must be explicit:
148
+
149
+ - PR text, code, diffs, issue comments, and README content are untrusted input.
150
+ - Untrusted repository content must never override system, developer, or policy instructions.
151
+ - AI summaries must be derived from deterministic scanner output first, not from free-form repository claims.
152
+ - The app must not run shell commands suggested by PR text.
153
+ - The app must not follow links from PR text during default scans.
154
+ - Human approval is required before posting generated remediation comments that go beyond scanner evidence.
155
+
156
+ The first version can avoid AI entirely and still be useful by posting deterministic PR triage.
157
+
158
+ ## Human Approval And Comments
159
+
160
+ The app should avoid noisy or overconfident comments.
161
+
162
+ Default behavior:
163
+
164
+ - Always create or update a check run.
165
+ - Do not post a PR comment unless the repository enables comments.
166
+ - If comments are enabled, post one upserted summary comment per PR.
167
+ - Never claim the PR is secure.
168
+ - Use language such as "review first" and "verify" instead of "pass" for non-empty findings.
169
+
170
+ Human approval should be required for:
171
+
172
+ - opening issues automatically
173
+ - requesting changes on a PR
174
+ - posting detailed remediation text
175
+ - marking a launch review as accepted
176
+ - applying team-wide suppression policy changes
177
+
178
+ ## Configuration Model
179
+
180
+ The hosted app should reuse the local config model where possible:
181
+
182
+ - `.ai-saas-guard.json` remains the repository-owned policy file.
183
+ - Team UI settings can set defaults, but repository config should be visible and reviewable.
184
+ - Rule severity overrides and path-specific suppressions should behave the same as the CLI.
185
+ - Stability labels can drive policy, such as "fail checks only on strict high/critical findings."
186
+
187
+ Policy precedence should be simple:
188
+
189
+ 1. explicit PR workflow input or check rerun option
190
+ 2. repository `.ai-saas-guard.json`
191
+ 3. team default policy
192
+ 4. product default policy
193
+
194
+ ## Report UX
195
+
196
+ The report should be short enough for busy PR review:
197
+
198
+ - summary counts by severity
199
+ - changed sensitive surfaces
200
+ - top files to review first
201
+ - exact rule IDs
202
+ - evidence path and line
203
+ - manual verification steps
204
+ - links to launch-readiness and Stripe replay docs when relevant
205
+ - note that the output is not a full security audit
206
+
207
+ Saved reports should make trend review easier:
208
+
209
+ - scan history by repository
210
+ - repeated findings
211
+ - suppressed findings by reason
212
+ - rule stability breakdown
213
+ - launch review sign-off evidence
214
+
215
+ ## Billing And Packaging
216
+
217
+ The open-source CLI should stay useful without an account.
218
+
219
+ Possible hosted plans:
220
+
221
+ - Free: public repos, check run only, short retention.
222
+ - Team: private repos, PR comments, saved reports, team policy settings.
223
+ - Launch Review: optional human review attached to a checklist and report.
224
+
225
+ Do not gate core local scanning behind the hosted app.
226
+
227
+ ## Operational Requirements
228
+
229
+ Before launch, the hosted app needs:
230
+
231
+ - privacy policy
232
+ - terms of service
233
+ - security contact
234
+ - incident response plan
235
+ - webhook delivery replay handling
236
+ - worker isolation design
237
+ - dependency and container scanning
238
+ - audit logs for comment, check, policy, and report access
239
+ - rate limits per installation and repository
240
+ - clear uninstall and data deletion behavior
241
+
242
+ ## Open Questions
243
+
244
+ These should be answered before implementation:
245
+
246
+ - Should the first hosted version fetch full repository files or PR diffs only?
247
+ - Should private repo reports store snippets, or only file paths and line numbers?
248
+ - Should comments be opt-in per repository or per organization?
249
+ - Should strict findings fail checks by default, or only after explicit policy setup?
250
+ - What is the minimum paid feature that saves enough time without weakening the open-source CLI?
251
+
252
+ ## Implementation Gate
253
+
254
+ Do not start implementation until the hosted app has:
255
+
256
+ - documented GitHub App permissions
257
+ - webhook signature verification tests
258
+ - installation-token scoping tests
259
+ - queue idempotency tests
260
+ - privacy and data retention docs
261
+ - prompt injection abuse-case tests if AI summaries are included
262
+ - release gate evidence equivalent to the CLI package process
@@ -5,10 +5,10 @@
5
5
  ## Current State
6
6
 
7
7
  - Package name: `ai-saas-guard`
8
- - Current version: `0.7.0`
8
+ - Current version: `0.8.0`
9
9
  - npm registry state: published at <https://www.npmjs.com/package/ai-saas-guard>
10
10
  - First npm-published version: `0.1.1`
11
- - GitHub Release: `v0.7.0`
11
+ - GitHub Release: `v0.8.0`
12
12
  - Publish workflow: `.github/workflows/npm-publish.yml`
13
13
  - Trusted Publisher: GitHub Actions, `zr9959/ai-saas-guard`, workflow `npm-publish.yml`, allowed action `npm publish`
14
14
  - Long-lived npm publish token: not required
@@ -17,7 +17,7 @@
17
17
 
18
18
  Use GitHub Actions with npm Trusted Publisher/OIDC:
19
19
 
20
- 1. Create and review a release tag such as `v0.7.0`.
20
+ 1. Create and review a release tag such as `v0.8.0`.
21
21
  2. Publish from the GitHub Release or run the `Publish npm` workflow manually with `ref` set to that tag.
22
22
  3. Keep `permissions.id-token: write` in the workflow so npm can exchange the GitHub Actions OIDC identity for a short-lived publish credential.
23
23
  4. Run `npm publish --access public` from the workflow. Trusted publishing automatically generates provenance for this public package from this public repository.
@@ -51,6 +51,7 @@ Implemented surfaces:
51
51
  - PR-focused markdown summary output for GitHub step summaries or PR comments
52
52
  - project-local `.ai-saas-guard.json` config for rule toggles, severity overrides, path-specific suppressions, and default fail thresholds
53
53
  - rule stability labels in catalog metadata, public rule docs, and SARIF rule properties
54
+ - hosted GitHub App design note covering least-privilege permissions, webhook verification, privacy, data retention, prompt-injection handling, and implementation gates
54
55
  - JSON output
55
56
  - SARIF output
56
57
  - composite GitHub Action wrapper
@@ -102,7 +103,7 @@ GitHub Project:
102
103
 
103
104
  Current issue set:
104
105
 
105
- - No open roadmap issues after the `v0.7.0` suppression and stability release.
106
+ - No open roadmap issues after the `v0.8.0` GitHub App design note release.
106
107
 
107
108
  CI:
108
109
 
@@ -114,7 +115,7 @@ CI:
114
115
  Publishing:
115
116
 
116
117
  - npm package: `ai-saas-guard`
117
- - Current release line: `v0.7.0`
118
+ - Current release line: `v0.8.0`
118
119
  - Publish workflow: `.github/workflows/npm-publish.yml`
119
120
  - Trusted Publisher: GitHub Actions for `zr9959/ai-saas-guard`, workflow `npm-publish.yml`
120
121
  - Long-lived npm publish tokens should not be required.
@@ -141,7 +142,9 @@ Not allowed:
141
142
 
142
143
  Recommended order:
143
144
 
144
- 1. Add a GitHub App design note for the potential hosted layer.
145
+ 1. Open new roadmap issues for the hosted GitHub App implementation gates in `docs/github-app-design.md`.
146
+ 2. Add issue templates for bug reports, false positives, false negatives, rule requests, and security-safe reports.
147
+ 3. Add CODEOWNERS once there are multiple maintainers.
145
148
 
146
149
  For every feature, keep the scanner evidence-first:
147
150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-saas-guard",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Repo-local launch-readiness scanner for AI-built SaaS apps.",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/zr9959/ai-saas-guard#readme",