Repository navigation
fix(a2): secure passwords and enable HTTPS in Snake Pro - #656
Closed
gabrielesequeira wants to merge 2 commits into
Closed
gabrielesequeira wants to merge 2 commits into
gabrielesequeira wants to merge 2 commits into
Conversation
|
Nice @gabrielesequeira , with your changes, I was not able to reproduce the attack anymore!! I really liked your choices -using bcrypt for password hashing, implementing HTTPS, and taking security into account (though in a production environment, the certificates should be issued by a trusted certificate authority).🐼 🚀 |
Author
|
Yes, exactly! Trusted Certificate Authorities are responsible for issuing valid certificates. In this lab, I just simulated the certificate creation to make the setup closer to a real-world implementation. That's why the browser still displays the warning and the option to proceed when it doesn't trust the address, even though HTTPS is already enabled in the URL. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This solution refers to which of the apps?
A2 - Cryptographic Failures - SnakePro
What did you do to mitigate the vulnerability?
Implemented two security improvements to protect user credentials and data transmission in Snake Pro.
Commit 1 —
fix(a2): hash user passwords with bcryptDuring the implementation, I identified the need to securely store user passwords during registration and verify them during authentication.
The
RegisterUserfunction handles user registration, whileCheckPassverifies the password when a user attempts to log in. To protect user credentials, I integrated bcrypt into the application.Instead of storing passwords in plain text, the application stores password hashes. During authentication, bcrypt compares the submitted password against the stored hash, allowing credentials to be verified without storing the original password.
Commit 2 —
fix(a2): add HTTPS support to Snake ProTo enable HTTPS communication between the browser and the API, I updated the server startup configuration to use Echo's
StartTLSmethod.I also created
deployments/generate-certs.goto automatically generate the server's TLS certificate and private key. The Docker Compose configuration mounts these files inside the API container through a volume, making them available to the application.Additionally, I integrated certificate generation into the Makefile installation workflow, allowing the TLS files to be generated automatically during the initial project setup.
Security considerations :
The generated certificate is intended for local development and testing. Production deployments should use a certificate issued by a trusted certificate authority and protect the private key appropriately.
Did you test your changes? What commands did you run?
Yes. I performed validation to verify the HTTPS implementation and its configuration.
The validation included: