-
Notifications
You must be signed in to change notification settings - Fork 110
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
Release/v2.4.5 #570
Release/v2.4.5 #570
Conversation
improve template download
Fix / Cors headers not applied
Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6. - [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md) - [Commits](moxystudio/node-cross-spawn@v7.0.3...v7.0.6) --- updated-dependencies: - dependency-name: cross-spawn dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]>
…tartup Feature/improve standallone startup
…t/cross-spawn-7.0.6 Bump cross-spawn from 7.0.3 to 7.0.6 in /client
add search and category select fields
//this.dotenv.KUBECONFIG_BASE64 = Buffer.from(this.kubeConfig).toString('base64') | ||
this.dotenv.KUBERO_CONTEXT = this.kubeContext | ||
this.dotenv.KUBERO_SESSION_KEY = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15) | ||
this.dotenv.KUBERO_WEBHOOK_SECRET = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15) |
Check failure
Code scanning / CodeQL
Insecure randomness High
Math.random()
This uses a cryptographically insecure random number generated at
Math.random()
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 16 days ago
To fix the problem, we need to replace the use of Math.random()
with a cryptographically secure random number generator. In the browser environment, we can use window.crypto.getRandomValues
to generate secure random values. This will ensure that the generated session keys and webhook secrets are not easily predictable.
We will modify the generateConfig
method to use window.crypto.getRandomValues
instead of Math.random()
. Specifically, we will generate a secure random string by converting random bytes to a base64 string.
-
Copy modified lines R531-R537
@@ -530,6 +530,10 @@ | ||
this.dotenv.KUBERO_CONTEXT = this.kubeContext | ||
this.dotenv.KUBERO_SESSION_KEY = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15) | ||
this.dotenv.KUBERO_WEBHOOK_SECRET = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15) | ||
this.dotenv.KUBERO_SESSION_KEY = this.generateSecureRandomString(30) | ||
this.dotenv.KUBERO_WEBHOOK_SECRET = this.generateSecureRandomString(30) | ||
}, | ||
generateSecureRandomString(length) { | ||
const array = new Uint8Array(length); | ||
window.crypto.getRandomValues(array); | ||
return Array.from(array, byte => ('0' + byte.toString(36)).slice(-2)).join('').substring(0, length); | ||
} | ||
}, | ||
}) |
@@ -66,6 +67,55 @@ | |||
res.send(await req.app.locals.settings.getDefaultRegistry()); | |||
}); | |||
|
|||
Router.post('/config/k8s/kubeconfig/validate', authMiddleware, async function (req: Request, res: Response) { |
Check failure
Code scanning / CodeQL
Missing rate limiting High
authorization
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 16 days ago
To fix the problem, we need to introduce rate limiting to the route handlers in the server/src/routes/config.ts
file. The best way to do this is by using the express-rate-limit
package, which allows us to easily set up rate limiting middleware. We will configure a rate limiter and apply it to the specific routes that perform potentially expensive operations.
- Install the
express-rate-limit
package. - Import the
express-rate-limit
package in theserver/src/routes/config.ts
file. - Configure a rate limiter with appropriate settings (e.g., maximum number of requests per minute).
- Apply the rate limiter to the relevant route handlers.
-
Copy modified line R3 -
Copy modified lines R12-R15 -
Copy modified line R75
@@ -2,2 +2,3 @@ | ||
import { Auth } from '../modules/auth'; | ||
import rateLimit from 'express-rate-limit'; | ||
|
||
@@ -10,2 +11,6 @@ | ||
|
||
const limiter = rateLimit({ | ||
windowMs: 15 * 60 * 1000, // 15 minutes | ||
max: 100, // limit each IP to 100 requests per windowMs | ||
}); | ||
|
||
@@ -69,3 +74,3 @@ | ||
|
||
Router.post('/config/k8s/kubeconfig/validate', authMiddleware, async function (req: Request, res: Response) { | ||
Router.post('/config/k8s/kubeconfig/validate', authMiddleware, limiter, async function (req: Request, res: Response) { | ||
// #swagger.tags = ['UI'] |
-
Copy modified lines R52-R53
@@ -51,3 +51,4 @@ | ||
"uuid": "^8.3.2", | ||
"yaml": "^2.1.1" | ||
"yaml": "^2.1.1", | ||
"express-rate-limit": "^7.5.0" | ||
}, |
Package | Version | Security advisories |
express-rate-limit (npm) | 7.5.0 | None |
res.send(result); | ||
}); | ||
|
||
Router.post('/config/setup/save', authMiddleware, async function (req: Request, res: Response) { |
Check failure
Code scanning / CodeQL
Missing rate limiting High
authorization
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 16 days ago
To fix the problem, we need to introduce rate limiting to the route handlers that perform authorization and other potentially expensive operations. The best way to do this is by using the express-rate-limit
package, which allows us to easily set up and apply rate limiting middleware to our routes.
- Install the
express-rate-limit
package. - Import the
express-rate-limit
package in theserver/src/routes/config.ts
file. - Set up a rate limiter with appropriate configuration (e.g., maximum number of requests per time window).
- Apply the rate limiter to the relevant routes.
-
Copy modified line R3 -
Copy modified lines R12-R15 -
Copy modified line R74 -
Copy modified line R85
@@ -2,2 +2,3 @@ | ||
import { Auth } from '../modules/auth'; | ||
import rateLimit from 'express-rate-limit'; | ||
|
||
@@ -10,2 +11,6 @@ | ||
|
||
const limiter = rateLimit({ | ||
windowMs: 15 * 60 * 1000, // 15 minutes | ||
max: 100, // limit each IP to 100 requests per windowMs | ||
}); | ||
|
||
@@ -14,3 +19,2 @@ | ||
debug('app:routes') | ||
|
||
Router.get('/config', authMiddleware, async function (req: Request, res: Response) { | ||
@@ -69,3 +73,3 @@ | ||
|
||
Router.post('/config/k8s/kubeconfig/validate', authMiddleware, async function (req: Request, res: Response) { | ||
Router.post('/config/k8s/kubeconfig/validate', limiter, authMiddleware, async function (req: Request, res: Response) { | ||
// #swagger.tags = ['UI'] | ||
@@ -80,3 +84,3 @@ | ||
|
||
Router.post('/config/setup/save', authMiddleware, async function (req: Request, res: Response) { | ||
Router.post('/config/setup/save', limiter, authMiddleware, async function (req: Request, res: Response) { | ||
// #swagger.tags = ['UI'] |
-
Copy modified lines R52-R53
@@ -51,3 +51,4 @@ | ||
"uuid": "^8.3.2", | ||
"yaml": "^2.1.1" | ||
"yaml": "^2.1.1", | ||
"express-rate-limit": "^7.5.0" | ||
}, |
Package | Version | Security advisories |
express-rate-limit (npm) | 7.5.0 | None |
res.send(resultUpdateConfig); | ||
}); | ||
|
||
Router.get('/config/setup/check/:component', authMiddleware, async function (req: Request, res: Response) { |
Check failure
Code scanning / CodeQL
Missing rate limiting High
authorization
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 16 days ago
To fix the problem, we need to introduce rate limiting to the route handlers in the server/src/routes/config.ts
file. We will use the express-rate-limit
package to achieve this. The rate limiter will be configured to allow a maximum of 100 requests per 15 minutes for each IP address. This will help prevent abuse and potential denial-of-service attacks.
- Install the
express-rate-limit
package. - Import the
express-rate-limit
package in theserver/src/routes/config.ts
file. - Configure the rate limiter with appropriate settings.
- Apply the rate limiter to the route handlers that perform potentially expensive operations.
-
Copy modified line R3 -
Copy modified lines R11-R14 -
Copy modified line R62 -
Copy modified line R68 -
Copy modified line R74 -
Copy modified line R85 -
Copy modified line R114 -
Copy modified line R124
@@ -2,2 +2,3 @@ | ||
import { Auth } from '../modules/auth'; | ||
import rateLimit from 'express-rate-limit'; | ||
|
||
@@ -9,3 +10,6 @@ | ||
export const bearerMiddleware = auth.getBearerMiddleware(); | ||
|
||
const limiter = rateLimit({ | ||
windowMs: 15 * 60 * 1000, // 15 minutes | ||
max: 100, // limit each IP to 100 requests per windowMs | ||
}); | ||
|
||
@@ -57,3 +61,3 @@ | ||
|
||
Router.get('/config/buildpacks', authMiddleware, async function (req: Request, res: Response) { | ||
Router.get('/config/buildpacks', authMiddleware, limiter, async function (req: Request, res: Response) { | ||
// #swagger.tags = ['UI'] | ||
@@ -63,3 +67,3 @@ | ||
|
||
Router.get('/config/registry', authMiddleware, async function (req: Request, res: Response) { | ||
Router.get('/config/registry', authMiddleware, limiter, async function (req: Request, res: Response) { | ||
// #swagger.tags = ['UI'] | ||
@@ -69,3 +73,3 @@ | ||
|
||
Router.post('/config/k8s/kubeconfig/validate', authMiddleware, async function (req: Request, res: Response) { | ||
Router.post('/config/k8s/kubeconfig/validate', authMiddleware, limiter, async function (req: Request, res: Response) { | ||
// #swagger.tags = ['UI'] | ||
@@ -80,3 +84,3 @@ | ||
|
||
Router.post('/config/setup/save', authMiddleware, async function (req: Request, res: Response) { | ||
Router.post('/config/setup/save', authMiddleware, limiter, async function (req: Request, res: Response) { | ||
// #swagger.tags = ['UI'] | ||
@@ -109,3 +113,3 @@ | ||
|
||
Router.get('/config/setup/check/:component', authMiddleware, async function (req: Request, res: Response) { | ||
Router.get('/config/setup/check/:component', authMiddleware, limiter, async function (req: Request, res: Response) { | ||
// #swagger.tags = ['UI'] | ||
@@ -119,3 +123,3 @@ | ||
|
||
Router.get('/cli/config/k8s/context', bearerMiddleware, async function (req: Request, res: Response) { | ||
Router.get('/cli/config/k8s/context', bearerMiddleware, limiter, async function (req: Request, res: Response) { | ||
// #swagger.tags = ['Config'] |
-
Copy modified lines R52-R53
@@ -51,3 +51,4 @@ | ||
"uuid": "^8.3.2", | ||
"yaml": "^2.1.1" | ||
"yaml": "^2.1.1", | ||
"express-rate-limit": "^7.5.0" | ||
}, |
Package | Version | Security advisories |
express-rate-limit (npm) | 7.5.0 | None |
Description
Fixes # (issue)
Type of change
How Has This Been Tested?
Test Configuration:
Checklist: