@akasecurity/ai-tc-antigravity 0.9.21 → 0.9.22
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/package.json +6 -6
- package/plugin.json +1 -1
- package/scripts/apply-suppressions.js +289 -21
- package/scripts/backfill.js +473 -76
- package/scripts/content-retention.js +101 -37
- package/scripts/fail-open-count.js +49 -6
- package/scripts/filescan.js +489 -87
- package/scripts/firstrun.js +436 -69
- package/scripts/history-sync.js +368 -47
- package/scripts/intro.js +47 -6
- package/scripts/onboard.js +289 -21
- package/scripts/post-tool-use.js +89 -33
- package/scripts/pre-invocation.js +449 -82
- package/scripts/pre-tool-use.js +471 -74
- package/scripts/query.js +435 -68
- package/scripts/reconcile.js +438 -71
- package/scripts/remediate.js +477 -80
- package/scripts/scan-worker.js +47 -6
- package/scripts/start-light.js +47 -6
- package/scripts/stop.js +89 -33
- package/scripts/sync.js +495 -93
|
@@ -8956,6 +8956,12 @@ var CaptureSighting = object({
|
|
|
8956
8956
|
ruleId: string2().min(1),
|
|
8957
8957
|
category: DetectionCategory
|
|
8958
8958
|
}).meta({ id: "CaptureSighting" });
|
|
8959
|
+
var REVIEW_VALUES_MAX = 16;
|
|
8960
|
+
var REVIEW_VALUE_MAX_CHARS = 1024;
|
|
8961
|
+
var ReviewValue = object({
|
|
8962
|
+
ruleId: string2().min(1).max(256),
|
|
8963
|
+
value: string2().min(1).max(REVIEW_VALUE_MAX_CHARS)
|
|
8964
|
+
}).meta({ id: "ReviewValue" });
|
|
8959
8965
|
var EventMetadata = object({
|
|
8960
8966
|
sessionId: string2().optional(),
|
|
8961
8967
|
repo: string2().optional(),
|
|
@@ -9063,7 +9069,14 @@ var EventMetadata = object({
|
|
|
9063
9069
|
scanIncomplete: _enum(["timeout", "unavailable"]).optional(),
|
|
9064
9070
|
// The sighting tokens in `content`, one entry per distinct token and rule.
|
|
9065
9071
|
// Set only on a forwarded capture; the locally stored copy holds the values.
|
|
9066
|
-
sightings: array(CaptureSighting).optional()
|
|
9072
|
+
sightings: array(CaptureSighting).optional(),
|
|
9073
|
+
// The length of the text this capture was cut from, when its content holds only the first
|
|
9074
|
+
// part of it. Absent when the content is the whole text.
|
|
9075
|
+
contentTruncatedFrom: number2().int().nonnegative().optional(),
|
|
9076
|
+
// The raw value of each finding in this capture, for review by the deployment. Set only on
|
|
9077
|
+
// a forwarded capture from a repository the organization's capture settings name; the
|
|
9078
|
+
// locally stored copy never carries it.
|
|
9079
|
+
reviewValues: array(ReviewValue).max(REVIEW_VALUES_MAX).optional()
|
|
9067
9080
|
}).meta({ id: "EventMetadata" });
|
|
9068
9081
|
var Event = object({
|
|
9069
9082
|
id: guid2(),
|
|
@@ -9917,6 +9930,8 @@ var AssetType = _enum(["project", "skill", "mcp", "hook", "config"]).meta({ id:
|
|
|
9917
9930
|
var AccessLevel = _enum(["open", "approved", "blocked"]).meta({ id: "AccessLevel" });
|
|
9918
9931
|
var Origin = _enum(["source", "public-dep", "vendored", "config", "data", "docs", "generated"]).meta({ id: "Origin" });
|
|
9919
9932
|
var TrustLevel = _enum(["known-good", "risky", "unapproved"]).meta({ id: "TrustLevel" });
|
|
9933
|
+
var ATTENTION_TRUST_LEVELS = ["unapproved", "risky"];
|
|
9934
|
+
var isAttentionTrust = (trust) => trust !== null && trust !== void 0 && ATTENTION_TRUST_LEVELS.includes(trust);
|
|
9920
9935
|
var Flag = _enum(["update", "stale", "conflict", "unknown", "change", "untracked", "risk", "findings"]).meta({ id: "Flag" });
|
|
9921
9936
|
var Visibility = _enum(["public", "private"]).meta({ id: "Visibility" });
|
|
9922
9937
|
var HarnessEventKind = _enum(["block", "redact", "warn"]).meta({ id: "HarnessEventKind" });
|
|
@@ -10094,7 +10109,7 @@ var McpTool = object({
|
|
|
10094
10109
|
signature: string2(),
|
|
10095
10110
|
description: string2(),
|
|
10096
10111
|
write: boolean2(),
|
|
10097
|
-
/**
|
|
10112
|
+
/** What makes the tool dangerous; null when nothing does. */
|
|
10098
10113
|
risk: string2().nullable()
|
|
10099
10114
|
}).meta({ id: "McpTool" });
|
|
10100
10115
|
var AssetFindingRef = object({
|
|
@@ -10141,8 +10156,9 @@ var ProjectSensitiveData = object({ items: array(SensitiveDataClass) }).meta({ i
|
|
|
10141
10156
|
var ListProjectsResponse = object({ items: array(ProjectSummary) }).meta({ id: "ListProjectsResponse" });
|
|
10142
10157
|
var InventoryStats = object({
|
|
10143
10158
|
/**
|
|
10144
|
-
* Assets with a flag
|
|
10145
|
-
*
|
|
10159
|
+
* Assets with a flag or with an `ATTENTION_TRUST_LEVELS` effective trust,
|
|
10160
|
+
* plus projects with a finding in the last `PROJECT_FINDINGS_WINDOW_DAYS`
|
|
10161
|
+
* days (drives the attention header chip). An asset counts once.
|
|
10146
10162
|
*/
|
|
10147
10163
|
attention: number2().int().nonnegative(),
|
|
10148
10164
|
byType: object({
|
|
@@ -10685,6 +10701,10 @@ var EgressIngestHit = object({
|
|
|
10685
10701
|
*/
|
|
10686
10702
|
credentialRefs: EgressCredentialRefs.optional()
|
|
10687
10703
|
}).meta({ id: "EgressIngestHit" });
|
|
10704
|
+
var SUPERSEDED_PROJECT_KEYS_MAX = 4;
|
|
10705
|
+
var SupersededProjectKeys = array(
|
|
10706
|
+
string2().regex(/^[0-9a-f]{64}$/, "a superseded key must be a 64-character lowercase hex digest")
|
|
10707
|
+
).max(SUPERSEDED_PROJECT_KEYS_MAX);
|
|
10688
10708
|
var EgressIngestRequest = object({
|
|
10689
10709
|
/**
|
|
10690
10710
|
* Hash digest of the local `projectKey`, never the plaintext.
|
|
@@ -10697,6 +10717,7 @@ var EgressIngestRequest = object({
|
|
|
10697
10717
|
* that still has the plaintext to not send.
|
|
10698
10718
|
*/
|
|
10699
10719
|
projectKey: string2().regex(/^[0-9a-f]{64}$/, "projectKey must be a 64-character lowercase hex digest"),
|
|
10720
|
+
supersededProjectKeys: SupersededProjectKeys.optional(),
|
|
10700
10721
|
/** Display name only — never keys reconciliation. */
|
|
10701
10722
|
project: string2(),
|
|
10702
10723
|
reconcile: EgressReconcile,
|
|
@@ -10806,6 +10827,10 @@ var DeviceCommand = object({
|
|
|
10806
10827
|
expiresAt: printable(64).min(1)
|
|
10807
10828
|
}).strict();
|
|
10808
10829
|
var DeviceCommandPollResponse = object({ command: DeviceCommand.nullable() });
|
|
10830
|
+
var SessionHoldResponse = object({
|
|
10831
|
+
held: boolean2(),
|
|
10832
|
+
reason: printable(500).optional()
|
|
10833
|
+
});
|
|
10809
10834
|
var DeviceCommandFailureReason = _enum(["scan_failed", "no_projects", "expired"]);
|
|
10810
10835
|
var DeviceCommandAckBody = discriminatedUnion("outcome", [
|
|
10811
10836
|
object({
|
|
@@ -10868,7 +10893,9 @@ var CredentialSighting = object({
|
|
|
10868
10893
|
}).strict().meta({ id: "CredentialSighting" });
|
|
10869
10894
|
var CredentialSightingsRequest = object({
|
|
10870
10895
|
sightings: array(CredentialSighting).min(1).max(CREDENTIAL_SIGHTINGS_BATCH_MAX),
|
|
10871
|
-
scanId: uuid2().optional()
|
|
10896
|
+
scanId: uuid2().optional(),
|
|
10897
|
+
/** The earlier digests of the one project every sighting in the request names. */
|
|
10898
|
+
supersededProjectKeys: SupersededProjectKeys.optional()
|
|
10872
10899
|
}).strict().meta({ id: "CredentialSightingsRequest" });
|
|
10873
10900
|
var CredentialSightingsAck = object({
|
|
10874
10901
|
accepted: number2().int().nonnegative()
|
|
@@ -10999,6 +11026,18 @@ var ModelPolicy = object({
|
|
|
10999
11026
|
mode: literal("allowlist"),
|
|
11000
11027
|
approved: array(string2().min(1).max(512)).max(1e3)
|
|
11001
11028
|
}).meta({ id: "ModelPolicy" });
|
|
11029
|
+
var TOOL_OUTPUT_FORWARD_MIN_CHARS = 2;
|
|
11030
|
+
var TOOL_OUTPUT_FORWARD_MAX_CHARS = 65536;
|
|
11031
|
+
var CAPTURE_REPOS_MAX = 1e3;
|
|
11032
|
+
var CaptureRepos = array(string2().min(1).max(512)).max(CAPTURE_REPOS_MAX);
|
|
11033
|
+
var CaptureSettings = object({
|
|
11034
|
+
toolOutput: object({
|
|
11035
|
+
maxChars: number2().int().min(TOOL_OUTPUT_FORWARD_MIN_CHARS).max(TOOL_OUTPUT_FORWARD_MAX_CHARS),
|
|
11036
|
+
repos: CaptureRepos.optional()
|
|
11037
|
+
}).optional(),
|
|
11038
|
+
reviewValueRepos: CaptureRepos.optional(),
|
|
11039
|
+
sessionHold: boolean2().optional()
|
|
11040
|
+
}).meta({ id: "CaptureSettings" });
|
|
11002
11041
|
var PolicyBundle = object({
|
|
11003
11042
|
version: string2(),
|
|
11004
11043
|
policies: array(Policy),
|
|
@@ -11062,6 +11101,9 @@ var PolicyBundle = object({
|
|
|
11062
11101
|
// absent leaves the device's own setting in force, which is the behaviour
|
|
11063
11102
|
// that predates the field and the safe direction to default.
|
|
11064
11103
|
redactFallback: RedactFallback.optional(),
|
|
11104
|
+
// Optional so an older backend, and an older on-disk cache, still parses; absent sends what
|
|
11105
|
+
// the machine sent before the field existed.
|
|
11106
|
+
capture: CaptureSettings.optional(),
|
|
11065
11107
|
customKeywords: array(string2()),
|
|
11066
11108
|
fetchedAt: iso_exports.datetime()
|
|
11067
11109
|
}).meta({ id: "PolicyBundle" });
|
|
@@ -11070,7 +11112,8 @@ var POLICY_BUNDLE_SHAPE_ID = [
|
|
|
11070
11112
|
...Object.keys(Policy.shape).map((key) => `policies.${key}`),
|
|
11071
11113
|
...PolicyTarget.options.flatMap((member) => "shape" in member ? Object.keys(member.shape) : []).map((key) => `policies.target.${key}`),
|
|
11072
11114
|
...Object.keys(ExceptionBundleEntry.shape).map((key) => `exceptions.${key}`),
|
|
11073
|
-
...Object.keys(ModelPolicy.shape).map((key) => `modelPolicy.${key}`)
|
|
11115
|
+
...Object.keys(ModelPolicy.shape).map((key) => `modelPolicy.${key}`),
|
|
11116
|
+
...Object.keys(CaptureSettings.shape).map((key) => `capture.${key}`)
|
|
11074
11117
|
].sort().join(",");
|
|
11075
11118
|
var OBSERVE_ONLY_CATEGORIES = ["config"];
|
|
11076
11119
|
var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
|
|
@@ -13906,7 +13949,7 @@ function trimSlashes(path) {
|
|
|
13906
13949
|
while (end > start && path.charCodeAt(end - 1) === SLASH) end -= 1;
|
|
13907
13950
|
return path.slice(start, end);
|
|
13908
13951
|
}
|
|
13909
|
-
function
|
|
13952
|
+
function parseRemote(url2, foldsForgePathCase) {
|
|
13910
13953
|
const trimmed = url2.trim();
|
|
13911
13954
|
if (DOS_DRIVE.test(trimmed) || FILE_URL.test(trimmed)) return void 0;
|
|
13912
13955
|
const scheme = SCHEME_FORM.exec(trimmed);
|
|
@@ -13915,7 +13958,8 @@ function parseGitRemote(url2) {
|
|
|
13915
13958
|
if (host === void 0) return void 0;
|
|
13916
13959
|
const bare = trimSlashes((scheme === null ? scp?.[2] : scheme[2]) ?? "");
|
|
13917
13960
|
const path = bare.endsWith(GIT_SUFFIX) ? bare.slice(0, -GIT_SUFFIX.length) : bare;
|
|
13918
|
-
|
|
13961
|
+
const folds = foldsForgePathCase && CASE_INSENSITIVE_FORGES.has(host);
|
|
13962
|
+
return { host, path: folds ? path.toLowerCase() : path };
|
|
13919
13963
|
}
|
|
13920
13964
|
var CASE_INSENSITIVE_FORGES = /* @__PURE__ */ new Set([
|
|
13921
13965
|
"github.com",
|
|
@@ -13923,7 +13967,10 @@ var CASE_INSENSITIVE_FORGES = /* @__PURE__ */ new Set([
|
|
|
13923
13967
|
"bitbucket.org"
|
|
13924
13968
|
]);
|
|
13925
13969
|
function canonicalGitUrl(url2) {
|
|
13926
|
-
|
|
13970
|
+
return canonicalUnder(url2, true);
|
|
13971
|
+
}
|
|
13972
|
+
function canonicalUnder(url2, foldsForgePathCase) {
|
|
13973
|
+
const remote = parseRemote(url2, foldsForgePathCase);
|
|
13927
13974
|
if (remote === void 0) return url2.trim();
|
|
13928
13975
|
return remote.path === "" ? remote.host : `${remote.host}/${remote.path}`;
|
|
13929
13976
|
}
|
|
@@ -20449,6 +20496,7 @@ var HARNESS_LABELS = {
|
|
|
20449
20496
|
[HARNESS.Copilot]: "GitHub Copilot"
|
|
20450
20497
|
};
|
|
20451
20498
|
var HARNESS_LIVENESS_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
20499
|
+
var ATTENTION_TRUST_SQL = ATTENTION_TRUST_LEVELS.map((t) => `'${t}'`).join(", ");
|
|
20452
20500
|
var PROJECT_FINDINGS_WINDOW_MS = PROJECT_FINDINGS_WINDOW_DAYS * 24 * 60 * 60 * 1e3;
|
|
20453
20501
|
var MCP_TOOLS_USED_WINDOW_MS = MCP_TOOLS_USED_WINDOW_DAYS * 24 * 60 * 60 * 1e3;
|
|
20454
20502
|
var PROJECT_FINDINGS_FROM = `audit_events s
|
|
@@ -20522,11 +20570,7 @@ function buildAssetDetail(row) {
|
|
|
20522
20570
|
finding: null
|
|
20523
20571
|
};
|
|
20524
20572
|
if (row.assetType === "mcp" && row.toolsJson !== null) {
|
|
20525
|
-
|
|
20526
|
-
detail.tools = row.effectiveTrust === "unapproved" ? rawTools.map((t) => ({
|
|
20527
|
-
...t,
|
|
20528
|
-
risk: t.risk ?? "Tool access blocked: MCP server trust is unapproved."
|
|
20529
|
-
})) : rawTools;
|
|
20573
|
+
detail.tools = safeJson(row.toolsJson, []);
|
|
20530
20574
|
}
|
|
20531
20575
|
return detail;
|
|
20532
20576
|
}
|
|
@@ -20615,7 +20659,12 @@ var SqliteInventoryAssetsRepository = class {
|
|
|
20615
20659
|
);
|
|
20616
20660
|
const flaggedAssets = countScalar(
|
|
20617
20661
|
this.db,
|
|
20618
|
-
|
|
20662
|
+
`SELECT count(*) AS n
|
|
20663
|
+
FROM inventory_asset a
|
|
20664
|
+
LEFT JOIN mcp_trust_override o ON o.asset_id = a.id
|
|
20665
|
+
WHERE a.flags_json <> '[]'
|
|
20666
|
+
OR (a.asset_type = 'mcp'
|
|
20667
|
+
AND coalesce(o.trust, a.trust) IN (${ATTENTION_TRUST_SQL}))`
|
|
20619
20668
|
);
|
|
20620
20669
|
const flaggedProjects = countScalar(
|
|
20621
20670
|
this.db,
|
|
@@ -20630,7 +20679,9 @@ var SqliteInventoryAssetsRepository = class {
|
|
|
20630
20679
|
byType[r.assetType] += 1;
|
|
20631
20680
|
if (r.assetType === "mcp" && r.effectiveTrust) mcpTrust[r.effectiveTrust] += 1;
|
|
20632
20681
|
}
|
|
20633
|
-
const flaggedConfig = configRows.filter(
|
|
20682
|
+
const flaggedConfig = configRows.filter(
|
|
20683
|
+
(r) => r.flagsJson !== "[]" || r.assetType === "mcp" && isAttentionTrust(r.effectiveTrust)
|
|
20684
|
+
).length;
|
|
20634
20685
|
return Promise.resolve({
|
|
20635
20686
|
attention: flaggedAssets + flaggedProjects + flaggedConfig,
|
|
20636
20687
|
byType,
|
|
@@ -23559,8 +23610,8 @@ import { dirname as dirname5 } from "path";
|
|
|
23559
23610
|
|
|
23560
23611
|
// ../../packages/plugin-runtime/src/attached/config-inventory-sync.ts
|
|
23561
23612
|
import { createHash as createHash10 } from "crypto";
|
|
23562
|
-
import { readFileSync as
|
|
23563
|
-
import { join as
|
|
23613
|
+
import { readFileSync as readFileSync17 } from "fs";
|
|
23614
|
+
import { join as join26 } from "path";
|
|
23564
23615
|
|
|
23565
23616
|
// ../../packages/plugin-runtime/src/attached/history-sync.ts
|
|
23566
23617
|
import { createHash as createHash9 } from "crypto";
|
|
@@ -23574,9 +23625,9 @@ var REDACT_DEGRADED_TO = EventMetadata.shape.redactDegradedTo.unwrap();
|
|
|
23574
23625
|
var SCAN_INCOMPLETE = EventMetadata.shape.scanIncomplete.unwrap();
|
|
23575
23626
|
|
|
23576
23627
|
// ../../packages/plugin-runtime/src/attached/policy-store.ts
|
|
23577
|
-
import { randomUUID as
|
|
23578
|
-
import { readFile as readFile2, rm, writeFile as
|
|
23579
|
-
import { join as
|
|
23628
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
23629
|
+
import { readFile as readFile2, rm as rm2, writeFile as writeFile3 } from "fs/promises";
|
|
23630
|
+
import { join as join25 } from "path";
|
|
23580
23631
|
|
|
23581
23632
|
// ../../packages/plugin-runtime/src/attached/atomic-publish.ts
|
|
23582
23633
|
import { rename as rename2 } from "fs/promises";
|
|
@@ -23584,6 +23635,16 @@ var IMMEDIATE_RETRIES = 8;
|
|
|
23584
23635
|
var TIMED_RETRIES = 4;
|
|
23585
23636
|
var ATTEMPTS = 1 + IMMEDIATE_RETRIES + TIMED_RETRIES;
|
|
23586
23637
|
|
|
23638
|
+
// ../../packages/plugin-runtime/src/attached/capture-settings.ts
|
|
23639
|
+
import { randomUUID as randomUUID15 } from "crypto";
|
|
23640
|
+
import { readFileSync as readFileSync16 } from "fs";
|
|
23641
|
+
import { rm, writeFile as writeFile2 } from "fs/promises";
|
|
23642
|
+
import { join as join24 } from "path";
|
|
23643
|
+
var HookCaptureSettingsSchema = CaptureSettings.pick({
|
|
23644
|
+
toolOutput: true,
|
|
23645
|
+
sessionHold: true
|
|
23646
|
+
});
|
|
23647
|
+
|
|
23587
23648
|
// ../../packages/plugin-runtime/src/attached/history-sync.ts
|
|
23588
23649
|
var CAPTURE_BATCH_BYTES = 1024 * 1024;
|
|
23589
23650
|
|
|
@@ -23593,22 +23654,22 @@ var CONFIG_INVENTORY_STAGED_MAX_AGE_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
|
23593
23654
|
var CONFIG_INVENTORY_STAGED_MAX_BYTES = 8 * 1024 * 1024;
|
|
23594
23655
|
|
|
23595
23656
|
// ../../packages/plugin-runtime/src/attached/forward-drops.ts
|
|
23596
|
-
import { readFileSync as
|
|
23597
|
-
import { join as
|
|
23657
|
+
import { readFileSync as readFileSync18 } from "fs";
|
|
23658
|
+
import { join as join27 } from "path";
|
|
23598
23659
|
|
|
23599
23660
|
// ../../packages/plugin-runtime/src/attached/plugin-block.ts
|
|
23600
|
-
import { readFileSync as
|
|
23661
|
+
import { readFileSync as readFileSync19 } from "fs";
|
|
23601
23662
|
|
|
23602
23663
|
// ../../packages/plugin-runtime/src/attached/install-record.ts
|
|
23603
23664
|
import { readFile as readFile3, stat } from "fs/promises";
|
|
23604
|
-
import { basename as basename2, dirname as dirname6, join as
|
|
23665
|
+
import { basename as basename2, dirname as dirname6, join as join28, resolve as resolve3 } from "path";
|
|
23605
23666
|
|
|
23606
23667
|
// ../../packages/plugin-runtime/src/attached/plugin-block.ts
|
|
23607
23668
|
var INSTALL_RECORD_READ_TIMEOUT_MS = REQUEST_TIMEOUT_MS / 2;
|
|
23608
23669
|
|
|
23609
23670
|
// ../../packages/plugin-runtime/src/attached/posture-report-state.ts
|
|
23610
|
-
import { readFileSync as
|
|
23611
|
-
import { join as
|
|
23671
|
+
import { readFileSync as readFileSync20 } from "fs";
|
|
23672
|
+
import { join as join29 } from "path";
|
|
23612
23673
|
var OUTCOME_KEYS = {
|
|
23613
23674
|
ok: true,
|
|
23614
23675
|
unauthorized: true,
|
|
@@ -23629,18 +23690,18 @@ import { statSync as statSync7 } from "fs";
|
|
|
23629
23690
|
import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
|
|
23630
23691
|
|
|
23631
23692
|
// ../../packages/plugin-runtime/src/attached/posture-store.ts
|
|
23632
|
-
import { randomUUID as
|
|
23633
|
-
import { readFile as readFile4, rm as
|
|
23634
|
-
import { join as join29 } from "path";
|
|
23635
|
-
|
|
23636
|
-
// ../../packages/plugin-runtime/src/attached/label-drops.ts
|
|
23637
|
-
import { readFileSync as readFileSync20 } from "fs";
|
|
23693
|
+
import { randomUUID as randomUUID17 } from "crypto";
|
|
23694
|
+
import { readFile as readFile4, rm as rm3, writeFile as writeFile4 } from "fs/promises";
|
|
23638
23695
|
import { join as join30 } from "path";
|
|
23639
23696
|
|
|
23640
|
-
// ../../packages/plugin-runtime/src/attached/
|
|
23697
|
+
// ../../packages/plugin-runtime/src/attached/label-drops.ts
|
|
23641
23698
|
import { readFileSync as readFileSync21 } from "fs";
|
|
23642
23699
|
import { join as join31 } from "path";
|
|
23643
23700
|
|
|
23701
|
+
// ../../packages/plugin-runtime/src/attached/sync-state.ts
|
|
23702
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
23703
|
+
import { join as join32 } from "path";
|
|
23704
|
+
|
|
23644
23705
|
// ../../packages/plugin-runtime/src/attached/status.ts
|
|
23645
23706
|
var REFUSAL_LINES = {
|
|
23646
23707
|
unauthorized: "KEY REJECTED \u2014 re-attach with a valid plugin key",
|
|
@@ -23670,10 +23731,13 @@ var WORK_LINES = {
|
|
|
23670
23731
|
// ../../packages/plugin-runtime/src/attached/history-sync-trigger.ts
|
|
23671
23732
|
import { spawn } from "child_process";
|
|
23672
23733
|
import { existsSync as existsSync8, statSync as statSync8 } from "fs";
|
|
23673
|
-
import { join as
|
|
23734
|
+
import { join as join33 } from "path";
|
|
23674
23735
|
import { fileURLToPath } from "url";
|
|
23675
23736
|
var HISTORY_SYNC_THROTTLE_MS = 5 * 60 * 1e3;
|
|
23676
23737
|
|
|
23738
|
+
// ../../packages/plugin-runtime/src/attached/session-hold.ts
|
|
23739
|
+
import { dirname as dirname7 } from "path";
|
|
23740
|
+
|
|
23677
23741
|
// ../../packages/plugin-runtime/src/attached/sighting-key-sync.ts
|
|
23678
23742
|
var SIGHTING_KEY_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
23679
23743
|
|
|
@@ -23732,10 +23796,10 @@ import { fileURLToPath as fileURLToPath3 } from "url";
|
|
|
23732
23796
|
var CONTENT_RETENTION_THROTTLE_MS = 60 * 60 * 1e3;
|
|
23733
23797
|
|
|
23734
23798
|
// ../../packages/plugin-runtime/src/handle-session-start.ts
|
|
23735
|
-
import { randomUUID as
|
|
23799
|
+
import { randomUUID as randomUUID18 } from "crypto";
|
|
23736
23800
|
|
|
23737
23801
|
// ../../packages/plugin-runtime/src/attached/forwarding-line.ts
|
|
23738
|
-
import { dirname as
|
|
23802
|
+
import { dirname as dirname8 } from "path";
|
|
23739
23803
|
|
|
23740
23804
|
// ../../packages/plugin-runtime/src/handle-session-start.ts
|
|
23741
23805
|
var EXCEPTION_RETENTION_MS = 90 * 24 * 60 * 60 * 1e3;
|
|
@@ -8531,6 +8531,12 @@ var CaptureSighting = object({
|
|
|
8531
8531
|
ruleId: string2().min(1),
|
|
8532
8532
|
category: DetectionCategory
|
|
8533
8533
|
}).meta({ id: "CaptureSighting" });
|
|
8534
|
+
var REVIEW_VALUES_MAX = 16;
|
|
8535
|
+
var REVIEW_VALUE_MAX_CHARS = 1024;
|
|
8536
|
+
var ReviewValue = object({
|
|
8537
|
+
ruleId: string2().min(1).max(256),
|
|
8538
|
+
value: string2().min(1).max(REVIEW_VALUE_MAX_CHARS)
|
|
8539
|
+
}).meta({ id: "ReviewValue" });
|
|
8534
8540
|
var EventMetadata = object({
|
|
8535
8541
|
sessionId: string2().optional(),
|
|
8536
8542
|
repo: string2().optional(),
|
|
@@ -8638,7 +8644,14 @@ var EventMetadata = object({
|
|
|
8638
8644
|
scanIncomplete: _enum(["timeout", "unavailable"]).optional(),
|
|
8639
8645
|
// The sighting tokens in `content`, one entry per distinct token and rule.
|
|
8640
8646
|
// Set only on a forwarded capture; the locally stored copy holds the values.
|
|
8641
|
-
sightings: array(CaptureSighting).optional()
|
|
8647
|
+
sightings: array(CaptureSighting).optional(),
|
|
8648
|
+
// The length of the text this capture was cut from, when its content holds only the first
|
|
8649
|
+
// part of it. Absent when the content is the whole text.
|
|
8650
|
+
contentTruncatedFrom: number2().int().nonnegative().optional(),
|
|
8651
|
+
// The raw value of each finding in this capture, for review by the deployment. Set only on
|
|
8652
|
+
// a forwarded capture from a repository the organization's capture settings name; the
|
|
8653
|
+
// locally stored copy never carries it.
|
|
8654
|
+
reviewValues: array(ReviewValue).max(REVIEW_VALUES_MAX).optional()
|
|
8642
8655
|
}).meta({ id: "EventMetadata" });
|
|
8643
8656
|
var Event = object({
|
|
8644
8657
|
id: guid2(),
|
|
@@ -9489,6 +9502,7 @@ var AssetType = _enum(["project", "skill", "mcp", "hook", "config"]).meta({ id:
|
|
|
9489
9502
|
var AccessLevel = _enum(["open", "approved", "blocked"]).meta({ id: "AccessLevel" });
|
|
9490
9503
|
var Origin = _enum(["source", "public-dep", "vendored", "config", "data", "docs", "generated"]).meta({ id: "Origin" });
|
|
9491
9504
|
var TrustLevel = _enum(["known-good", "risky", "unapproved"]).meta({ id: "TrustLevel" });
|
|
9505
|
+
var ATTENTION_TRUST_LEVELS = ["unapproved", "risky"];
|
|
9492
9506
|
var Flag = _enum(["update", "stale", "conflict", "unknown", "change", "untracked", "risk", "findings"]).meta({ id: "Flag" });
|
|
9493
9507
|
var Visibility = _enum(["public", "private"]).meta({ id: "Visibility" });
|
|
9494
9508
|
var HarnessEventKind = _enum(["block", "redact", "warn"]).meta({ id: "HarnessEventKind" });
|
|
@@ -9631,7 +9645,7 @@ var McpTool = object({
|
|
|
9631
9645
|
signature: string2(),
|
|
9632
9646
|
description: string2(),
|
|
9633
9647
|
write: boolean2(),
|
|
9634
|
-
/**
|
|
9648
|
+
/** What makes the tool dangerous; null when nothing does. */
|
|
9635
9649
|
risk: string2().nullable()
|
|
9636
9650
|
}).meta({ id: "McpTool" });
|
|
9637
9651
|
var AssetFindingRef = object({
|
|
@@ -9678,8 +9692,9 @@ var ProjectSensitiveData = object({ items: array(SensitiveDataClass) }).meta({ i
|
|
|
9678
9692
|
var ListProjectsResponse = object({ items: array(ProjectSummary) }).meta({ id: "ListProjectsResponse" });
|
|
9679
9693
|
var InventoryStats = object({
|
|
9680
9694
|
/**
|
|
9681
|
-
* Assets with a flag
|
|
9682
|
-
*
|
|
9695
|
+
* Assets with a flag or with an `ATTENTION_TRUST_LEVELS` effective trust,
|
|
9696
|
+
* plus projects with a finding in the last `PROJECT_FINDINGS_WINDOW_DAYS`
|
|
9697
|
+
* days (drives the attention header chip). An asset counts once.
|
|
9683
9698
|
*/
|
|
9684
9699
|
attention: number2().int().nonnegative(),
|
|
9685
9700
|
byType: object({
|
|
@@ -10202,6 +10217,10 @@ var EgressIngestHit = object({
|
|
|
10202
10217
|
*/
|
|
10203
10218
|
credentialRefs: EgressCredentialRefs.optional()
|
|
10204
10219
|
}).meta({ id: "EgressIngestHit" });
|
|
10220
|
+
var SUPERSEDED_PROJECT_KEYS_MAX = 4;
|
|
10221
|
+
var SupersededProjectKeys = array(
|
|
10222
|
+
string2().regex(/^[0-9a-f]{64}$/, "a superseded key must be a 64-character lowercase hex digest")
|
|
10223
|
+
).max(SUPERSEDED_PROJECT_KEYS_MAX);
|
|
10205
10224
|
var EgressIngestRequest = object({
|
|
10206
10225
|
/**
|
|
10207
10226
|
* Hash digest of the local `projectKey`, never the plaintext.
|
|
@@ -10214,6 +10233,7 @@ var EgressIngestRequest = object({
|
|
|
10214
10233
|
* that still has the plaintext to not send.
|
|
10215
10234
|
*/
|
|
10216
10235
|
projectKey: string2().regex(/^[0-9a-f]{64}$/, "projectKey must be a 64-character lowercase hex digest"),
|
|
10236
|
+
supersededProjectKeys: SupersededProjectKeys.optional(),
|
|
10217
10237
|
/** Display name only — never keys reconciliation. */
|
|
10218
10238
|
project: string2(),
|
|
10219
10239
|
reconcile: EgressReconcile,
|
|
@@ -10323,6 +10343,10 @@ var DeviceCommand = object({
|
|
|
10323
10343
|
expiresAt: printable(64).min(1)
|
|
10324
10344
|
}).strict();
|
|
10325
10345
|
var DeviceCommandPollResponse = object({ command: DeviceCommand.nullable() });
|
|
10346
|
+
var SessionHoldResponse = object({
|
|
10347
|
+
held: boolean2(),
|
|
10348
|
+
reason: printable(500).optional()
|
|
10349
|
+
});
|
|
10326
10350
|
var DeviceCommandFailureReason = _enum(["scan_failed", "no_projects", "expired"]);
|
|
10327
10351
|
var DeviceCommandAckBody = discriminatedUnion("outcome", [
|
|
10328
10352
|
object({
|
|
@@ -10385,7 +10409,9 @@ var CredentialSighting = object({
|
|
|
10385
10409
|
}).strict().meta({ id: "CredentialSighting" });
|
|
10386
10410
|
var CredentialSightingsRequest = object({
|
|
10387
10411
|
sightings: array(CredentialSighting).min(1).max(CREDENTIAL_SIGHTINGS_BATCH_MAX),
|
|
10388
|
-
scanId: uuid2().optional()
|
|
10412
|
+
scanId: uuid2().optional(),
|
|
10413
|
+
/** The earlier digests of the one project every sighting in the request names. */
|
|
10414
|
+
supersededProjectKeys: SupersededProjectKeys.optional()
|
|
10389
10415
|
}).strict().meta({ id: "CredentialSightingsRequest" });
|
|
10390
10416
|
var CredentialSightingsAck = object({
|
|
10391
10417
|
accepted: number2().int().nonnegative()
|
|
@@ -10516,6 +10542,18 @@ var ModelPolicy = object({
|
|
|
10516
10542
|
mode: literal("allowlist"),
|
|
10517
10543
|
approved: array(string2().min(1).max(512)).max(1e3)
|
|
10518
10544
|
}).meta({ id: "ModelPolicy" });
|
|
10545
|
+
var TOOL_OUTPUT_FORWARD_MIN_CHARS = 2;
|
|
10546
|
+
var TOOL_OUTPUT_FORWARD_MAX_CHARS = 65536;
|
|
10547
|
+
var CAPTURE_REPOS_MAX = 1e3;
|
|
10548
|
+
var CaptureRepos = array(string2().min(1).max(512)).max(CAPTURE_REPOS_MAX);
|
|
10549
|
+
var CaptureSettings = object({
|
|
10550
|
+
toolOutput: object({
|
|
10551
|
+
maxChars: number2().int().min(TOOL_OUTPUT_FORWARD_MIN_CHARS).max(TOOL_OUTPUT_FORWARD_MAX_CHARS),
|
|
10552
|
+
repos: CaptureRepos.optional()
|
|
10553
|
+
}).optional(),
|
|
10554
|
+
reviewValueRepos: CaptureRepos.optional(),
|
|
10555
|
+
sessionHold: boolean2().optional()
|
|
10556
|
+
}).meta({ id: "CaptureSettings" });
|
|
10519
10557
|
var PolicyBundle = object({
|
|
10520
10558
|
version: string2(),
|
|
10521
10559
|
policies: array(Policy),
|
|
@@ -10579,6 +10617,9 @@ var PolicyBundle = object({
|
|
|
10579
10617
|
// absent leaves the device's own setting in force, which is the behaviour
|
|
10580
10618
|
// that predates the field and the safe direction to default.
|
|
10581
10619
|
redactFallback: RedactFallback.optional(),
|
|
10620
|
+
// Optional so an older backend, and an older on-disk cache, still parses; absent sends what
|
|
10621
|
+
// the machine sent before the field existed.
|
|
10622
|
+
capture: CaptureSettings.optional(),
|
|
10582
10623
|
customKeywords: array(string2()),
|
|
10583
10624
|
fetchedAt: iso_exports.datetime()
|
|
10584
10625
|
}).meta({ id: "PolicyBundle" });
|
|
@@ -10587,7 +10628,8 @@ var POLICY_BUNDLE_SHAPE_ID = [
|
|
|
10587
10628
|
...Object.keys(Policy.shape).map((key) => `policies.${key}`),
|
|
10588
10629
|
...PolicyTarget.options.flatMap((member) => "shape" in member ? Object.keys(member.shape) : []).map((key) => `policies.target.${key}`),
|
|
10589
10630
|
...Object.keys(ExceptionBundleEntry.shape).map((key) => `exceptions.${key}`),
|
|
10590
|
-
...Object.keys(ModelPolicy.shape).map((key) => `modelPolicy.${key}`)
|
|
10631
|
+
...Object.keys(ModelPolicy.shape).map((key) => `modelPolicy.${key}`),
|
|
10632
|
+
...Object.keys(CaptureSettings.shape).map((key) => `capture.${key}`)
|
|
10591
10633
|
].sort().join(",");
|
|
10592
10634
|
var OBSERVE_ONLY_CATEGORIES = ["config"];
|
|
10593
10635
|
var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
|
|
@@ -13560,6 +13602,7 @@ var HARNESS_LABELS = {
|
|
|
13560
13602
|
[HARNESS.Copilot]: "GitHub Copilot"
|
|
13561
13603
|
};
|
|
13562
13604
|
var HARNESS_LIVENESS_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
13605
|
+
var ATTENTION_TRUST_SQL = ATTENTION_TRUST_LEVELS.map((t) => `'${t}'`).join(", ");
|
|
13563
13606
|
var PROJECT_FINDINGS_WINDOW_MS = PROJECT_FINDINGS_WINDOW_DAYS * 24 * 60 * 60 * 1e3;
|
|
13564
13607
|
var MCP_TOOLS_USED_WINDOW_MS = MCP_TOOLS_USED_WINDOW_DAYS * 24 * 60 * 60 * 1e3;
|
|
13565
13608
|
var CATEGORY_OF_DEFINITION = `CASE WHEN d.category IN (${DetectionCategory.options.map((c) => `'${c}'`).join(", ")}) THEN d.category ELSE 'custom' END`;
|