ai-saas-guard 0.31.0 → 0.33.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
@@ -29,7 +29,9 @@
29
29
 
30
30
  ## Before You Invite Users
31
31
 
32
- AI can make a SaaS look finished: login works, checkout opens, the dashboard loads, and tests are green. The launch risk is usually hidden in trust-boundary code that decides who gets access, who pays, what data they can see, and whether failures are visible.
32
+ AI-built SaaS can look ready before it is ready: login works, checkout opens, the dashboard loads, and tests are green. The launch risk is usually hidden in trust-boundary code that decides who gets access, who pays, what data they can see, and whether failures are visible.
33
+
34
+ Start with the 30-second copy-paste demo: `npx ai-saas-guard@latest demo --summary`. No signup, no code upload, no LLM call. See [docs/demo-terminal-output.txt](docs/demo-terminal-output.txt) and [compare with alternatives](docs/launch-gate-positioning.md).
33
35
 
34
36
  These are the failures that hurt after real users arrive:
35
37
 
@@ -44,6 +46,16 @@ These are the failures that hurt after real users arrive:
44
46
 
45
47
  `ai-saas-guard` gives you a short local review queue for those risks. It does not prove the app is secure, certify a release, or replace human review. It tells founders, solo builders, small teams, and reviewers what deserves attention first.
46
48
 
49
+ ## 30-Second Copy-Paste Demo
50
+
51
+ No signup, no code upload, no LLM call:
52
+
53
+ ```bash
54
+ npx ai-saas-guard@latest demo --summary
55
+ ```
56
+
57
+ The demo scans two packaged fixtures: one risky AI-built SaaS and one safer version. See the saved terminal sample in [docs/demo-terminal-output.txt](docs/demo-terminal-output.txt), then compare with alternatives in [docs/launch-gate-positioning.md](docs/launch-gate-positioning.md).
58
+
47
59
  ## 60-Second Local Check
48
60
 
49
61
  See the public demo output without cloning a repo:
@@ -187,13 +199,13 @@ The CLI is published on npm as `ai-saas-guard`, and the GitHub Action is availab
187
199
  | Area | Status |
188
200
  | --- | --- |
189
201
  | Public GitHub repository | Available |
190
- | npm CLI | `ai-saas-guard@0.31.0` |
191
- | GitHub Action | `zr9959/ai-saas-guard@v0` or fixed tag `v0.31.0` |
202
+ | npm CLI | `ai-saas-guard@0.33.0` |
203
+ | GitHub Action | `zr9959/ai-saas-guard@v0` or fixed tag `v0.33.0` |
192
204
  | Outputs | Short summary, terminal, JSON, SARIF, and PR-focused markdown |
193
205
  | Project config | `.ai-saas-guard.json` rule toggles, severity overrides, suppressions, and fail thresholds |
194
206
  | Privacy model | Local-first, read-only scan commands, no LLM calls, no code upload |
195
- | Versioned Action tags | `v0.31.0`, `v0` |
196
- | Current release | `0.31.0` adds executable hosted staging evidence: success/failure cleanup probes, log-boundary validation, stricter read-only checkout worker boundaries, and release-gate evaluation from evidence bundles |
207
+ | Versioned Action tags | `v0.33.0`, `v0` |
208
+ | Current release | `0.33.0` sharpens the README first screen, adds a saved terminal demo output, and adds deployed worker staging evidence automation that validates safe logs before building hosted release-gate input |
197
209
  | npm publishing | Trusted Publisher/OIDC, no long-lived publish token |
198
210
  | Repository trust hardening | Strict branch protection, Dependabot, CodeQL, fast-check fuzzing, signed release provenance assets, private vulnerability reporting, secret scanning, and push protection |
199
211
  | Cloudflare hosted ingress | Deployed at `https://ai-saas-guard-hosted.zr9959.workers.dev`; signed GitHub App webhook delivery and compact Check Run smoke now pass in staging |
