securenow 8.20.0 → 8.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app-config.js CHANGED
@@ -56,6 +56,7 @@ const DEFAULT_CONFIG = Object.freeze({
56
56
  headers: {},
57
57
  logLevel: 'error',
58
58
  disableInstrumentations: [],
59
+ middlewareSpans: false,
59
60
  },
60
61
  runtime: {
61
62
  deploymentEnvironment: 'production',
@@ -112,6 +113,7 @@ const CONFIG_EXPLANATIONS = Object.freeze({
112
113
  'config.otel.headers': 'Optional OTLP headers. The SDK auto-adds x-securenow-app-key from app.key and Authorization from apiKey when missing.',
113
114
  'config.otel.logLevel': 'OpenTelemetry diagnostic log level: error, warn, info, debug, or none.',
114
115
  'config.otel.disableInstrumentations': 'Optional OTel instrumentation package names to disable.',
116
+ 'config.otel.middlewareSpans': 'If true, Express and Koa emit one span per middleware per request (off by default: high volume, not used by detections; route handlers and http.route are kept).',
115
117
  'config.runtime.deploymentEnvironment': 'deployment.environment resource attribute. Set this in the credentials file for production.',
116
118
  'config.runtime.noUuid': 'null means auto: true when app.key is present. Set true/false only for advanced routing needs.',
117
119
  'config.runtime.strict': 'If true, PM2/cluster workers exit when no app identity is resolvable.',
package/mcp/catalog.js CHANGED
@@ -780,7 +780,20 @@ const TOOLS = [
780
780
  notificationId: string('Notification id from the human action row.'),
781
781
  ip: string('IP address to mark as false positive.'),
782
782
  verificationId: string('The autonomous agent must pass the verificationId from securenow_agent_verify_ip for this IP (verdict benign or never_block).'),
783
- conditions: { type: 'array', items: { type: 'object', additionalProperties: true }, description: 'Restrictive false-positive conditions, scoped by app, rule, path, method, status, user agent or body.' },
783
+ conditions: {
784
+ type: 'array',
785
+ description: 'Restrictive exclusion conditions on the request (all must match unless matchMode is "any"). The app and rule scope come from the alert and ruleScope, not from a condition.',
786
+ items: {
787
+ type: 'object',
788
+ additionalProperties: false,
789
+ required: ['field', 'operator', 'value'],
790
+ properties: {
791
+ field: { type: 'string', enum: ['path', 'method', 'user_agent', 'status_code', 'request_body', 'request_headers'] },
792
+ operator: { type: 'string', enum: ['equals', 'not_equals', 'contains', 'not_contains', 'starts_with', 'ends_with', 'regex', 'in', 'not_in'], description: 'Text operators; in / not_in take comma-separated values.' },
793
+ value: { type: 'string', description: 'A string; comma-separated for in / not_in.' },
794
+ },
795
+ },
796
+ },
784
797
  matchMode: string('Condition match mode: all or any.'),
785
798
  createExclusion: boolean('Whether to create a restrictive exclusion rule.'),
786
799
  applyToExisting: boolean('Whether to apply to existing matching IP investigations.'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securenow",
3
- "version": "8.20.0",
3
+ "version": "8.20.1",
4
4
  "mcpName": "ai.securenow/securenow",
5
5
  "description": "OpenTelemetry instrumentation for Node.js, Next.js, and Nuxt - Send traces and logs to any OTLP-compatible backend",
6
6
  "type": "commonjs",
package/tracing.js CHANGED
@@ -420,6 +420,16 @@ for (const n of appConfig.listConfig('otel.disableInstrumentations')) {
420
420
  disabledMap[n] = { enabled: false };
421
421
  }
422
422
 
423
+ // Express and Koa make one span per middleware per request (body parsers, compression, cors...). On a busy app
424
+ // that is most of the telemetry (one store sent 16 of its 21 million spans an hour this way) and no detection
425
+ // reads it. Route handlers and http.route on the server span stay. config.otel.middlewareSpans=true keeps them.
426
+ const frameworkInstrumentationConfig = appConfig.boolConfig('otel.middlewareSpans', false)
427
+ ? {}
428
+ : {
429
+ '@opentelemetry/instrumentation-express': { ignoreLayersType: ['middleware'] },
430
+ '@opentelemetry/instrumentation-koa': { ignoreLayersType: ['middleware'] },
431
+ };
432
+
423
433
  // -------- Body Capture Configuration --------
424
434
  // Opt-out defaults: set config.capture.body=false to disable.
425
435
  const captureBody = appConfig.boolConfig('capture.body', true);
@@ -754,7 +764,8 @@ const sdk = new NodeSDK({
754
764
  instrumentations: [
755
765
  httpInstrumentation,
756
766
  ...(disabledMap['@opentelemetry/instrumentation-mongodb'] ? [] : [new MongoDBInstrumentation()]),
757
- ...getNodeAutoInstrumentations({
767
+ ...getNodeAutoInstrumentations({
768
+ ...frameworkInstrumentationConfig,
758
769
  ...disabledMap,
759
770
  '@opentelemetry/instrumentation-http': { enabled: false },
760
771
  '@opentelemetry/instrumentation-mongodb': { enabled: false },