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

gh security check #2803

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Update server.js
radekwarisch authored Mar 27, 2024
commit 1ec007d7a17c1d6c5d42c38d609360ce9241e8aa
17 changes: 0 additions & 17 deletions src/server.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
const express = require('express');
const app = express();
const port = 3000;

app.use(express.urlencoded({extended: true}));


app.post('/echo', (req, res) => {
const userInput = req.body.name;

res.send(`Hello, ${userInput}!`);
});

app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`);
});

const http = require('http');
const url = require('url');
const querystring = require('querystring');
@@ -48,7 +31,7 @@
if (userId === query.user_id) {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/html');
res.end(`<h1>Welcome, ${query.username}!</h1>`);

Check failure

Code scanning / CodeQL

Reflected cross-site scripting High

Cross-site scripting vulnerability due to a
user-provided value
.
} else {
res.statusCode = 403;
res.setHeader('Content-Type', 'text/plain');