@nextera.one/axis-server-sdk 2.2.5 → 2.2.7

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.
@@ -104,8 +104,9 @@ var require_access_profile_resolver_sensor = __commonJS({
104
104
  this.name = "AccessProfileResolverSensor";
105
105
  this.order = sensor_bands_1.BAND.IDENTITY + 10;
106
106
  }
107
- supports() {
108
- return true;
107
+ async supports(input) {
108
+ void input;
109
+ return { action: "ALLOW" };
109
110
  }
110
111
  async run(input) {
111
112
  const hasCapsule = !!input.metadata?.capsuleId;
@@ -317,8 +318,12 @@ var require_body_budget_sensor = __commonJS({
317
318
  this.name = "BodyBudgetSensor";
318
319
  this.order = sensor_bands_1.BAND.CONTENT + 10;
319
320
  }
320
- supports(input) {
321
- return !!input.peek && input.peek.length >= 8;
321
+ async supports(input) {
322
+ return !!input.peek && input.peek.length >= 8 ? { action: "ALLOW" } : {
323
+ action: "DENY",
324
+ code: "SENSOR_NOT_APPLICABLE",
325
+ reason: "Insufficient peek data to read headers"
326
+ };
322
327
  }
323
328
  async run(input) {
324
329
  const { peek } = input;
@@ -1645,6 +1650,7 @@ var init_cce_types = __esm({
1645
1650
  CAPSULE_NOT_YET_VALID: "CCE_CAPSULE_NOT_YET_VALID",
1646
1651
  CAPSULE_REVOKED: "CCE_CAPSULE_REVOKED",
1647
1652
  CAPSULE_CONSUMED: "CCE_CAPSULE_CONSUMED",
1653
+ CAPSULE_NOT_VERIFIED: "CCE_CAPSULE_NOT_VERIFIED",
1648
1654
  // Binding errors
1649
1655
  AUDIENCE_MISMATCH: "CCE_AUDIENCE_MISMATCH",
1650
1656
  INTENT_MISMATCH: "CCE_INTENT_MISMATCH",
@@ -3091,8 +3097,11 @@ var init_intent_router = __esm({
3091
3097
  return this.intentRateLimits.get(intent);
3092
3098
  }
3093
3099
  async emitIntentObservers(bindings, context) {
3094
- if (!this.observerDispatcher || bindings.length === 0) return;
3095
- await this.observerDispatcher.dispatch(bindings, context);
3100
+ if (!this.observerDispatcher) return;
3101
+ await this.observerDispatcher.dispatch(
3102
+ bindings.length > 0 ? bindings : void 0,
3103
+ context
3104
+ );
3096
3105
  }
3097
3106
  async runIntentSensors(sensorBindings, intent, frame, stage, extras) {
3098
3107
  for (const binding of sensorBindings) {
@@ -8619,9 +8628,37 @@ var init_axis_sensor_chain_service = __esm({
8619
8628
  );
8620
8629
  }
8621
8630
  async evaluateSensors(sensors, input, baseDecision) {
8622
- const relevantSensors = sensors.filter(
8623
- (s) => !s.supports || s.supports(input)
8624
- );
8631
+ const relevantSensors = [];
8632
+ for (const sensor of sensors) {
8633
+ if (!sensor.supports) {
8634
+ relevantSensors.push(sensor);
8635
+ continue;
8636
+ }
8637
+ try {
8638
+ const supportsDecision = normalizeSensorDecision(
8639
+ await sensor.supports(input)
8640
+ );
8641
+ if (supportsDecision.allow) {
8642
+ relevantSensors.push(sensor);
8643
+ }
8644
+ } catch (error) {
8645
+ console.error(
8646
+ `[AXIS][SENSOR] ${sensor.name} supports() failed:`,
8647
+ error
8648
+ );
8649
+ const obs = input.metadata?.observation;
8650
+ if (obs) {
8651
+ recordSensor(obs, sensor.name, false, 100, 0, [
8652
+ `sensor_support_error:${sensor.name}`
8653
+ ]);
8654
+ }
8655
+ return {
8656
+ allow: false,
8657
+ riskScore: 100,
8658
+ reasons: [`sensor_support_error:${sensor.name}`]
8659
+ };
8660
+ }
8661
+ }
8625
8662
  const normalizedBase = baseDecision ? normalizeSensorDecision(baseDecision) : void 0;
8626
8663
  let riskScore = normalizedBase?.riskScore ?? 0;
8627
8664
  const reasons = normalizedBase?.reasons ? [...normalizedBase.reasons] : [];
@@ -10963,8 +11000,9 @@ var require_capability_enforcement_sensor = __commonJS({
10963
11000
  this.name = "CapabilityEnforcementSensor";
10964
11001
  this.order = sensor_bands_1.BAND.POLICY + 10;
10965
11002
  }
10966
- supports(input) {
10967
- return !!input.intent;
11003
+ async supports(input) {
11004
+ void input;
11005
+ return { action: "ALLOW" };
10968
11006
  }
10969
11007
  async run(input) {
10970
11008
  const { intent, packet } = input;
@@ -11030,8 +11068,12 @@ var require_chunk_hash_sensor = __commonJS({
11030
11068
  this.name = "ChunkHashSensor";
11031
11069
  this.order = sensor_bands_1.BAND.CONTENT + 50;
11032
11070
  }
11033
- supports(input) {
11034
- return input.intent === "file.chunk";
11071
+ async supports(input) {
11072
+ return input.intent === "file.chunk" ? { action: "ALLOW" } : {
11073
+ action: "DENY",
11074
+ code: "SENSOR_NOT_APPLICABLE",
11075
+ reason: "Only file.chunk intent is supported"
11076
+ };
11035
11077
  }
11036
11078
  async run(input) {
11037
11079
  const headerTLVs = input.headerTLVs;
@@ -11221,8 +11263,8 @@ var require_execution_timeout_sensor = __commonJS({
11221
11263
  this.name = "ExecutionTimeoutSensor";
11222
11264
  this.order = sensor_bands_1.BAND.BUSINESS + 10;
11223
11265
  }
11224
- supports(input) {
11225
- return !!input.intent;
11266
+ async supports() {
11267
+ return Promise.resolve({ action: "ALLOW" });
11226
11268
  }
11227
11269
  async run(input) {
11228
11270
  const { intent, context } = input;
@@ -11275,8 +11317,12 @@ var require_frame_budget_sensor = __commonJS({
11275
11317
  this.name = "FrameBudgetSensor";
11276
11318
  this.order = sensor_bands_1.BAND.WIRE + 20;
11277
11319
  }
11278
- supports(input) {
11279
- return typeof input.contentLength === "number";
11320
+ async supports(input) {
11321
+ return typeof input.contentLength === "number" ? { action: "ALLOW" } : {
11322
+ action: "DENY",
11323
+ code: "SENSOR_NOT_APPLICABLE",
11324
+ reason: "Content-Length not available"
11325
+ };
11280
11326
  }
11281
11327
  async run(input) {
11282
11328
  const maxBytes = Number(process.env["AXIS_MAX_FRAME_SIZE"]) || 50 * 1024 * 1024;
@@ -11321,8 +11367,12 @@ var require_frame_header_sanity_sensor = __commonJS({
11321
11367
  this.name = "FrameHeaderSanitySensor";
11322
11368
  this.order = sensor_bands_1.BAND.WIRE + 30;
11323
11369
  }
11324
- supports(input) {
11325
- return !!input.peek && input.peek.length >= 7;
11370
+ async supports(input) {
11371
+ return !!input.peek && input.peek.length >= 7 ? { action: "ALLOW" } : {
11372
+ action: "DENY",
11373
+ code: "SENSOR_NOT_APPLICABLE",
11374
+ reason: "Insufficient peek data for header sanity checks"
11375
+ };
11326
11376
  }
11327
11377
  async run(input) {
11328
11378
  const peek = input.peek;
@@ -11388,8 +11438,12 @@ var require_header_tlv_limit_sensor = __commonJS({
11388
11438
  this.order = sensor_bands_1.BAND.CONTENT + 0;
11389
11439
  this.MAX_TLVS = 64;
11390
11440
  }
11391
- supports(input) {
11392
- return !!input.headerTLVs || !!input.packet;
11441
+ async supports(input) {
11442
+ return !!input.headerTLVs || !!input.packet ? { action: "ALLOW" } : {
11443
+ action: "DENY",
11444
+ code: "SENSOR_NOT_APPLICABLE",
11445
+ reason: "Header TLV context is not available"
11446
+ };
11393
11447
  }
11394
11448
  async run(input) {
11395
11449
  if (input.headerTLVs && input.headerTLVs.size > this.MAX_TLVS) {
@@ -11445,8 +11499,12 @@ var require_intent_allowlist_sensor = __commonJS({
11445
11499
  this.name = "IntentAllowlistSensor";
11446
11500
  this.order = sensor_bands_1.BAND.IDENTITY + 20;
11447
11501
  }
11448
- supports(input) {
11449
- return !!input.intent;
11502
+ async supports(input) {
11503
+ return !!input.intent ? { action: "ALLOW" } : {
11504
+ action: "DENY",
11505
+ code: "SENSOR_NOT_APPLICABLE",
11506
+ reason: "Intent is not available"
11507
+ };
11450
11508
  }
11451
11509
  async run(input) {
11452
11510
  const profile = input.metadata?.profile || "PUBLIC";
@@ -11496,8 +11554,8 @@ var require_intent_registry_sensor = __commonJS({
11496
11554
  this.name = "IntentRegistrySensor";
11497
11555
  this.order = sensor_bands_1.BAND.IDENTITY + 25;
11498
11556
  }
11499
- supports(input) {
11500
- return !!input.intent;
11557
+ async supports() {
11558
+ return Promise.resolve({ action: "ALLOW" });
11501
11559
  }
11502
11560
  async run(input) {
11503
11561
  const intent = input.intent;
@@ -11546,8 +11604,12 @@ var require_law_evaluation_sensor = __commonJS({
11546
11604
  this.name = "LawEvaluationSensor";
11547
11605
  this.order = sensor_bands_1.BAND.POLICY + 5;
11548
11606
  }
11549
- supports(input) {
11550
- return !!this.options.evaluator && !!input.intent;
11607
+ async supports(input) {
11608
+ return !!this.options.evaluator && !!input.intent ? { action: "ALLOW" } : {
11609
+ action: "DENY",
11610
+ code: "SENSOR_NOT_APPLICABLE",
11611
+ reason: "Law evaluator or intent missing"
11612
+ };
11551
11613
  }
11552
11614
  async run(input) {
11553
11615
  const evaluator = this.options.evaluator;
@@ -11613,7 +11675,9 @@ var require_law_evaluation_sensor = __commonJS({
11613
11675
  return {
11614
11676
  action: "FLAG",
11615
11677
  scoreDelta: 25,
11616
- reasons: reasons.length > 0 ? reasons : ["Execution is conditionally permitted pending additional requirements"],
11678
+ reasons: reasons.length > 0 ? reasons : [
11679
+ "Execution is conditionally permitted pending additional requirements"
11680
+ ],
11617
11681
  meta: result
11618
11682
  };
11619
11683
  }
@@ -12004,8 +12068,11 @@ var require_proof_presence_sensor = __commonJS({
12004
12068
  this.name = "ProofPresenceSensor";
12005
12069
  this.order = sensor_bands_1.BAND.IDENTITY + 30;
12006
12070
  }
12007
- supports(input) {
12008
- return !!input.profile && !!input.visibility;
12071
+ async supports(input) {
12072
+ if (!!input.profile && !!input.visibility) {
12073
+ return { action: "ALLOW" };
12074
+ }
12075
+ return { action: "DENY", code: "MISSING_REQUIRED_FIELDS" };
12009
12076
  }
12010
12077
  async run(input) {
12011
12078
  const validatedInput = axis_schemas_1.ProofPresenceInputZ.safeParse(input);
@@ -12299,8 +12366,8 @@ var require_receipt_policy_sensor = __commonJS({
12299
12366
  this.name = "ReceiptPolicySensor";
12300
12367
  this.order = sensor_bands_1.BAND.BUSINESS + 20;
12301
12368
  }
12302
- supports() {
12303
- return true;
12369
+ async supports() {
12370
+ return { action: "ALLOW" };
12304
12371
  }
12305
12372
  async run() {
12306
12373
  return { action: "ALLOW" };
@@ -12460,8 +12527,11 @@ var require_schema_validation_sensor = __commonJS({
12460
12527
  this.name = "SchemaValidationSensor";
12461
12528
  this.order = sensor_bands_1.BAND.CONTENT + 35;
12462
12529
  }
12463
- supports(input) {
12464
- return !!input.metadata?.schema;
12530
+ async supports(input) {
12531
+ if (input.metadata?.schema) {
12532
+ return { action: "ALLOW" };
12533
+ }
12534
+ return { action: "DENY", code: "SCHEMA_NOT_CONFIGURED" };
12465
12535
  }
12466
12536
  async run(input) {
12467
12537
  const schema = input.metadata?.schema;
@@ -12586,8 +12656,8 @@ var require_stream_scope_sensor = __commonJS({
12586
12656
  this.name = "StreamScopeSensor";
12587
12657
  this.order = sensor_bands_1.BAND.BUSINESS + 0;
12588
12658
  }
12589
- supports() {
12590
- return true;
12659
+ async supports() {
12660
+ return { action: "ALLOW" };
12591
12661
  }
12592
12662
  async run() {
12593
12663
  return { action: "ALLOW" };
@@ -12625,8 +12695,12 @@ var require_tickauth_sensor = __commonJS({
12625
12695
  this.matchIntent = options.matchIntent ?? true;
12626
12696
  this.acceptTypes = options.acceptTypes?.length ? new Set(options.acceptTypes) : null;
12627
12697
  }
12628
- supports(input) {
12629
- return !!(input.metadata?.capsule || input.metadata?.tickauthCapsule || input.metadata?.cceEnvelope?.capsule);
12698
+ async supports(input) {
12699
+ return !!(input.metadata?.capsule || input.metadata?.tickauthCapsule || input.metadata?.cceEnvelope?.capsule) ? { action: "ALLOW" } : {
12700
+ action: "DENY",
12701
+ code: "SENSOR_NOT_APPLICABLE",
12702
+ reason: "TickAuth capsule not found"
12703
+ };
12630
12704
  }
12631
12705
  async run(input) {
12632
12706
  const capsule = input.metadata?.capsule ?? input.metadata?.tickauthCapsule ?? input.metadata?.cceEnvelope?.capsule;
@@ -12732,8 +12806,12 @@ var require_tlv_parse_sensor = __commonJS({
12732
12806
  this.name = "TLVParseSensor";
12733
12807
  this.order = sensor_bands_1.BAND.CONTENT + 20;
12734
12808
  }
12735
- supports(input) {
12736
- return !!input.packet;
12809
+ async supports(input) {
12810
+ return !!input.packet ? { action: "ALLOW" } : {
12811
+ action: "DENY",
12812
+ code: "SENSOR_NOT_APPLICABLE",
12813
+ reason: "Packet is not available"
12814
+ };
12737
12815
  }
12738
12816
  async run(input) {
12739
12817
  const packet = input.packet;
@@ -12865,9 +12943,13 @@ var require_tps_sensor = __commonJS({
12865
12943
  this.maxDriftMs = options.maxDriftMs ?? 3e4;
12866
12944
  this.resolver = options.resolver ?? parseINotation;
12867
12945
  }
12868
- supports(input) {
12946
+ async supports(input) {
12869
12947
  const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
12870
- return typeof tps === "string" && tps.length > 0;
12948
+ return typeof tps === "string" && tps.length > 0 ? { action: "ALLOW" } : {
12949
+ action: "DENY",
12950
+ code: "SENSOR_NOT_APPLICABLE",
12951
+ reason: "TPS coordinate not available"
12952
+ };
12871
12953
  }
12872
12954
  async run(input) {
12873
12955
  const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
@@ -12933,8 +13015,12 @@ var require_varint_hardening_sensor = __commonJS({
12933
13015
  this.order = sensor_bands_1.BAND.WIRE + 35;
12934
13016
  this.MAX_VARINT_BYTES = 5;
12935
13017
  }
12936
- supports(input) {
12937
- return !!input.peek && input.peek.length >= 7;
13018
+ async supports(input) {
13019
+ return !!input.peek && input.peek.length >= 7 ? { action: "ALLOW" } : {
13020
+ action: "DENY",
13021
+ code: "SENSOR_NOT_APPLICABLE",
13022
+ reason: "Insufficient peek data for varint hardening"
13023
+ };
12938
13024
  }
12939
13025
  async run(input) {
12940
13026
  const peek = input.peek;