Skip to content

fix(a5): improve stegonography security configuration - #659

Open
gabrielesequeira wants to merge 1 commit into
globocom:masterfrom
gabrielesequeira:feature/a5-stegonography
Open

gabrielesequeira wants to merge 1 commit into
globocom:masterfrom
gabrielesequeira:feature/a5-stegonography

Conversation

@gabrielesequeira

Copy link
Copy Markdown

This solution refers to which of the apps?

A5 - Security Misconfiguration (Stegonography)

What did you do to mitigate the vulnerability?

  • Replaced the hardcoded administrator password with an environment variable (ADMIN_PASSWORD), generated through the environment configuration script.
  • Implemented bcrypt password hashing to securely store administrator passwords and validation of this login credentials verifications
  • Replaced throw err statements with controlled error handling to prevent exposing internal exceptions and stack details to users, returning generic error responses instead.- Disabled the X-Powered-By HTTP header to prevent exposing the Express technology information.
  • Hardened session cookies using HttpOnly, SameSite=Strict, and Secure in production.
  • Configured JWT signing using the environment variable SECRET
  • Enabled MongoDB authentication using mongod --auth.
  • Updated the MongoDB connection URI to use environment-based credentials and authSource=admin.
  • Upgraded the application runtime from Node.js 8.15.1 to Node.js 22 using node:22-bookworm-slim to suport the updates.
  • Added bcrypt as an application dependency and updated package-lock.json.

Did you test your changes? What commands did you run?

Yes. Changes were tested locally and manually.

Commands executed:

make install
docker exec Stegonography_api node -v
docker logs Stegonography_api --tail 100

Test results:

  • Confirmed Node.js v22.23.5.
  • Confirmed successful application startup.
  • Confirmed authenticated MongoDB connection.
  • Confirmed administrator creation and successful login.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant