Skip to content

fix(a2): secure passwords and enable HTTPS in Snake Pro - #656

Closed
gabrielesequeira wants to merge 2 commits into
globocom:masterfrom
gabrielesequeira:feature/a2-snake-pro
Closed

gabrielesequeira wants to merge 2 commits into
globocom:masterfrom
gabrielesequeira:feature/a2-snake-pro

Conversation

@gabrielesequeira

@gabrielesequeira gabrielesequeira commented Oct 23, 2026 •

Copy link
Copy Markdown

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 bcrypt

During the implementation, I identified the need to securely store user passwords during registration and verify them during authentication.

The RegisterUser function handles user registration, while CheckPass verifies 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 Pro

To enable HTTPS communication between the browser and the API, I updated the server startup configuration to use Echo's StartTLS method.

I also created deployments/generate-certs.go to 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:

  • Verified that HTTPS requests reach the application successfully.
  • Verified that plain HTTP requests are rejected by the HTTPS server.
  • Configured Docker Compose to mount the TLS certificate and private key inside the API container.
  • Integrated automatic certificate generation into the project setup workflow.

@vitor-mauricio

Copy link
Copy Markdown

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).🐼 🚀

@vitor-mauricio vitor-mauricio added mitigation solution 🔒 This is a possible way to fix this vulnerability SnakePro labels Nov 11, 2026
@gabrielesequeira

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mitigation solution 🔒 This is a possible way to fix this vulnerability SnakePro

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants