@akasecurity/ai-tc-codex 0.9.20 → 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.
@@ -8089,7 +8089,8 @@ var Span = object({
8089
8089
  var MAX_VARIABLE_NAME_LENGTH = 128;
8090
8090
  var VariableName = string2().max(MAX_VARIABLE_NAME_LENGTH);
8091
8091
  var Finding = object({
8092
- id: guid2(),
8092
+ // A random UUID or a content-addressed sha256 hex digest, depending on the writer.
8093
+ id: string2(),
8093
8094
  eventId: guid2(),
8094
8095
  ruleId: string2(),
8095
8096
  category: DetectionCategory,
@@ -8517,11 +8518,20 @@ var EventKind = _enum(["prompt", "response", "code_change", "tool_use"]).meta({
8517
8518
  var CAPTURE_EVENT_TYPES_SQL = EventKind.options.map((k) => `'${k}'`).join(",");
8518
8519
  var SIGHTING_TOKEN_PATTERN = /\[\[aka:fp:v[1-9][0-9]{0,15}\.[A-Za-z0-9_-]{43}\]\]/;
8519
8520
  var SIGHTING_TOKEN_ANCHORED = new RegExp(`^${SIGHTING_TOKEN_PATTERN.source}$`);
8521
+ var SIGHTING_ALIASES_MAX = 4;
8522
+ var SightingAliases = array(string2().regex(SIGHTING_TOKEN_ANCHORED)).min(1).max(SIGHTING_ALIASES_MAX);
8520
8523
  var CaptureSighting = object({
8521
8524
  token: string2().regex(SIGHTING_TOKEN_ANCHORED),
8525
+ aliases: SightingAliases.optional(),
8522
8526
  ruleId: string2().min(1),
8523
8527
  category: DetectionCategory
8524
8528
  }).meta({ id: "CaptureSighting" });
8529
+ var REVIEW_VALUES_MAX = 16;
8530
+ var REVIEW_VALUE_MAX_CHARS = 1024;
8531
+ var ReviewValue = object({
8532
+ ruleId: string2().min(1).max(256),
8533
+ value: string2().min(1).max(REVIEW_VALUE_MAX_CHARS)
8534
+ }).meta({ id: "ReviewValue" });
8525
8535
  var EventMetadata = object({
8526
8536
  sessionId: string2().optional(),
8527
8537
  repo: string2().optional(),
@@ -8629,7 +8639,14 @@ var EventMetadata = object({
8629
8639
  scanIncomplete: _enum(["timeout", "unavailable"]).optional(),
8630
8640
  // The sighting tokens in `content`, one entry per distinct token and rule.
8631
8641
  // Set only on a forwarded capture; the locally stored copy holds the values.
8632
- sightings: array(CaptureSighting).optional()
8642
+ sightings: array(CaptureSighting).optional(),
8643
+ // The length of the text this capture was cut from, when its content holds only the first
8644
+ // part of it. Absent when the content is the whole text.
8645
+ contentTruncatedFrom: number2().int().nonnegative().optional(),
8646
+ // The raw value of each finding in this capture, for review by the deployment. Set only on
8647
+ // a forwarded capture from a repository the organization's capture settings name; the
8648
+ // locally stored copy never carries it.
8649
+ reviewValues: array(ReviewValue).max(REVIEW_VALUES_MAX).optional()
8633
8650
  }).meta({ id: "EventMetadata" });
8634
8651
  var Event = object({
8635
8652
  id: guid2(),
@@ -9620,7 +9637,7 @@ var McpTool = object({
9620
9637
  signature: string2(),
9621
9638
  description: string2(),
9622
9639
  write: boolean2(),
9623
- /** Non-null string when tool is dangerous / blocked; null otherwise. */
9640
+ /** What makes the tool dangerous; null when nothing does. */
9624
9641
  risk: string2().nullable()
9625
9642
  }).meta({ id: "McpTool" });
9626
9643
  var AssetFindingRef = object({
@@ -9667,8 +9684,9 @@ var ProjectSensitiveData = object({ items: array(SensitiveDataClass) }).meta({ i
9667
9684
  var ListProjectsResponse = object({ items: array(ProjectSummary) }).meta({ id: "ListProjectsResponse" });
9668
9685
  var InventoryStats = object({
9669
9686
  /**
9670
- * Assets with a flag, plus projects with a finding in the last
9671
- * `PROJECT_FINDINGS_WINDOW_DAYS` days (drives the attention header chip).
9687
+ * Assets with a flag or with an `ATTENTION_TRUST_LEVELS` effective trust,
9688
+ * plus projects with a finding in the last `PROJECT_FINDINGS_WINDOW_DAYS`
9689
+ * days (drives the attention header chip). An asset counts once.
9672
9690
  */
9673
9691
  attention: number2().int().nonnegative(),
9674
9692
  byType: object({
@@ -9958,6 +9976,7 @@ var EgressCredentialRef = discriminatedUnion("kind", [
9958
9976
  object({
9959
9977
  kind: literal("literal"),
9960
9978
  token: string2().regex(SIGHTING_TOKEN_ANCHORED),
9979
+ aliases: SightingAliases.optional(),
9961
9980
  ruleId: string2().min(1).max(256)
9962
9981
  }).strict(),
9963
9982
  object({ kind: literal("variable"), variableName: VariableName.min(1) }).strict()
@@ -10190,6 +10209,10 @@ var EgressIngestHit = object({
10190
10209
  */
10191
10210
  credentialRefs: EgressCredentialRefs.optional()
10192
10211
  }).meta({ id: "EgressIngestHit" });
10212
+ var SUPERSEDED_PROJECT_KEYS_MAX = 4;
10213
+ var SupersededProjectKeys = array(
10214
+ string2().regex(/^[0-9a-f]{64}$/, "a superseded key must be a 64-character lowercase hex digest")
10215
+ ).max(SUPERSEDED_PROJECT_KEYS_MAX);
10193
10216
  var EgressIngestRequest = object({
10194
10217
  /**
10195
10218
  * Hash digest of the local `projectKey`, never the plaintext.
@@ -10202,6 +10225,7 @@ var EgressIngestRequest = object({
10202
10225
  * that still has the plaintext to not send.
10203
10226
  */
10204
10227
  projectKey: string2().regex(/^[0-9a-f]{64}$/, "projectKey must be a 64-character lowercase hex digest"),
10228
+ supersededProjectKeys: SupersededProjectKeys.optional(),
10205
10229
  /** Display name only — never keys reconciliation. */
10206
10230
  project: string2(),
10207
10231
  reconcile: EgressReconcile,
@@ -10311,6 +10335,10 @@ var DeviceCommand = object({
10311
10335
  expiresAt: printable(64).min(1)
10312
10336
  }).strict();
10313
10337
  var DeviceCommandPollResponse = object({ command: DeviceCommand.nullable() });
10338
+ var SessionHoldResponse = object({
10339
+ held: boolean2(),
10340
+ reason: printable(500).optional()
10341
+ });
10314
10342
  var DeviceCommandFailureReason = _enum(["scan_failed", "no_projects", "expired"]);
10315
10343
  var DeviceCommandAckBody = discriminatedUnion("outcome", [
10316
10344
  object({
@@ -10328,7 +10356,8 @@ var sightingKeyMaterial = string2().regex(SIGHTING_KEY_MATERIAL, "must be the ba
10328
10356
  var sightingKeyVersion = number2().int().min(1);
10329
10357
  var SightingKeyVersion = object({
10330
10358
  keyVersion: sightingKeyVersion,
10331
- key: sightingKeyMaterial
10359
+ key: sightingKeyMaterial,
10360
+ acceptedUntil: iso_exports.datetime({ offset: true }).optional().catch(void 0)
10332
10361
  });
10333
10362
  var SightingKeyResponse = object({
10334
10363
  keyVersion: sightingKeyVersion,
@@ -10345,7 +10374,8 @@ var SightingKeyResponse = object({
10345
10374
  var StoredSightingKeys = SightingKeyResponse.and(
10346
10375
  object({
10347
10376
  fetchedAtMs: number2().int().nonnegative(),
10348
- endpointFingerprint: string2().regex(/^[0-9a-f]{64}$/)
10377
+ endpointFingerprint: string2().regex(/^[0-9a-f]{64}$/),
10378
+ previousFirstSeenAtMs: record(string2().regex(/^[1-9][0-9]*$/), number2().int().nonnegative()).optional()
10349
10379
  })
10350
10380
  );
10351
10381
  var CREDENTIAL_SIGHTINGS_BATCH_MAX = 500;
@@ -10360,6 +10390,7 @@ var SightingProject = object({
10360
10390
  }).strict().meta({ id: "SightingProject" });
10361
10391
  var CredentialSighting = object({
10362
10392
  token: string2().regex(SIGHTING_TOKEN_ANCHORED),
10393
+ aliases: SightingAliases.optional(),
10363
10394
  ruleId: printable(256).min(1),
10364
10395
  category: literal("secret"),
10365
10396
  variableName: VariableName.min(1).optional(),
@@ -10370,7 +10401,9 @@ var CredentialSighting = object({
10370
10401
  }).strict().meta({ id: "CredentialSighting" });
10371
10402
  var CredentialSightingsRequest = object({
10372
10403
  sightings: array(CredentialSighting).min(1).max(CREDENTIAL_SIGHTINGS_BATCH_MAX),
10373
- scanId: uuid2().optional()
10404
+ scanId: uuid2().optional(),
10405
+ /** The earlier digests of the one project every sighting in the request names. */
10406
+ supersededProjectKeys: SupersededProjectKeys.optional()
10374
10407
  }).strict().meta({ id: "CredentialSightingsRequest" });
10375
10408
  var CredentialSightingsAck = object({
10376
10409
  accepted: number2().int().nonnegative()
@@ -10497,6 +10530,22 @@ var Policy = object({
10497
10530
  var RedactFallback = BuiltinPolicyId.extract(["monitor", "warn", "block"]).meta({
10498
10531
  id: "RedactFallback"
10499
10532
  });
10533
+ var ModelPolicy = object({
10534
+ mode: literal("allowlist"),
10535
+ approved: array(string2().min(1).max(512)).max(1e3)
10536
+ }).meta({ id: "ModelPolicy" });
10537
+ var TOOL_OUTPUT_FORWARD_MIN_CHARS = 2;
10538
+ var TOOL_OUTPUT_FORWARD_MAX_CHARS = 65536;
10539
+ var CAPTURE_REPOS_MAX = 1e3;
10540
+ var CaptureRepos = array(string2().min(1).max(512)).max(CAPTURE_REPOS_MAX);
10541
+ var CaptureSettings = object({
10542
+ toolOutput: object({
10543
+ maxChars: number2().int().min(TOOL_OUTPUT_FORWARD_MIN_CHARS).max(TOOL_OUTPUT_FORWARD_MAX_CHARS),
10544
+ repos: CaptureRepos.optional()
10545
+ }).optional(),
10546
+ reviewValueRepos: CaptureRepos.optional(),
10547
+ sessionHold: boolean2().optional()
10548
+ }).meta({ id: "CaptureSettings" });
10500
10549
  var PolicyBundle = object({
10501
10550
  version: string2(),
10502
10551
  policies: array(Policy),
@@ -10547,6 +10596,9 @@ var PolicyBundle = object({
10547
10596
  // control plane), so no name resolution stands between the decision and the
10548
10597
  // comparison.
10549
10598
  prohibitedModels: array(string2()).optional(),
10599
+ // Optional so an older backend, and an older on-disk cache, still parses; absent leaves every
10600
+ // model approved.
10601
+ modelPolicy: ModelPolicy.optional(),
10550
10602
  // What a resolved `redact` becomes on a field the host cannot rewrite, as
10551
10603
  // the ORGANIZATION would have it. Merged raise-only against the device's own
10552
10604
  // `WorkspaceSettings.redactFallback` (see strongerRedactFallback below), so
@@ -10557,6 +10609,9 @@ var PolicyBundle = object({
10557
10609
  // absent leaves the device's own setting in force, which is the behaviour
10558
10610
  // that predates the field and the safe direction to default.
10559
10611
  redactFallback: RedactFallback.optional(),
10612
+ // Optional so an older backend, and an older on-disk cache, still parses; absent sends what
10613
+ // the machine sent before the field existed.
10614
+ capture: CaptureSettings.optional(),
10560
10615
  customKeywords: array(string2()),
10561
10616
  fetchedAt: iso_exports.datetime()
10562
10617
  }).meta({ id: "PolicyBundle" });
@@ -10564,7 +10619,9 @@ var POLICY_BUNDLE_SHAPE_ID = [
10564
10619
  ...Object.keys(PolicyBundle.shape),
10565
10620
  ...Object.keys(Policy.shape).map((key) => `policies.${key}`),
10566
10621
  ...PolicyTarget.options.flatMap((member) => "shape" in member ? Object.keys(member.shape) : []).map((key) => `policies.target.${key}`),
10567
- ...Object.keys(ExceptionBundleEntry.shape).map((key) => `exceptions.${key}`)
10622
+ ...Object.keys(ExceptionBundleEntry.shape).map((key) => `exceptions.${key}`),
10623
+ ...Object.keys(ModelPolicy.shape).map((key) => `modelPolicy.${key}`),
10624
+ ...Object.keys(CaptureSettings.shape).map((key) => `capture.${key}`)
10568
10625
  ].sort().join(",");
10569
10626
  var OBSERVE_ONLY_CATEGORIES = ["config"];
10570
10627
  var ENFORCEABLE_CATEGORIES = DetectionCategory.options.filter((c) => !OBSERVE_ONLY_CATEGORIES.includes(c));
@@ -10925,7 +10982,7 @@ var DetectedWebAccounts = object({
10925
10982
  var DetectedWebAccountsEnvelope = DetectedWebAccounts.extend({ accounts: array(unknown()) });
10926
10983
 
10927
10984
  // ../../packages/schema/src/zod/local.ts
10928
- var WORKSPACE_SETTINGS_SPEC_VERSION = 10;
10985
+ var WORKSPACE_SETTINGS_SPEC_VERSION = 11;
10929
10986
  var RunMode = _enum(["standalone", "attached"]);
10930
10987
  var ControlPlaneConnection = object({
10931
10988
  endpoint: string2().min(1),
@@ -11027,6 +11084,15 @@ var BodyRetention = object({
11027
11084
  // candidate set that is already bounded by "delivered, or never owed".
11028
11085
  retainDays: number2().int().min(1).max(3650).default(BODY_RETENTION_DEFAULT_DAYS)
11029
11086
  }).meta({ id: "BodyRetention" });
11087
+ var MAX_PROTECTED_PATH_ENTRIES = 256;
11088
+ var MAX_PROTECTED_PATH_ENTRY_CHARS = 1024;
11089
+ var ProtectedPathEntry = string2().trim().min(1).max(MAX_PROTECTED_PATH_ENTRY_CHARS);
11090
+ var ProtectedPaths = array(unknown()).transform(
11091
+ (entries) => entries.flatMap((entry) => {
11092
+ const parsed = ProtectedPathEntry.safeParse(entry);
11093
+ return parsed.success ? [parsed.data] : [];
11094
+ }).slice(0, MAX_PROTECTED_PATH_ENTRIES)
11095
+ );
11030
11096
  var WorkspaceSettings = object({
11031
11097
  specVersion: number2().int().positive().default(WORKSPACE_SETTINGS_SPEC_VERSION),
11032
11098
  runMode: RunMode.default("standalone"),
@@ -11117,7 +11183,18 @@ var WorkspaceSettings = object({
11117
11183
  bodyRetention: BodyRetention.default({
11118
11184
  enabled: false,
11119
11185
  retainDays: BODY_RETENTION_DEFAULT_DAYS
11120
- })
11186
+ }),
11187
+ // Folders and file name globs whose files a tool call may not touch
11188
+ // unflagged: a Read, Grep, Glob or Bash naming one becomes a finding under
11189
+ // the command-risk pack's policy. Absent means none are protected, and
11190
+ // protectedPathsOf is the one reader.
11191
+ //
11192
+ // A bad entry is dropped on its own (see ProtectedPaths); `.catch(undefined)`
11193
+ // reads a value that is not a list at all as no list. A settings.json that
11194
+ // fails this schema reads as the unonboarded defaults, and the next save
11195
+ // writes those back over it, so a malformed value must not cost every other
11196
+ // setting. Not a ManagedSettingKey.
11197
+ protectedPaths: ProtectedPaths.optional().catch(void 0)
11121
11198
  });
11122
11199
 
11123
11200
  // ../../packages/schema/src/zod/agent-scope.ts
@@ -11281,6 +11358,9 @@ var ConfigInventoryAck = object({
11281
11358
  accepted: number2().int().nonnegative()
11282
11359
  });
11283
11360
 
11361
+ // ../../packages/schema/src/zod/credential-status.ts
11362
+ var CredentialStatus = _enum(["rotation_overdue", "exposed"]).meta({ id: "CredentialStatus" });
11363
+
11284
11364
  // ../../packages/schema/src/zod/registry.ts
11285
11365
  var Namespace = string2().regex(/^[a-z][a-z0-9-]*$/);
11286
11366
  var PackId = string2().regex(/^[a-z][a-z0-9-]*$/);
@@ -13621,7 +13701,7 @@ function scanText(text, ruleset2, context) {
13621
13701
  var SHIELDED_SOURCE = `${POINTER_TOKEN_PATTERN.source}|${SIGHTING_TOKEN_PATTERN.source}`;
13622
13702
 
13623
13703
  // ../../packages/detections/src/posture/config-posture.ts
13624
- var RULE_VERSION = "1";
13704
+ var RULE_VERSION = "2";
13625
13705
  var KNOWN_TOOLS = /* @__PURE__ */ new Set([
13626
13706
  "prettier",
13627
13707
  "eslint",
@@ -13635,6 +13715,13 @@ var KNOWN_TOOLS = /* @__PURE__ */ new Set([
13635
13715
  "npm",
13636
13716
  "pnpm",
13637
13717
  "yarn",
13718
+ "bun",
13719
+ "bunx",
13720
+ "deno",
13721
+ "python3",
13722
+ "uv",
13723
+ "bash",
13724
+ "sh",
13638
13725
  "make",
13639
13726
  "git",
13640
13727
  "jq",
@@ -13661,7 +13748,7 @@ var CONFIG_POSTURE_RULES = [
13661
13748
  name: "Unknown hook \u2014 not attributable to a plugin or known tool",
13662
13749
  category: "config",
13663
13750
  // medium, not high: with a deliberately tiny allowlist this v1 heuristic
13664
- // fires on ordinary interpreter hooks (python3 x.py) and compound commands
13751
+ // fires on ordinary hooks it cannot attribute, such as compound commands
13665
13752
  // (cd … && tool); 'high' is reserved for egress, which is genuinely
13666
13753
  // dangerous. Revisit when the known-hooks registry replaces the allowlist.
13667
13754
  severity: "medium",
@@ -13835,6 +13922,7 @@ function worstProbeMs(rule, now = wallClock, corroborate) {
13835
13922
  }
13836
13923
  var CPU_CORROBORATION_SHARE = 0.2;
13837
13924
  var CORROBORATION_FLOOR_MS = BUDGET_MS * CPU_CORROBORATION_SHARE;
13925
+ var MAX_GROWTH_RATIO = 3;
13838
13926
  function repeatTo(unit, length) {
13839
13927
  return unit.repeat(Math.ceil(length / unit.length)).slice(0, length);
13840
13928
  }
@@ -13871,6 +13959,8 @@ var GROWTH_CORPORA = [
13871
13959
  build: (length) => repeatTo(unit, length)
13872
13960
  }))
13873
13961
  ];
13962
+ var QUADRATIC_GROWTH = 4;
13963
+ var SAMPLED_GROWTH = MAX_GROWTH_RATIO ** 2 / QUADRATIC_GROWTH;
13874
13964
  function checkRuleTiming(rule, corroborate) {
13875
13965
  const { ms, probe, corroboratedMs } = worstProbeMs(rule, wallClock, corroborate);
13876
13966
  const work = corroboratedMs ?? 0;