@@ -312,6 +324,8 @@ The hosted staging deployment planner is documented in [docs/hosted-staging-depl
312
324
 
313
325
  The hosted staging harness is documented in [docs/hosted-staging-harness.md](docs/hosted-staging-harness.md). It exports `createFileBackedHostedStagingHarness`, `createHostedStagingHarnessEvidence`, `createHostedStagingReleaseEvidenceBundle`, `evaluateHostedStagingReleaseEvidenceBundle`, and `validateHostedLogBoundary` from `ai-saas-guard/hosted/staging-harness`. It runs signed webhook replay through the provider-independent hosted runtime with local file-backed queue, compact report, and Check Run adapters, verifies worker sandbox cleanup, turns success/failure cleanup probes plus log-boundary samples into release-gate evidence, and evaluates the hosted gate without cloud calls. It is a staging rehearsal tool only; it does not call cloud providers, create a GitHub App, publish live Check Runs, or expose a public hosted service.
314
326
 
327
+ Deployed worker staging evidence is documented in [docs/hosted-deployed-worker-staging.md](docs/hosted-deployed-worker-staging.md). It exports `createHostedDeployedWorkerStagingEvidenceAutomation`, `createHostedDeployedWorkerStagingEvidenceBundle`, and `evaluateHostedDeployedWorkerStagingReleaseGate` from `ai-saas-guard/hosted/deployed-staging`. It validates safe log samples, then turns public HTTPS health, signed webhook replay, deployed worker cleanup, and external CI/scan/rollback evidence into the hosted release gate for a Node/container read-only checkout worker candidate. It does not deploy cloud resources or claim production hosted exposure.
328
+
315
329
  The first live hosted ingress is deployed on Cloudflare Workers at `https://ai-saas-guard-hosted.zr9959.workers.dev` and documented in [hosted/cloudflare-worker/README.md](hosted/cloudflare-worker/README.md). It exposes `/healthz`, `/github/app/manifest-callback`, and signed `/github/webhook` intake backed by Cloudflare KV. A private staging GitHub App, `ai-saas-guard-hosted`, is installed on `zr9959/ai-saas-guard` with selected-repository access and the first-slice permission contract. The Worker verifies signatures, stores compact pull request identity records, exchanges a scoped installation token, fetches PR file metadata from GitHub, classifies PR-risk hotspots, and publishes a bounded Check Run summary. Current deployed evidence is tracked in [docs/hosted-operations-evidence.md](docs/hosted-operations-evidence.md): health, signed webhook delivery, compact KV records, cleanup, and Check Run publication pass for the staging smoke. The Cloudflare Worker still does not run a full source checkout scan worker or store raw webhook payloads, PR title/body text, raw diffs, source, secrets, checkout paths, or installation tokens.
316
330
 
317
331
  The hosted operational release gate is documented in [docs/hosted-operational-release-gate.md](docs/hosted-operational-release-gate.md). It defines the hosted-specific CI, replay, queue, worker cleanup, privacy, monitoring, rollback, and incident-response evidence required before any hosted environment is exposed to users. The pure gate evaluator exported from `ai-saas-guard/hosted/contracts` blocks hosted exposure unless every P0 evidence item is fresh, a container digest is recorded, and release notes avoid pentest, certification, and full-audit claims.
@@ -320,7 +334,7 @@ Hosted uninstall and data deletion behavior is documented in [docs/hosted-uninst
320
334
 
321
335
  Hosted pricing and packaging boundaries are documented in [docs/hosted-pricing-packaging.md](docs/hosted-pricing-packaging.md). Core local scanning stays useful without an account; hosted plans may add workflow convenience, saved reports, team policy, and optional human review, but they do not gate local CLI scanning.
322
336
 
323
- Hosted pre-implementation pure contracts are documented in [docs/hosted-preimplementation-contracts.md](docs/hosted-preimplementation-contracts.md). They now include a pull request webhook intake planner that verifies signatures before parsing or queueing, a durable scan queue planner that reuses queued, running, and completed jobs for the same trusted scan key, a worker read-only scan planner that fixes the CLI command and requires repository `contents: read`, a concrete Node read-only checkout scan runner, and a Check Run publication planner that requires repository `checks: write` and builds bounded check-only payloads from compact reports. They also cover queue-safe webhook event parsing, bounded check-run summary rendering, idempotent queue cleanup planning, worker checkout cleanup planning, a retention/deletion cleanup planner, an operational release gate evaluator, the production adapter plans needed for GitHub App auth and bounded worker execution, the Node/container app skeleton needed for real provider wiring, the staging deployment planner needed before production GitHub App promotion, and the local staging harness needed to rehearse webhook replay, persistence, publication, and cleanup without cloud calls. The service runtime composes these contracts behind replaceable adapters. PR comments remain a later workflow or paid hosted feature, not part of the hosted MVP contract.
337
+ Hosted pre-implementation pure contracts are documented in [docs/hosted-preimplementation-contracts.md](docs/hosted-preimplementation-contracts.md). They now include a pull request webhook intake planner that verifies signatures before parsing or queueing, a durable scan queue planner that reuses queued, running, and completed jobs for the same trusted scan key, a worker read-only scan planner that fixes the CLI command and requires repository `contents: read`, a concrete Node read-only checkout scan runner, and a Check Run publication planner that requires repository `checks: write` and builds bounded check-only payloads from compact reports. They also cover queue-safe webhook event parsing, bounded check-run summary rendering, idempotent queue cleanup planning, worker checkout cleanup planning, a retention/deletion cleanup planner, an operational release gate evaluator, the production adapter plans needed for GitHub App auth and bounded worker execution, the Node/container app skeleton needed for real provider wiring, the staging deployment planner needed before production GitHub App promotion, the local staging harness needed to rehearse webhook replay, persistence, publication, and cleanup without cloud calls, and the deployed worker staging evidence helper needed to evaluate public HTTPS health, deployed cleanup, and log-boundary evidence without storing raw hosted data. The service runtime composes these contracts behind replaceable adapters. PR comments remain a later workflow or paid hosted feature, not part of the hosted MVP contract.
324
338
 
325
339
  A public hosted compact report schema fixture is available at [examples/hosted-compact-report.json](examples/hosted-compact-report.json). It is synthetic and public-safe: compact evidence only, no raw source, raw diffs, secrets, webhook payload bodies, customer payloads, private URLs, or worker checkout paths.
326
340
 
@@ -360,7 +374,7 @@ Use `suppressions` for narrower false-positive handling when one rule is noisy o
360
374
 
361
375
  ## GitHub Action
362
376
 
363
- The repo includes a composite Action. Use `v0` for the latest compatible pre-1.0 Action, a specific release tag such as `v0.31.0` for controlled upgrades, or pin a reviewed commit SHA for stricter supply-chain control:
377
+ The repo includes a composite Action. Use `v0` for the latest compatible pre-1.0 Action, a specific release tag such as `v0.33.0` for controlled upgrades, or pin a reviewed commit SHA for stricter supply-chain control:
364
378
 
365
379
  ```yaml
366
380
  name: ai-saas-guard
@@ -0,0 +1,87 @@
1
+ import { type HostedOperationalReleaseGateDecision, type HostedOperationalReleaseGateEvidence } from "./contracts.js";
2
+ import type { HostedLogBoundaryForbiddenInput, HostedLogBoundaryValidation, HostedStagingHarnessReplayResult, HostedStagingHarnessWorkerTickResult } from "./staging-harness.js";
3
+ export interface HostedDeployedWorkerHealthProbe {
4
+ observedAt: string;
5
+ status: number;
6
+ body: unknown;
7
+ }
8
+ export interface HostedDeployedWorkerStagingEvidenceBundleInput {
9
+ collectedAt: string;
10
+ evidenceBaseUrl: string;
11
+ owner: string;
12
+ publicBaseUrl: string;
13
+ scannerVersion: string;
14
+ healthProbe: HostedDeployedWorkerHealthProbe;
15
+ webhookReplays: HostedStagingHarnessReplayResult[];
16
+ workerTicks: HostedStagingHarnessWorkerTickResult[];
17
+ logBoundary: HostedLogBoundaryValidation;
18
+ externalEvidence: HostedOperationalReleaseGateEvidence[];
19
+ requiredFailureReasons?: string[];
20
+ }
21
+ export interface HostedDeployedWorkerStagingEvidenceBundle {
22
+ readyForReleaseGate: boolean;
23
+ blockedReasons: string[];
24
+ evidence: HostedOperationalReleaseGateEvidence[];
25
+ releaseGateInput: {
26
+ evidence: HostedOperationalReleaseGateEvidence[];
27
+ };
28
+ deployedScenarioSummary: HostedDeployedWorkerStagingScenarioSummary;
29
+ privacy: HostedDeployedWorkerStagingPrivacy;
30
+ }
31
+ export interface HostedDeployedWorkerStagingEvidenceAutomationInput extends Omit<HostedDeployedWorkerStagingEvidenceBundleInput, "logBoundary"> {
32
+ logSamples: unknown[];
33
+ forbiddenLogMaterial: HostedLogBoundaryForbiddenInput;
34
+ }
35
+ export interface HostedDeployedWorkerStagingEvidenceAutomation {
36
+ readyForReleaseGate: boolean;
37
+ blockedReasons: string[];
38
+ logBoundary: HostedLogBoundaryValidation;
39
+ collectionPlan: HostedDeployedWorkerStagingEvidenceCollectionPlan;
40
+ bundle: HostedDeployedWorkerStagingEvidenceBundle;
41
+ releaseGateInput: {
42
+ evidence: HostedOperationalReleaseGateEvidence[];
43
+ };
44
+ privacy: HostedDeployedWorkerStagingPrivacy;
45
+ }
46
+ export interface HostedDeployedWorkerStagingEvidenceCollectionPlan {
47
+ steps: string[];
48
+ requiredSafeLogFields: string[];
49
+ requiredFailureReasons: string[];
50
+ }
51
+ export interface HostedDeployedWorkerStagingScenarioSummary {
52
+ publicIngressAccepted: boolean;
53
+ healthAccepted: boolean;
54
+ webhookReplayAccepted: boolean;
55
+ completedWorkerProbe: boolean;
56
+ failureCleanupProbe: boolean;
57
+ observedFailureReasons: string[];
58
+ allWorkerCheckoutsDeleted: boolean;
59
+ checkRunPublished: boolean;
60
+ logBoundaryAccepted: boolean;
61
+ }
62
+ export interface HostedDeployedWorkerStagingReleaseGateInput {
63
+ bundle: HostedDeployedWorkerStagingEvidenceBundle;
64
+ commitSha: string;
65
+ scannerVersion: string;
66
+ deploymentTarget: string;
67
+ evaluatedAt: string;
68
+ releaseNotes: string;
69
+ containerImageDigest: string;
70
+ maxEvidenceAgeDays?: number;
71
+ }
72
+ export interface HostedDeployedWorkerStagingPrivacy {
73
+ includesRawHealthResponse: false;
74
+ includesPublicBaseUrl: false;
75
+ includesRawWebhookPayload: false;
76
+ includesUntrustedPrText: false;
77
+ includesRawSource: false;
78
+ includesRawDiffs: false;
79
+ includesSecrets: false;
80
+ includesCustomerPayloads: false;
81
+ includesPrivateCheckoutPath: false;
82
+ includesInstallationToken: false;
83
+ claimsProductionHostedService: false;
84
+ }
85
+ export declare function createHostedDeployedWorkerStagingEvidenceBundle(input: HostedDeployedWorkerStagingEvidenceBundleInput): HostedDeployedWorkerStagingEvidenceBundle;
86
+ export declare function createHostedDeployedWorkerStagingEvidenceAutomation(input: HostedDeployedWorkerStagingEvidenceAutomationInput): HostedDeployedWorkerStagingEvidenceAutomation;
87
+ export declare function evaluateHostedDeployedWorkerStagingReleaseGate(input: HostedDeployedWorkerStagingReleaseGateInput): HostedOperationalReleaseGateDecision;
@@ -0,0 +1,320 @@
1
+ import { evaluateHostedOperationalReleaseGate, HOSTED_OPERATIONAL_RELEASE_GATE_REQUIREMENTS } from "./contracts.js";
2
+ import { HOSTED_NODE_CONTAINER_PLATFORM, HOSTED_NODE_CONTAINER_ROLES } from "./app.js";
3
+ import { validateHostedLogBoundary } from "./staging-harness.js";
4
+ export function createHostedDeployedWorkerStagingEvidenceBundle(input) {
5
+ const summary = deployedScenarioSummary(input);
6
+ const blockedReasons = deployedBlockedReasons(input, summary);
7
+ const externalEvidence = new Map(input.externalEvidence.map((evidence) => [evidence.id, sanitizeEvidence(evidence, input)]));
8
+ const evidence = HOSTED_OPERATIONAL_RELEASE_GATE_REQUIREMENTS.map((requirement) => {
9
+ const generated = generatedEvidenceFor(requirement.id, input, summary, blockedReasons);
10
+ return generated ?? externalEvidence.get(requirement.id) ?? missingEvidence(requirement.id, input);
11
+ });
12
+ const readyForReleaseGate = blockedReasons.length === 0 && evidence.every((item) => item.status === "passed");
13
+ return {
14
+ readyForReleaseGate,
15
+ blockedReasons,
16
+ evidence,
17
+ releaseGateInput: { evidence },
18
+ deployedScenarioSummary: summary,
19
+ privacy: deployedPrivacy()
20
+ };
21
+ }
22
+ export function createHostedDeployedWorkerStagingEvidenceAutomation(input) {
23
+ const logBoundary = validateHostedLogBoundary({
24
+ samples: input.logSamples,
25
+ forbidden: input.forbiddenLogMaterial
26
+ });
27
+ const bundle = createHostedDeployedWorkerStagingEvidenceBundle({
28
+ collectedAt: input.collectedAt,
29
+ evidenceBaseUrl: input.evidenceBaseUrl,
30
+ owner: input.owner,
31
+ publicBaseUrl: input.publicBaseUrl,
32
+ scannerVersion: input.scannerVersion,
33
+ healthProbe: input.healthProbe,
34
+ webhookReplays: input.webhookReplays,
35
+ workerTicks: input.workerTicks,
36
+ logBoundary,
37
+ externalEvidence: input.externalEvidence,
38
+ requiredFailureReasons: input.requiredFailureReasons
39
+ });
40
+ return {
41
+ readyForReleaseGate: bundle.readyForReleaseGate,
42
+ blockedReasons: bundle.blockedReasons,
43
+ logBoundary,
44
+ collectionPlan: deployedEvidenceCollectionPlan(input.requiredFailureReasons ?? []),
45
+ bundle,
46
+ releaseGateInput: bundle.releaseGateInput,
47
+ privacy: deployedPrivacy()
48
+ };
49
+ }
50
+ export function evaluateHostedDeployedWorkerStagingReleaseGate(input) {
51
+ return evaluateHostedOperationalReleaseGate({
52
+ commitSha: input.commitSha,
53
+ scannerVersion: input.scannerVersion,
54
+ deploymentTarget: input.deploymentTarget,
55
+ evaluatedAt: input.evaluatedAt,
56
+ evidence: input.bundle.evidence,
57
+ releaseNotes: input.releaseNotes,
58
+ containerImageDigest: input.containerImageDigest,
59
+ maxEvidenceAgeDays: input.maxEvidenceAgeDays
60
+ });
61
+ }
62
+ function deployedScenarioSummary(input) {
63
+ const processedWorkers = input.workerTicks.filter((tick) => tick.processed);
64
+ const completedWorkers = processedWorkers.filter((tick) => tick.status === "completed");
65
+ const observedFailureReasons = [
66
+ ...new Set(processedWorkers.flatMap((tick) => tick.status === "failed" && tick.cleanupVerified && tick.safeFailureReason
67
+ ? [tick.safeFailureReason]
68
+ : []))
69
+ ].sort();
70
+ const requiredFailureReasons = input.requiredFailureReasons ?? [];
71
+ const failureCleanupProbe = requiredFailureReasons.length
72
+ ? requiredFailureReasons.every((reason) => observedFailureReasons.includes(reason))
73
+ : processedWorkers.some((tick) => tick.status === "failed" && tick.cleanupVerified);
74
+ const allWorkerCheckoutsDeleted = processedWorkers.length > 0 &&
75
+ processedWorkers.every((tick) => tick.workerSandboxDeleted &&
76
+ tick.activeWorkerSandboxCount === 0 &&
77
+ tick.cleanupVerified);
78
+ return {
79
+ publicIngressAccepted: isSafePublicHttpsUrl(input.publicBaseUrl),
80
+ healthAccepted: healthProbeAccepted(input),
81
+ webhookReplayAccepted: input.webhookReplays.some((replay) => replay.accepted && replay.queuedWorker && replay.shouldCreateCheckRun),
82
+ completedWorkerProbe: completedWorkers.some((tick) => tick.checkRunPublished && tick.compactReportStored),
83
+ failureCleanupProbe,
84
+ observedFailureReasons,
85
+ allWorkerCheckoutsDeleted,
86
+ checkRunPublished: completedWorkers.some((tick) => tick.checkRunPublished),
87
+ logBoundaryAccepted: input.logBoundary.sampleCount > 0 && input.logBoundary.accepted
88
+ };
89
+ }
90
+ function deployedBlockedReasons(input, summary) {
91
+ const reasons = [];
92
+ const health = healthBody(input.healthProbe.body);
93
+ if (!summary.publicIngressAccepted)
94
+ reasons.push("invalid_public_base_url");
95
+ if (!isSafePublicHttpsUrl(input.evidenceBaseUrl))
96
+ reasons.push("unsafe_evidence_base_url");
97
+ if (input.healthProbe.status !== 200)
98
+ reasons.push("health_status_unhealthy");
99
+ if (health.ok !== true)
100
+ reasons.push("health_not_ok");
101
+ if (health.platform !== HOSTED_NODE_CONTAINER_PLATFORM)
102
+ reasons.push("health_platform_mismatch");
103
+ if (health.scannerVersion !== input.scannerVersion) {
104
+ reasons.push("health_scanner_version_mismatch");
105
+ }
106
+ if (!health.roles.includes("webhook-ingress"))
107
+ reasons.push("health_missing_webhook_role");
108
+ if (!health.roles.includes("scan-worker"))
109
+ reasons.push("health_missing_scan_worker_role");
110
+ if (!privacyFlagsAreSafe(health.privacy))
111
+ reasons.push("health_privacy_flags_unsafe");
112
+ if (!summary.webhookReplayAccepted)
113
+ reasons.push("webhook_replay_missing");
114
+ if (!summary.completedWorkerProbe)
115
+ reasons.push("worker_success_probe_missing");
116
+ if (!summary.failureCleanupProbe)
117
+ reasons.push("worker_failure_cleanup_probe_missing");
118
+ if (!summary.allWorkerCheckoutsDeleted)
119
+ reasons.push("worker_cleanup_not_verified");
120
+ if (!summary.checkRunPublished)
121
+ reasons.push("check_run_not_published");
122
+ if (!summary.logBoundaryAccepted)
123
+ reasons.push("log_boundary_rejected");
124
+ return reasons;
125
+ }
126
+ function generatedEvidenceFor(id, input, summary, blockedReasons) {
127
+ if (blockedReasons.length > 0) {
128
+ return undefined;
129
+ }
130
+ if (id === "webhook_replay") {
131
+ return summary.publicIngressAccepted && summary.healthAccepted && summary.webhookReplayAccepted
132
+ ? passedEvidence(id, "Deployed staging ingress accepted a signed webhook and queued check-run-only work.", input)
133
+ : missingEvidence(id, input);
134
+ }
135
+ if (id === "queue_worker_cleanup") {
136
+ return summary.completedWorkerProbe &&
137
+ summary.failureCleanupProbe &&
138
+ summary.allWorkerCheckoutsDeleted
139
+ ? passedEvidence(id, "Deployed staging worker success and failure probes published compact checks and deleted worker checkouts.", input)
140
+ : missingEvidence(id, input);
141
+ }
142
+ if (id === "privacy_retention") {
143
+ return summary.logBoundaryAccepted && privacyFlagsAreSafe(input.logBoundary.privacy)
144
+ ? passedEvidence(id, "Deployed staging log samples stayed within the safe metadata boundary and avoided raw payloads.", input)
145
+ : missingEvidence(id, input);
146
+ }
147
+ if (id === "release_cleanup") {
148
+ return summary.allWorkerCheckoutsDeleted
149
+ ? passedEvidence(id, "Deployed staging release cleanup left no active worker checkout entries.", input)
150
+ : missingEvidence(id, input);
151
+ }
152
+ return undefined;
153
+ }
154
+ function healthProbeAccepted(input) {
155
+ const health = healthBody(input.healthProbe.body);
156
+ return (input.healthProbe.status === 200 &&
157
+ health.ok === true &&
158
+ health.platform === HOSTED_NODE_CONTAINER_PLATFORM &&
159
+ HOSTED_NODE_CONTAINER_ROLES.every((role) => health.roles.includes(role)) &&
160
+ health.scannerVersion === input.scannerVersion &&
161
+ privacyFlagsAreSafe(health.privacy));
162
+ }
163
+ function sanitizeEvidence(evidence, input) {
164
+ return {
165
+ id: evidence.id,
166
+ status: evidence.status,
167
+ ...(evidence.collectedAt === undefined
168
+ ? { collectedAt: input.collectedAt }
169
+ : { collectedAt: evidence.collectedAt }),
170
+ ...(safeEvidenceUrl(evidence.evidenceUrl) === undefined
171
+ ? {}
172
+ : { evidenceUrl: safeEvidenceUrl(evidence.evidenceUrl) }),
173
+ note: `External deployed-staging release-gate evidence recorded for ${evidence.id}.`,
174
+ ...(evidence.owner === undefined ? { owner: input.owner } : { owner: evidence.owner })
175
+ };
176
+ }
177
+ function passedEvidence(id, note, input) {
178
+ return {
179
+ id,
180
+ status: "passed",
181
+ collectedAt: input.collectedAt,
182
+ ...(evidenceUrlFor(input, id) === undefined ? {} : { evidenceUrl: evidenceUrlFor(input, id) }),
183
+ note,
184
+ owner: input.owner
185
+ };
186
+ }
187
+ function missingEvidence(id, input) {
188
+ return {
189
+ id,
190
+ status: "missing",
191
+ collectedAt: input.collectedAt,
192
+ note: `Missing deployed staging worker evidence for ${id}.`,
193
+ owner: input.owner
194
+ };
195
+ }
196
+ function deployedEvidenceCollectionPlan(requiredFailureReasons) {
197
+ return {
198
+ steps: [
199
+ "Collect public HTTPS health metadata from the deployed Node/container candidate.",
200
+ "Replay a signed webhook and confirm it queues check-run-only worker work.",
201
+ "Run deployed worker cleanup probes for one success path and the required failure reasons.",
202
+ "Validate safe log samples before building release-gate evidence.",
203
+ "Attach external CI, workflow, dependency, container, monitoring, rollback, and incident-response evidence."
204
+ ],
205
+ requiredSafeLogFields: [
206
+ "scanKey",
207
+ "installationId",
208
+ "repositoryId",
209
+ "pullRequestNumber",
210
+ "headSha",
211
+ "scannerVersion",
212
+ "durationMs",
213
+ "summaryCounts",
214
+ "errorClass",
215
+ "cleanupStatus"
216
+ ],
217
+ requiredFailureReasons: [...requiredFailureReasons].sort()
218
+ };
219
+ }
220
+ function evidenceUrlFor(input, id) {
221
+ const baseUrl = safeEvidenceUrl(input.evidenceBaseUrl);
222
+ return baseUrl === undefined ? undefined : `${baseUrl}/${id}.json`;
223
+ }
224
+ function safeEvidenceUrl(value) {
225
+ if (!value || !isSafePublicHttpsUrl(value)) {
226
+ return undefined;
227
+ }
228
+ return trimTrailingSlashes(value.trim());
229
+ }
230
+ function healthBody(value) {
231
+ if (!isRecord(value)) {
232
+ return {
233
+ ok: undefined,
234
+ platform: undefined,
235
+ roles: [],
236
+ scannerVersion: undefined,
237
+ privacy: undefined
238
+ };
239
+ }
240
+ const roles = Array.isArray(value.roles)
241
+ ? value.roles.filter((role) => typeof role === "string")
242
+ : [];
243
+ return {
244
+ ok: typeof value.ok === "boolean" ? value.ok : undefined,
245
+ platform: typeof value.platform === "string" ? value.platform : undefined,
246
+ roles,
247
+ scannerVersion: typeof value.scannerVersion === "string" ? value.scannerVersion : undefined,
248
+ privacy: isRecord(value.privacy) ? value.privacy : undefined
249
+ };
250
+ }
251
+ function privacyFlagsAreSafe(value) {
252
+ return isRecord(value) && Object.values(value).every((flag) => flag === false);
253
+ }
254
+ function isSafePublicHttpsUrl(value) {
255
+ try {
256
+ const url = new URL(value.trim());
257
+ return (url.protocol === "https:" &&
258
+ !url.username &&
259
+ !url.password &&
260
+ !url.search &&
261
+ !url.hash &&
262
+ !isUnsafeHostedHostname(url.hostname));
263
+ }
264
+ catch {
265
+ return false;
266
+ }
267
+ }
268
+ function isUnsafeHostedHostname(hostname) {
269
+ const normalized = hostname.toLowerCase().replace(/\.$/, "");
270
+ return (normalized === "localhost" ||
271
+ normalized.endsWith(".localhost") ||
272
+ isUnsafeIpv4Hostname(normalized) ||
273
+ normalized === "::1" ||
274
+ normalized.startsWith("fc") ||
275
+ normalized.startsWith("fd") ||
276
+ normalized.startsWith("fe80:"));
277
+ }
278
+ function isUnsafeIpv4Hostname(hostname) {
279
+ const parts = hostname.split(".");
280
+ if (parts.length !== 4 || !parts.every((part) => /^\d+$/.test(part)))
281
+ return false;
282
+ const octets = parts.map((part) => Number(part));
283
+ if (octets.some((octet) => !Number.isInteger(octet) || octet < 0 || octet > 255)) {
284
+ return false;
285
+ }
286
+ const [first, second] = octets;
287
+ return (first === 0 ||
288
+ first === 10 ||
289
+ first === 127 ||
290
+ (first === 169 && second === 254) ||
291
+ (first === 172 && second >= 16 && second <= 31) ||
292
+ (first === 192 && second === 168) ||
293
+ (first === 100 && second >= 64 && second <= 127) ||
294
+ first >= 224);
295
+ }
296
+ function trimTrailingSlashes(value) {
297
+ let end = value.length;
298
+ while (end > 0 && value[end - 1] === "/") {
299
+ end -= 1;
300
+ }
301
+ return value.slice(0, end);
302
+ }
303
+ function isRecord(value) {
304
+ return typeof value === "object" && value !== null && !Array.isArray(value);
305
+ }
306
+ function deployedPrivacy() {
307
+ return {
308
+ includesRawHealthResponse: false,
309
+ includesPublicBaseUrl: false,
310
+ includesRawWebhookPayload: false,
311
+ includesUntrustedPrText: false,
312
+ includesRawSource: false,
313
+ includesRawDiffs: false,
314
+ includesSecrets: false,
315
+ includesCustomerPayloads: false,
316
+ includesPrivateCheckoutPath: false,
317
+ includesInstallationToken: false,
318
+ claimsProductionHostedService: false
319
+ };
320
+ }
@@ -28,7 +28,7 @@
28
28
 
29
29
  ## 邀请真实用户前先看这里
30
30
 
31
- AI 能很快把一个 SaaS 做到“看起来能用”:能登录、能打开 checkout、dashboard 能加载、测试也是绿的。真正危险的是信任边界代码,它决定谁有权限、谁付了钱、谁能看哪些数据,以及服务失败时会不会被悄悄伪装成成功。
31
+ AI 构建的 SaaS 很容易“看起来已经能上线”:能登录、能打开 checkout、dashboard 能加载、测试也是绿的。真正危险的是信任边界代码,它决定谁有权限、谁付了钱、谁能看哪些数据,以及服务失败时会不会被悄悄伪装成成功。
32
32
 
33
33
  这些问题通常会在真实用户来了以后才变痛:
34
34
 
@@ -43,6 +43,16 @@ AI 能很快把一个 SaaS 做到“看起来能用”:能登录、能打开 c
43
43
 
44
44
  `ai-saas-guard` 是面向这个时刻的本地优先、review-first 上线预检工具。它不会证明你的应用绝对安全,也不是渗透测试、认证或完整安全审计。它的目标是给 founder、独立开发者、小团队和 reviewer 一份短而有证据的清单,告诉你上线或合并 PR 前最该先看哪里。
45
45
 
46
+ ## 30 秒复制粘贴 demo
47
+
48
+ 不需要注册、不上传代码、不调用 LLM:
49
+
50
+ ```bash
51
+ npx ai-saas-guard@latest demo --summary
52
+ ```
53
+
54
+ 这个 demo 会扫描两个包内 fixture:一个故意有上线风险的 AI-built SaaS,和一个同类场景下更安全的版本。可以先看保存好的终端样例:[docs/demo-terminal-output.txt](demo-terminal-output.txt),再看它[和替代方案的区别](launch-gate-positioning.md)。
55
+
46
56
  ## 60 秒本地检查
47
57
 
48
58
  不用 clone 仓库,先看公开 demo 输出:
@@ -169,18 +179,18 @@ node dist/cli.js scan --root /path/to/your-saas
169
179
 
170
180
  这个仓库是公开 GitHub 仓库。
171
181
 
172
- CLI 已发布到 npm:`ai-saas-guard@0.31.0`。GitHub Action 支持 `v0` 浮动标签,也支持固定版本标签,例如 `v0.31.0`。
182
+ CLI 已发布到 npm:`ai-saas-guard@0.33.0`。GitHub Action 支持 `v0` 浮动标签,也支持固定版本标签,例如 `v0.33.0`。
173
183
 
174
184
  | 模块 | 状态 |
175
185
  | --- | --- |
176
186
  | 公开 GitHub 仓库 | 已可用 |
177
- | npm CLI | `ai-saas-guard@0.31.0` |
178
- | GitHub Action | `zr9959/ai-saas-guard@v0` 或固定标签 `v0.31.0` |
187
+ | npm CLI | `ai-saas-guard@0.33.0` |
188
+ | GitHub Action | `zr9959/ai-saas-guard@v0` 或固定标签 `v0.33.0` |
179
189
  | 输出格式 | 短 summary、Terminal、JSON、SARIF 和 PR markdown |
180
190
  | 项目配置 | `.ai-saas-guard.json` 支持规则开关、severity 覆盖、suppressions 和 fail threshold |
181
191
  | 隐私模型 | 本地优先、只读扫描、不调用 LLM、不上传代码 |
182
- | 当前版本 | `0.31.0` 增加可执行 hosted staging evidence:成功/失败 cleanup probes、log-boundary validation、更严格的 read-only checkout worker 边界,以及从 evidence bundle 直接评估 release gate |
183
- | Action 标签 | `v0.31.0`、`v0` |
192
+ | 当前版本 | `0.33.0` 优化 README 首屏、增加保存好的终端 demo 输出,并新增 deployed worker staging evidence automation:先验证 safe log samples,再生成 hosted release-gate input |
193
+ | Action 标签 | `v0.33.0`、`v0` |
184
194
  | npm 发布 | GitHub Actions Trusted Publisher/OIDC,无需长期 npm token |
185
195
  | 仓库可信度加固 | 严格 branch protection、Dependabot、CodeQL、fast-check fuzzing、signed release provenance assets、private vulnerability reporting、secret scanning 和 push protection |
186
196
  | Cloudflare hosted ingress | 已部署到 `https://ai-saas-guard-hosted.zr9959.workers.dev`;签名 GitHub App webhook delivery 和 compact Check Run staging smoke 已通过 |
@@ -349,6 +359,7 @@ GitHub Marketplace wrapper 决策见 [docs/github-marketplace-wrapper-decision.m
349
359
  - [docs/hosted-node-container-app.md](hosted-node-container-app.md)
350
360
  - [docs/hosted-staging-deployment.md](hosted-staging-deployment.md)
351
361
  - [docs/hosted-staging-harness.md](hosted-staging-harness.md)
362
+ - [docs/hosted-deployed-worker-staging.md](hosted-deployed-worker-staging.md)
352
363
  - [docs/hosted-operational-release-gate.md](hosted-operational-release-gate.md)
353
364
  - [docs/hosted-uninstall-data-deletion.md](hosted-uninstall-data-deletion.md)
354
365
  - [docs/hosted-pricing-packaging.md](hosted-pricing-packaging.md)
@@ -366,6 +377,7 @@ GitHub Marketplace wrapper 决策见 [docs/github-marketplace-wrapper-decision.m
366
377
  - Hosted Node/container app skeleton:`ai-saas-guard/hosted/app` 导出 `createHostedHttpApp`、`createInMemoryHostedAppPlatform`、`createHostedNodeCheckoutAppPlatform` 和 `planHostedNodeContainerDeployment`,提供安全 `/healthz`、签名 `/github/webhook` ingress、单 job worker tick、测试用 in-memory provider adapters、真实 read-only checkout worker 组合入口、可见 timeout/output 安全预算,以及 secret manager、queue、compact report store、worker sandbox、GitHub Checks publisher 的部署引用校验;它本身仍然不部署或暴露公开 hosted 服务
367
378
  - Hosted staging deployment planner:`ai-saas-guard/hosted/staging` 导出 `planHostedProviderBinding`、`planHostedStagingDeployment` 和 `planHostedGitHubAppPromotion`,把真实 provider 引用、Node/container deployment plan、hosted operational release-gate evidence 和 GitHub App deployment planning 组合起来;缺少 queue、store、worker sandbox、Check Run publisher、logs、metrics、rollback 或 incident-response 引用时,会阻止 staging exposure 和 production promotion;它本身仍然不会调用云平台、创建 GitHub App 或暴露公开 hosted 服务
368
379
  - Hosted staging harness:`ai-saas-guard/hosted/staging-harness` 导出 `createFileBackedHostedStagingHarness`、`createHostedStagingHarnessEvidence`、`createHostedStagingReleaseEvidenceBundle`、`evaluateHostedStagingReleaseEvidenceBundle` 和 `validateHostedLogBoundary`,可以在本地用 file-backed queue、compact report、Check Run request 和 worker sandbox 跑通签名 webhook replay、worker tick 和 cleanup 校验,把 success/failure cleanup probes 与 log-boundary samples 转成 release-gate evidence,并直接执行 hosted release gate 判断;它只是 staging 演练工具,不会调用云平台、创建 GitHub App、写真实 Check Run 或暴露公开 hosted 服务
380
+ - Deployed worker staging evidence:`ai-saas-guard/hosted/deployed-staging` 导出 `createHostedDeployedWorkerStagingEvidenceAutomation`、`createHostedDeployedWorkerStagingEvidenceBundle` 和 `evaluateHostedDeployedWorkerStagingReleaseGate`,先验证 safe log samples,再把 public HTTPS health、signed webhook replay、deployed worker cleanup 以及外部 CI/scan/rollback evidence 转成 hosted release gate evidence;它不会部署云资源,也不会宣称 production hosted exposure
369
381
  - Cloudflare hosted ingress:`hosted/cloudflare-worker` 已部署到 `https://ai-saas-guard-hosted.zr9959.workers.dev`,提供 `/healthz`、`/github/app/manifest-callback` 和签名 `/github/webhook` intake;Worker 已具备 compact pull request identity、file/category risk signal 和 Check Run metadata 路径;staging GitHub App ID 为 `3834787`,installation ID 为 `135085075`;真实 GitHub App webhook delivery 和 Check Run smoke 已通过;完整 source checkout worker deployment、monitoring、rollback 和 incident-response evidence 仍需要通过 hosted operational release gate
370
382
  - webhook event parser
371
383
  - check-run summary renderer
@@ -0,0 +1,19 @@
1
+ ai-saas-guard demo --summary
2
+
3
+ Risky demo: 19 findings
4
+ Launch gate: blocked
5
+
6
+ Top risks:
7
+ - CRITICAL stripe.webhook.missing-signature at app/api/stripe/webhook/route.ts:1
8
+ - CRITICAL supabase.rls.broad-policy at supabase/migrations/001_accounts.sql:10
9
+ - HIGH silent-success.swallowed-error at app/api/billing/checkout/route.ts:4
10
+
11
+ Manual proof to run next:
12
+ - Send a request without a valid Stripe signature and confirm the handler rejects it.
13
+ - Run a two-account tenant check and confirm User B cannot access User A data.
14
+ - Force the billing provider call to fail and confirm the API route returns an error, not fake success.
15
+
16
+ Safe demo: 0 findings
17
+ Launch gate: ready for local review
18
+
19
+ This is a deterministic local demo fixture. It does not upload code, call an LLM, or certify the app.
@@ -0,0 +1,86 @@
1
+ # Hosted Deployed Worker Staging Evidence
2
+
3
+ This document describes the deployed worker staging evidence helper implemented in `src/hosted/deployed-staging.ts`.
4
+
5
+ The package exports `ai-saas-guard/hosted/deployed-staging` with:
6
+
7
+ - `createHostedDeployedWorkerStagingEvidenceAutomation`
8
+ - `createHostedDeployedWorkerStagingEvidenceBundle`
9
+ - `evaluateHostedDeployedWorkerStagingReleaseGate`
10
+
11
+ The helper is for a deployed Node/container read-only checkout worker release candidate. It turns safe deployment observations into the same hosted operational release-gate evidence used by the rest of the hosted planning layer.
12
+
13
+ It does not deploy cloud resources, create a GitHub App, call GitHub, fetch repositories, upload source code, or publish Check Runs by itself. It is not production hosted exposure. It records whether a deployed staging candidate has enough public-safe evidence to pass the hosted release gate.
14
+
15
+ ## Inputs
16
+
17
+ `createHostedDeployedWorkerStagingEvidenceAutomation` is the recommended helper for a deployed staging candidate. It validates safe log samples with `validateHostedLogBoundary`, builds the deployed evidence bundle, returns the release-gate input, and includes the collection steps that should have produced the evidence. It never returns the forbidden raw source, raw diff, secret, customer payload, installation token, checkout path, private URL, or untrusted PR text values used for the boundary check.
18
+
19
+ `createHostedDeployedWorkerStagingEvidenceBundle` expects only bounded evidence:
20
+
21
+ - public HTTPS health probe metadata from the deployed Node/container app
22
+ - signed webhook replay summaries
23
+ - deployed worker success and failure cleanup summaries
24
+ - log-boundary validation output, or safe log samples passed through the automation helper first
25
+ - external evidence for CI, workflow static checks, dependency/container scans, monitoring, rollback, and incident response
26
+ - scanner version, collected timestamp, evidence URL base, and evidence owner
27
+
28
+ The public HTTPS health probe must show:
29
+
30
+ - HTTP `200`
31
+ - `ok: true`
32
+ - `platform: "node_container"`
33
+ - both `webhook-ingress` and `scan-worker` roles
34
+ - a scanner version matching the release candidate
35
+ - privacy flags set to false for raw webhook payloads, PR text, source, diffs, secrets, customer payloads, checkout paths, and installation tokens
36
+
37
+ The helper requires a public HTTPS URL for both the deployed ingress and the evidence base. Localhost, private IPs, link-local addresses, non-HTTPS URLs, file URLs, URL credentials, query strings, and fragments are rejected for deployed staging evidence.
38
+
39
+ ## Generated Evidence
40
+
41
+ The bundle generates deployed evidence for these hosted gate IDs when the probes are complete:
42
+
43
+ - `webhook_replay`: deployed staging ingress accepted a signed webhook and queued check-run-only work
44
+ - `queue_worker_cleanup`: deployed worker success and failure probes completed and deleted worker checkouts
45
+ - `privacy_retention`: deployed log samples stayed within the safe metadata boundary
46
+ - `release_cleanup`: no deployed worker checkout entries remained active after release probes
47
+
48
+ Other gate IDs still come from external evidence because they belong to CI, workflow analysis, dependency/container scan, monitoring, rollback, and incident-response systems.
49
+
50
+ ## Automation Helper
51
+
52
+ The automation helper keeps this evidence path deterministic while removing a manual wiring step:
53
+
54
+ 1. Validate safe log samples against known forbidden material.
55
+ 2. Convert public health, signed webhook replay, deployed worker cleanup, and external evidence into a deployed staging bundle.
56
+ 3. Return the exact `releaseGateInput` for `evaluateHostedDeployedWorkerStagingReleaseGate`.
57
+ 4. Return a collection plan naming the required public HTTPS health, signed webhook, worker cleanup, safe log samples, and external evidence steps.
58
+
59
+ It is still static and caller-driven. It does not connect to a provider, read source files, deploy infrastructure, fetch repositories, or publish Check Runs.
60
+
61
+ ## Blocking Behavior
62
+
63
+ The helper blocks release-gate readiness when deployed evidence is incomplete. Common blocked reasons include:
64
+
65
+ - `invalid_public_base_url`
66
+ - `unsafe_evidence_base_url`
67
+ - `health_scanner_version_mismatch`
68
+ - `health_missing_scan_worker_role`
69
+ - `health_privacy_flags_unsafe`
70
+ - `worker_failure_cleanup_probe_missing`
71
+ - `worker_cleanup_not_verified`
72
+ - `log_boundary_rejected`
73
+
74
+ Blocked output remains public-safe. It does not return the raw health body, public base URL, raw webhook payload, untrusted PR text, raw source, raw diffs, secrets, customer payloads, private checkout paths, or installation tokens.
75
+
76
+ ## Release Gate
77
+
78
+ `evaluateHostedDeployedWorkerStagingReleaseGate` passes the generated bundle to the hosted operational release gate with the release commit, scanner version, deployment target, container digest, and release notes.
79
+
80
+ The evaluator still blocks hosted exposure unless every P0 evidence row is fresh, the deployed artifact has a `sha256:<digest>` container image digest, and release notes avoid positive pentest, certification, and full-audit claims. Wording such as "not a pentest, certification, or full security audit" remains allowed.
81
+
82
+ ## Boundary
83
+
84
+ This helper narrows the gap between local source-candidate rehearsals and deployed staging evidence. It is still deterministic and local-first: callers collect evidence outside the package and pass only safe summaries into the helper.
85
+
86
+ It is not a pentest, full audit, or certification. It is not production hosted exposure. It does not prove customer SaaS apps are secure. It only helps decide whether the hosted worker release candidate has enough operational evidence to be exposed for the next staged rollout step.
@@ -40,7 +40,11 @@ Every hosted release must record:
40
40
 
41
41
  The current public package release is still a local CLI and pure hosted-contract release. No hosted production environment is exposed by this release.
42
42
 
43
- The pure evaluator `evaluateHostedOperationalReleaseGate` and the exported `HOSTED_OPERATIONAL_RELEASE_GATE_REQUIREMENTS` list make the gate machine-checkable for the next hosted service stage. The staging harness also exports `createHostedStagingReleaseEvidenceBundle`, `evaluateHostedStagingReleaseEvidenceBundle`, and `validateHostedLogBoundary` so source-candidate rehearsals can turn webhook replay, success/failure cleanup probes, required safe failure reasons, and log samples into an executable gate decision. The evaluator blocks hosted exposure unless every P0 item has fresh evidence, a `sha256:<digest>` container image digest is recorded, and release notes avoid positive pentest, certification, and full-audit claims. Explicit wording such as "not a pentest, certification, or full security audit" remains allowed.
43
+ The pure evaluator `evaluateHostedOperationalReleaseGate` and the exported `HOSTED_OPERATIONAL_RELEASE_GATE_REQUIREMENTS` list make the gate machine-checkable for the next hosted service stage. The staging harness also exports `createHostedStagingReleaseEvidenceBundle`, `evaluateHostedStagingReleaseEvidenceBundle`, and `validateHostedLogBoundary` so source-candidate rehearsals can turn webhook replay, success/failure cleanup probes, required safe failure reasons, and log samples into an executable gate decision.
44
+
45
+ Deployed worker staging evidence is documented in [hosted-deployed-worker-staging.md](hosted-deployed-worker-staging.md). The `ai-saas-guard/hosted/deployed-staging` export adds `createHostedDeployedWorkerStagingEvidenceBundle` and `evaluateHostedDeployedWorkerStagingReleaseGate` so a deployed Node/container read-only checkout worker candidate can turn public HTTPS health, signed webhook replay, deployed success/failure cleanup probes, log-boundary samples, and external CI/scan/rollback evidence into this same gate. It does not deploy cloud resources and is not production hosted exposure.
46
+
47
+ The evaluator blocks hosted exposure unless every P0 item has fresh evidence, a `sha256:<digest>` container image digest is recorded, and release notes avoid positive pentest, certification, and full-audit claims. Explicit wording such as "not a pentest, certification, or full security audit" remains allowed.
44
48
 
45
49
  Source-level evidence notes for this release candidate:
46
50
 
@@ -48,12 +52,12 @@ Source-level evidence notes for this release candidate:
48
52
  | --- | --- | --- | --- |
49
53
  | `clean_ci` | Clean install, tests, build, CLI help, JSON/SARIF scan, PR-risk, npm audit, pack dry-run | Local release gate plus GitHub Actions CI run from the release commit | Passed for source package |
50
54
  | `hosted_contract_tests` | Hosted contract tests for webhook, scope, queue, worker, check summaries, cleanup, retention, and release gate evaluation | `tests/hosted-contracts.test.mjs` | Passed for pure contracts |
51
- | `webhook_replay` | Valid events queue work; invalid, missing, malformed, replayed, removed, and non-installed events queue nothing | Pure replay coverage in hosted webhook intake tests | Passed for pure contracts; must replay against deployed ingress before exposure |
55
+ | `webhook_replay` | Valid events queue work; invalid, missing, malformed, replayed, removed, and non-installed events queue nothing | Pure replay coverage in hosted webhook intake tests plus deployed worker staging evidence helper | Passed for pure contracts; deployed helper can record public HTTPS staging replay before exposure |
52
56
  | `workflow_static_checks` | GitHub Actions static analysis | `actionlint` and `uvx zizmor --offline .github/workflows` | Passed for repository workflows |
53
57
  | `dependency_scan` | Dependency scan has no unresolved high or critical production findings | `npm audit --audit-level=high --registry=https://registry.npmjs.org` | Passed for source package |
54
58
  | `container_scan` | Container image scan has no unresolved high or critical runtime-layer findings | No hosted container image exists in the public package release | Not applicable to current non-hosted release; required before hosted exposure |
55
- | `queue_worker_cleanup` | Queue dedupe, running cancellation, terminal cleanup, worker checkout deletion, and no long-running processes | Pure queue, worker, checkout, retention cleanup planner tests, and staging harness success/failure cleanup probes | Passed for source candidate; must verify against deployed queue and worker before exposure |
56
- | `privacy_retention` | No raw source, raw diffs, secrets, customer payloads, private URLs, or full file contents; retention and uninstall cleanup are proven | Compact report, Check Run publication, retention/deletion cleanup, docs tests, and `validateHostedLogBoundary` source-candidate log checks | Passed for source candidate; deployed log sampling still required before exposure |
59
+ | `queue_worker_cleanup` | Queue dedupe, running cancellation, terminal cleanup, worker checkout deletion, and no long-running processes | Pure queue, worker, checkout, retention cleanup planner tests, staging harness success/failure cleanup probes, and deployed worker staging cleanup evidence helper | Passed for source candidate; deployed helper can record success/failure cleanup before exposure |
60
+ | `privacy_retention` | No raw source, raw diffs, secrets, customer payloads, private URLs, or full file contents; retention and uninstall cleanup are proven | Compact report, Check Run publication, retention/deletion cleanup, docs tests, `validateHostedLogBoundary` source-candidate log checks, and deployed log-boundary staging evidence | Passed for source candidate; deployed log sampling still required before exposure |
57
61
  | `monitoring_alerting` | Ingress, queue depth, worker failures, Check Run failures, cleanup failures, retention failures, and credential rotation alerts | Required alert list remains in this document | Documented; must attach provider evidence before exposure |
58
62
  | `manual_rollback` | Worker pause, previous artifact redeploy, queue resume, controlled ingress failure, and affected Check Run identification | Manual rollback procedure remains in this document | Documented; must execute against deployed artifact before exposure |
59
63
  | `incident_response` | Owner, backup, credential rotation, queue pause, customer communication, status path, and privacy-safe evidence collection | Incident response checklist remains in this document | Documented; must name live owners before exposure |
@@ -31,6 +31,8 @@ The hosted release gate still requires fresh deployed evidence for:
31
31
 
32
32
  Source-candidate executable evidence now exists in `ai-saas-guard/hosted/staging-harness`: `createHostedStagingReleaseEvidenceBundle` combines signed webhook replay, success and failure cleanup probes, safe worker failure reasons, and `validateHostedLogBoundary` samples into hosted release-gate evidence, then `evaluateHostedStagingReleaseEvidenceBundle` runs the same gate evaluator used by deployment planning. This improves local release readiness, but it is still not production hosted exposure and does not replace deployed worker, logging, metrics, rollback, incident-response, dependency, or container evidence.
33
33
 
34
+ Deployed worker staging evidence now has its own helper in `ai-saas-guard/hosted/deployed-staging`: `createHostedDeployedWorkerStagingEvidenceBundle` accepts public HTTPS health, deployed webhook replay, worker cleanup, log-boundary, and external CI/scan/rollback evidence summaries, then `evaluateHostedDeployedWorkerStagingReleaseGate` evaluates the same hosted release gate. Use [hosted-deployed-worker-staging.md](hosted-deployed-worker-staging.md) before exposing a Node/container read-only checkout worker beyond staging.
35
+
34
36
  ## Read-Only Checkout Worker Evidence Checklist
35
37
 
36
38
  Before any hosted source checkout worker is exposed beyond staging, attach fresh evidence for each row below. The current Cloudflare ingress evidence above does not satisfy these rows because it publishes compact PR-risk signals without running a full source checkout scan worker.
@@ -2,7 +2,7 @@
2
2
 
3
3
  This document collects pure hosted contracts that can be tested before any hosted GitHub App service is deployed. These contracts keep the hosted design inspectable, local-first, and implementation-ready without adding network calls, credentials, queues, workers, or GitHub API writes. They are no network calls contracts by design.
4
4
 
5
- The helpers live in `src/hosted/contracts.ts` and are exported from `ai-saas-guard/hosted/contracts`. The production adapter plans live in `src/hosted/production-adapters.ts` and are exported from `ai-saas-guard/hosted/production-adapters`. The Node/container app skeleton lives in `src/hosted/app.ts` and is exported from `ai-saas-guard/hosted/app`. The concrete read-only checkout worker runner lives in `src/hosted/worker.ts` and is exported from `ai-saas-guard/hosted/worker`. The staging deployment planner lives in `src/hosted/staging.ts` and is exported from `ai-saas-guard/hosted/staging`. The local staging harness lives in `src/hosted/staging-harness.ts` and is exported from `ai-saas-guard/hosted/staging-harness`.
5
+ The helpers live in `src/hosted/contracts.ts` and are exported from `ai-saas-guard/hosted/contracts`. The production adapter plans live in `src/hosted/production-adapters.ts` and are exported from `ai-saas-guard/hosted/production-adapters`. The Node/container app skeleton lives in `src/hosted/app.ts` and is exported from `ai-saas-guard/hosted/app`. The concrete read-only checkout worker runner lives in `src/hosted/worker.ts` and is exported from `ai-saas-guard/hosted/worker`. The staging deployment planner lives in `src/hosted/staging.ts` and is exported from `ai-saas-guard/hosted/staging`. The local staging harness lives in `src/hosted/staging-harness.ts` and is exported from `ai-saas-guard/hosted/staging-harness`. The deployed worker staging evidence helper lives in `src/hosted/deployed-staging.ts` and is exported from `ai-saas-guard/hosted/deployed-staging`.
6
6
 
7
7
  ## Pull Request Webhook Intake Planner
8
8
 
@@ -5,11 +5,11 @@
5
5
  ## Current State
6
6
 
7
7
  - Package name: `ai-saas-guard`
8
- - Current published version: `0.31.0`
8
+ - Current published version: `0.33.0`
9
9
  - Next source candidate: none
10
10
  - npm registry state: published at <https://www.npmjs.com/package/ai-saas-guard>
11
11
  - First npm-published version: `0.1.1`
12
- - GitHub Release: `v0.31.0`
12
+ - GitHub Release: `v0.33.0`
13
13
  - Publish workflow: `.github/workflows/npm-publish.yml`
14
14
  - Trusted Publisher: GitHub Actions, `zr9959/ai-saas-guard`, workflow `npm-publish.yml`, allowed action `npm publish`
15
15
  - Long-lived npm publish token: not required
@@ -18,7 +18,7 @@
18
18
 
19
19
  Use GitHub Actions with npm Trusted Publisher/OIDC:
20
20
 
21
- 1. Create and review a release tag such as `v0.31.0`.
21
+ 1. Create and review a release tag such as `v0.33.0`.
22
22
  2. Publish from the GitHub Release or run the `Publish npm` workflow manually with `ref` set to that tag.
23
23
  3. Keep `permissions.id-token: write` in the workflow so npm can exchange the GitHub Actions OIDC identity for a short-lived publish credential.
24
24
  4. Run `npm publish --access public` from the workflow. Trusted publishing automatically generates provenance for this public package from this public repository.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-saas-guard",
3
- "version": "0.31.0",
3
+ "version": "0.33.0",
4
4
  "description": "Local-first CLI that catches launch blockers in AI-built Next.js/Supabase/Stripe SaaS apps.",
5
5
  "readmeFilename": "README.md",
6
6
  "type": "module",
@@ -70,6 +70,10 @@
70
70
  "types": "./dist/hosted/staging-harness.d.ts",
71
71
  "default": "./dist/hosted/staging-harness.js"
72
72
  },
73
+ "./hosted/deployed-staging": {
74
+ "types": "./dist/hosted/deployed-staging.d.ts",
75
+ "default": "./dist/hosted/deployed-staging.js"
76
+ },
73
77
  "./hosted/worker": {
74
78
  "types": "./dist/hosted/worker.d.ts",
75
79
  "default": "./dist/hosted/worker.js"