dd-trace 3.21.0 → 3.22.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.
Files changed (92) hide show
  1. package/LICENSE-3rdparty.csv +1 -0
  2. package/package.json +3 -2
  3. package/packages/datadog-esbuild/index.js +13 -1
  4. package/packages/datadog-instrumentations/src/cucumber.js +13 -0
  5. package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -0
  6. package/packages/datadog-instrumentations/src/http/client.js +2 -1
  7. package/packages/datadog-instrumentations/src/http/server.js +14 -0
  8. package/packages/datadog-instrumentations/src/http2/client.js +4 -0
  9. package/packages/datadog-instrumentations/src/pg.js +14 -11
  10. package/packages/datadog-instrumentations/src/playwright.js +1 -1
  11. package/packages/datadog-instrumentations/src/sequelize.js +51 -0
  12. package/packages/datadog-plugin-amqp10/src/consumer.js +1 -3
  13. package/packages/datadog-plugin-amqp10/src/producer.js +1 -3
  14. package/packages/datadog-plugin-amqplib/src/client.js +4 -3
  15. package/packages/datadog-plugin-amqplib/src/consumer.js +1 -3
  16. package/packages/datadog-plugin-amqplib/src/producer.js +1 -3
  17. package/packages/datadog-plugin-cucumber/src/index.js +2 -2
  18. package/packages/datadog-plugin-cypress/src/plugin.js +150 -30
  19. package/packages/datadog-plugin-cypress/src/support.js +6 -3
  20. package/packages/datadog-plugin-google-cloud-pubsub/src/client.js +4 -3
  21. package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +1 -3
  22. package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +1 -3
  23. package/packages/datadog-plugin-http/src/client.js +70 -68
  24. package/packages/datadog-plugin-http2/src/client.js +50 -47
  25. package/packages/datadog-plugin-jest/src/index.js +5 -4
  26. package/packages/datadog-plugin-kafkajs/src/consumer.js +1 -4
  27. package/packages/datadog-plugin-kafkajs/src/producer.js +1 -3
  28. package/packages/datadog-plugin-memcached/src/index.js +2 -3
  29. package/packages/datadog-plugin-mocha/src/index.js +4 -2
  30. package/packages/datadog-plugin-pg/src/index.js +1 -1
  31. package/packages/datadog-plugin-redis/src/index.js +2 -13
  32. package/packages/datadog-plugin-rhea/src/consumer.js +1 -3
  33. package/packages/datadog-plugin-rhea/src/producer.js +1 -5
  34. package/packages/datadog-plugin-router/src/index.js +12 -1
  35. package/packages/dd-trace/src/appsec/blocked_templates.js +2 -101
  36. package/packages/dd-trace/src/appsec/blocking.js +60 -11
  37. package/packages/dd-trace/src/appsec/channels.js +3 -2
  38. package/packages/dd-trace/src/appsec/iast/analyzers/analyzers.js +7 -5
  39. package/packages/dd-trace/src/appsec/iast/analyzers/index.js +3 -0
  40. package/packages/dd-trace/src/appsec/iast/analyzers/insecure-cookie-analyzer.js +31 -0
  41. package/packages/dd-trace/src/appsec/iast/analyzers/path-traversal-analyzer.js +4 -0
  42. package/packages/dd-trace/src/appsec/iast/analyzers/set-cookies-header-interceptor.js +47 -0
  43. package/packages/dd-trace/src/appsec/iast/analyzers/sql-injection-analyzer.js +30 -5
  44. package/packages/dd-trace/src/appsec/iast/analyzers/ssrf-analyzer.js +26 -0
  45. package/packages/dd-trace/src/appsec/iast/analyzers/vulnerability-analyzer.js +35 -3
  46. package/packages/dd-trace/src/appsec/iast/path-line.js +14 -7
  47. package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +19 -4
  48. package/packages/dd-trace/src/appsec/iast/telemetry/logs.js +1 -1
  49. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +25 -2
  50. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/url-sensitive-analyzer.js +49 -0
  51. package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +3 -1
  52. package/packages/dd-trace/src/appsec/iast/vulnerabilities.js +7 -5
  53. package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +0 -33
  54. package/packages/dd-trace/src/appsec/recommended.json +45 -46
  55. package/packages/dd-trace/src/appsec/remote_config/capabilities.js +3 -1
  56. package/packages/dd-trace/src/appsec/remote_config/index.js +4 -0
  57. package/packages/dd-trace/src/appsec/rule_manager.js +49 -6
  58. package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +2 -7
  59. package/packages/dd-trace/src/ci-visibility/exporters/agentless/index.js +1 -1
  60. package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +1 -6
  61. package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +10 -4
  62. package/packages/dd-trace/src/config.js +36 -5
  63. package/packages/dd-trace/src/encode/coverage-ci-visibility.js +11 -3
  64. package/packages/dd-trace/src/exporters/common/util.js +9 -0
  65. package/packages/dd-trace/src/exporters/common/writer.js +3 -2
  66. package/packages/dd-trace/src/plugin_manager.js +2 -0
  67. package/packages/dd-trace/src/plugins/cache.js +7 -0
  68. package/packages/dd-trace/src/plugins/ci_plugin.js +2 -0
  69. package/packages/dd-trace/src/plugins/client.js +3 -2
  70. package/packages/dd-trace/src/plugins/consumer.js +14 -2
  71. package/packages/dd-trace/src/plugins/database.js +2 -2
  72. package/packages/dd-trace/src/plugins/inbound.js +7 -0
  73. package/packages/dd-trace/src/plugins/{outgoing.js → outbound.js} +2 -2
  74. package/packages/dd-trace/src/plugins/producer.js +19 -2
  75. package/packages/dd-trace/src/plugins/server.js +2 -2
  76. package/packages/dd-trace/src/plugins/storage.js +2 -0
  77. package/packages/dd-trace/src/plugins/tracing.js +11 -0
  78. package/packages/dd-trace/src/plugins/util/ci.js +1 -1
  79. package/packages/dd-trace/src/profiling/config.js +4 -2
  80. package/packages/dd-trace/src/service-naming/index.js +30 -0
  81. package/packages/dd-trace/src/service-naming/schemas/definition.js +24 -0
  82. package/packages/dd-trace/src/service-naming/schemas/index.js +6 -0
  83. package/packages/dd-trace/src/service-naming/schemas/util.js +5 -0
  84. package/packages/dd-trace/src/service-naming/schemas/v0/index.js +5 -0
  85. package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +64 -0
  86. package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +33 -0
  87. package/packages/dd-trace/src/service-naming/schemas/v1/index.js +5 -0
  88. package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +52 -0
  89. package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +21 -0
  90. package/packages/dd-trace/src/telemetry/index.js +5 -6
  91. package/packages/dd-trace/src/telemetry/send-data.js +17 -5
  92. package/packages/dd-trace/src/plugins/incoming.js +0 -7
