-
Notifications
You must be signed in to change notification settings - Fork 19
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
improve(feat): Imagebuild and Imagesize #876
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you think of a healthcheck of the running application in the container please?
RUN apk --no-cache add \
openssl=3.0.14-r0 \
python3=3.10.14-r1 \
make=4.3-r1 \
g++=12.2.1_git20220924-r4 \
gcc=12.2.1_git20220924-r4 this makes the image double it size! |
i had to remove bcrypt because of its deps to python and openssl... it add extra ~400-500 MB to each image! https://www.npmjs.com/package/bcrypt
|
at this stage we just connect and disconnect! |
callback(null, false); | ||
} | ||
}); | ||
const hash = createHash("sha512").update(password).digest("hex") |
Check failure
Code scanning / CodeQL
Use of password hash with insufficient computational effort High
an access to password
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 3 months ago
To fix the problem, we need to replace the use of the sha512
hashing algorithm with a more secure password hashing algorithm, such as bcrypt
. This will involve:
- Importing the
bcrypt
library. - Modifying the
isValidUserAsync
function to usebcrypt
for password hashing and comparison. - Ensuring that the
bcrypt
library is installed as a dependency.
-
Copy modified line R23 -
Copy modified lines R55-R56
@@ -22,3 +22,3 @@ | ||
import { green, red } from './utils/log'; | ||
import { createHash } from 'crypto'; | ||
import * as bcrypt from 'bcrypt'; | ||
|
||
@@ -54,4 +54,4 @@ | ||
if (user) { | ||
const hash = createHash("sha512").update(password).digest("hex") | ||
if (hash === user.password) { | ||
const isMatch = bcrypt.compareSync(password, user.password); | ||
if (isMatch) { | ||
green(` User:'${user.username}' logged in as '${user.roles}'! `); |
-
Copy modified lines R34-R35
@@ -33,3 +33,4 @@ | ||
"node-opcua-server-discovery": "2.133.0", | ||
"yargs": "17.7.2" | ||
"yargs": "17.7.2", | ||
"bcrypt": "^5.1.1" | ||
}, |
Package | Version | Security advisories |
bcrypt (npm) | 5.1.1 | None |
@@ -32,7 +32,7 @@ | |||
this.userList.push(Object.freeze({ | |||
username: user.username, | |||
roles: user.roles, | |||
password: hashSync(user.password, genSaltSync()) | |||
password: createHash("sha512").update(user.password).digest("hex") |
Check failure
Code scanning / CodeQL
Use of password hash with insufficient computational effort High
an access to password
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 3 months ago
To fix the problem, we need to replace the use of the sha512
hashing algorithm with a more secure password hashing scheme. The bcrypt
library is a good choice for this purpose as it is specifically designed for hashing passwords securely.
- First, we need to install the
bcrypt
library if it is not already installed. - Then, we need to import the
bcrypt
library in the file. - Finally, we need to replace the
createHash("sha512").update(user.password).digest("hex")
line withbcrypt.hashSync(user.password, saltRounds)
, wheresaltRounds
is a parameter that defines the computational cost of the hashing process.
-
Copy modified line R16 -
Copy modified line R35
@@ -15,3 +15,3 @@ | ||
import { writeFileSync } from 'fs' | ||
import { createHash } from 'crypto'; | ||
import * as bcrypt from 'bcrypt'; | ||
|
||
@@ -34,3 +34,3 @@ | ||
roles: user.roles, | ||
password: createHash("sha512").update(user.password).digest("hex") | ||
password: bcrypt.hashSync(user.password, 10) | ||
})) |
-
Copy modified lines R34-R35
@@ -33,3 +33,4 @@ | ||
"node-opcua-server-discovery": "2.133.0", | ||
"yargs": "17.7.2" | ||
"yargs": "17.7.2", | ||
"bcrypt": "^5.1.1" | ||
}, |
Package | Version | Security advisories |
bcrypt (npm) | 5.1.1 | None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot ... i dont want bcrypt... grrr!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebase and decide what to do with the cryptography feedback from GitHub.
Send you two possible alternatives.
No description provided.