failproofai 1.0.8 → 1.0.9-beta.1
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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +5 -5
- package/.next/standalone/.next/prerender-manifest.json +4 -4
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +6 -6
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +14 -14
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +15 -15
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
- package/.next/standalone/.next/server/app/policies/page.js +4 -4
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +8 -8
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +1 -1
- package/.next/standalone/.next/server/chunks/_09dz7xv._.js +20 -20
- package/.next/standalone/.next/server/chunks/_0tovk6q._.js +1 -1
- package/.next/standalone/.next/server/chunks/_0trp3yc._.js +1 -1
- package/.next/standalone/.next/server/chunks/_1ek68ln._.js +2 -2
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_01r25oi._.js +2 -2
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_09z9-p7._.js +2 -2
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_hooks_1aveq0u._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__03m2iw6._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04usis8._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__056wjo4._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0n0xg95._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0rwtwpm._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__12e7nhs._.js → [root-of-the-server]__1-bm5zf._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11mayhe._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__15578wp._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1m_svbe._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1pprgri._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1q4p5b8._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_042cgl1._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0bqoto4._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_11ilmst._.js +23 -0
- package/.next/standalone/.next/server/chunks/ssr/_1gb0ifp._.js +3 -3
- package/.next/standalone/.next/server/chunks/ssr/{_0-vcssj._.js → _1jatlmf._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1zopuov._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_policies_page_actions_1sp2-yo.js +3 -3
- package/.next/standalone/.next/server/chunks/ssr/app_actions_get-scheduled-audit_ts_0ei9sni._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_settings_02tf1h4._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_effective-reviewers_ts_1h4wtvo._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_hooks_semantic_pack-policies_ts_0gh_bu_._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +23 -23
- package/.next/standalone/.next/static/chunks/{06jxjnw8bfczc.js → 0542cuk_va8g1.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0wbjy0zo-m7is.js → 08ckontevw-0w.js} +1 -1
- package/.next/standalone/.next/static/chunks/0pefjgvu4x-sx.js +1 -0
- package/.next/standalone/.next/static/chunks/{21uv-uusw329x.js → 1-d48e9k-7e1a.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0m-9d6yn9hx4j.js → 1r74hmr1wm_sd.js} +1 -1
- package/.next/standalone/.next/static/chunks/1uec0n0lcx5h1.js +1 -0
- package/.next/standalone/.next/static/chunks/21-pqc3-l9ak2.js +6 -0
- package/.next/standalone/.next/static/chunks/21qlo00jis4w-.js +1 -0
- package/.next/standalone/.next/static/chunks/2n00c3zqyloy9.js +1 -0
- package/.next/standalone/.next/static/chunks/{0bhidk90e-07f.css → 3_e_wg5_oay87.css} +1 -1
- package/.next/standalone/.next/static/chunks/{3c3qbmosdjl6w.js → 3tv107_for_n7.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2qdpj67x6ifk_.js → 3vp54x0dyrrm6.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-38nzuvp95_2rv.js → turbopack-11dn2pegmg9_9.js} +1 -1
- package/.next/standalone/app/actions/get-jev-config.ts +2 -2
- package/.next/standalone/app/actions/update-jev-config.ts +12 -9
- package/.next/standalone/app/components/jev-notices.tsx +10 -10
- package/.next/standalone/app/settings/jev-panel.tsx +11 -11
- package/.next/standalone/fp-cloud-cli/CHANGELOG.md +2 -0
- package/.next/standalone/fp-cloud-cli/fp_cli/output.py +26 -0
- package/.next/standalone/fp-cloud-cli/tests/test_output.py +27 -0
- package/.next/standalone/fp-cloud-cli/uv.lock +3 -3
- package/.next/standalone/hermes-plugin/README.md +18 -8
- package/.next/standalone/node_modules/@next/env/package.json +1 -1
- package/.next/standalone/node_modules/next/dist/build/swc/index.js +1 -1
- package/.next/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
- package/.next/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +3 -3
- package/.next/standalone/node_modules/next/dist/server/config.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +2 -2
- package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/lib/app-info-log.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/lib/start-server.js +1 -1
- package/.next/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
- package/.next/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
- package/.next/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
- package/.next/standalone/node_modules/next/package.json +10 -10
- package/.next/standalone/package.json +12 -12
- package/.next/standalone/sdk/python/uv.lock +18 -18
- package/.next/standalone/server.js +1 -1
- package/bin/failproofai.mjs +33 -7
- package/dist/cli.mjs +1385 -1158
- package/dist/worker.mjs +59 -375
- package/hermes-plugin/README.md +18 -8
- package/package.json +12 -12
- package/scripts/build-policy-pack.mjs +6 -9
- package/src/hooks/cloud-connection.ts +12 -6
- package/src/hooks/custom-hooks-loader.ts +1 -1
- package/src/hooks/effective-reviewers.ts +50 -43
- package/src/hooks/handler.ts +25 -16
- package/src/hooks/hermes-update.ts +74 -0
- package/src/hooks/hook-activity-store.ts +3 -3
- package/src/hooks/integrations.ts +472 -68
- package/src/hooks/jev-activity.ts +8 -3
- package/src/hooks/jev-cli.ts +17 -17
- package/src/hooks/jev-cloud-connection.ts +4 -4
- package/src/hooks/manager.ts +3 -2
- package/src/hooks/pack-cli.ts +24 -23
- package/src/hooks/pack-manifest.ts +25 -2
- package/src/hooks/pack-store.ts +2 -2
- package/src/hooks/policy-authority.ts +51 -32
- package/src/hooks/policy-evaluator.ts +5 -5
- package/src/hooks/policy-registry.ts +5 -7
- package/src/hooks/policy-reviewability.ts +30 -12
- package/src/hooks/policy-types.ts +4 -4
- package/src/hooks/safe-config-write.ts +119 -0
- package/src/hooks/semantic/combine.ts +13 -13
- package/src/hooks/semantic/evaluator.ts +5 -5
- package/src/hooks/semantic/jev-client.ts +1 -1
- package/src/hooks/semantic/jev-config.ts +21 -12
- package/src/hooks/semantic/jev-review.ts +3 -3
- package/src/hooks/semantic/jev-stats.ts +17 -17
- package/src/hooks/semantic/pack-policies.ts +48 -48
- package/src/hooks/semantic/policies.ts +13 -425
- package/src/hooks/semantic/precondition-names.ts +1 -1
- package/src/hooks/semantic/preconditions.ts +1 -1
- package/src/hooks/semantic/types.ts +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__13t1zkw._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_13kfn90._.js +0 -23
- package/.next/standalone/.next/static/chunks/06dnzbolj00mc.js +0 -6
- package/.next/standalone/.next/static/chunks/16f3fa-lx38hk.js +0 -1
- package/.next/standalone/.next/static/chunks/2g2tki08kdhie.js +0 -1
- package/.next/standalone/.next/static/chunks/3-nbtkhg9y-1j.js +0 -1
- package/.next/standalone/.next/static/chunks/355km0ihuqo1p.js +0 -1
- /package/.next/standalone/.next/static/{5yKM8NoTOpUI0MoQl8eo5 → ozuWoyIwOTqeUUjKqOKiH}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{5yKM8NoTOpUI0MoQl8eo5 → ozuWoyIwOTqeUUjKqOKiH}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{5yKM8NoTOpUI0MoQl8eo5 → ozuWoyIwOTqeUUjKqOKiH}/_ssgManifest.js +0 -0
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Which
|
|
2
|
+
* Which Jev checks this machine asks: the ones its installed packs declare, and
|
|
3
|
+
* nothing else.
|
|
3
4
|
*
|
|
4
|
-
* ##
|
|
5
|
+
* ## No pack, no questions
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
7
|
+
* The npm package ships NO Jev checks. The sixteen FailproofAI writes are
|
|
8
|
+
* published as the `FailproofAI/jev-policies` pack, and a machine asks them only
|
|
9
|
+
* after `failproofai policies add FailproofAI/jev-policies`. With no installed
|
|
10
|
+
* pack declaring a `semantic` entry the set is EMPTY: nothing is asked, no
|
|
11
|
+
* request is sent (the hook path does not even start a review —
|
|
12
|
+
* `jevChecksInstalled` in `effective-reviewers.ts`), and no regex verdict can be
|
|
13
|
+
* cleared, because the reviewer names come from the same packs and there are
|
|
14
|
+
* none. That holds whether or not the machine is Jev-configured or connected to
|
|
15
|
+
* FailproofAI Cloud: configuring a provider says where to ask, a pack says what.
|
|
13
16
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* keeps the first and drops the later one, because the answer map is keyed by
|
|
22
|
-
* policy name and the second would overwrite the first's questions in the
|
|
23
|
-
* compiled request.
|
|
17
|
+
* Several declaring packs CONCATENATE, FailproofAI's first. A name declared by
|
|
18
|
+
* two packs keeps the first and drops the later one, because the answer map is
|
|
19
|
+
* keyed by policy name and the second would overwrite the first's questions in
|
|
20
|
+
* the compiled request. The sixteen FailproofAI names are reserved: a pack not
|
|
21
|
+
* installed from a FailproofAI repository that declares one is ignored for that
|
|
22
|
+
* name (`isReservedClaim`), so it cannot become the question that clears the
|
|
23
|
+
* core pack's policies.
|
|
24
24
|
*
|
|
25
25
|
* ## Where the manifest ends and this begins
|
|
26
26
|
*
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* regex policies cover — a machine locked out over a typo in the half of the
|
|
40
40
|
* system whose job is to let more real work through.
|
|
41
41
|
*/
|
|
42
|
-
import { contestedSemanticNames, isFirstPartyPack, isReservedClaim, jevPacks
|
|
42
|
+
import { contestedSemanticNames, isFirstPartyPack, isReservedClaim, jevPacks } from "../effective-reviewers";
|
|
43
43
|
import { hookLogWarn } from "../hook-logger";
|
|
44
44
|
import {
|
|
45
45
|
packSemantic,
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
} from "../pack-manifest";
|
|
51
51
|
import { MAX_REQUEST_CHARS, userAskedQuestion } from "./compile";
|
|
52
52
|
import { MAX_STATE_CHARS } from "./envelope";
|
|
53
|
-
import { INJECTION_PROBE, SCOPE_PROBE,
|
|
53
|
+
import { INJECTION_PROBE, SCOPE_PROBE, TASK_PROBES } from "./policies";
|
|
54
54
|
import { preconditionFor } from "./preconditions";
|
|
55
55
|
import { isPackPreconditionName } from "./precondition-names";
|
|
56
56
|
import type { NoulQuestion, SemanticPolicy } from "./types";
|
|
@@ -95,9 +95,9 @@ const GLOBAL_QUESTION_CHARS = Math.max(
|
|
|
95
95
|
* "somebody installed a big pack", and the flag that was supposed to be
|
|
96
96
|
* unreachable from ordinary work becomes routine.
|
|
97
97
|
*
|
|
98
|
-
*
|
|
99
|
-
* constraint on the set we ship.
|
|
100
|
-
*
|
|
98
|
+
* `FailproofAI/jev-policies` uses `JEV_POLICIES_QUESTION_CHARS` of it, so this
|
|
99
|
+
* is not a constraint on the set we ship. FailproofAI's packs spend the budget
|
|
100
|
+
* first, so a stranger's pack installed beside that one gets what it leaves.
|
|
101
101
|
*/
|
|
102
102
|
export const MAX_PACK_QUESTION_CHARS = MAX_REQUEST_CHARS - MAX_STATE_CHARS - GLOBAL_QUESTION_CHARS;
|
|
103
103
|
|
|
@@ -123,8 +123,15 @@ export function questionChars(entry: SemanticManifestEntry): number {
|
|
|
123
123
|
return JSON.stringify(questions).length;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
/**
|
|
127
|
-
|
|
126
|
+
/**
|
|
127
|
+
* What `FailproofAI/jev-policies`' sixteen checks spend of that budget, which a
|
|
128
|
+
* pack from anyone else shares with them on a machine that has both installed.
|
|
129
|
+
* Measured, not chosen: `pack-semantic-registry.test.ts` pins it to the
|
|
130
|
+
* reference copy in `__tests__/fixtures/jev-policies.ts`. Only `publish` reads
|
|
131
|
+
* it, to warn an author before release; the machine measures what is actually
|
|
132
|
+
* installed.
|
|
133
|
+
*/
|
|
134
|
+
export const JEV_POLICIES_QUESTION_CHARS = 18490;
|
|
128
135
|
|
|
129
136
|
export interface ResolvedSemanticPolicies {
|
|
130
137
|
policies: ReadonlyArray<SemanticPolicy>;
|
|
@@ -166,8 +173,7 @@ function toSemanticPolicy(entry: SemanticManifestEntry, pack: { id: string; vers
|
|
|
166
173
|
}
|
|
167
174
|
|
|
168
175
|
/**
|
|
169
|
-
* The semantic set these packs declare
|
|
170
|
-
* declares any.
|
|
176
|
+
* The semantic set these packs declare — empty when none of them declares any.
|
|
171
177
|
*
|
|
172
178
|
* Pure: it takes the packs rather than reading them, so the caller that already
|
|
173
179
|
* has them does not read `installed.json` a second time and a test does not need
|
|
@@ -177,16 +183,13 @@ export function semanticPoliciesFromPacks(
|
|
|
177
183
|
packs: ReadonlyArray<Pick<ResolvedPack, "id" | "semantic"> & { source?: string; version?: string }>,
|
|
178
184
|
): ResolvedSemanticPolicies {
|
|
179
185
|
const declared = packs.filter((p) => packSemantic(p).length > 0);
|
|
180
|
-
if (declared.length === 0) return { policies:
|
|
186
|
+
if (declared.length === 0) return { policies: [], fromPack: false, errors: [] };
|
|
181
187
|
|
|
182
|
-
//
|
|
183
|
-
// (`replacesBuiltinChecks`, which the reviewer set applies too). First-party
|
|
184
|
-
// packs spend the budget first, so install order cannot starve them.
|
|
185
|
-
const replace = replacesBuiltinChecks(declared);
|
|
188
|
+
// First-party packs spend the budget first, so install order cannot starve them.
|
|
186
189
|
const ordered = [...declared.filter((p) => isFirstPartyPack(p)), ...declared.filter((p) => !isFirstPartyPack(p))];
|
|
187
|
-
const policies: SemanticPolicy[] =
|
|
190
|
+
const policies: SemanticPolicy[] = [];
|
|
188
191
|
const errors: string[] = [];
|
|
189
|
-
const seen = new Set<string>(
|
|
192
|
+
const seen = new Set<string>();
|
|
190
193
|
// A name two packs declare DIFFERENTLY is asked for nobody. Keeping the first
|
|
191
194
|
// was the escalation: the question that decides another pack's policies came
|
|
192
195
|
// from whichever pack was listed first, so installing a permissive
|
|
@@ -196,7 +199,7 @@ export function semanticPoliciesFromPacks(
|
|
|
196
199
|
// be the same name — a check in the set with nobody's question, or a question
|
|
197
200
|
// nobody may name, are both worse than neither.
|
|
198
201
|
const contested = contestedSemanticNames(declared);
|
|
199
|
-
let spent =
|
|
202
|
+
let spent = 0;
|
|
200
203
|
for (const pack of ordered) {
|
|
201
204
|
for (const entry of packSemantic(pack)) {
|
|
202
205
|
if (isReservedClaim(pack, entry.name)) {
|
|
@@ -241,13 +244,11 @@ export function semanticPoliciesFromPacks(
|
|
|
241
244
|
}
|
|
242
245
|
}
|
|
243
246
|
|
|
244
|
-
// Every entry a declaring pack shipped was unusable
|
|
245
|
-
//
|
|
246
|
-
//
|
|
247
|
-
//
|
|
248
|
-
|
|
249
|
-
if (policies.length === (replace ? 0 : SEMANTIC_POLICIES.length)) return { policies: SEMANTIC_POLICIES, fromPack: false, errors };
|
|
250
|
-
return { policies, fromPack: true, errors };
|
|
247
|
+
// Every entry a declaring pack shipped was unusable: nothing is asked, and
|
|
248
|
+
// `fromPack` says no pack supplied anything. There is no compiled-in set to
|
|
249
|
+
// fall back to, and that is the safe direction — nothing is asked, so nothing
|
|
250
|
+
// a `reviewedBy` names is ever answered, and those policies stay hard.
|
|
251
|
+
return { policies, fromPack: policies.length > 0, errors };
|
|
251
252
|
}
|
|
252
253
|
|
|
253
254
|
const warned = new Set<string>();
|
|
@@ -262,10 +263,9 @@ const warned = new Set<string>();
|
|
|
262
263
|
* exactly that reason. The read costs one digest per pack against a call that is
|
|
263
264
|
* about to spend up to three seconds on the network.
|
|
264
265
|
*
|
|
265
|
-
* Never throws. An unreadable manifest yields
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
* builtin set, so nothing gets cleared by a policy nobody could read.
|
|
266
|
+
* Never throws. An unreadable manifest yields NO checks: nothing is asked and
|
|
267
|
+
* nothing is cleared, so every regex verdict stands. There is deliberately no
|
|
268
|
+
* compiled-in set to fall back to — the package ships none.
|
|
269
269
|
*/
|
|
270
270
|
export function resolveSemanticPolicies(cli?: string): ReadonlyArray<SemanticPolicy> {
|
|
271
271
|
let packs: ReadonlyArray<ResolvedPack> = [];
|
|
@@ -275,7 +275,7 @@ export function resolveSemanticPolicies(cli?: string): ReadonlyArray<SemanticPol
|
|
|
275
275
|
packs = read.packs;
|
|
276
276
|
manifestErrors = read.warnings ?? [];
|
|
277
277
|
} catch {
|
|
278
|
-
return
|
|
278
|
+
return [];
|
|
279
279
|
}
|
|
280
280
|
const resolved = semanticPoliciesFromPacks(jevPacks(packs, cli));
|
|
281
281
|
// Once per process per message, like `warnAuthority`: this runs on every gate
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
* the
|
|
2
|
+
* The probes every Jev request carries (scope, injection, the task probes) and
|
|
3
|
+
* the path and branch helpers the pack preconditions compile to.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* ## No checks live here
|
|
6
|
+
*
|
|
7
|
+
* The npm package ships NO Jev checks. The sixteen that used to be compiled in
|
|
8
|
+
* as `SEMANTIC_POLICIES` are published as the `FailproofAI/jev-policies` pack,
|
|
9
|
+
* and reach a machine only through `failproofai policies add
|
|
10
|
+
* FailproofAI/jev-policies`. With no installed pack declaring a `semantic`
|
|
11
|
+
* entry, Jev asks nothing and is never called (`pack-policies.ts`). Tests keep
|
|
12
|
+
* a reference copy in `__tests__/fixtures/jev-policies.ts`.
|
|
13
|
+
*
|
|
14
|
+
* Authoring rules for a check (in a pack), learned from TypeSafe's docs and from measuring the regex
|
|
6
15
|
* engine against real traffic:
|
|
7
16
|
*
|
|
8
17
|
* - One dimension per probe. A single "is this dangerous" question scored
|
|
@@ -17,7 +26,7 @@
|
|
|
17
26
|
* - Refer to state by its field names (`agent_request`, `facts.paths`,
|
|
18
27
|
* `user_said`) so every question is anchored to the same labelled envelope.
|
|
19
28
|
*/
|
|
20
|
-
import type { Facts, PathFact
|
|
29
|
+
import type { Facts, PathFact } from "./types";
|
|
21
30
|
|
|
22
31
|
/**
|
|
23
32
|
* The branch names `commit-on-protected-branch` guards.
|
|
@@ -71,427 +80,6 @@ export function outsideProject(facts: Facts, p: PathFact): boolean {
|
|
|
71
80
|
return p.resolved !== cwd && !p.resolved.startsWith(cwd.endsWith("/") ? cwd : cwd + "/");
|
|
72
81
|
}
|
|
73
82
|
|
|
74
|
-
export const SEMANTIC_POLICIES: ReadonlyArray<SemanticPolicy> = [
|
|
75
|
-
{
|
|
76
|
-
name: "destructive-deletion",
|
|
77
|
-
title: "Tried to permanently delete data that cannot be regenerated",
|
|
78
|
-
appliesTo: ["shell", "write"],
|
|
79
|
-
mode: "deny",
|
|
80
|
-
userCanOverride: true,
|
|
81
|
-
probes: [
|
|
82
|
-
{
|
|
83
|
-
id: "destroys",
|
|
84
|
-
instructions:
|
|
85
|
-
"The tool call in `agent_request` permanently deletes, wipes, truncates or overwrites existing files, " +
|
|
86
|
-
"directories or disks — for example `rm -r`, `find -delete`, `shred`, `dd of=`, `mkfs`, `truncate`, " +
|
|
87
|
-
"`rsync --delete`, `git clean -fdx`, or redirecting output over an existing file.",
|
|
88
|
-
criteria: {
|
|
89
|
-
true: "Existing data would be destroyed or irreversibly overwritten.",
|
|
90
|
-
false: "Nothing existing is destroyed: it reads, lists, creates new files, or moves data somewhere recoverable.",
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
id: "irreplaceable",
|
|
95
|
-
instructions:
|
|
96
|
-
"What would be destroyed is outside the project, is the whole project, is the user's home directory, " +
|
|
97
|
-
"is the filesystem root, or is data that cannot simply be regenerated (source code, documents, databases, " +
|
|
98
|
-
"keys). Use `facts.paths[].relation` to see where each target sits relative to the project.",
|
|
99
|
-
criteria: {
|
|
100
|
-
true: "The destroyed data matters and could not be rebuilt by running a command.",
|
|
101
|
-
false:
|
|
102
|
-
"Only regenerable data inside the project is affected: build output, dist/, caches, node_modules, " +
|
|
103
|
-
"virtualenvs, coverage reports, temp files, or files the agent itself just created.",
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
],
|
|
107
|
-
guidance: "This permanently deletes data that cannot be rebuilt. Confirm the exact paths with the user first.",
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: "production-infra-change",
|
|
111
|
-
title: "Tried to change live infrastructure",
|
|
112
|
-
appliesTo: ["shell"],
|
|
113
|
-
mode: "deny",
|
|
114
|
-
userCanOverride: true,
|
|
115
|
-
probes: [
|
|
116
|
-
{
|
|
117
|
-
id: "mutates",
|
|
118
|
-
instructions:
|
|
119
|
-
"The command in `agent_request` changes the state of cloud or cluster infrastructure: it creates, " +
|
|
120
|
-
"updates, deletes, applies, scales, restarts, rolls out, deploys or destroys resources in a cloud " +
|
|
121
|
-
"account, Kubernetes cluster, managed database, DNS, CDN or hosting platform (any CLI: kubectl, helm, " +
|
|
122
|
-
"terraform, tofu, pulumi, aws, gcloud, az, doctl, flyctl, vercel, wrangler, railway, and so on — " +
|
|
123
|
-
"however the binary is spelled or pathed).",
|
|
124
|
-
criteria: {
|
|
125
|
-
true: "It mutates infrastructure.",
|
|
126
|
-
false:
|
|
127
|
-
"It only reads or plans: get, list, describe, logs, status, plan, diff, validate, whoami, or --dry-run.",
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
id: "not_local",
|
|
132
|
-
instructions:
|
|
133
|
-
"The target of that change is a shared or production environment, or its environment cannot be told " +
|
|
134
|
-
"from the command.",
|
|
135
|
-
criteria: {
|
|
136
|
-
true: "Production, shared, or unknown environment.",
|
|
137
|
-
false:
|
|
138
|
-
"Clearly a local or throwaway environment: localhost, kind, minikube, docker-desktop, k3d, or a " +
|
|
139
|
-
"context, workspace or profile whose name says dev, test, staging, sandbox or local.",
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
guidance: "This changes live infrastructure. Run it against a non-production target, or hand the command to a human.",
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
name: "git-history-rewrite",
|
|
147
|
-
title: "Tried to rewrite or discard shared git history",
|
|
148
|
-
appliesTo: ["shell"],
|
|
149
|
-
mode: "deny",
|
|
150
|
-
userCanOverride: true,
|
|
151
|
-
probes: [
|
|
152
|
-
{
|
|
153
|
-
id: "rewrites_remote",
|
|
154
|
-
instructions:
|
|
155
|
-
"The command in `agent_request` force-pushes or otherwise overwrites history on a git remote: " +
|
|
156
|
-
"`git push --force`, `--force-with-lease`, `-f`, a `+refspec` such as `+HEAD:main`, or deleting a " +
|
|
157
|
-
"remote branch. Git's global options before the subcommand (`git -C dir`, `git -c key=val`) and an " +
|
|
158
|
-
"absolute path to the git binary do not change what the command does.",
|
|
159
|
-
criteria: {
|
|
160
|
-
true: "Remote history would be overwritten or a remote branch deleted.",
|
|
161
|
-
false: "A normal push that only adds commits, or no push at all.",
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
],
|
|
165
|
-
guidance: "Force-pushing rewrites history other people may have pulled. Confirm with the user first.",
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
name: "push-to-protected-branch",
|
|
169
|
-
title: "Tried to push directly to a protected branch",
|
|
170
|
-
appliesTo: ["shell"],
|
|
171
|
-
mode: "instruct",
|
|
172
|
-
userCanOverride: true,
|
|
173
|
-
probes: [
|
|
174
|
-
{
|
|
175
|
-
id: "pushes_protected",
|
|
176
|
-
instructions:
|
|
177
|
-
"The command in `agent_request` pushes commits to a remote branch named main, master, production, " +
|
|
178
|
-
"release or trunk — either named explicitly or implied because `facts.current_git_branch` is one of " +
|
|
179
|
-
"those and the push names no other branch.",
|
|
180
|
-
criteria: {
|
|
181
|
-
true: "Commits land directly on a protected remote branch.",
|
|
182
|
-
false:
|
|
183
|
-
"It pushes a feature branch whose name merely contains a word like main (e.g. feature/main-menu), " +
|
|
184
|
-
"or it does not push.",
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
guidance: "Pushing straight to a protected branch skips review. Push a branch and open a PR unless the user asked for this.",
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
name: "commit-on-protected-branch",
|
|
192
|
-
title: "Tried to commit directly on a protected branch",
|
|
193
|
-
appliesTo: ["shell"],
|
|
194
|
-
mode: "instruct",
|
|
195
|
-
userCanOverride: true,
|
|
196
|
-
precondition: (facts) => facts.currentGitBranch !== null && PROTECTED_BRANCHES.has(facts.currentGitBranch),
|
|
197
|
-
probes: [
|
|
198
|
-
{
|
|
199
|
-
id: "creates_commit",
|
|
200
|
-
instructions:
|
|
201
|
-
"The command in `agent_request` creates or amends a git commit, merge, rebase or cherry-pick in the " +
|
|
202
|
-
"repository (including `git -C dir commit` and `git commit -a`).",
|
|
203
|
-
criteria: {
|
|
204
|
-
true: "A new commit is written to the current branch.",
|
|
205
|
-
false: "It only inspects history (log, show, diff, status) or mentions `commit` in a message or search.",
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
],
|
|
209
|
-
guidance: "You are on a protected branch. Create a feature branch before committing unless the user asked otherwise.",
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
name: "secret-exposure",
|
|
213
|
-
title: "Tried to read or copy credentials",
|
|
214
|
-
appliesTo: ["shell", "read", "write"],
|
|
215
|
-
mode: "deny",
|
|
216
|
-
userCanOverride: true,
|
|
217
|
-
probes: [
|
|
218
|
-
{
|
|
219
|
-
id: "touches_secrets",
|
|
220
|
-
instructions:
|
|
221
|
-
"The tool call in `agent_request` reads, prints, copies, or writes credential material: SSH private " +
|
|
222
|
-
"keys (~/.ssh/id_*), authorized_keys, cloud credentials (~/.aws, ~/.config/gcloud, ~/.azure, " +
|
|
223
|
-
"~/.kube/config), .env files containing real secret values, API tokens, password stores, keychains, " +
|
|
224
|
-
"or browser cookie databases.",
|
|
225
|
-
criteria: {
|
|
226
|
-
true: "Actual secret values would be read, displayed, copied or written.",
|
|
227
|
-
false:
|
|
228
|
-
"It only references the concept: source code that reads process.env, a variable name, an .env.example " +
|
|
229
|
-
"template, a test fixture, documentation about credentials, or a grep for the word.",
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
],
|
|
233
|
-
guidance: "This exposes real credentials. Ask the user before reading or copying secret material.",
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
name: "credential-exfiltration",
|
|
237
|
-
title: "Tried to send secrets or private files off the machine",
|
|
238
|
-
appliesTo: ["shell", "network"],
|
|
239
|
-
mode: "deny",
|
|
240
|
-
userCanOverride: false,
|
|
241
|
-
probes: [
|
|
242
|
-
{
|
|
243
|
-
id: "sends_out",
|
|
244
|
-
instructions:
|
|
245
|
-
"The tool call in `agent_request` sends data to a network destination: an HTTP POST or PUT (curl -d, " +
|
|
246
|
-
"curl -F, curl -T, wget --post-data), scp, sftp, rsync or rclone to a remote, nc or socat, an upload to " +
|
|
247
|
-
"a paste site, bucket or webhook, or a DNS lookup carrying encoded data.",
|
|
248
|
-
criteria: {
|
|
249
|
-
true: "Data leaves this machine.",
|
|
250
|
-
false: "It only downloads, or only talks to localhost.",
|
|
251
|
-
},
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
id: "sensitive_payload",
|
|
255
|
-
instructions:
|
|
256
|
-
"The data being sent includes credentials, keys, tokens, environment variables, or the contents of files " +
|
|
257
|
-
"from outside the project (see `facts.paths`).",
|
|
258
|
-
criteria: {
|
|
259
|
-
true: "Secrets or private files are in what is sent.",
|
|
260
|
-
false: "What is sent is ordinary project data the user would expect to share, like a test request body.",
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
|
-
],
|
|
264
|
-
guidance: "This sends secrets or private files to a remote destination, which the user cannot approve. Do not send them.",
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
name: "remote-code-execution",
|
|
268
|
-
title: "Tried to run code downloaded from the internet",
|
|
269
|
-
appliesTo: ["shell"],
|
|
270
|
-
mode: "deny",
|
|
271
|
-
userCanOverride: true,
|
|
272
|
-
probes: [
|
|
273
|
-
{
|
|
274
|
-
/**
|
|
275
|
-
* The `…` in the `wget` example is load-bearing, not decoration.
|
|
276
|
-
*
|
|
277
|
-
* A code span in a question whose first token is `curl` or `wget` and
|
|
278
|
-
* whose second token is a bare short option (`-O x.sh`, `-s`, `-fsSL`)
|
|
279
|
-
* is refused by the Cloudflare route — HTTP 402, code 2021, "Model
|
|
280
|
-
* execution failed (Payment error)" — deterministically, on any state.
|
|
281
|
-
* `curl … | sh` and `bash <(curl …)` below are accepted because their
|
|
282
|
-
* second token is the placeholder, and `wget … -O x.sh` is accepted for
|
|
283
|
-
* the same reason. The client reads 402 as `out-of-credits`, so the
|
|
284
|
-
* refusal used to degrade every call that selected this policy to
|
|
285
|
-
* regex and blame the operator's billing for it.
|
|
286
|
-
*
|
|
287
|
-
* So: keep a placeholder (or a URL) between `wget`/`curl` and its first
|
|
288
|
-
* short option in any example written inside backticks here.
|
|
289
|
-
*/
|
|
290
|
-
id: "download_and_run",
|
|
291
|
-
instructions:
|
|
292
|
-
"The command in `agent_request` downloads code or a script from the internet and executes it: " +
|
|
293
|
-
"`curl … | sh`, `bash <(curl …)`, `wget … -O x.sh && bash x.sh`, `python3 -c \"$(curl …)\"`, piping into " +
|
|
294
|
-
"any interpreter (sh, bash, zsh, python, node, perl, ruby), or eval of a fetched string.",
|
|
295
|
-
criteria: {
|
|
296
|
-
true: "Fetched code is executed.",
|
|
297
|
-
false:
|
|
298
|
-
"It only downloads without running, runs a local file, or merely searches for or quotes such a command " +
|
|
299
|
-
"(for example grep over a README).",
|
|
300
|
-
},
|
|
301
|
-
},
|
|
302
|
-
],
|
|
303
|
-
exempt: {
|
|
304
|
-
id: "official_installer",
|
|
305
|
-
instructions:
|
|
306
|
-
"The URL being executed is the documented official installer of a widely used developer tool, served from " +
|
|
307
|
-
"that tool's own domain (for example bun.sh, sh.rustup.rs, get.docker.com, deb.nodesource.com, " +
|
|
308
|
-
"raw.githubusercontent.com/nvm-sh/nvm, astral.sh/uv).",
|
|
309
|
-
},
|
|
310
|
-
guidance: "This executes code fetched from the internet. Download it, show it to the user, then run it.",
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
name: "privilege-escalation",
|
|
314
|
-
title: "Tried to run with elevated privileges",
|
|
315
|
-
appliesTo: ["shell"],
|
|
316
|
-
mode: "deny",
|
|
317
|
-
userCanOverride: true,
|
|
318
|
-
probes: [
|
|
319
|
-
{
|
|
320
|
-
id: "elevates",
|
|
321
|
-
instructions:
|
|
322
|
-
"The command in `agent_request` runs something as root or another user: sudo, doas, su, pkexec, run0, " +
|
|
323
|
-
"`sudo -i`, `sudo -s`, including when the binary is written as an absolute path or reached through a " +
|
|
324
|
-
"variable or wrapper.",
|
|
325
|
-
criteria: {
|
|
326
|
-
true: "Privileges are elevated.",
|
|
327
|
-
false: "It runs as the current user, or only mentions sudo in text, a comment, or a search pattern.",
|
|
328
|
-
},
|
|
329
|
-
},
|
|
330
|
-
],
|
|
331
|
-
guidance: "This runs with elevated privileges. Ask the user to run it themselves.",
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
name: "database-destruction",
|
|
335
|
-
title: "Tried to destroy or mass-modify database data",
|
|
336
|
-
appliesTo: ["shell"],
|
|
337
|
-
mode: "deny",
|
|
338
|
-
userCanOverride: true,
|
|
339
|
-
probes: [
|
|
340
|
-
{
|
|
341
|
-
id: "destructive_sql",
|
|
342
|
-
instructions:
|
|
343
|
-
"The command in `agent_request` executes SQL or a database command that drops or truncates a table, " +
|
|
344
|
-
"schema or database, or deletes or updates rows without a condition that narrows them to specific " +
|
|
345
|
-
"records. A condition that is always true (`WHERE 1=1`, `WHERE true`, `WHERE id > 0`) does not narrow " +
|
|
346
|
-
"anything. Also counts: `redis-cli FLUSHALL`, `dropdb`, `mongo … dropDatabase()`.",
|
|
347
|
-
criteria: {
|
|
348
|
-
true: "Many rows, a table, or a whole database would be removed or overwritten.",
|
|
349
|
-
false: "It reads, inserts, or changes a specific identified record, or runs a migration file by name.",
|
|
350
|
-
},
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
id: "real_database",
|
|
354
|
-
instructions: "The database it targets holds real data rather than being a disposable test database.",
|
|
355
|
-
criteria: {
|
|
356
|
-
true: "A real or shared database, or one whose purpose cannot be told.",
|
|
357
|
-
false: "Clearly an in-memory, test, fixture or throwaway local database (sqlite :memory:, a test_ database).",
|
|
358
|
-
},
|
|
359
|
-
},
|
|
360
|
-
],
|
|
361
|
-
guidance: "This destroys database data. Confirm the target and scope with the user first.",
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
name: "read-outside-workspace",
|
|
365
|
-
title: "Read files outside the project",
|
|
366
|
-
appliesTo: ["shell", "read"],
|
|
367
|
-
mode: "instruct",
|
|
368
|
-
userCanOverride: true,
|
|
369
|
-
precondition: (facts) => facts.paths.some((p) => outsideProject(facts, p)),
|
|
370
|
-
probes: [
|
|
371
|
-
{
|
|
372
|
-
id: "reads_outside",
|
|
373
|
-
instructions:
|
|
374
|
-
"The tool call in `agent_request` reads the contents of files that `facts.paths` marks as outside the " +
|
|
375
|
-
"project, in the user's home directory (for example another repository, Documents, or dotfiles).",
|
|
376
|
-
criteria: {
|
|
377
|
-
true: "It reads file contents from outside the project.",
|
|
378
|
-
false:
|
|
379
|
-
"It only changes directory, lists names, checks existence, or touches the agent's own tool caches.",
|
|
380
|
-
},
|
|
381
|
-
},
|
|
382
|
-
],
|
|
383
|
-
guidance: "This reads files outside the current project. Mention why before continuing.",
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
name: "agent-config-tampering",
|
|
387
|
-
title: "Tried to change the agent's own safety configuration",
|
|
388
|
-
appliesTo: ["shell", "write"],
|
|
389
|
-
mode: "deny",
|
|
390
|
-
userCanOverride: false,
|
|
391
|
-
probes: [
|
|
392
|
-
{
|
|
393
|
-
id: "edits_agent_config",
|
|
394
|
-
instructions:
|
|
395
|
-
"The tool call in `agent_request` modifies or deletes an AI agent's own configuration, hooks, " +
|
|
396
|
-
"permissions or guardrails: .claude/settings.json, .claude/settings.local.json, ~/.claude/, .codex/, " +
|
|
397
|
-
".cursor/hooks.json, .gemini/, .factory/, failproofai configuration or policies, or permission and " +
|
|
398
|
-
"safety sections of AGENTS.md or CLAUDE.md.",
|
|
399
|
-
criteria: {
|
|
400
|
-
true: "The agent's hooks, permissions or safety settings would change.",
|
|
401
|
-
false: "It only reads those files, or edits ordinary project documentation.",
|
|
402
|
-
},
|
|
403
|
-
},
|
|
404
|
-
],
|
|
405
|
-
guidance: "An agent must not change its own guardrails. Ask the user to make this change.",
|
|
406
|
-
},
|
|
407
|
-
{
|
|
408
|
-
name: "system-modification",
|
|
409
|
-
title: "Tried to change the system outside the project",
|
|
410
|
-
appliesTo: ["shell"],
|
|
411
|
-
mode: "instruct",
|
|
412
|
-
userCanOverride: true,
|
|
413
|
-
probes: [
|
|
414
|
-
{
|
|
415
|
-
id: "modifies_system",
|
|
416
|
-
instructions:
|
|
417
|
-
"The command in `agent_request` installs or removes software system-wide or changes machine " +
|
|
418
|
-
"configuration: apt, dnf, pacman, brew install, `npm install -g`, `pip install` outside a virtualenv, " +
|
|
419
|
-
"editing files under /etc, systemctl enable or disable, crontab, or changing shell startup files.",
|
|
420
|
-
criteria: {
|
|
421
|
-
true: "The machine changes outside the project directory.",
|
|
422
|
-
false: "It installs project dependencies locally (npm install, bun install, pip install in a venv).",
|
|
423
|
-
},
|
|
424
|
-
},
|
|
425
|
-
],
|
|
426
|
-
guidance: "This changes the machine outside the project. Mention it to the user.",
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
name: "env-secrets-dump",
|
|
430
|
-
title: "Tried to print environment secrets",
|
|
431
|
-
appliesTo: ["shell"],
|
|
432
|
-
mode: "instruct",
|
|
433
|
-
userCanOverride: true,
|
|
434
|
-
probes: [
|
|
435
|
-
{
|
|
436
|
-
id: "dumps_env",
|
|
437
|
-
instructions:
|
|
438
|
-
"The command in `agent_request` prints environment variable VALUES that may be secret: `env`, " +
|
|
439
|
-
"`printenv`, `set`, `export -p`, or `echo` of a variable whose name suggests a key, token, password " +
|
|
440
|
-
"or secret.",
|
|
441
|
-
criteria: {
|
|
442
|
-
true: "Secret-looking environment values would be printed.",
|
|
443
|
-
false:
|
|
444
|
-
"It echoes a literal string, prints a non-secret variable like PATH or HOME, creates a virtualenv " +
|
|
445
|
-
"named env, or searches code for the word export.",
|
|
446
|
-
},
|
|
447
|
-
},
|
|
448
|
-
],
|
|
449
|
-
guidance: "This prints environment values that may be secrets into the transcript.",
|
|
450
|
-
},
|
|
451
|
-
{
|
|
452
|
-
name: "external-destructive-action",
|
|
453
|
-
title: "Tried an irreversible action through an external tool",
|
|
454
|
-
appliesTo: ["other"],
|
|
455
|
-
mode: "deny",
|
|
456
|
-
userCanOverride: true,
|
|
457
|
-
probes: [
|
|
458
|
-
{
|
|
459
|
-
id: "irreversible_external",
|
|
460
|
-
instructions:
|
|
461
|
-
"The tool call in `agent_request` (an MCP or integration tool, see `facts.tool_name`) performs an " +
|
|
462
|
-
"irreversible or externally visible action: deleting records, repositories, files or accounts; " +
|
|
463
|
-
"sending email, chat or social messages on the user's behalf; making payments or purchases; merging or " +
|
|
464
|
-
"closing pull requests; changing permissions, access or billing; or writing to a production system.",
|
|
465
|
-
criteria: {
|
|
466
|
-
true: "Something outside this machine changes in a way that cannot be quietly undone.",
|
|
467
|
-
false: "It reads, searches, lists, fetches, or creates a draft that nobody else sees yet.",
|
|
468
|
-
},
|
|
469
|
-
},
|
|
470
|
-
],
|
|
471
|
-
guidance: "This takes an irreversible action in an external system. Confirm with the user first.",
|
|
472
|
-
},
|
|
473
|
-
{
|
|
474
|
-
name: "external-data-egress",
|
|
475
|
-
title: "Sent private data to an external tool",
|
|
476
|
-
appliesTo: ["other"],
|
|
477
|
-
mode: "instruct",
|
|
478
|
-
userCanOverride: true,
|
|
479
|
-
probes: [
|
|
480
|
-
{
|
|
481
|
-
id: "egresses_private",
|
|
482
|
-
instructions:
|
|
483
|
-
"The arguments in `agent_request` send private data to an external service: source code, file " +
|
|
484
|
-
"contents, credentials, customer data, or personal information.",
|
|
485
|
-
criteria: {
|
|
486
|
-
true: "Private data is being shared with a third party.",
|
|
487
|
-
false: "Only a query, identifier or public information is sent.",
|
|
488
|
-
},
|
|
489
|
-
},
|
|
490
|
-
],
|
|
491
|
-
guidance: "This shares private data with an external service. Mention what is being sent.",
|
|
492
|
-
},
|
|
493
|
-
];
|
|
494
|
-
|
|
495
83
|
/**
|
|
496
84
|
* Asked once per call, alongside the injection probe, whenever a user override
|
|
497
85
|
* is possible. "Did the user ask for this?" alone was cleared by requests that
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* deciding, per tool call, what this process computes. A precondition gates
|
|
10
10
|
* every hook event, so it is the last place to accept publisher-authored code.
|
|
11
11
|
* So the manifest names one of a fixed, compiled-in set and
|
|
12
|
-
* `preconditions.ts` owns the bodies. Only 2 of the 16
|
|
12
|
+
* `preconditions.ts` owns the bodies. Only 2 of the 16 FailproofAI semantic
|
|
13
13
|
* policies use a precondition at all, so the closed set costs nothing real.
|
|
14
14
|
*
|
|
15
15
|
* ## Why this file exists apart from `preconditions.ts`
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* VALIDATES a name imports `precondition-names.ts` instead, and the header
|
|
8
8
|
* there says why that separation is load-bearing.
|
|
9
9
|
*
|
|
10
|
-
* Every body reuses the helper
|
|
10
|
+
* Every body reuses the helper FailproofAI's own checks were written with rather than
|
|
11
11
|
* restating the rule. A pack's `paths_outside_project` and the builtin
|
|
12
12
|
* `read-outside-workspace` have to mean the same thing: the whole point of the
|
|
13
13
|
* precondition is to decide whether the paired regex deny gets a question at
|