1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-10 19:34:34 +00:00

Compare commits

..

2 Commits

Author SHA1 Message Date
Trevor Moody
2f5421600e build: axios package dependency changes. Missing type added in Group.ts 2025-09-16 15:01:11 +01:00
Trevor Moody
1c4f5fc421 build: updated axios and jsonwebtoken versions 2025-09-16 11:52:06 +01:00
15 changed files with 22148 additions and 7438 deletions

View File

@@ -5,7 +5,7 @@ on:
jobs:
lint:
runs-on: ubuntu-22.04
runs-on: ubuntu-20.04
strategy:
matrix:
@@ -28,7 +28,7 @@ jobs:
run: npm run lint-web
build-api:
runs-on: ubuntu-22.04
runs-on: ubuntu-20.04
strategy:
matrix:
@@ -66,7 +66,7 @@ jobs:
CI: true
build-web:
runs-on: ubuntu-22.04
runs-on: ubuntu-20.04
strategy:
matrix:

View File

@@ -7,7 +7,7 @@ on:
jobs:
release:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
strategy:
matrix:

View File

@@ -1,22 +1,3 @@
## [0.39.3](https://github.com/sasjs/server/compare/v0.39.2...v0.39.3) (2025-11-25)
### Bug Fixes
* (deps) bump @sasjs/core to 4.59.7 ([ab96653](https://github.com/sasjs/server/commit/ab966535642d08d4e8e984007b98c8fdffbe30f7))
* (deps) rerun npm i to sync ([225f381](https://github.com/sasjs/server/commit/225f381bdf8ad5aa2af8d75648df1dd5175e12e0))
## [0.39.2](https://github.com/sasjs/server/compare/v0.39.1...v0.39.2) (2025-09-25)
### Bug Fixes
* addressing test fail ([e51b204](https://github.com/sasjs/server/commit/e51b20421adc1598ea267c79b1fb4dbc085f97b9))
* packages missmatch ([379ea60](https://github.com/sasjs/server/commit/379ea604bcb5686b5299fae6a32f759c45b275ea))
* type libs ([6d123c3](https://github.com/sasjs/server/commit/6d123c3e23628c1d703eaa13142c77f0da970a55))
* typescript errors ([631e956](https://github.com/sasjs/server/commit/631e95604b64b1a96f2abade659348618f3b00b2))
* typescript errors ([198cd79](https://github.com/sasjs/server/commit/198cd79354254511c21ac1acfbf7b6bcfdab2af7))
## [0.39.1](https://github.com/sasjs/server/compare/v0.39.0...v0.39.1) (2025-03-13)

19329
api/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -48,25 +48,25 @@
},
"author": "4GL Ltd",
"dependencies": {
"@sasjs/core": "^4.59.7",
"@sasjs/utils": "^3.5.2",
"@sasjs/core": "^4.40.1",
"@sasjs/utils": "3.2.0",
"bcryptjs": "^2.4.3",
"connect-mongo": "^5.1.0",
"cookie-parser": "^1.4.7",
"connect-mongo": "^4.6.0",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"express": "^4.21.2",
"express-session": "^1.18.2",
"express": "^4.17.1",
"express-session": "^1.17.2",
"helmet": "^5.0.2",
"joi": "^17.4.2",
"jsonwebtoken": "^9.0.2",
"ldapjs": "2.3.3",
"mongoose": "^6.13.8",
"morgan": "^1.10.1",
"mongoose": "^6.0.12",
"morgan": "^1.10.0",
"multer": "^1.4.5-lts.1",
"rate-limiter-flexible": "2.4.1",
"rotating-file-stream": "^3.0.4",
"swagger-ui-express": "4.3.0",
"unzipper": "^0.12.3",
"unzipper": "^0.10.11",
"url": "^0.10.3"
},
"devDependencies": {
@@ -76,12 +76,12 @@
"@types/cors": "^2.8.12",
"@types/express": "^4.17.12",
"@types/express-session": "^1.17.4",
"@types/jest": "^29.5.0",
"@types/jest": "^26.0.24",
"@types/jsonwebtoken": "^8.5.5",
"@types/ldapjs": "^2.2.4",
"@types/morgan": "^1.9.3",
"@types/multer": "^1.4.7",
"@types/node": "^20.0.0",
"@types/node": "^15.12.2",
"@types/supertest": "^2.0.11",
"@types/swagger-ui-express": "^4.1.3",
"@types/unzipper": "^0.10.5",
@@ -90,18 +90,18 @@
"csrf": "^3.1.0",
"dotenv": "^16.0.1",
"http-headers-validation": "^0.0.1",
"jest": "^29.7.0",
"jest": "^27.0.6",
"mongodb-memory-server": "8.11.4",
"nodejs-file-downloader": "4.10.2",
"nodemon": "^3.0.0",
"nodemon": "^2.0.7",
"pkg": "5.6.0",
"prettier": "^3.0.0",
"prettier": "^2.3.1",
"rimraf": "^3.0.2",
"supertest": "^6.1.3",
"ts-jest": "^29.1.0",
"ts-jest": "^27.0.3",
"ts-node": "^10.0.0",
"tsoa": "3.14.1",
"typescript": "^5.0.0"
"typescript": "^4.3.2"
},
"nodemonConfig": {
"ignore": [

File diff suppressed because one or more lines are too long

View File

@@ -234,10 +234,9 @@ const verifyAuthCode = async (
jwt.verify(code, process.secrets.AUTH_CODE_SECRET, (err, data) => {
if (err) return resolve(undefined)
const payload = data as InfoJWT
const clientInfo: InfoJWT = {
clientId: payload?.clientId,
userId: payload?.userId
clientId: data?.clientId,
userId: data?.userId
}
if (clientInfo.clientId === clientId) {
return resolve(clientInfo)

View File

@@ -106,10 +106,7 @@ const login = async (
const rateLimiter = RateLimiter.getInstance()
if (!validPass) {
const retrySecs = await rateLimiter.consume(
req.ip || 'unknown',
user?.username
)
const retrySecs = await rateLimiter.consume(req.ip, user?.username)
if (retrySecs > 0) throw errors.tooManyRequests(retrySecs)
}
@@ -117,7 +114,7 @@ const login = async (
if (!validPass) throw errors.invalidPassword
// Reset on successful authorization
rateLimiter.resetOnSuccess(req.ip || 'unknown', user.username)
rateLimiter.resetOnSuccess(req.ip, user.username)
req.session.loggedIn = true
req.session.user = {

View File

@@ -37,10 +37,10 @@ export const authenticateAccessToken: RequestHandler = async (
if (user.isActive) {
req.user = user
return csrfProtection(req, res, nextFunction)
} else return res.status(401).send('Unauthorized')
} else return res.sendStatus(401)
}
}
return res.status(401).send('Unauthorized')
return res.sendStatus(401)
}
await authenticateToken(
@@ -118,6 +118,6 @@ const authenticateToken = async (
return next()
}
res.status(401).send('Unauthorized')
res.sendStatus(401)
}
}

View File

@@ -3,7 +3,7 @@ import { convertSecondsToHms } from '@sasjs/utils'
import { RateLimiter } from '../utils'
export const bruteForceProtection: RequestHandler = async (req, res, next) => {
const ip = req.ip || 'unknown'
const ip = req.ip
const username = req.body.username
const rateLimiter = RateLimiter.getInstance()

View File

@@ -277,10 +277,7 @@ const performLogin = async (
.set('x-xsrf-token', csrfToken)
.send(credentials)
return {
authCookies:
(header['set-cookie'] as unknown as string[] | undefined)?.join() || ''
}
return { authCookies: header['set-cookie'].join() }
}
const extractCSRF = (text: string) =>

View File

@@ -1,6 +1,5 @@
import jwt from 'jsonwebtoken'
import User from '../model/User'
import { InfoJWT } from '../types/InfoJWT'
const isValidToken = async (
token: string,
@@ -12,8 +11,7 @@ const isValidToken = async (
jwt.verify(token, key, (err, decoded) => {
if (err) return reject(false)
const payload = decoded as InfoJWT
if (payload?.userId === userId && payload?.clientId === clientId) {
if (decoded?.userId === userId && decoded?.clientId === clientId) {
return resolve(true)
}

6292
package-lock.json generated

File diff suppressed because it is too large Load Diff

3867
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -21,6 +21,7 @@
"@types/react": "^17.0.27",
"axios": "^1.12.2",
"monaco-editor": "^0.33.0",
"monaco-editor-webpack-plugin": "^7.0.1",
"react": "^17.0.2",
"react-copy-to-clipboard": "^5.1.0",
"react-dom": "^17.0.2",
@@ -53,7 +54,6 @@
"eslint-webpack-plugin": "^3.1.1",
"file-loader": "^6.2.0",
"html-webpack-plugin": "5.5.0",
"monaco-editor-webpack-plugin": "^7.0.1",
"path": "0.12.7",
"prettier": "^2.4.1",
"sass": "^1.44.0",
@@ -62,7 +62,7 @@
"ts-loader": "^9.2.6",
"typescript": "^4.5.2",
"typescript-plugin-css-modules": "^5.0.1",
"webpack": "5.64.3",
"webpack": "^5.101.3",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "4.7.4"
},