Skip to content

Commit

Permalink
fix: Fixing most of the eslint error messages
Browse files Browse the repository at this point in the history
Signed-off-by: Ana Rocha <[email protected]>
  • Loading branch information
thc202 authored and anaaroch committed Sep 5, 2024
2 parents 326c314 + 86e64ab commit a81fad7
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 53 deletions.
22 changes: 22 additions & 0 deletions site/content/docs/alerts/10004.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: "Tech Detected - Apache HTTP Server"
alertid: 10004
alertindex: 1000400
alerttype: "Tool"
alertcount: 1
status: release
type: alert
risk: Informational
solution: ""
references:
- https://httpd.apache.org
other: "The following CPE is associated with the identified tech: cpe:2.3:a:apache:http_server:*:*:*:*:*:*:*:* The following version(s) is/are associated with the identified tech: 2.4.7"
cwe: 200
wasc: 13
alerttags:
- CWE-200
code: https://github.com/zaproxy/zap-extensions/blob/main/addOns/wappalyzer/src/main/java/org/zaproxy/zap/extension/wappalyzer/ExtensionWappalyzer.java
linktext: "org/zaproxy/zap/extension/wappalyzer/ExtensionWappalyzer.java"
help: https://www.zaproxy.org/docs/desktop/addons/technology-detection/options/#10004
---
The following "Web servers" technology was identified: Apache HTTP Server.
2 changes: 1 addition & 1 deletion site/content/docs/alerts/10094-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ code: https://github.com/zaproxy/zap-extensions/blob/main/addOns/pscanrulesAlpha
linktext: "org/zaproxy/zap/extension/pscanrulesAlpha/Base64Disclosure.java"
help: https://www.zaproxy.org/docs/desktop/addons/passive-scan-rules-alpha/#id-10094
---
An ASP.NET ViewState was disclosed by the application/web server
An ASP.NET ViewState was disclosed by the application/web server.
2 changes: 1 addition & 1 deletion site/content/docs/alerts/10094-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ code: https://github.com/zaproxy/zap-extensions/blob/main/addOns/pscanrulesAlpha
linktext: "org/zaproxy/zap/extension/pscanrulesAlpha/Base64Disclosure.java"
help: https://www.zaproxy.org/docs/desktop/addons/passive-scan-rules-alpha/#id-10094
---
The application does not use a Message Authentication Code (MAC) to protect the integrity of the ASP.NET ViewState, which can be tampered with by a malicious client
The application does not use a Message Authentication Code (MAC) to protect the integrity of the ASP.NET ViewState, which can be tampered with by a malicious client.
4 changes: 2 additions & 2 deletions site/content/docs/alerts/40015.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ alertcount: 1
status: alpha
type: alert
risk: High
solution: "Validate and/or escape all user input before using it to create an LDAP query. In particular, the following characters (or combinations) should be deny listed: & | ! < > = ~= >= <= * ( ) , + - \" ' ; \\ / NUL character "
solution: "Validate and/or escape all user input before using it to create an LDAP query. In particular, the following characters (or combinations) should be deny listed: & | ! < > = ~= >= <= * ( ) , + - \" ' ; \\ / NUL character "
references:
- https://owasp.org/www-community/attacks/LDAP_Injection
- https://cheatsheetseries.owasp.org/cheatsheets/LDAP_Injection_Prevention_Cheat_Sheet.html
Expand All @@ -24,4 +24,4 @@ code: https://github.com/zaproxy/zap-extensions/blob/main/addOns/ascanrulesAlpha
linktext: "org/zaproxy/zap/extension/ascanrulesAlpha/LdapInjectionScanRule.java"
help: https://www.zaproxy.org/docs/desktop/addons/active-scan-rules-alpha/#id-40015
---
LDAP Injection may be possible. It may be possible for an attacker to bypass authentication controls, and to view and modify arbitrary data in the LDAP directory.
LDAP Injection may be possible. It may be possible for an attacker to bypass authentication controls, and to view and modify arbitrary data in the LDAP directory.
2 changes: 1 addition & 1 deletion site/content/docs/alerts/40033.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ alertcount: 1
status: alpha
type: alert
risk: High
solution: "Do not trust client side input and escape all data on the server side. Avoid to use the query input directly into the where and group clauses and upgrade all drivers at the latest available version."
solution: "Do not trust client side input and escape all data on the server side. Avoid to use the query input directly into the where and group clauses and upgrade all drivers at the latest available version."
references:
- https://arxiv.org/pdf/1506.04082.pdf
- https://owasp.org/www-project-web-security-testing-guide/v41/4-Web_Application_Security_Testing/07-Input_Validation_Testing/05.6-Testing_for_NoSQL_Injection.html
Expand Down
2 changes: 1 addition & 1 deletion site/content/docs/alerts/90039.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ alertcount: 1
status: alpha
type: alert
risk: High
solution: "Do not trust client side input and escape all data on the server side. Avoid to use the query input directly into the where and group clauses and upgrade all drivers at the latest available version."
solution: "Do not trust client side input and escape all data on the server side. Avoid to use the query input directly into the where and group clauses and upgrade all drivers at the latest available version."
references:
- https://arxiv.org/pdf/1506.04082.pdf
- https://owasp.org/www-project-web-security-testing-guide/v41/4-Web_Application_Security_Testing/07-Input_Validation_Testing/05.6-Testing_for_NoSQL_Injection.html
Expand Down
94 changes: 47 additions & 47 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ new BadgerAccordion(".js-badger-accordion", {

function removeAllChildNodes(parent) {
while (parent.firstChild) {
parent.removeChild(parent.firstChild);
parent.removeChild(parent.firstChild);
}
}

Expand All @@ -28,7 +28,7 @@ document.addEventListener("DOMContentLoaded", function() {
Array.from(document.querySelectorAll("[data-sort-filter]")).map(function(el) {
const widget = {
options: {},
filters: {}
filters: {}
};

// Checks if row matches against filter
Expand All @@ -45,47 +45,47 @@ document.addEventListener("DOMContentLoaded", function() {

// Create datalist that input can use for suggetions
function setupDatalist(el, label, idx) {
widget.options[idx] = document.createElement('datalist');
widget.options[idx].setAttribute('id', 'opts_for_' + label);
widget.options[idx]._options = []
widget.options[idx] = document.createElement("datalist");
widget.options[idx].setAttribute("id", "opts_for_" + label);
widget.options[idx]._options = [];
el.appendChild(widget.options[idx]);
}

// Add input for filtering
function addInput(el, label, idx) {
const input = document.createElement('input');
const input = document.createElement("input");
input.addEventListener("change", function(e) {
widget.filters[idx] = e.target.value;
removeAllChildNodes(tbody);
rows.filter(isFilterMatch).map(r => {
tbody.appendChild(r.el)
rows.filter(isFilterMatch).map((r) => {
tbody.appendChild(r.el);
});
});
input.setAttribute('style', 'width:100%;display:block')
input.setAttribute('type', 'text');
input.setAttribute('name', 'filter_' + label);
input.setAttribute('list', 'opts_for_' + label);
input.setAttribute("style", "width:100%;display:block");
input.setAttribute("type", "text");
input.setAttribute("name", "filter_" + label);
input.setAttribute("list", "opts_for_" + label);
el.appendChild(input);
}
const tbody = el.querySelector('tbody');
const headings = Array.from(el.querySelectorAll('thead th')).map((el, idx) => {
const tbody = el.querySelector("tbody");
const headings = Array.from(el.querySelectorAll("thead th")).map((el, idx) => {
const isSuggested = el.getAttribute("data-suggest") !== null;
const label = el.innerText.toLowerCase();
el.appendChild(document.createElement('br'));
el.appendChild(document.createElement("br"));
addInput(el, label, idx);

if (isSuggested) {
setupDatalist(el, label, idx);
setupDatalist(el, label, idx);
}
return {idx, isSuggested, label};
});

const rows = Array.from(el.querySelectorAll('tbody tr')).map(tr => {
const columns = Array.from(tr.querySelectorAll('td')).map((c, idx) => {
const rows = Array.from(el.querySelectorAll("tbody tr")).map((tr) => {
const columns = Array.from(tr.querySelectorAll("td")).map((c, idx) => {
// For columns that match the index of the `data-suggest` headers
// ... add the text value to options
if (widget.options[idx]) {
widget.options[idx]._options.push(c.innerText)
widget.options[idx]._options.push(c.innerText);
}
return c.innerText;
});
Expand All @@ -97,39 +97,39 @@ document.addEventListener("DOMContentLoaded", function() {

// Go through options elements and populate lists with column aggregates
// gathered in previous loop
Object.entries(widget.options).map(pair => {
Object.entries(widget.options).map((pair) => {
const [idx, el] = pair;
const opts = [...new Set(el._options)];
opts.sort((a, b) => a.length - b.length);
opts.map(o => {
const ol = document.createElement('option');
opts.map((o) => {
const ol = document.createElement("option");
ol.innerText = o;
return ol;
}).map(ol => el.appendChild(ol));
}).map((ol) => el.appendChild(ol));
});
});

function clearFilter(menu) {
menu.classList.remove("is-filtering");
Array.from(menu.getElementsByTagName('li')).map(function(el) {
Array.from(menu.getElementsByTagName("li")).map(function(el) {
el.classList.remove("tree-filter-match");
});
Array.from(menu.getElementsByTagName('ul')).map(function(el) {
el.classList.remove("tree-branch-filter");
Array.from(menu.getElementsByTagName("ul")).map(function(el) {
el.classList.remove("tree-branch-filter");
});
}

function applyFilter(menu, filter) {
menu.classList.add("is-filtering");
Array.from(menu.getElementsByTagName('li')).map(function(el) {
Array.from(menu.getElementsByTagName("li")).map(function(el) {
const text = el.textContent.toLowerCase();
if (text.indexOf(filter) !== -1) {
el.classList.add("tree-filter-match");
} else {
el.classList.remove("tree-filter-match");
}
});
Array.from(menu.getElementsByTagName('ul')).map(function(el) {
Array.from(menu.getElementsByTagName("ul")).map(function(el) {
const text = el.textContent.toLowerCase();

if (text.indexOf(filter) !== -1) {
Expand All @@ -151,18 +151,18 @@ document.addEventListener("DOMContentLoaded", function() {
});
});

const menu = document.getElementById('primary-menu');
menu.querySelector('.toggler').addEventListener("click", function(e) {
const menu = document.getElementById("primary-menu");
menu.querySelector(".toggler").addEventListener("click", function(e) {
e.preventDefault();
menu.classList.toggle("in-search");
});

Array.from(document.querySelectorAll("[track-event]")).map((el) => {
el.addEventListener("click", function(e) {
e.preventDefault();
const [action, category, label] = el.getAttribute("track-event").split(".")
const [action, category, label] = el.getAttribute("track-event").split(".");
if (window.ga === undefined) {
console.log("track-event", action, category, label);
//console.log("track-event", action, category, label);
} else {
ga("send", {
hitType: "event",
Expand All @@ -177,27 +177,27 @@ document.addEventListener("DOMContentLoaded", function() {
}, 400);
});
});

// Sortable tables
// Based on https://stackoverflow.com/questions/14267781/sorting-html-table-with-javascript
const getCellValue = (tr, idx) => tr.children[idx].innerText || tr.children[idx].textContent;

const comparer = (idx, asc) => (a, b) => ((v1, v2) =>
v1 !== '' && v2 !== '' && !isNaN(v1) && !isNaN(v2) ? v1 - v2 : v1.toString().localeCompare(v2)
)(getCellValue(asc ? a : b, idx), getCellValue(asc ? b : a, idx));
const comparer = (idx, asc) => (a, b) => ((v1, v2) =>
v1 !== "" && v2 !== "" && !isNaN(v1) && !isNaN(v2) ? v1 - v2 : v1.toString().localeCompare(v2)
)(getCellValue(asc ? a : b, idx), getCellValue(asc ? b : a, idx));

document.querySelectorAll('th.sortable').forEach(th => th.addEventListener('click', (() => {
const table = th.closest('table');
Array.from(table.querySelectorAll('tr:nth-child(n+2)'))
.sort(comparer(Array.from(th.parentNode.children).indexOf(th), this.asc = !this.asc))
.forEach(tr => table.appendChild(tr) );
document.querySelectorAll("th.sortable").forEach((th) => th.addEventListener("click", (() => {
const table = th.closest("table");
Array.from(table.querySelectorAll("tr:nth-child(n+2)"))
.sort(comparer(Array.from(th.parentNode.children).indexOf(th), this.asc = !this.asc))
.forEach((tr) => table.appendChild(tr));
})));

// Tables with hidden rows
document.querySelectorAll('input.togglehidetablerows').forEach(input => input.addEventListener('change', (() => {
const table = input.closest('table');
Array.from(table.querySelectorAll('tr.togglehide'))
.forEach(tr => tr.style.display = input.checked ? '' : 'none');
document.querySelectorAll("input.togglehidetablerows").forEach((input) => input.addEventListener("change", (() => {
const table = input.closest("table");
Array.from(table.querySelectorAll("tr.togglehide"))
.forEach((tr) => tr.style.display = input.checked ? "" : "none");
})));

});

0 comments on commit a81fad7

Please sign in to comment.