@contrast/agent 4.36.0 → 4.36.2

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.
@@ -46,11 +46,7 @@ function shouldSkip(data) {
46
46
 
47
47
  // split just returns the original string
48
48
  // if not passed an argument
49
- if (data.args.length === 0) {
50
- return true;
51
- }
52
-
53
- return false;
49
+ return data.args.length === 0;
54
50
  }
55
51
 
56
52
  /**
@@ -111,6 +107,10 @@ module.exports.handle = {
111
107
  } else {
112
108
  for (let i = 0; i < result.length; i++) {
113
109
  const stringPart = result[i];
110
+ if (!stringPart) {
111
+ continue;
112
+ }
113
+
114
114
  const stringPartLength = stringPart.length - 1;
115
115
 
116
116
  let stringStart = origString.indexOf(stringPart);
@@ -130,10 +130,6 @@ module.exports.handle = {
130
130
 
131
131
  indexOfFounds.add(stringStart + stringPartLength);
132
132
 
133
- if (stringPart.length === 0) {
134
- continue;
135
- }
136
-
137
133
  const newTagRanges = [];
138
134
  oldTagRanges.forEach((tag) => {
139
135
  const relation = new TagRange(
@@ -12,6 +12,8 @@ Copyright: 2023 Contrast Security, Inc
12
12
  engineered, modified, repackaged, sold, redistributed or otherwise used in a
13
13
  way not consistent with the End User License Agreement.
14
14
  */
15
+ 'use strict';
16
+
15
17
  const agentEmitter = require('../../../agent-emitter');
16
18
 
17
19
  const RULE_ID = 'xxssprotection-header-disabled';
@@ -23,14 +25,11 @@ module.exports = ({ common }) => {
23
25
  rule.check = function check(responseHeaders) {
24
26
  const header = responseHeaders[HEADER_NAME];
25
27
 
26
- // This header is set by default, so `header` should always be present.
27
- if (header && header.startsWith('1')) {
28
- return;
28
+ if (header && !header.startsWith('1')) {
29
+ return {
30
+ data: header
31
+ };
29
32
  }
30
-
31
- return {
32
- data: header
33
- };
34
33
  };
35
34
 
36
35
  rule.handle = function handle() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/agent",
3
- "version": "4.36.0",
3
+ "version": "4.36.2",
4
4
  "description": "Node.js security instrumentation by Contrast Security",
5
5
  "keywords": [
6
6
  "security",