Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions istanbul.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# istanbul.yml
check-coverage: true
instrumentation:
root: ./src
extensions: ['.js']
default-excludes: true
excludes: ['**/node_modules/**', '**/test/**']
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
"prepush": "npm run test",
"start": "node .",
"test": "mocha",
"test:watch": "mocha --watch"
"test:watch": "mocha --watch",
"test": "mocha",
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha -- ./test/*.js",
"report": "istanbul report"
},
"repository": {
"type": "git",
Expand Down
11 changes: 11 additions & 0 deletions src/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# have vulnerability code

const secretKey = "mysecretkey";

function encryptData(data) {
// This function encrypts the input data using a hardcoded secret key
const cipher = crypto.createCipher('aes192', secretKey);
let encryptedData = cipher.update(data, 'utf8', 'hex');
encryptedData += cipher.final('hex');
return encryptedData;
}
8 changes: 8 additions & 0 deletions test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const correctPassword = "mysecretpassword223@"; // define the correct password
const enteredPassword = prompt("Enter the password:"); // prompt the user for a password

if (enteredPassword === correctPassword) {
console.log("Access granted!"); // if the passwords match, print "Access granted!"
} else {
console.log("Access denied!"); // if the passwords don't match, print "Access denied!"
}
11 changes: 11 additions & 0 deletions test1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# have vulnerability code

const secretKey = "mysecretkey";

function encryptData(data) {
// This function encrypts the input data using a hardcoded secret key
const cipher = crypto.createCipher('aes192', secretKey);
let encryptedData = cipher.update(data, 'utf8', 'hex');
encryptedData += cipher.final('hex');
return encryptedData;
}
9 changes: 9 additions & 0 deletions vulnerability.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const secretKey = "mysecretkey";

function encryptData(data) {
// This function encrypts the input data using a hardcoded secret key
const cipher = crypto.createCipher('aes192', secretKey);
let encryptedData = cipher.update(data, 'utf8', 'hex');
encryptedData += cipher.final('hex');
return encryptedData;
}