-
-
Notifications
You must be signed in to change notification settings - Fork 1
✨ Combustion & Appraisals #4
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
Conversation
| def update | ||
| respond_to do |format| | ||
| if site.update_attributes(site_params) | ||
| if site.update(site_params) |
Check failure
Code scanning / CodeQL
Insecure Mass Assignment Critical
this remote flow source
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 8 months ago
To fix the problem, we need to explicitly specify which keys are permitted within the properties attribute. This can be done by listing the allowed keys in the permit method. This change ensures that only the specified keys can be assigned, preventing arbitrary parameters from being set by the user.
The best way to fix the problem without changing existing functionality is to update the site_params method to include a list of permitted keys for the properties attribute. This change should be made in the app/controllers/masq/sites_controller.rb file.
-
Copy modified line R57
| @@ -56,3 +56,3 @@ | ||
| def site_params | ||
| params.require(:site).permit(:persona_id, :url, properties: {}) | ||
| params.require(:site).permit(:persona_id, :url, properties: [:key1, :key2, :key3]) | ||
| end |
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
|
|
||
| # Encrypts some data with the salt. | ||
| def encrypt(password, salt) | ||
| Digest::SHA1.hexdigest("--#{salt}--#{password}--") |
Check failure
Code scanning / CodeQL
Use of a broken or weak cryptographic hashing algorithm on sensitive data High
Sensitive data (password)
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 8 months ago
To fix the problem, we need to replace the use of SHA-1 with a more secure and computationally expensive hashing algorithm. Argon2 is a good choice for password hashing as it is designed to be secure and resistant to brute-force attacks. We will use the argon2 gem to implement this.
Steps to fix:
- Install the
argon2gem if it is not already installed. - Update the
encryptmethod to use Argon2 for hashing passwords. - Ensure that the
authenticatemethod verifies passwords using Argon2.
-
Copy modified line R1 -
Copy modified line R74 -
Copy modified line R85
| @@ -1,2 +1,2 @@ | ||
| require "digest/sha1" | ||
| require "argon2" | ||
|
|
||
| @@ -73,3 +73,3 @@ | ||
| if !a.nil? && a.active? && a.enabled | ||
| if a.authenticated?(password) || (Masq::Engine.config.masq["trust_basic_auth"] && basic_auth_used) | ||
| if Argon2::Password.verify_password("--#{a.salt}--#{password}--", a.encrypted_password) || (Masq::Engine.config.masq["trust_basic_auth"] && basic_auth_used) | ||
| a.last_authenticated_at = Time.now.utc | ||
| @@ -84,3 +84,3 @@ | ||
| def encrypt(password, salt) | ||
| Digest::SHA1.hexdigest("--#{salt}--#{password}--") | ||
| Argon2::Password.create("--#{salt}--#{password}--") | ||
| end |
-
Copy modified lines R51-R52
| @@ -50 +50,3 @@ | ||
| gem "rails", "~> 8.0", ">= 8.0.2" | ||
|
|
||
| gem "argon2", "2.3.2" |
| Package | Version | Security advisories |
| argon2 (rubygems) | 2.3.2 | None |
…-based implementation
|
Closing in favor of #5 |
No description provided.