Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Security Report: 4 high severity findings, 14 total findings #2

Open
1 task
mend-for-github-com bot opened this issue May 27, 2024 · 0 comments
Open
1 task
Labels
Mend: code security findings Code security findings detected by Mend

Comments

@mend-for-github-com
Copy link

Code Security Report

Scan Metadata

Latest Scan: 2024-05-27 12:19pm
Total Findings: 14 | New Findings: 0 | Resolved Findings: 0
Tested Project Files: 451
Detected Programming Languages: 1 (JavaScript / TypeScript*)

  • Check this box to manually trigger a scan

Most Relevant Findings

The list below presents the 10 most relevant findings that need your attention. To view information on the remaining findings, navigate to the Mend Application.

SeverityVulnerability TypeCWEFileData FlowsDate
HighCross-Site Scripting

CWE-79

index.js:14

12024-05-27 12:19pm
Vulnerable Code

res.setHeader('Content-Type', 'text/plain');
return res.send(req.body);
});
router.post('/xml-parsed', (req, res) => {
return res.send(req.body);

1 Data Flow/s detected

router.post('/xml-parsed', (req, res) => {

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Cross-Site Scripting Training

● Videos

   ▪ Secure Code Warrior Cross-Site Scripting Video

 
HighCross-Site Scripting

CWE-79

index.js:19

12024-05-27 12:19pm
Vulnerable Code

return res.send(req.body);
});
router.post('/xml-raw', (req, res) => {
res.setHeader('Content-Type', 'application/xml');
return res.send(req.rawBody);

1 Data Flow/s detected

router.post('/xml-raw', (req, res) => {

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Cross-Site Scripting Training

● Videos

   ▪ Secure Code Warrior Cross-Site Scripting Video

 
HighCross-Site Scripting

CWE-79

index.js:10

12024-05-27 12:19pm
Vulnerable Code

return res.json(req.body);
});
router.post('/text', (req, res) => {
res.setHeader('Content-Type', 'text/plain');
return res.send(req.body);

1 Data Flow/s detected

router.post('/text', (req, res) => {

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Cross-Site Scripting Training

● Videos

   ▪ Secure Code Warrior Cross-Site Scripting Video

 
HighCross-Site Scripting

CWE-79

authorizationCode.js:86

12024-05-27 12:19pm
Vulnerable Code

<button id='authorize'>Authorize</button>
</body>
</html>
`;
res.send(_res);

1 Data Flow/s detected

router.get('/authorize', (req, res) => {

const { response_type, client_id, redirect_uri, code_challenge } = req.query;

const redirectUrl = `${redirect_uri}?code=${authorization_code}`;

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Cross-Site Scripting Training

● Videos

   ▪ Secure Code Warrior Cross-Site Scripting Video

 
MediumRegex Denial of Service (ReDoS)

CWE-1333

index.js:9

12024-05-27 12:19pm
Vulnerable Code

const cors = require('cors');
const multer = require('multer');
const app = new express();
const port = process.env.PORT || 8080;
const upload = multer();

1 Data Flow/s detected

const upload = multer();

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Regex Denial of Service (ReDoS) Training

● Videos

   ▪ Secure Code Warrior Regex Denial of Service (ReDoS) Video

 
MediumHardcoded Password/Credentials

CWE-798

passwordCredentials.js:26

12024-05-27 12:19pm
Vulnerable Code

var token = jwt.sign({ username, password }, 'bruno');

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Hardcoded Password/Credentials Training

● Videos

   ▪ Secure Code Warrior Hardcoded Password/Credentials Video

● Further Reading

   ▪ OWASP Top Ten 2017 A3: Sensitive Data Exposure

   ▪ OWASP Top Ten Proactive Controls 2018 C8: Protect Data Everywhere

   ▪ OWASP Top Ten 2021 A02: Cryptographic Failures

 
LowLog Forging

CWE-117

clientCredentials.js:32

12024-05-27 12:19pm
Vulnerable Code

client_id = req?.headers?.client_id;
client_secret = req?.headers?.client_secret;
scope = req?.headers?.scope;
}
console.log('client_cred', client_id, client_secret, scope);

1 Data Flow/s detected

router.post('/token', (req, res) => {

client_id = req?.body?.client_id;

console.log('client_cred', client_id, client_secret, scope);

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Log Forging Training

● Videos

   ▪ Secure Code Warrior Log Forging Video

● Further Reading

   ▪ OWASP Log Forging

 
LowLog Forging

CWE-117

authorizationCode.js:105

12024-05-27 12:19pm
Vulnerable Code

return res.json({ message: 'Authorization successful', storedAuthCode });
});
router.post('/token', (req, res) => {
console.log('authorization code token', req.body, req.headers);

1 Data Flow/s detected

router.post('/token', (req, res) => {

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Log Forging Training

● Videos

   ▪ Secure Code Warrior Log Forging Video

● Further Reading

   ▪ OWASP Log Forging

 
LowLog Forging

CWE-117

authorizationCode.js:156

12024-05-27 12:19pm
Vulnerable Code

res.json({ access_token: accessToken });
});
router.post('/resource', (req, res) => {
try {
console.log('authorization code resource', req.query, tokens);

1 Data Flow/s detected

router.post('/resource', (req, res) => {

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Log Forging Training

● Videos

   ▪ Secure Code Warrior Log Forging Video

● Further Reading

   ▪ OWASP Log Forging

 
LowLog Forging

CWE-117

authorizationCode.js:29

12024-05-27 12:19pm
Vulnerable Code

return base64Hash.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
};
router.get('/authorize', (req, res) => {
const { response_type, client_id, redirect_uri, code_challenge } = req.query;
console.log('authorization code authorize', req.query);

1 Data Flow/s detected

router.get('/authorize', (req, res) => {

Secure Code Warrior Training Material

● Training

   ▪ Secure Code Warrior Log Forging Training

● Videos

   ▪ Secure Code Warrior Log Forging Video

● Further Reading

   ▪ OWASP Log Forging

Findings Overview

Severity Vulnerability Type CWE Language Count
High Cross-Site Scripting CWE-79 JavaScript / TypeScript* 4
Medium Hardcoded Password/Credentials CWE-798 JavaScript / TypeScript* 1
Medium Regex Denial of Service (ReDoS) CWE-1333 JavaScript / TypeScript* 1
Low Cookie Without 'HttpOnly' Flag CWE-1004 JavaScript / TypeScript* 1
Low Log Forging CWE-117 JavaScript / TypeScript* 6
Low Sensitive Cookie Without Secure CWE-614 JavaScript / TypeScript* 1
@mend-for-github-com mend-for-github-com bot added the Mend: code security findings Code security findings detected by Mend label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mend: code security findings Code security findings detected by Mend
Projects
None yet
Development

No branches or pull requests

0 participants