@@ -11,38 +11,6 @@ let tracer
11
11
  let resetVulnerabilityCacheTimer
12
12
  let deduplicationEnabled = true
13
13
 
14
- function createVulnerability (type, evidence, spanId, location) {
15
- if (type && evidence) {
16
- const _spanId = spanId || 0
17
- return {
18
- type,
19
- evidence,
20
- location: {
21
- spanId: _spanId,
22
- ...location
23
- },
24
- hash: createHash(type, location)
25
- }
26
- }
27
- return null
28
- }
29
-
30
- function createHash (type, location) {
31
- let hashSource
32
- if (location) {
33
- hashSource = `${type}:${location.path}:${location.line}`
34
- } else {
35
- hashSource = type
36
- }
37
- let hash = 0
38
- let offset = 0
39
- const size = hashSource.length
40
- for (let i = 0; i < size; i++) {
41
- hash = ((hash << 5) - hash) + hashSource.charCodeAt(offset++)
42
- }
43
- return hash
44
- }
45
-
46
14
  function addVulnerability (iastContext, vulnerability) {
47
15
  if (vulnerability && vulnerability.evidence && vulnerability.type &&
48
16
  vulnerability.location) {
@@ -133,7 +101,6 @@ function stop () {
133
101
  }
134
102
 
135
103
  module.exports = {
136
- createVulnerability,
137
104
  addVulnerability,
138
105
  sendVulnerabilities,
139
106
  clearCache,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "2.2",
3
3
  "metadata": {
4
- "rules_version": "1.7.0"
4
+ "rules_version": "1.7.1"
5
5
  },
6
6
  "rules": [
7
7
  {
@@ -4390,7 +4390,7 @@
4390
4390
  "id": "dog-913-001",
4391
4391
  "name": "BurpCollaborator OOB domain",
4392
4392
  "tags": {
4393
- "type": "security_scanner",
4393
+ "type": "attack_tool",
4394
4394
  "category": "attack_attempt",
4395
4395
  "tool_name": "BurpCollaborator",
4396
4396
  "confidence": "1"
@@ -4604,7 +4604,7 @@
4604
4604
  "id": "dog-913-007",
4605
4605
  "name": "Interact.sh OOB domain",
4606
4606
  "tags": {
4607
- "type": "security_scanner",
4607
+ "type": "attack_tool",
4608
4608
  "category": "attack_attempt",
4609
4609
  "tool_name": "interact.sh",
4610
4610
  "confidence": "1"
@@ -5689,7 +5689,7 @@
5689
5689
  "id": "ua0-600-0xx",
5690
5690
  "name": "Joomla exploitation tool",
5691
5691
  "tags": {
5692
- "type": "security_scanner",
5692
+ "type": "attack_tool",
5693
5693
  "category": "attack_attempt",
5694
5694
  "tool_name": "Joomla exploitation tool",
5695
5695
  "confidence": "1"
@@ -5716,7 +5716,7 @@
5716
5716
  "id": "ua0-600-10x",
5717
5717
  "name": "Nessus",
5718
5718
  "tags": {
5719
- "type": "security_scanner",
5719
+ "type": "attack_tool",
5720
5720
  "category": "attack_attempt",
5721
5721
  "tool_name": "Nessus",
5722
5722
  "confidence": "1"
@@ -5743,7 +5743,7 @@
5743
5743
  "id": "ua0-600-12x",
5744
5744
  "name": "Arachni",
5745
5745
  "tags": {
5746
- "type": "security_scanner",
5746
+ "type": "attack_tool",
5747
5747
  "category": "attack_attempt",
5748
5748
  "tool_name": "Arachni",
5749
5749
  "confidence": "1"
@@ -5770,7 +5770,7 @@
5770
5770
  "id": "ua0-600-13x",
5771
5771
  "name": "Jorgee",
5772
5772
  "tags": {
5773
- "type": "security_scanner",
5773
+ "type": "attack_tool",
5774
5774
  "category": "attack_attempt",
5775
5775
  "tool_name": "Jorgee",
5776
5776
  "confidence": "1"
@@ -5824,7 +5824,7 @@
5824
5824
  "id": "ua0-600-15x",
5825
5825
  "name": "Metis",
5826
5826
  "tags": {
5827
- "type": "security_scanner",
5827
+ "type": "attack_tool",
5828
5828
  "category": "attack_attempt",
5829
5829
  "tool_name": "Metis",
5830
5830
  "confidence": "1"
@@ -5851,7 +5851,7 @@
5851
5851
  "id": "ua0-600-16x",
5852
5852
  "name": "SQL power injector",
5853
5853
  "tags": {
5854
- "type": "security_scanner",
5854
+ "type": "attack_tool",
5855
5855
  "category": "attack_attempt",
5856
5856
  "tool_name": "SQLPowerInjector",
5857
5857
  "confidence": "1"
@@ -5878,7 +5878,7 @@
5878
5878
  "id": "ua0-600-18x",
5879
5879
  "name": "N-Stealth",
5880
5880
  "tags": {
5881
- "type": "security_scanner",
5881
+ "type": "attack_tool",
5882
5882
  "category": "attack_attempt",
5883
5883
  "tool_name": "N-Stealth",
5884
5884
  "confidence": "1"
@@ -5905,7 +5905,7 @@
5905
5905
  "id": "ua0-600-19x",
5906
5906
  "name": "Brutus",
5907
5907
  "tags": {
5908
- "type": "security_scanner",
5908
+ "type": "attack_tool",
5909
5909
  "category": "attack_attempt",
5910
5910
  "tool_name": "Brutus",
5911
5911
  "confidence": "1"
@@ -5934,7 +5934,6 @@
5934
5934
  "tags": {
5935
5935
  "type": "security_scanner",
5936
5936
  "category": "attack_attempt",
5937
- "tool_name": "Shellshock",
5938
5937
  "confidence": "1"
5939
5938
  },
5940
5939
  "conditions": [
@@ -5986,7 +5985,7 @@
5986
5985
  "id": "ua0-600-22x",
5987
5986
  "name": "JAASCois",
5988
5987
  "tags": {
5989
- "type": "security_scanner",
5988
+ "type": "attack_tool",
5990
5989
  "category": "attack_attempt",
5991
5990
  "tool_name": "JAASCois",
5992
5991
  "confidence": "1"
@@ -6013,7 +6012,7 @@
6013
6012
  "id": "ua0-600-26x",
6014
6013
  "name": "Nsauditor",
6015
6014
  "tags": {
6016
- "type": "security_scanner",
6015
+ "type": "attack_tool",
6017
6016
  "category": "attack_attempt",
6018
6017
  "tool_name": "Nsauditor",
6019
6018
  "confidence": "1"
@@ -6040,7 +6039,7 @@
6040
6039
  "id": "ua0-600-27x",
6041
6040
  "name": "Paros",
6042
6041
  "tags": {
6043
- "type": "security_scanner",
6042
+ "type": "attack_tool",
6044
6043
  "category": "attack_attempt",
6045
6044
  "tool_name": "Paros",
6046
6045
  "confidence": "1"
@@ -6067,7 +6066,7 @@
6067
6066
  "id": "ua0-600-28x",
6068
6067
  "name": "DirBuster",
6069
6068
  "tags": {
6070
- "type": "security_scanner",
6069
+ "type": "attack_tool",
6071
6070
  "category": "attack_attempt",
6072
6071
  "tool_name": "DirBuster",
6073
6072
  "confidence": "1"
@@ -6094,7 +6093,7 @@
6094
6093
  "id": "ua0-600-29x",
6095
6094
  "name": "Pangolin",
6096
6095
  "tags": {
6097
- "type": "security_scanner",
6096
+ "type": "attack_tool",
6098
6097
  "category": "attack_attempt",
6099
6098
  "tool_name": "Pangolin",
6100
6099
  "confidence": "1"
@@ -6148,7 +6147,7 @@
6148
6147
  "id": "ua0-600-30x",
6149
6148
  "name": "SQLNinja",
6150
6149
  "tags": {
6151
- "type": "security_scanner",
6150
+ "type": "attack_tool",
6152
6151
  "category": "attack_attempt",
6153
6152
  "tool_name": "SQLNinja",
6154
6153
  "confidence": "1"
@@ -6175,7 +6174,7 @@
6175
6174
  "id": "ua0-600-31x",
6176
6175
  "name": "Nikto",
6177
6176
  "tags": {
6178
- "type": "security_scanner",
6177
+ "type": "attack_tool",
6179
6178
  "category": "attack_attempt",
6180
6179
  "tool_name": "Nikto",
6181
6180
  "confidence": "1"
@@ -6202,7 +6201,7 @@
6202
6201
  "id": "ua0-600-33x",
6203
6202
  "name": "BlackWidow",
6204
6203
  "tags": {
6205
- "type": "security_scanner",
6204
+ "type": "attack_tool",
6206
6205
  "category": "attack_attempt",
6207
6206
  "tool_name": "BlackWidow",
6208
6207
  "confidence": "1"
@@ -6229,7 +6228,7 @@
6229
6228
  "id": "ua0-600-34x",
6230
6229
  "name": "Grendel-Scan",
6231
6230
  "tags": {
6232
- "type": "security_scanner",
6231
+ "type": "attack_tool",
6233
6232
  "category": "attack_attempt",
6234
6233
  "tool_name": "Grendel-Scan",
6235
6234
  "confidence": "1"
@@ -6256,7 +6255,7 @@
6256
6255
  "id": "ua0-600-35x",
6257
6256
  "name": "Havij",
6258
6257
  "tags": {
6259
- "type": "security_scanner",
6258
+ "type": "attack_tool",
6260
6259
  "category": "attack_attempt",
6261
6260
  "tool_name": "Havij",
6262
6261
  "confidence": "1"
@@ -6283,7 +6282,7 @@
6283
6282
  "id": "ua0-600-36x",
6284
6283
  "name": "w3af",
6285
6284
  "tags": {
6286
- "type": "security_scanner",
6285
+ "type": "attack_tool",
6287
6286
  "category": "attack_attempt",
6288
6287
  "tool_name": "w3af",
6289
6288
  "confidence": "1"
@@ -6310,7 +6309,7 @@
6310
6309
  "id": "ua0-600-37x",
6311
6310
  "name": "Nmap",
6312
6311
  "tags": {
6313
- "type": "security_scanner",
6312
+ "type": "attack_tool",
6314
6313
  "category": "attack_attempt",
6315
6314
  "tool_name": "Nmap",
6316
6315
  "confidence": "1"
@@ -6337,7 +6336,7 @@
6337
6336
  "id": "ua0-600-39x",
6338
6337
  "name": "Nessus Scripted",
6339
6338
  "tags": {
6340
- "type": "security_scanner",
6339
+ "type": "attack_tool",
6341
6340
  "category": "attack_attempt",
6342
6341
  "tool_name": "Nessus",
6343
6342
  "confidence": "1"
@@ -6364,7 +6363,7 @@
6364
6363
  "id": "ua0-600-3xx",
6365
6364
  "name": "Evil Scanner",
6366
6365
  "tags": {
6367
- "type": "security_scanner",
6366
+ "type": "attack_tool",
6368
6367
  "category": "attack_attempt",
6369
6368
  "tool_name": "EvilScanner",
6370
6369
  "confidence": "1"
@@ -6391,7 +6390,7 @@
6391
6390
  "id": "ua0-600-40x",
6392
6391
  "name": "WebFuck",
6393
6392
  "tags": {
6394
- "type": "security_scanner",
6393
+ "type": "attack_tool",
6395
6394
  "category": "attack_attempt",
6396
6395
  "tool_name": "WebFuck",
6397
6396
  "confidence": "1"
@@ -6418,7 +6417,7 @@
6418
6417
  "id": "ua0-600-42x",
6419
6418
  "name": "OpenVAS",
6420
6419
  "tags": {
6421
- "type": "security_scanner",
6420
+ "type": "attack_tool",
6422
6421
  "category": "attack_attempt",
6423
6422
  "tool_name": "OpenVAS",
6424
6423
  "confidence": "1"
@@ -6445,7 +6444,7 @@
6445
6444
  "id": "ua0-600-43x",
6446
6445
  "name": "Spider-Pig",
6447
6446
  "tags": {
6448
- "type": "security_scanner",
6447
+ "type": "attack_tool",
6449
6448
  "category": "attack_attempt",
6450
6449
  "tool_name": "Spider-Pig",
6451
6450
  "confidence": "1"
@@ -6472,7 +6471,7 @@
6472
6471
  "id": "ua0-600-44x",
6473
6472
  "name": "Zgrab",
6474
6473
  "tags": {
6475
- "type": "security_scanner",
6474
+ "type": "attack_tool",
6476
6475
  "category": "attack_attempt",
6477
6476
  "tool_name": "Zgrab",
6478
6477
  "confidence": "1"
@@ -6499,7 +6498,7 @@
6499
6498
  "id": "ua0-600-45x",
6500
6499
  "name": "Zmeu",
6501
6500
  "tags": {
6502
- "type": "security_scanner",
6501
+ "type": "attack_tool",
6503
6502
  "category": "attack_attempt",
6504
6503
  "tool_name": "Zmeu",
6505
6504
  "confidence": "1"
@@ -6553,7 +6552,7 @@
6553
6552
  "id": "ua0-600-48x",
6554
6553
  "name": "Commix",
6555
6554
  "tags": {
6556
- "type": "security_scanner",
6555
+ "type": "attack_tool",
6557
6556
  "category": "attack_attempt",
6558
6557
  "tool_name": "Commix",
6559
6558
  "confidence": "1"
@@ -6580,7 +6579,7 @@
6580
6579
  "id": "ua0-600-49x",
6581
6580
  "name": "Gobuster",
6582
6581
  "tags": {
6583
- "type": "security_scanner",
6582
+ "type": "attack_tool",
6584
6583
  "category": "attack_attempt",
6585
6584
  "tool_name": "Gobuster",
6586
6585
  "confidence": "1"
@@ -6607,7 +6606,7 @@
6607
6606
  "id": "ua0-600-4xx",
6608
6607
  "name": "CGIchk",
6609
6608
  "tags": {
6610
- "type": "security_scanner",
6609
+ "type": "attack_tool",
6611
6610
  "category": "attack_attempt",
6612
6611
  "tool_name": "CGIchk",
6613
6612
  "confidence": "1"
@@ -6634,7 +6633,7 @@
6634
6633
  "id": "ua0-600-51x",
6635
6634
  "name": "FFUF",
6636
6635
  "tags": {
6637
- "type": "security_scanner",
6636
+ "type": "attack_tool",
6638
6637
  "category": "attack_attempt",
6639
6638
  "tool_name": "FFUF",
6640
6639
  "confidence": "1"
@@ -6661,7 +6660,7 @@
6661
6660
  "id": "ua0-600-52x",
6662
6661
  "name": "Nuclei",
6663
6662
  "tags": {
6664
- "type": "security_scanner",
6663
+ "type": "attack_tool",
6665
6664
  "category": "attack_attempt",
6666
6665
  "tool_name": "Nuclei",
6667
6666
  "confidence": "1"
@@ -6688,7 +6687,7 @@
6688
6687
  "id": "ua0-600-53x",
6689
6688
  "name": "Tsunami",
6690
6689
  "tags": {
6691
- "type": "security_scanner",
6690
+ "type": "attack_tool",
6692
6691
  "category": "attack_attempt",
6693
6692
  "tool_name": "Tsunami",
6694
6693
  "confidence": "1"
@@ -6715,7 +6714,7 @@
6715
6714
  "id": "ua0-600-54x",
6716
6715
  "name": "Nimbostratus",
6717
6716
  "tags": {
6718
- "type": "security_scanner",
6717
+ "type": "attack_tool",
6719
6718
  "category": "attack_attempt",
6720
6719
  "tool_name": "Nimbostratus",
6721
6720
  "confidence": "1"
@@ -6775,7 +6774,7 @@
6775
6774
  "id": "ua0-600-56x",
6776
6775
  "name": "Datadog test scanner - blocking version: user-agent",
6777
6776
  "tags": {
6778
- "type": "security_scanner",
6777
+ "type": "attack_tool",
6779
6778
  "category": "attack_attempt",
6780
6779
  "tool_name": "Datadog Canary Test",
6781
6780
  "confidence": "1"
@@ -6838,7 +6837,7 @@
6838
6837
  "id": "ua0-600-58x",
6839
6838
  "name": "wfuzz",
6840
6839
  "tags": {
6841
- "type": "security_scanner",
6840
+ "type": "attack_tool",
6842
6841
  "category": "attack_attempt",
6843
6842
  "tool_name": "wfuzz",
6844
6843
  "confidence": "1"
@@ -6892,7 +6891,7 @@
6892
6891
  "id": "ua0-600-5xx",
6893
6892
  "name": "Blind SQL Injection Brute Forcer",
6894
6893
  "tags": {
6895
- "type": "security_scanner",
6894
+ "type": "attack_tool",
6896
6895
  "category": "attack_attempt",
6897
6896
  "tool_name": "BSQLBF",
6898
6897
  "confidence": "1"
@@ -6919,7 +6918,7 @@
6919
6918
  "id": "ua0-600-60x",
6920
6919
  "name": "masscan",
6921
6920
  "tags": {
6922
- "type": "security_scanner",
6921
+ "type": "attack_tool",
6923
6922
  "category": "attack_attempt",
6924
6923
  "tool_name": "masscan",
6925
6924
  "confidence": "1"
@@ -6946,7 +6945,7 @@
6946
6945
  "id": "ua0-600-61x",
6947
6946
  "name": "WPScan",
6948
6947
  "tags": {
6949
- "type": "security_scanner",
6948
+ "type": "attack_tool",
6950
6949
  "category": "attack_attempt",
6951
6950
  "tool_name": "WPScan",
6952
6951
  "confidence": "1"
@@ -7026,7 +7025,7 @@
7026
7025
  "id": "ua0-600-7xx",
7027
7026
  "name": "SQLmap",
7028
7027
  "tags": {
7029
- "type": "security_scanner",
7028
+ "type": "attack_tool",
7030
7029
  "category": "attack_attempt",
7031
7030
  "tool_name": "SQLmap",
7032
7031
  "confidence": "1"
@@ -7053,7 +7052,7 @@
7053
7052
  "id": "ua0-600-9xx",
7054
7053
  "name": "Skipfish",
7055
7054
  "tags": {
7056
- "type": "security_scanner",
7055
+ "type": "attack_tool",
7057
7056
  "category": "attack_attempt",
7058
7057
  "tool_name": "Skipfish",
7059
7058
  "confidence": "1"
@@ -7077,4 +7076,4 @@
7077
7076
  "transformers": []
7078
7077
  }
7079
7078
  ]
7080
- }
7079
+ }
@@ -6,5 +6,7 @@ module.exports = {
6
6
  ASM_DD_RULES: 1n << 3n,
7
7
  ASM_EXCLUSIONS: 1n << 4n,
8
8
  ASM_REQUEST_BLOCKING: 1n << 5n,
9
- ASM_USER_BLOCKING: 1n << 7n
9
+ ASM_USER_BLOCKING: 1n << 7n,
10
+ ASM_CUSTOM_RULES: 1n << 8n,
11
+ ASM_CUSTOM_BLOCKING_RESPONSE: 1n << 9n
10
12
  }
@@ -42,6 +42,8 @@ function enableWafUpdate (appsecConfig) {
42
42
  rc.updateCapabilities(RemoteConfigCapabilities.ASM_DD_RULES, true)
43
43
  rc.updateCapabilities(RemoteConfigCapabilities.ASM_EXCLUSIONS, true)
44
44
  rc.updateCapabilities(RemoteConfigCapabilities.ASM_REQUEST_BLOCKING, true)
45
+ rc.updateCapabilities(RemoteConfigCapabilities.ASM_CUSTOM_RULES, true)
46
+ rc.updateCapabilities(RemoteConfigCapabilities.ASM_CUSTOM_BLOCKING_RESPONSE, true)
45
47
 
46
48
  rc.on('ASM_DATA', noop)
47
49
  rc.on('ASM_DD', noop)
@@ -60,6 +62,8 @@ function disableWafUpdate () {
60
62
  rc.updateCapabilities(RemoteConfigCapabilities.ASM_DD_RULES, false)
61
63
  rc.updateCapabilities(RemoteConfigCapabilities.ASM_EXCLUSIONS, false)
62
64
  rc.updateCapabilities(RemoteConfigCapabilities.ASM_REQUEST_BLOCKING, false)
65
+ rc.updateCapabilities(RemoteConfigCapabilities.ASM_CUSTOM_RULES, false)
66
+ rc.updateCapabilities(RemoteConfigCapabilities.ASM_CUSTOM_BLOCKING_RESPONSE, false)
63
67
 
64
68
  rc.off('ASM_DATA', noop)
65
69
  rc.off('ASM_DD', noop)
@@ -2,6 +2,7 @@
2
2
 
3
3
  const waf = require('./waf')
4
4
  const { ACKNOWLEDGED, ERROR } = require('./remote_config/apply_states')
5
+ const blocking = require('./blocking')
5
6
 
6
7
  let defaultRules
7
8
 
@@ -9,11 +10,17 @@ let appliedRulesData = new Map()
9
10
  let appliedRulesetId
10
11
  let appliedRulesOverride = new Map()
11
12
  let appliedExclusions = new Map()
13
+ let appliedCustomRules = new Map()
14
+ let appliedActions = new Map()
12
15
 
13
16
  function applyRules (rules, config) {
14
17
  defaultRules = rules
15
18
 
16
19
  waf.init(rules, config)
20
+
21
+ if (rules.actions) {
22
+ blocking.updateBlockingConfiguration(rules.actions.find(action => action.id === 'block'))
23
+ }
17
24
  }
18
25
 
19
26
  function updateWafFromRC ({ toUnapply, toApply, toModify }) {
@@ -24,6 +31,8 @@ function updateWafFromRC ({ toUnapply, toApply, toModify }) {
24
31
  let newRulesetId
25
32
  const newRulesOverride = new SpyMap(appliedRulesOverride)
26
33
  const newExclusions = new SpyMap(appliedExclusions)
34
+ const newCustomRules = new SpyMap(appliedCustomRules)
35
+ const newActions = new SpyMap(appliedActions)
27
36
 
28
37
  for (const item of toUnapply) {
29
38
  const { product, id } = item
@@ -33,11 +42,12 @@ function updateWafFromRC ({ toUnapply, toApply, toModify }) {
33
42
  } else if (product === 'ASM_DD') {
34
43
  if (appliedRulesetId === id) {
35
44
  newRuleset = defaultRules
36
- newRulesetId = null
37
45
  }
38
46
  } else if (product === 'ASM') {
39
47
  newRulesOverride.delete(id)
40
48
  newExclusions.delete(id)
49
+ newCustomRules.delete(id)
50
+ newActions.delete(id)
41
51
  }
42
52
  }
43
53
 
@@ -51,7 +61,7 @@ function updateWafFromRC ({ toUnapply, toApply, toModify }) {
51
61
 
52
62
  batch.add(item)
53
63
  } else if (product === 'ASM_DD') {
54
- if (appliedRulesetId && appliedRulesetId !== id) {
64
+ if (appliedRulesetId && appliedRulesetId !== id && newRuleset !== defaultRules) {
55
65
  item.apply_state = ERROR
56
66
  item.apply_error = 'Multiple ruleset received in ASM_DD'
57
67
  } else {
@@ -65,22 +75,41 @@ function updateWafFromRC ({ toUnapply, toApply, toModify }) {
65
75
  batch.add(item)
66
76
  }
67
77
  } else if (product === 'ASM') {
78
+ let batchConfiguration = false
68
79
  if (file && file.rules_override && file.rules_override.length) {
80
+ batchConfiguration = true
69
81
  newRulesOverride.set(id, file.rules_override)
70
82
  }
71
83
 
72
84
  if (file && file.exclusions && file.exclusions.length) {
85
+ batchConfiguration = true
73
86
  newExclusions.set(id, file.exclusions)
74
87
  }
75
88
 
76
- batch.add(item)
89
+ if (file && file.custom_rules && file.custom_rules.length) {
90
+ batchConfiguration = true
91
+ newCustomRules.set(id, file.custom_rules)
92
+ }
93
+
94
+ if (file && file.actions && file.actions.length) {
95
+ newActions.set(id, file.actions)
96
+ }
97
+
98
+ // "actions" data is managed by tracer and not by waf
99
+ if (batchConfiguration) {
100
+ batch.add(item)
101
+ }
77
102
  }
78
103
  }
79
104
 
80
105
  let newApplyState = ACKNOWLEDGED
81
106
  let newApplyError
82
107
 
83
- if (newRulesData.modified || newRuleset || newRulesOverride.modified || newExclusions.modified) {
108
+ if (newRulesData.modified ||
109
+ newRuleset ||
110
+ newRulesOverride.modified ||
111
+ newExclusions.modified ||
112
+ newCustomRules.modified) {
84
113
  const payload = newRuleset || {}
85
114
 
86
115
  if (newRulesData.modified) {
@@ -92,6 +121,9 @@ function updateWafFromRC ({ toUnapply, toApply, toModify }) {
92
121
  if (newExclusions.modified) {
93
122
  payload.exclusions = concatArrays(newExclusions)
94
123
  }
124
+ if (newCustomRules.modified) {
125
+ payload.custom_rules = concatArrays(newCustomRules)
126
+ }
95
127
 
96
128
  try {
97
129
  waf.update(payload)
@@ -108,6 +140,9 @@ function updateWafFromRC ({ toUnapply, toApply, toModify }) {
108
140
  if (newExclusions.modified) {
109
141
  appliedExclusions = newExclusions
110
142
  }
143
+ if (newCustomRules.modified) {
144
+ appliedCustomRules = newCustomRules
145
+ }
111
146
  } catch (err) {
112
147
  newApplyState = ERROR
113
148
  newApplyError = err.toString()
@@ -118,6 +153,11 @@ function updateWafFromRC ({ toUnapply, toApply, toModify }) {
118
153
  config.apply_state = newApplyState
119
154
  if (newApplyError) config.apply_error = newApplyError
120
155
  }
156
+
157
+ if (newActions.modified) {
158
+ blocking.updateBlockingConfiguration(concatArrays(newActions).find(action => action.id === 'block'))
159
+ appliedActions = newActions
160
+ }
121
161
  }
122
162
 
123
163
  // A Map with a new prop `modified`, a bool that indicates if the Map was modified
@@ -199,13 +239,16 @@ function copyRulesData (rulesData) {
199
239
 
200
240
  function clearAllRules () {
201
241
  waf.destroy()
242
+ blocking.updateBlockingConfiguration(undefined)
202
243
 
203
- defaultRules = null
244
+ defaultRules = undefined
204
245
 
205
246
  appliedRulesData.clear()
206
- appliedRulesetId = null
247
+ appliedRulesetId = undefined
207
248
  appliedRulesOverride.clear()
208
249
  appliedExclusions.clear()
250
+ appliedCustomRules.clear()
251
+ appliedActions.clear()
209
252
  }
210
253
 
211
254
  module.exports = {
@@ -1,16 +1,11 @@
1
1
  'use strict'
2
2
  const request = require('../../../exporters/common/request')
3
3
  const log = require('../../../log')
4
+ const { safeJSONStringify } = require('../../../exporters/common/util')
4
5
 
5
6
  const { CoverageCIVisibilityEncoder } = require('../../../encode/coverage-ci-visibility')
6
7
  const BaseWriter = require('../../../exporters/common/writer')
7
8
 
8
- function safeJSONStringify (value) {
9
- return JSON.stringify(value, (key, value) =>
10
- key !== 'dd-api-key' ? value : undefined
11
- )
12
- }
13
-
14
9
  class Writer extends BaseWriter {
15
10
  constructor ({ url, evpProxyPrefix = '' }) {
16
11
  super(...arguments)
@@ -34,7 +29,7 @@ class Writer extends BaseWriter {
34
29
  if (this._evpProxyPrefix) {
35
30
  options.path = `${this._evpProxyPrefix}/api/v2/citestcov`
36
31
  delete options.headers['dd-api-key']
37
- options.headers['X-Datadog-EVP-Subdomain'] = 'event-platform-intake'
32
+ options.headers['X-Datadog-EVP-Subdomain'] = 'citestcov-intake'
38
33
  }
39
34
 
40
35
  log.debug(() => `Request to the intake: ${safeJSONStringify(options)}`)
@@ -17,7 +17,7 @@ class AgentlessCiVisibilityExporter extends CiVisibilityExporter {
17
17
  this._url = url || new URL(`https://citestcycle-intake.${site}`)
18
18
  this._writer = new Writer({ url: this._url, tags })
19
19
 
20
- this._coverageUrl = url || new URL(`https://event-platform-intake.${site}`)
20
+ this._coverageUrl = url || new URL(`https://citestcov-intake.${site}`)
21
21
  this._coverageWriter = new CoverageWriter({ url: this._coverageUrl })
22
22
 
23
23
  this._apiUrl = url || new URL(`https://api.${site}`)
@@ -1,16 +1,11 @@
1
1
  'use strict'
2
2
  const request = require('../../../exporters/common/request')
3
+ const { safeJSONStringify } = require('../../../exporters/common/util')
3
4
  const log = require('../../../log')
4
5
 
5
6
  const { AgentlessCiVisibilityEncoder } = require('../../../encode/agentless-ci-visibility')
6
7
  const BaseWriter = require('../../../exporters/common/writer')
7
8
 
8
- function safeJSONStringify (value) {
9
- return JSON.stringify(value, (key, value) =>
10
- key !== 'dd-api-key' ? value : undefined
11
- )
12
- }
13
-
14
9
  class Writer extends BaseWriter {
15
10
  constructor ({ url, tags, evpProxyPrefix = '' }) {
16
11
  super(...arguments)