Skip to content

Commit 1fd3764

Browse files
committed
✨ add note when a CVE is not reproducible but should be
1 parent 7c1fba7 commit 1fd3764

File tree

5 files changed

+86
-9
lines changed

5 files changed

+86
-9
lines changed

security/server/index.cjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const xssApp = express();
44
const port = 3333;
55
const xssPort = 3334;
66
const cors = require('cors');
7+
const chalk = require('chalk');
78

89
xssApp.use(cors());
910

@@ -15,12 +16,12 @@ xssApp.get('/jqueryxss', (req, res) => {
1516
});
1617

1718
xssApp.listen(xssPort, () => {
18-
console.log(`listening on port ${xssPort} (xss endpoint)`);
19+
console.log(chalk.magenta(`listening on port ${xssPort} (xss endpoint)`));
1920
});
2021

2122
app.use(express.static('../site'));
2223

2324
app.listen(port, () => {
24-
console.log(`listening on port ${port} (test site)`);
25-
console.log('\nopen http://localhost:3333 in your browser if you want to test manually');
25+
console.log(chalk.cyan(`listening on port ${port} (test site)`));
26+
console.log(chalk.green('\nopen http://localhost:3333 in your browser if you want to test manually\n\n'));
2627
});

security/server/package-lock.json

Lines changed: 65 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

security/server/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"serve": "node index.cjs"
55
},
66
"dependencies": {
7+
"chalk": "^4.1.2",
78
"cors": "^2.8.5",
89
"express": "^4.18.2"
910
}

security/site/main.mjs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ if(qsVersion) {
9090
else {
9191

9292
const sessionVersion = sessionStorage.getItem(VERSION);
93-
const sessionPatched = sessionStorage.getItem(PATCHED);
93+
const sessionPatched = sessionStorage.getItem(PATCHED) === 'true';
9494

9595
if(sessionVersion) {
9696
selVersion.value = sessionVersion;
97-
chkPatched.checked = sessionPatched === 'true';
97+
chkPatched.checked = sessionPatched;
9898
}
9999

100100
}
@@ -165,6 +165,8 @@ function triggerCVE(cveID){
165165
function updateCVE(cve) {
166166

167167
const cveID = `CVE-${cve[0]}`;
168+
const version = sessionStorage.getItem(VERSION); // use version from session/select because our CVE map doesn't have the patched versions
169+
const patched = sessionStorage.getItem(PATCHED) === 'true';
168170

169171
const $relevantCVEFooter = $(`div.cve__header:contains(${cveID})`).siblings('.cve__footer');
170172
const $footerStatus = $('.cve__footer-status', $relevantCVEFooter);
@@ -180,11 +182,19 @@ function updateCVE(cve) {
180182
}
181183
else {
182184
$footerStatus.text(`Can't reproduce! 🎉`);
183-
const v = sessionStorage.getItem(VERSION); // use version from session/select because our CVE map doesn't have the patched versions
184-
if(!cve[1].versions.includes(v)) {
185+
186+
if(!patched) {
187+
185188
const $footerNote = $('.cve__footer-note', $relevantCVEFooter);
186-
$footerNote.text(`(but v${v} is not vulnerable to this CVE)`);
189+
190+
if(cve[1].versions.includes(version)) {
191+
$footerNote.text(`but v${version} should be vulnerable 🤔`);
192+
}
193+
else {
194+
$footerNote.text(`but v${version} is not vulnerable 😺`);
195+
}
187196
}
197+
188198
}
189199

190200
$relevantCVEFooter.addClass('flash');

security/site/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ input[type="checkbox"] {
7979
background-color: var(--grey);
8080
border: solid .2rem var(--blue-white);
8181
margin: 2rem;
82-
width: 32rem;
82+
width: 30rem;
8383
}
8484

8585
.cve__header {

0 commit comments

Comments
 (0)