failproofai 1.0.8 → 1.0.9-beta.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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- 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/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/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/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/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/server-reference-manifest.json +14 -14
- package/.next/standalone/.next/server/app/policies/page.js +3 -3
- 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/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/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/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/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/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]__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]__0tmz862._.js +3 -0
- 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/{_0-vcssj._.js → _0n0lja6._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_1gb0ifp._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_1p3iz2d._.js +23 -0
- 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/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 +3 -3
- 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/{3c3qbmosdjl6w.js → 0247hc9ath5t-.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0m-9d6yn9hx4j.js → 03001k9jy-kst.js} +1 -1
- package/.next/standalone/.next/static/chunks/{2qdpj67x6ifk_.js → 06k7gsfnb7jkh.js} +1 -1
- package/.next/standalone/.next/static/chunks/0qejem4-zt-hy.js +1 -0
- package/.next/standalone/.next/static/chunks/{21uv-uusw329x.js → 0snylg3y1i47a.js} +1 -1
- package/.next/standalone/.next/static/chunks/1h0if8ky362as.js +1 -0
- package/.next/standalone/.next/static/chunks/{0wbjy0zo-m7is.js → 2qsrrrl2maqsb.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0bhidk90e-07f.css → 3_e_wg5_oay87.css} +1 -1
- package/.next/standalone/.next/static/chunks/3ns-egfh8i8i5.js +6 -0
- package/.next/standalone/.next/static/chunks/3rq7fjj9we0v3.js +1 -0
- package/.next/standalone/.next/static/chunks/42m0f2hh8vfb1.js +1 -0
- 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/hermes-plugin/README.md +18 -8
- package/.next/standalone/package.json +10 -10
- package/.next/standalone/server.js +1 -1
- package/bin/failproofai.mjs +33 -7
- package/dist/cli.mjs +556 -521
- package/dist/worker.mjs +56 -375
- package/hermes-plugin/README.md +18 -8
- package/package.json +10 -10
- 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 +349 -55
- package/src/hooks/jev-activity.ts +3 -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 +26 -10
- package/src/hooks/policy-types.ts +4 -4
- 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 → z1C0kJVF0NCtWn5R88hW3}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{5yKM8NoTOpUI0MoQl8eo5 → z1C0kJVF0NCtWn5R88hW3}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{5yKM8NoTOpUI0MoQl8eo5 → z1C0kJVF0NCtWn5R88hW3}/_ssgManifest.js +0 -0
package/dist/worker.mjs
CHANGED
|
@@ -1162,7 +1162,7 @@ function instruct(reason) {
|
|
|
1162
1162
|
}
|
|
1163
1163
|
|
|
1164
1164
|
// package.json
|
|
1165
|
-
var version = "1.0.
|
|
1165
|
+
var version = "1.0.9-beta.0";
|
|
1166
1166
|
var init_package = () => {};
|
|
1167
1167
|
|
|
1168
1168
|
// src/hooks/policy-types.ts
|
|
@@ -1179,7 +1179,7 @@ function effectiveAuthority(p) {
|
|
|
1179
1179
|
|
|
1180
1180
|
// src/hooks/policy-authority.ts
|
|
1181
1181
|
import { existsSync as existsSync3 } from "node:fs";
|
|
1182
|
-
function resolvePolicyAuthority(decl, knownReviewers =
|
|
1182
|
+
function resolvePolicyAuthority(decl, knownReviewers = NO_REVIEWERS, contested) {
|
|
1183
1183
|
const declaredReviewable = decl?.authority === "reviewable";
|
|
1184
1184
|
if (!decl || effectiveAuthority(decl) === "hard") {
|
|
1185
1185
|
if (!declaredReviewable)
|
|
@@ -1191,6 +1191,8 @@ function resolvePolicyAuthority(decl, knownReviewers = SEMANTIC_REVIEWER_NAMES,
|
|
|
1191
1191
|
return { authority: "hard", downgraded: "reviewedBy is not a list of semantic policy names" };
|
|
1192
1192
|
}
|
|
1193
1193
|
const unknown = names.filter((n) => !knownReviewers.has(n));
|
|
1194
|
+
if (knownReviewers.size === 0 && !unknown.some((n) => contested?.has(n)))
|
|
1195
|
+
return { authority: "hard" };
|
|
1194
1196
|
if (unknown.length > 0) {
|
|
1195
1197
|
return { authority: "hard", downgraded: `reviewedBy names ${unknown.map((n) => whyUnknown(n, knownReviewers, contested)).join("; ")}` };
|
|
1196
1198
|
}
|
|
@@ -1225,7 +1227,7 @@ function authorityFieldsOf(raw) {
|
|
|
1225
1227
|
}
|
|
1226
1228
|
return out;
|
|
1227
1229
|
}
|
|
1228
|
-
function withMergedAuthority(record, declarations, knownReviewers =
|
|
1230
|
+
function withMergedAuthority(record, declarations, knownReviewers = NO_REVIEWERS) {
|
|
1229
1231
|
const resolved = declarations.map((d) => resolvePolicyAuthority(d, knownReviewers));
|
|
1230
1232
|
const allReviewable = resolved.length > 0 && resolved.every((r) => r.authority === "reviewable");
|
|
1231
1233
|
const decided = declarations[resolved.findIndex((r) => r.authority !== "reviewable")] ?? {};
|
|
@@ -1264,7 +1266,7 @@ function authorityDeclarationFor(hook, source) {
|
|
|
1264
1266
|
}
|
|
1265
1267
|
return { authority: hook.authority, reviewedBy: hook.reviewedBy };
|
|
1266
1268
|
}
|
|
1267
|
-
var SEMANTIC_POLICY_NAMES, SEMANTIC_REVIEWER_NAMES, isName = (n) => typeof n === "string" && n.length > 0, warnedAuthority;
|
|
1269
|
+
var SEMANTIC_POLICY_NAMES, SEMANTIC_REVIEWER_NAMES, NO_REVIEWERS, isName = (n) => typeof n === "string" && n.length > 0, warnedAuthority;
|
|
1268
1270
|
var init_policy_authority = __esm(() => {
|
|
1269
1271
|
init_fp_home();
|
|
1270
1272
|
init_hook_logger();
|
|
@@ -1287,6 +1289,7 @@ var init_policy_authority = __esm(() => {
|
|
|
1287
1289
|
"external-data-egress"
|
|
1288
1290
|
];
|
|
1289
1291
|
SEMANTIC_REVIEWER_NAMES = new Set(SEMANTIC_POLICY_NAMES);
|
|
1292
|
+
NO_REVIEWERS = new Set;
|
|
1290
1293
|
warnedAuthority = new Set;
|
|
1291
1294
|
});
|
|
1292
1295
|
|
|
@@ -1480,10 +1483,12 @@ function parsePackIdentity(value) {
|
|
|
1480
1483
|
...commit ? { commit } : {}
|
|
1481
1484
|
};
|
|
1482
1485
|
}
|
|
1483
|
-
function
|
|
1486
|
+
function hasInstalledRegexPacks() {
|
|
1484
1487
|
try {
|
|
1485
1488
|
const raw = JSON.parse(readFileSync3(installedFilePath(), "utf8"));
|
|
1486
|
-
|
|
1489
|
+
if (!Array.isArray(raw.packs))
|
|
1490
|
+
return false;
|
|
1491
|
+
return raw.packs.some((p) => !!p && typeof p === "object" && Array.isArray(p.policies) && p.policies.length > 0);
|
|
1487
1492
|
} catch {
|
|
1488
1493
|
return false;
|
|
1489
1494
|
}
|
|
@@ -1903,7 +1908,7 @@ function isReservedClaim(pack, name) {
|
|
|
1903
1908
|
function effectiveReviewerNames() {
|
|
1904
1909
|
if (cached)
|
|
1905
1910
|
return cached;
|
|
1906
|
-
let names =
|
|
1911
|
+
let names = NO_REVIEWERS;
|
|
1907
1912
|
cachedContested = new Map;
|
|
1908
1913
|
try {
|
|
1909
1914
|
const packs = jevPacks(readInstalledPacks().packs, reviewerCli);
|
|
@@ -1917,15 +1922,15 @@ function contestedReviewerNames() {
|
|
|
1917
1922
|
effectiveReviewerNames();
|
|
1918
1923
|
return cachedContested;
|
|
1919
1924
|
}
|
|
1920
|
-
function
|
|
1921
|
-
return
|
|
1925
|
+
function jevChecksInstalled() {
|
|
1926
|
+
return effectiveReviewerNames().size > 0;
|
|
1922
1927
|
}
|
|
1923
1928
|
function reviewerNamesFor(packs) {
|
|
1924
1929
|
const contested = contestedSemanticNames(packs);
|
|
1925
1930
|
const declared = packs.flatMap((p) => (p.semantic ?? []).filter((s) => !isReservedClaim(p, s.name)).map((s) => s.name)).filter((name) => !contested.has(name));
|
|
1926
1931
|
if (declared.length === 0)
|
|
1927
|
-
return
|
|
1928
|
-
return new Set(
|
|
1932
|
+
return NO_REVIEWERS;
|
|
1933
|
+
return new Set(declared);
|
|
1929
1934
|
}
|
|
1930
1935
|
function forgetEffectiveReviewerNames(cli) {
|
|
1931
1936
|
cached = null;
|
|
@@ -4222,7 +4227,7 @@ var init_jev_activity = __esm(() => {
|
|
|
4222
4227
|
];
|
|
4223
4228
|
EVALUATORS = new Set(["jev", "jev-fallback"]);
|
|
4224
4229
|
DECISIONS = new Set(["allow", "instruct", "deny"]);
|
|
4225
|
-
MODES = new Set(["
|
|
4230
|
+
MODES = new Set(["observe", "enforce"]);
|
|
4226
4231
|
REASON_HEAD_RE = /^([a-z0-9]+(?:-[a-z0-9]+)*)\s*(?:$|[:(])/;
|
|
4227
4232
|
HTTP_CODE_RE = /^http-\d{3}$/;
|
|
4228
4233
|
JEV_REASON_CODE_LIST = [
|
|
@@ -4327,14 +4332,14 @@ function combineTwoTier(verdicts, review, mode) {
|
|
|
4327
4332
|
...review.model ? { jevModel: review.model } : {},
|
|
4328
4333
|
jevMode: mode
|
|
4329
4334
|
};
|
|
4330
|
-
if (mode === "
|
|
4331
|
-
const
|
|
4335
|
+
if (mode === "observe") {
|
|
4336
|
+
const observeVerdict = review.decision === "deny" || review.decision === "instruct" ? {
|
|
4332
4337
|
policyName: jevEntry.policyName,
|
|
4333
4338
|
decision: review.decision,
|
|
4334
4339
|
reason: jevEntry.reason,
|
|
4335
4340
|
version: review.model && JEV_MODEL_RE.test(review.model) ? review.model : "jev"
|
|
4336
4341
|
} : undefined;
|
|
4337
|
-
return { final: legacy, cleared, decidedByJev: false, activity, ...
|
|
4342
|
+
return { final: legacy, cleared, decidedByJev: false, activity, ...observeVerdict ? { observeVerdict } : {} };
|
|
4338
4343
|
}
|
|
4339
4344
|
return { ...enforced, cleared, activity };
|
|
4340
4345
|
}
|
|
@@ -4908,7 +4913,7 @@ async function evaluatePolicies(eventType, payload, session, config, twoTier) {
|
|
|
4908
4913
|
}
|
|
4909
4914
|
const combined = combineTwoTier(collected.verdicts, review, twoTier.mode);
|
|
4910
4915
|
if (combined.cleared.length > 0) {
|
|
4911
|
-
hookLogInfo(`jev ${twoTier.mode === "
|
|
4916
|
+
hookLogInfo(`jev ${twoTier.mode === "observe" ? "would clear" : "cleared"}: ${combined.cleared.join(", ")}`);
|
|
4912
4917
|
}
|
|
4913
4918
|
if (combined.activity.evaluator === "jev-fallback") {
|
|
4914
4919
|
hookLogInfo(combined.activity.jevFallbackReason === JEV_REASON_REQUEST_CUT ? "jev could not be shown the whole call; it cleared nothing, and the call was not allowed on a partial read" : `jev unavailable (${combined.activity.jevFallbackReason}); the regex result decided this call`);
|
|
@@ -4919,7 +4924,7 @@ async function evaluatePolicies(eventType, payload, session, config, twoTier) {
|
|
|
4919
4924
|
activity: combined.activity,
|
|
4920
4925
|
decidedByJev: combined.decidedByJev,
|
|
4921
4926
|
...combined.decidedByJev && review.kind === "answered" && review.origin ? { jevOrigin: review.origin } : {},
|
|
4922
|
-
...combined.
|
|
4927
|
+
...combined.observeVerdict ? { observeVerdict: combined.observeVerdict } : {}
|
|
4923
4928
|
}
|
|
4924
4929
|
};
|
|
4925
4930
|
}
|
|
@@ -11479,6 +11484,9 @@ var init_fp_reset = __esm(() => {
|
|
|
11479
11484
|
// src/hooks/semantic/jev-config.ts
|
|
11480
11485
|
import { closeSync as closeSync2, constants as fsConstants2, fstatSync as fstatSync2, openSync as openSync2, readSync as readSync2, statSync as statSync15 } from "node:fs";
|
|
11481
11486
|
import { dirname as dirname6 } from "node:path";
|
|
11487
|
+
function parseJevMode(raw) {
|
|
11488
|
+
return raw === "off" || raw === "observe" || raw === "enforce" ? raw : null;
|
|
11489
|
+
}
|
|
11482
11490
|
function jevConfigPath() {
|
|
11483
11491
|
return jevConfigFile();
|
|
11484
11492
|
}
|
|
@@ -11665,14 +11673,15 @@ function validateJevConfig(raw, envKey, cloud) {
|
|
|
11665
11673
|
cfg.timeoutMs = t;
|
|
11666
11674
|
}
|
|
11667
11675
|
if (o.mode !== undefined) {
|
|
11668
|
-
|
|
11669
|
-
|
|
11670
|
-
|
|
11676
|
+
const mode = parseJevMode(o.mode);
|
|
11677
|
+
if (mode === null)
|
|
11678
|
+
return { ok: false, problem: 'mode must be "off", "observe" or "enforce"' };
|
|
11679
|
+
cfg.mode = mode;
|
|
11671
11680
|
}
|
|
11672
11681
|
if (cfg.baseUrl !== undefined && isPlainHttp(cfg.baseUrl) && cfg.mode === "enforce") {
|
|
11673
11682
|
return {
|
|
11674
11683
|
ok: false,
|
|
11675
|
-
problem: "plain http (to localhost) is accepted only with mode
|
|
11684
|
+
problem: "plain http (to localhost) is accepted only with mode observe: in enforce mode Jev's answers can clear a deny, " + "and while the local proxy is down any process on this machine could take its port and answer. " + (cfg.provider === JEV_CLOUD_PROVIDER ? "Reconnect to an https FailproofAI Cloud URL (failproofai config --token <key> --url https://…), or keep mode observe" : "Use https, or mode observe")
|
|
11676
11685
|
};
|
|
11677
11686
|
}
|
|
11678
11687
|
return { ok: true, value: cfg };
|
|
@@ -12525,7 +12534,7 @@ function outsideProject(facts, p) {
|
|
|
12525
12534
|
return false;
|
|
12526
12535
|
return p.resolved !== cwd && !p.resolved.startsWith(cwd.endsWith("/") ? cwd : cwd + "/");
|
|
12527
12536
|
}
|
|
12528
|
-
var PROTECTED_BRANCHES, OUTSIDE_PROJECT,
|
|
12537
|
+
var PROTECTED_BRANCHES, OUTSIDE_PROJECT, SCOPE_PROBE, INJECTION_PROBE, HUMAN_ONLY, TASK_STEP_PROBE, OP_REQUESTED_PROBE, BEYOND_TASK_PROBE, TASK_PROBES;
|
|
12529
12538
|
var init_policies = __esm(() => {
|
|
12530
12539
|
PROTECTED_BRANCHES = new Set(["main", "master", "production", "prod", "release", "trunk"]);
|
|
12531
12540
|
OUTSIDE_PROJECT = new Set([
|
|
@@ -12534,334 +12543,6 @@ var init_policies = __esm(() => {
|
|
|
12534
12543
|
"system",
|
|
12535
12544
|
"root"
|
|
12536
12545
|
]);
|
|
12537
|
-
SEMANTIC_POLICIES = [
|
|
12538
|
-
{
|
|
12539
|
-
name: "destructive-deletion",
|
|
12540
|
-
title: "Tried to permanently delete data that cannot be regenerated",
|
|
12541
|
-
appliesTo: ["shell", "write"],
|
|
12542
|
-
mode: "deny",
|
|
12543
|
-
userCanOverride: true,
|
|
12544
|
-
probes: [
|
|
12545
|
-
{
|
|
12546
|
-
id: "destroys",
|
|
12547
|
-
instructions: "The tool call in `agent_request` permanently deletes, wipes, truncates or overwrites existing files, " + "directories or disks — for example `rm -r`, `find -delete`, `shred`, `dd of=`, `mkfs`, `truncate`, " + "`rsync --delete`, `git clean -fdx`, or redirecting output over an existing file.",
|
|
12548
|
-
criteria: {
|
|
12549
|
-
true: "Existing data would be destroyed or irreversibly overwritten.",
|
|
12550
|
-
false: "Nothing existing is destroyed: it reads, lists, creates new files, or moves data somewhere recoverable."
|
|
12551
|
-
}
|
|
12552
|
-
},
|
|
12553
|
-
{
|
|
12554
|
-
id: "irreplaceable",
|
|
12555
|
-
instructions: "What would be destroyed is outside the project, is the whole project, is the user's home directory, " + "is the filesystem root, or is data that cannot simply be regenerated (source code, documents, databases, " + "keys). Use `facts.paths[].relation` to see where each target sits relative to the project.",
|
|
12556
|
-
criteria: {
|
|
12557
|
-
true: "The destroyed data matters and could not be rebuilt by running a command.",
|
|
12558
|
-
false: "Only regenerable data inside the project is affected: build output, dist/, caches, node_modules, " + "virtualenvs, coverage reports, temp files, or files the agent itself just created."
|
|
12559
|
-
}
|
|
12560
|
-
}
|
|
12561
|
-
],
|
|
12562
|
-
guidance: "This permanently deletes data that cannot be rebuilt. Confirm the exact paths with the user first."
|
|
12563
|
-
},
|
|
12564
|
-
{
|
|
12565
|
-
name: "production-infra-change",
|
|
12566
|
-
title: "Tried to change live infrastructure",
|
|
12567
|
-
appliesTo: ["shell"],
|
|
12568
|
-
mode: "deny",
|
|
12569
|
-
userCanOverride: true,
|
|
12570
|
-
probes: [
|
|
12571
|
-
{
|
|
12572
|
-
id: "mutates",
|
|
12573
|
-
instructions: "The command in `agent_request` changes the state of cloud or cluster infrastructure: it creates, " + "updates, deletes, applies, scales, restarts, rolls out, deploys or destroys resources in a cloud " + "account, Kubernetes cluster, managed database, DNS, CDN or hosting platform (any CLI: kubectl, helm, " + "terraform, tofu, pulumi, aws, gcloud, az, doctl, flyctl, vercel, wrangler, railway, and so on — " + "however the binary is spelled or pathed).",
|
|
12574
|
-
criteria: {
|
|
12575
|
-
true: "It mutates infrastructure.",
|
|
12576
|
-
false: "It only reads or plans: get, list, describe, logs, status, plan, diff, validate, whoami, or --dry-run."
|
|
12577
|
-
}
|
|
12578
|
-
},
|
|
12579
|
-
{
|
|
12580
|
-
id: "not_local",
|
|
12581
|
-
instructions: "The target of that change is a shared or production environment, or its environment cannot be told " + "from the command.",
|
|
12582
|
-
criteria: {
|
|
12583
|
-
true: "Production, shared, or unknown environment.",
|
|
12584
|
-
false: "Clearly a local or throwaway environment: localhost, kind, minikube, docker-desktop, k3d, or a " + "context, workspace or profile whose name says dev, test, staging, sandbox or local."
|
|
12585
|
-
}
|
|
12586
|
-
}
|
|
12587
|
-
],
|
|
12588
|
-
guidance: "This changes live infrastructure. Run it against a non-production target, or hand the command to a human."
|
|
12589
|
-
},
|
|
12590
|
-
{
|
|
12591
|
-
name: "git-history-rewrite",
|
|
12592
|
-
title: "Tried to rewrite or discard shared git history",
|
|
12593
|
-
appliesTo: ["shell"],
|
|
12594
|
-
mode: "deny",
|
|
12595
|
-
userCanOverride: true,
|
|
12596
|
-
probes: [
|
|
12597
|
-
{
|
|
12598
|
-
id: "rewrites_remote",
|
|
12599
|
-
instructions: "The command in `agent_request` force-pushes or otherwise overwrites history on a git remote: " + "`git push --force`, `--force-with-lease`, `-f`, a `+refspec` such as `+HEAD:main`, or deleting a " + "remote branch. Git's global options before the subcommand (`git -C dir`, `git -c key=val`) and an " + "absolute path to the git binary do not change what the command does.",
|
|
12600
|
-
criteria: {
|
|
12601
|
-
true: "Remote history would be overwritten or a remote branch deleted.",
|
|
12602
|
-
false: "A normal push that only adds commits, or no push at all."
|
|
12603
|
-
}
|
|
12604
|
-
}
|
|
12605
|
-
],
|
|
12606
|
-
guidance: "Force-pushing rewrites history other people may have pulled. Confirm with the user first."
|
|
12607
|
-
},
|
|
12608
|
-
{
|
|
12609
|
-
name: "push-to-protected-branch",
|
|
12610
|
-
title: "Tried to push directly to a protected branch",
|
|
12611
|
-
appliesTo: ["shell"],
|
|
12612
|
-
mode: "instruct",
|
|
12613
|
-
userCanOverride: true,
|
|
12614
|
-
probes: [
|
|
12615
|
-
{
|
|
12616
|
-
id: "pushes_protected",
|
|
12617
|
-
instructions: "The command in `agent_request` pushes commits to a remote branch named main, master, production, " + "release or trunk — either named explicitly or implied because `facts.current_git_branch` is one of " + "those and the push names no other branch.",
|
|
12618
|
-
criteria: {
|
|
12619
|
-
true: "Commits land directly on a protected remote branch.",
|
|
12620
|
-
false: "It pushes a feature branch whose name merely contains a word like main (e.g. feature/main-menu), " + "or it does not push."
|
|
12621
|
-
}
|
|
12622
|
-
}
|
|
12623
|
-
],
|
|
12624
|
-
guidance: "Pushing straight to a protected branch skips review. Push a branch and open a PR unless the user asked for this."
|
|
12625
|
-
},
|
|
12626
|
-
{
|
|
12627
|
-
name: "commit-on-protected-branch",
|
|
12628
|
-
title: "Tried to commit directly on a protected branch",
|
|
12629
|
-
appliesTo: ["shell"],
|
|
12630
|
-
mode: "instruct",
|
|
12631
|
-
userCanOverride: true,
|
|
12632
|
-
precondition: (facts) => facts.currentGitBranch !== null && PROTECTED_BRANCHES.has(facts.currentGitBranch),
|
|
12633
|
-
probes: [
|
|
12634
|
-
{
|
|
12635
|
-
id: "creates_commit",
|
|
12636
|
-
instructions: "The command in `agent_request` creates or amends a git commit, merge, rebase or cherry-pick in the " + "repository (including `git -C dir commit` and `git commit -a`).",
|
|
12637
|
-
criteria: {
|
|
12638
|
-
true: "A new commit is written to the current branch.",
|
|
12639
|
-
false: "It only inspects history (log, show, diff, status) or mentions `commit` in a message or search."
|
|
12640
|
-
}
|
|
12641
|
-
}
|
|
12642
|
-
],
|
|
12643
|
-
guidance: "You are on a protected branch. Create a feature branch before committing unless the user asked otherwise."
|
|
12644
|
-
},
|
|
12645
|
-
{
|
|
12646
|
-
name: "secret-exposure",
|
|
12647
|
-
title: "Tried to read or copy credentials",
|
|
12648
|
-
appliesTo: ["shell", "read", "write"],
|
|
12649
|
-
mode: "deny",
|
|
12650
|
-
userCanOverride: true,
|
|
12651
|
-
probes: [
|
|
12652
|
-
{
|
|
12653
|
-
id: "touches_secrets",
|
|
12654
|
-
instructions: "The tool call in `agent_request` reads, prints, copies, or writes credential material: SSH private " + "keys (~/.ssh/id_*), authorized_keys, cloud credentials (~/.aws, ~/.config/gcloud, ~/.azure, " + "~/.kube/config), .env files containing real secret values, API tokens, password stores, keychains, " + "or browser cookie databases.",
|
|
12655
|
-
criteria: {
|
|
12656
|
-
true: "Actual secret values would be read, displayed, copied or written.",
|
|
12657
|
-
false: "It only references the concept: source code that reads process.env, a variable name, an .env.example " + "template, a test fixture, documentation about credentials, or a grep for the word."
|
|
12658
|
-
}
|
|
12659
|
-
}
|
|
12660
|
-
],
|
|
12661
|
-
guidance: "This exposes real credentials. Ask the user before reading or copying secret material."
|
|
12662
|
-
},
|
|
12663
|
-
{
|
|
12664
|
-
name: "credential-exfiltration",
|
|
12665
|
-
title: "Tried to send secrets or private files off the machine",
|
|
12666
|
-
appliesTo: ["shell", "network"],
|
|
12667
|
-
mode: "deny",
|
|
12668
|
-
userCanOverride: false,
|
|
12669
|
-
probes: [
|
|
12670
|
-
{
|
|
12671
|
-
id: "sends_out",
|
|
12672
|
-
instructions: "The tool call in `agent_request` sends data to a network destination: an HTTP POST or PUT (curl -d, " + "curl -F, curl -T, wget --post-data), scp, sftp, rsync or rclone to a remote, nc or socat, an upload to " + "a paste site, bucket or webhook, or a DNS lookup carrying encoded data.",
|
|
12673
|
-
criteria: {
|
|
12674
|
-
true: "Data leaves this machine.",
|
|
12675
|
-
false: "It only downloads, or only talks to localhost."
|
|
12676
|
-
}
|
|
12677
|
-
},
|
|
12678
|
-
{
|
|
12679
|
-
id: "sensitive_payload",
|
|
12680
|
-
instructions: "The data being sent includes credentials, keys, tokens, environment variables, or the contents of files " + "from outside the project (see `facts.paths`).",
|
|
12681
|
-
criteria: {
|
|
12682
|
-
true: "Secrets or private files are in what is sent.",
|
|
12683
|
-
false: "What is sent is ordinary project data the user would expect to share, like a test request body."
|
|
12684
|
-
}
|
|
12685
|
-
}
|
|
12686
|
-
],
|
|
12687
|
-
guidance: "This sends secrets or private files to a remote destination, which the user cannot approve. Do not send them."
|
|
12688
|
-
},
|
|
12689
|
-
{
|
|
12690
|
-
name: "remote-code-execution",
|
|
12691
|
-
title: "Tried to run code downloaded from the internet",
|
|
12692
|
-
appliesTo: ["shell"],
|
|
12693
|
-
mode: "deny",
|
|
12694
|
-
userCanOverride: true,
|
|
12695
|
-
probes: [
|
|
12696
|
-
{
|
|
12697
|
-
id: "download_and_run",
|
|
12698
|
-
instructions: "The command in `agent_request` downloads code or a script from the internet and executes it: " + '`curl … | sh`, `bash <(curl …)`, `wget … -O x.sh && bash x.sh`, `python3 -c "$(curl …)"`, piping into ' + "any interpreter (sh, bash, zsh, python, node, perl, ruby), or eval of a fetched string.",
|
|
12699
|
-
criteria: {
|
|
12700
|
-
true: "Fetched code is executed.",
|
|
12701
|
-
false: "It only downloads without running, runs a local file, or merely searches for or quotes such a command " + "(for example grep over a README)."
|
|
12702
|
-
}
|
|
12703
|
-
}
|
|
12704
|
-
],
|
|
12705
|
-
exempt: {
|
|
12706
|
-
id: "official_installer",
|
|
12707
|
-
instructions: "The URL being executed is the documented official installer of a widely used developer tool, served from " + "that tool's own domain (for example bun.sh, sh.rustup.rs, get.docker.com, deb.nodesource.com, " + "raw.githubusercontent.com/nvm-sh/nvm, astral.sh/uv)."
|
|
12708
|
-
},
|
|
12709
|
-
guidance: "This executes code fetched from the internet. Download it, show it to the user, then run it."
|
|
12710
|
-
},
|
|
12711
|
-
{
|
|
12712
|
-
name: "privilege-escalation",
|
|
12713
|
-
title: "Tried to run with elevated privileges",
|
|
12714
|
-
appliesTo: ["shell"],
|
|
12715
|
-
mode: "deny",
|
|
12716
|
-
userCanOverride: true,
|
|
12717
|
-
probes: [
|
|
12718
|
-
{
|
|
12719
|
-
id: "elevates",
|
|
12720
|
-
instructions: "The command in `agent_request` runs something as root or another user: sudo, doas, su, pkexec, run0, " + "`sudo -i`, `sudo -s`, including when the binary is written as an absolute path or reached through a " + "variable or wrapper.",
|
|
12721
|
-
criteria: {
|
|
12722
|
-
true: "Privileges are elevated.",
|
|
12723
|
-
false: "It runs as the current user, or only mentions sudo in text, a comment, or a search pattern."
|
|
12724
|
-
}
|
|
12725
|
-
}
|
|
12726
|
-
],
|
|
12727
|
-
guidance: "This runs with elevated privileges. Ask the user to run it themselves."
|
|
12728
|
-
},
|
|
12729
|
-
{
|
|
12730
|
-
name: "database-destruction",
|
|
12731
|
-
title: "Tried to destroy or mass-modify database data",
|
|
12732
|
-
appliesTo: ["shell"],
|
|
12733
|
-
mode: "deny",
|
|
12734
|
-
userCanOverride: true,
|
|
12735
|
-
probes: [
|
|
12736
|
-
{
|
|
12737
|
-
id: "destructive_sql",
|
|
12738
|
-
instructions: "The command in `agent_request` executes SQL or a database command that drops or truncates a table, " + "schema or database, or deletes or updates rows without a condition that narrows them to specific " + "records. A condition that is always true (`WHERE 1=1`, `WHERE true`, `WHERE id > 0`) does not narrow " + "anything. Also counts: `redis-cli FLUSHALL`, `dropdb`, `mongo … dropDatabase()`.",
|
|
12739
|
-
criteria: {
|
|
12740
|
-
true: "Many rows, a table, or a whole database would be removed or overwritten.",
|
|
12741
|
-
false: "It reads, inserts, or changes a specific identified record, or runs a migration file by name."
|
|
12742
|
-
}
|
|
12743
|
-
},
|
|
12744
|
-
{
|
|
12745
|
-
id: "real_database",
|
|
12746
|
-
instructions: "The database it targets holds real data rather than being a disposable test database.",
|
|
12747
|
-
criteria: {
|
|
12748
|
-
true: "A real or shared database, or one whose purpose cannot be told.",
|
|
12749
|
-
false: "Clearly an in-memory, test, fixture or throwaway local database (sqlite :memory:, a test_ database)."
|
|
12750
|
-
}
|
|
12751
|
-
}
|
|
12752
|
-
],
|
|
12753
|
-
guidance: "This destroys database data. Confirm the target and scope with the user first."
|
|
12754
|
-
},
|
|
12755
|
-
{
|
|
12756
|
-
name: "read-outside-workspace",
|
|
12757
|
-
title: "Read files outside the project",
|
|
12758
|
-
appliesTo: ["shell", "read"],
|
|
12759
|
-
mode: "instruct",
|
|
12760
|
-
userCanOverride: true,
|
|
12761
|
-
precondition: (facts) => facts.paths.some((p) => outsideProject(facts, p)),
|
|
12762
|
-
probes: [
|
|
12763
|
-
{
|
|
12764
|
-
id: "reads_outside",
|
|
12765
|
-
instructions: "The tool call in `agent_request` reads the contents of files that `facts.paths` marks as outside the " + "project, in the user's home directory (for example another repository, Documents, or dotfiles).",
|
|
12766
|
-
criteria: {
|
|
12767
|
-
true: "It reads file contents from outside the project.",
|
|
12768
|
-
false: "It only changes directory, lists names, checks existence, or touches the agent's own tool caches."
|
|
12769
|
-
}
|
|
12770
|
-
}
|
|
12771
|
-
],
|
|
12772
|
-
guidance: "This reads files outside the current project. Mention why before continuing."
|
|
12773
|
-
},
|
|
12774
|
-
{
|
|
12775
|
-
name: "agent-config-tampering",
|
|
12776
|
-
title: "Tried to change the agent's own safety configuration",
|
|
12777
|
-
appliesTo: ["shell", "write"],
|
|
12778
|
-
mode: "deny",
|
|
12779
|
-
userCanOverride: false,
|
|
12780
|
-
probes: [
|
|
12781
|
-
{
|
|
12782
|
-
id: "edits_agent_config",
|
|
12783
|
-
instructions: "The tool call in `agent_request` modifies or deletes an AI agent's own configuration, hooks, " + "permissions or guardrails: .claude/settings.json, .claude/settings.local.json, ~/.claude/, .codex/, " + ".cursor/hooks.json, .gemini/, .factory/, failproofai configuration or policies, or permission and " + "safety sections of AGENTS.md or CLAUDE.md.",
|
|
12784
|
-
criteria: {
|
|
12785
|
-
true: "The agent's hooks, permissions or safety settings would change.",
|
|
12786
|
-
false: "It only reads those files, or edits ordinary project documentation."
|
|
12787
|
-
}
|
|
12788
|
-
}
|
|
12789
|
-
],
|
|
12790
|
-
guidance: "An agent must not change its own guardrails. Ask the user to make this change."
|
|
12791
|
-
},
|
|
12792
|
-
{
|
|
12793
|
-
name: "system-modification",
|
|
12794
|
-
title: "Tried to change the system outside the project",
|
|
12795
|
-
appliesTo: ["shell"],
|
|
12796
|
-
mode: "instruct",
|
|
12797
|
-
userCanOverride: true,
|
|
12798
|
-
probes: [
|
|
12799
|
-
{
|
|
12800
|
-
id: "modifies_system",
|
|
12801
|
-
instructions: "The command in `agent_request` installs or removes software system-wide or changes machine " + "configuration: apt, dnf, pacman, brew install, `npm install -g`, `pip install` outside a virtualenv, " + "editing files under /etc, systemctl enable or disable, crontab, or changing shell startup files.",
|
|
12802
|
-
criteria: {
|
|
12803
|
-
true: "The machine changes outside the project directory.",
|
|
12804
|
-
false: "It installs project dependencies locally (npm install, bun install, pip install in a venv)."
|
|
12805
|
-
}
|
|
12806
|
-
}
|
|
12807
|
-
],
|
|
12808
|
-
guidance: "This changes the machine outside the project. Mention it to the user."
|
|
12809
|
-
},
|
|
12810
|
-
{
|
|
12811
|
-
name: "env-secrets-dump",
|
|
12812
|
-
title: "Tried to print environment secrets",
|
|
12813
|
-
appliesTo: ["shell"],
|
|
12814
|
-
mode: "instruct",
|
|
12815
|
-
userCanOverride: true,
|
|
12816
|
-
probes: [
|
|
12817
|
-
{
|
|
12818
|
-
id: "dumps_env",
|
|
12819
|
-
instructions: "The command in `agent_request` prints environment variable VALUES that may be secret: `env`, " + "`printenv`, `set`, `export -p`, or `echo` of a variable whose name suggests a key, token, password " + "or secret.",
|
|
12820
|
-
criteria: {
|
|
12821
|
-
true: "Secret-looking environment values would be printed.",
|
|
12822
|
-
false: "It echoes a literal string, prints a non-secret variable like PATH or HOME, creates a virtualenv " + "named env, or searches code for the word export."
|
|
12823
|
-
}
|
|
12824
|
-
}
|
|
12825
|
-
],
|
|
12826
|
-
guidance: "This prints environment values that may be secrets into the transcript."
|
|
12827
|
-
},
|
|
12828
|
-
{
|
|
12829
|
-
name: "external-destructive-action",
|
|
12830
|
-
title: "Tried an irreversible action through an external tool",
|
|
12831
|
-
appliesTo: ["other"],
|
|
12832
|
-
mode: "deny",
|
|
12833
|
-
userCanOverride: true,
|
|
12834
|
-
probes: [
|
|
12835
|
-
{
|
|
12836
|
-
id: "irreversible_external",
|
|
12837
|
-
instructions: "The tool call in `agent_request` (an MCP or integration tool, see `facts.tool_name`) performs an " + "irreversible or externally visible action: deleting records, repositories, files or accounts; " + "sending email, chat or social messages on the user's behalf; making payments or purchases; merging or " + "closing pull requests; changing permissions, access or billing; or writing to a production system.",
|
|
12838
|
-
criteria: {
|
|
12839
|
-
true: "Something outside this machine changes in a way that cannot be quietly undone.",
|
|
12840
|
-
false: "It reads, searches, lists, fetches, or creates a draft that nobody else sees yet."
|
|
12841
|
-
}
|
|
12842
|
-
}
|
|
12843
|
-
],
|
|
12844
|
-
guidance: "This takes an irreversible action in an external system. Confirm with the user first."
|
|
12845
|
-
},
|
|
12846
|
-
{
|
|
12847
|
-
name: "external-data-egress",
|
|
12848
|
-
title: "Sent private data to an external tool",
|
|
12849
|
-
appliesTo: ["other"],
|
|
12850
|
-
mode: "instruct",
|
|
12851
|
-
userCanOverride: true,
|
|
12852
|
-
probes: [
|
|
12853
|
-
{
|
|
12854
|
-
id: "egresses_private",
|
|
12855
|
-
instructions: "The arguments in `agent_request` send private data to an external service: source code, file " + "contents, credentials, customer data, or personal information.",
|
|
12856
|
-
criteria: {
|
|
12857
|
-
true: "Private data is being shared with a third party.",
|
|
12858
|
-
false: "Only a query, identifier or public information is sent."
|
|
12859
|
-
}
|
|
12860
|
-
}
|
|
12861
|
-
],
|
|
12862
|
-
guidance: "This shares private data with an external service. Mention what is being sent."
|
|
12863
|
-
}
|
|
12864
|
-
];
|
|
12865
12546
|
SCOPE_PROBE = {
|
|
12866
12547
|
id: "scope",
|
|
12867
12548
|
instructions: "Everything `agent_request` would affect — every branch, file, directory, table, record, environment, " + "account or recipient — is covered by what the human asked for in `user_said`. It reaches no further: not " + "all branches when they named one, not production when they said local or staging, not a parent directory " + 'when they named one folder, not every record when they named some. References such as "it", "this PR" ' + 'or "that volume" mean whatever the conversation is about. Details the agent filled in to carry the ' + "request out (a commit title, a flag the operation needs) do not make it broader.",
|
|
@@ -16004,14 +15685,13 @@ function toSemanticPolicy(entry, pack) {
|
|
|
16004
15685
|
function semanticPoliciesFromPacks(packs) {
|
|
16005
15686
|
const declared = packs.filter((p) => packSemantic(p).length > 0);
|
|
16006
15687
|
if (declared.length === 0)
|
|
16007
|
-
return { policies:
|
|
16008
|
-
const replace = replacesBuiltinChecks(declared);
|
|
15688
|
+
return { policies: [], fromPack: false, errors: [] };
|
|
16009
15689
|
const ordered = [...declared.filter((p) => isFirstPartyPack(p)), ...declared.filter((p) => !isFirstPartyPack(p))];
|
|
16010
|
-
const policies =
|
|
15690
|
+
const policies = [];
|
|
16011
15691
|
const errors = [];
|
|
16012
|
-
const seen = new Set
|
|
15692
|
+
const seen = new Set;
|
|
16013
15693
|
const contested = contestedSemanticNames(declared);
|
|
16014
|
-
let spent =
|
|
15694
|
+
let spent = 0;
|
|
16015
15695
|
for (const pack of ordered) {
|
|
16016
15696
|
for (const entry of packSemantic(pack)) {
|
|
16017
15697
|
if (isReservedClaim(pack, entry.name)) {
|
|
@@ -16044,9 +15724,7 @@ function semanticPoliciesFromPacks(packs) {
|
|
|
16044
15724
|
spent += cost;
|
|
16045
15725
|
}
|
|
16046
15726
|
}
|
|
16047
|
-
|
|
16048
|
-
return { policies: SEMANTIC_POLICIES, fromPack: false, errors };
|
|
16049
|
-
return { policies, fromPack: true, errors };
|
|
15727
|
+
return { policies, fromPack: policies.length > 0, errors };
|
|
16050
15728
|
}
|
|
16051
15729
|
function resolveSemanticPolicies(cli) {
|
|
16052
15730
|
let packs = [];
|
|
@@ -16056,7 +15734,7 @@ function resolveSemanticPolicies(cli) {
|
|
|
16056
15734
|
packs = read.packs;
|
|
16057
15735
|
manifestErrors = read.warnings ?? [];
|
|
16058
15736
|
} catch {
|
|
16059
|
-
return
|
|
15737
|
+
return [];
|
|
16060
15738
|
}
|
|
16061
15739
|
const resolved = semanticPoliciesFromPacks(jevPacks(packs, cli));
|
|
16062
15740
|
for (const message of [...manifestErrors, ...resolved.errors]) {
|
|
@@ -16067,7 +15745,7 @@ function resolveSemanticPolicies(cli) {
|
|
|
16067
15745
|
}
|
|
16068
15746
|
return resolved.policies;
|
|
16069
15747
|
}
|
|
16070
|
-
var GLOBAL_QUESTION_CHARS, MAX_PACK_QUESTION_CHARS,
|
|
15748
|
+
var GLOBAL_QUESTION_CHARS, MAX_PACK_QUESTION_CHARS, warned;
|
|
16071
15749
|
var init_pack_policies = __esm(() => {
|
|
16072
15750
|
init_effective_reviewers();
|
|
16073
15751
|
init_hook_logger();
|
|
@@ -16079,7 +15757,6 @@ var init_pack_policies = __esm(() => {
|
|
|
16079
15757
|
init_precondition_names();
|
|
16080
15758
|
GLOBAL_QUESTION_CHARS = Math.max(JSON.stringify({ [INJECTION_PROBE.id]: noulOf(INJECTION_PROBE), [SCOPE_PROBE.id]: noulOf(SCOPE_PROBE) }).length, JSON.stringify(Object.fromEntries([INJECTION_PROBE, ...TASK_PROBES].map((p) => [p.id, noulOf(p)]))).length);
|
|
16081
15759
|
MAX_PACK_QUESTION_CHARS = MAX_REQUEST_CHARS - MAX_STATE_CHARS - GLOBAL_QUESTION_CHARS;
|
|
16082
|
-
BUILTIN_QUESTION_CHARS = SEMANTIC_POLICIES.reduce((n, p) => n + questionChars(p), 0);
|
|
16083
15760
|
warned = new Set;
|
|
16084
15761
|
});
|
|
16085
15762
|
|
|
@@ -16584,7 +16261,7 @@ function authorityOf(p) {
|
|
|
16584
16261
|
return { authority, reviewedBy };
|
|
16585
16262
|
}
|
|
16586
16263
|
function resolveMode(cfg) {
|
|
16587
|
-
return cfg.mode === "
|
|
16264
|
+
return cfg.mode === "observe" || cfg.mode === "enforce" ? cfg.mode : DEFAULT_JEV_MODE;
|
|
16588
16265
|
}
|
|
16589
16266
|
function resolveTimeout(cfg) {
|
|
16590
16267
|
const t = cfg.timeoutMs;
|
|
@@ -16702,7 +16379,7 @@ function startJevReview(cfg, call) {
|
|
|
16702
16379
|
sessionId: call.sessionId,
|
|
16703
16380
|
cli: call.cli,
|
|
16704
16381
|
eventType: call.eventType,
|
|
16705
|
-
applied: abandoned || review.kind !== "answered" ? "legacy-fallback" : mode === "
|
|
16382
|
+
applied: abandoned || review.kind !== "answered" ? "legacy-fallback" : mode === "observe" ? "observe" : "two-tier"
|
|
16706
16383
|
});
|
|
16707
16384
|
appendVerdictLog(hit ? { ...row, cached: true } : row);
|
|
16708
16385
|
}
|
|
@@ -16953,6 +16630,8 @@ async function startTwoTier(canonicalEventType, parsed, session, cli, opts, acti
|
|
|
16953
16630
|
return null;
|
|
16954
16631
|
if (jevForcedOff(opts) || activePause)
|
|
16955
16632
|
return null;
|
|
16633
|
+
if (!jevChecksInstalled())
|
|
16634
|
+
return null;
|
|
16956
16635
|
const loaded = await readJevConfig();
|
|
16957
16636
|
if (!loaded)
|
|
16958
16637
|
return null;
|
|
@@ -16971,7 +16650,7 @@ async function startTwoTier(canonicalEventType, parsed, session, cli, opts, acti
|
|
|
16971
16650
|
} catch (err) {
|
|
16972
16651
|
hookLogInfo(`Jev review could not start (${err instanceof Error ? err.message : String(err)})`);
|
|
16973
16652
|
return {
|
|
16974
|
-
mode: cfg.mode === "
|
|
16653
|
+
mode: cfg.mode === "observe" || cfg.mode === "enforce" ? cfg.mode : loaded.defaultMode,
|
|
16975
16654
|
review: Promise.resolve({ kind: "fallback", reason: "error", latencyMs: null, model: null }),
|
|
16976
16655
|
abort: () => {},
|
|
16977
16656
|
authorityOf: () => ({ authority: "hard", reviewedBy: [] })
|
|
@@ -16995,6 +16674,8 @@ async function captureJevIntent(canonicalEventType, decision, parsed, session, c
|
|
|
16995
16674
|
if (canonicalEventType !== "UserPromptSubmit" || jevForcedOff(opts))
|
|
16996
16675
|
return;
|
|
16997
16676
|
try {
|
|
16677
|
+
if (!jevChecksInstalled())
|
|
16678
|
+
return;
|
|
16998
16679
|
if (!await readJevConfig())
|
|
16999
16680
|
return;
|
|
17000
16681
|
if (decision === "deny") {
|
|
@@ -17075,7 +16756,7 @@ async function evaluateHookEvent(eventType, cli = "claude", stdinPayload, opts)
|
|
|
17075
16756
|
config = readMergedHooksConfig(session.cwd);
|
|
17076
16757
|
clearPolicies(cli);
|
|
17077
16758
|
activePause = readActivePause(session.sessionId);
|
|
17078
|
-
const packsInstalledHere =
|
|
16759
|
+
const packsInstalledHere = hasInstalledRegexPacks();
|
|
17079
16760
|
const legacyNames = activePause || packsInstalledHere ? [] : config.enabledPolicies;
|
|
17080
16761
|
registerBuiltinPolicies(activePause ? [] : legacyNames);
|
|
17081
16762
|
if (legacyNames.length > 0) {
|
|
@@ -17149,14 +16830,14 @@ async function evaluateHookEvent(eventType, cli = "claude", stdinPayload, opts)
|
|
|
17149
16830
|
const observeOnly = cloudManaged?.effect === "observe" || pack?.effect === "observe";
|
|
17150
16831
|
const fn = async (ctx) => {
|
|
17151
16832
|
if (observeOnly) {
|
|
17152
|
-
const
|
|
17153
|
-
if (
|
|
16833
|
+
const observed = await runObserved(hook, ctx, hookName, eventType, cli);
|
|
16834
|
+
if (observed.decision !== "allow") {
|
|
17154
16835
|
const observer = cloudManaged ?? pack;
|
|
17155
16836
|
observedResults.push({
|
|
17156
16837
|
policyId: observer.id,
|
|
17157
16838
|
version: observer.version,
|
|
17158
|
-
decision:
|
|
17159
|
-
reason:
|
|
16839
|
+
decision: observed.decision,
|
|
16840
|
+
reason: observed.reason ?? null
|
|
17160
16841
|
});
|
|
17161
16842
|
}
|
|
17162
16843
|
return { decision: "allow" };
|
|
@@ -17246,13 +16927,13 @@ async function evaluateHookEvent(eventType, cli = "claude", stdinPayload, opts)
|
|
|
17246
16927
|
...twoTier,
|
|
17247
16928
|
releaseRegistry: opts?.releaseRegistry
|
|
17248
16929
|
}) : await evaluatePolicies(canonicalEventType, parsed, session, config);
|
|
17249
|
-
const
|
|
17250
|
-
if (
|
|
16930
|
+
const observeVerdict = result.twoTier?.observeVerdict;
|
|
16931
|
+
if (observeVerdict) {
|
|
17251
16932
|
observedResults.push({
|
|
17252
|
-
policyId:
|
|
17253
|
-
version:
|
|
17254
|
-
decision:
|
|
17255
|
-
reason:
|
|
16933
|
+
policyId: observeVerdict.policyName,
|
|
16934
|
+
version: observeVerdict.version,
|
|
16935
|
+
decision: observeVerdict.decision,
|
|
16936
|
+
reason: observeVerdict.reason
|
|
17256
16937
|
});
|
|
17257
16938
|
}
|
|
17258
16939
|
const durationMs = Math.round(performance.now() - startTime);
|