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

Address CodeQL issues #462

Merged
merged 25 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ba1cb5b
fix: codeql fix wip
vaibssingh Feb 28, 2024
2ca7149
Merge branch 'main' into 412-fix-codeql-issues
vaibssingh Feb 28, 2024
78adaaf
fix: remove default value for SESSION_SECRET in session configuration
vaibssingh Feb 28, 2024
69ffeb0
Merge branch '412-fix-codeql-issues' of github.com:vaibssingh/git-pro…
vaibssingh Feb 28, 2024
9b26f98
Merge pull request #1 from vaibssingh/412-fix-codeql-issues
vaibssingh Feb 28, 2024
0e0bd2a
fix: fix stack and secure cookie issues
vaibssingh Feb 28, 2024
4fc25c0
Merge pull request #2 from vaibssingh/412-fix-codeql-issues
vaibssingh Feb 28, 2024
bf4a67a
fix: revert changes in index.js for #335
vaibssingh Feb 29, 2024
ad05993
Merge branch 'main' into 412-fix-codeql-issues
vaibssingh Feb 29, 2024
06aa349
Merge branch 'main' into 412-fix-codeql-issues
JamieSlome Mar 6, 2024
cc76b12
Merge branch 'main' into 412-fix-codeql-issues
maoo Mar 11, 2024
91b9540
Merge branch 'finos:main' into main
vaibssingh Mar 13, 2024
3f5e2e3
Merge branch 'main' of github.com:vaibssingh/git-proxy into 412-fix-c…
vaibssingh Mar 13, 2024
1bf746d
Update src/service/index.js
vaibssingh Mar 13, 2024
4a06bcc
Merge branch 'main' into 412-fix-codeql-issues
vaibssingh Mar 13, 2024
d6d9bbe
Merge branch 'main' into 412-fix-codeql-issues
vaibssingh Mar 14, 2024
0b0d5ef
Merge branch 'main' of github.com:finos/git-proxy into 412-fix-codeql…
vaibssingh Mar 14, 2024
718c9fb
Merge branch '412-fix-codeql-issues' of github.com:vaibssingh/git-pro…
vaibssingh Mar 14, 2024
181cc4b
fix: remove unused dependency
vaibssingh Mar 14, 2024
51d238e
Merge branch 'main' into 412-fix-codeql-issues
JamieSlome Mar 18, 2024
28665e9
Merge branch 'main' into 412-fix-codeql-issues
JamieSlome Mar 20, 2024
4576458
Merge branch 'main' into 412-fix-codeql-issues
JamieSlome Mar 20, 2024
d6a2a7c
Merge branch 'main' into 412-fix-codeql-issues
JamieSlome Mar 21, 2024
3b72b1b
chore: remove dotenv from package-lock.json
JamieSlome Mar 21, 2024
d8cf1a6
Merge branch 'main' into 412-fix-codeql-issues
JamieSlome Mar 21, 2024
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
47 changes: 47 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,18 @@
"concurrently": "^8.0.0",
"cors": "^2.8.5",
"diff2html": "^3.4.33",
"dotenv": "^16.4.5",
vaibssingh marked this conversation as resolved.
Show resolved Hide resolved
"email-validator": "^2.0.4",
"express": "^4.18.2",
"express-http-proxy": "^2.0.0",
"express-rate-limit": "^7.1.5",
"express-session": "^1.17.1",
"generate-password": "^1.5.1",
"history": "5.3.0",
"jsonschema": "^1.4.1",
"load-plugin": "^6.0.0",
"lodash": "^4.17.21",
"lusca": "^1.7.0",
"moment": "^2.29.4",
"mongodb": "^5.0.0",
"nodemailer": "^6.6.1",
Expand Down
12 changes: 11 additions & 1 deletion src/service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ const session = require('express-session');
const http = require('http');
const cors = require('cors');
const app = express();
require('dotenv').config();
vaibssingh marked this conversation as resolved.
Show resolved Hide resolved
const rateLimit = require('express-rate-limit');
const csrf = require('lusca').csrf;

const limiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100, // limit each IP to 100 requests per windowMs
});
vaibssingh marked this conversation as resolved.
Show resolved Hide resolved

const { GIT_PROXY_UI_PORT: uiPort } = require('../config/env').Vars;

Expand All @@ -16,18 +24,20 @@ const corsOptions = {
};

const start = async () => {
// confiugraiton of passport is async
// configuration of passport is async
// Before we can bind the routes - we need the passport
const passport = await require('./passport').configure();
const routes = require('./routes');
app.use(cors(corsOptions));
app.use(limiter);
app.use(
session({
secret: 'keyboard cat',
resave: false,
saveUninitialized: false,
}),
);
app.use(csrf());
app.use(passport.initialize());
app.use(passport.session());
app.use(express.json());
Expand Down
7 changes: 6 additions & 1 deletion src/service/routes/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@
throw new Error('current password did not match the given');
}
} catch (e) {
res.status(500).send(e).end();
res

Check warning on line 120 in src/service/routes/auth.js

View check run for this annotation

Codecov / codecov/patch

src/service/routes/auth.js#L120

Added line #L120 was not covered by tests
.status(500)
.send({
message: 'An error occurred',
})
.end();
}
} else {
res.status(401).end();
Expand Down