fix: CWE-256 in src/main/java/org/cysecurity/cspf/jvl/controller/Register.java - #46
Open
sudhakarkr wants to merge 1 commit into
Open
fix: CWE-256 in src/main/java/org/cysecurity/cspf/jvl/controller/Register.java#46sudhakarkr wants to merge 1 commit into
sudhakarkr wants to merge 1 commit into
Conversation
…ster.java The finding flags cleartext storage of passwords (CWE-256): the raw `password` request parameter was inserted directly into the `users` table. I added a minimal `hashPassword` helper that derives a salted, iterated SHA-256 hash using `java.security` classes already available in the JRE (no new dependencies), producing a self-describing `iterations$salt$hash` string. The INSERT now stores `hashedPass` instead of the cleartext `pass`. On hash algorithm failure the request fails closed by redirecting to Register.jsp. All other logic, signatures, and the surrounding (separate) SQL-injection concern are left unchanged, keeping the patch narrowly scoped to the reported CWE-256 issue.
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.
Automated code fix — CWE-256
File:
src/main/java/org/cysecurity/cspf/jvl/controller/Register.javaSeverity: high
Lane: code-fix
Skill used:
default-secure-codingAssessment
Rationale
The finding flags cleartext storage of passwords (CWE-256): the raw
passwordrequest parameter was inserted directly into theuserstable. I added a minimalhashPasswordhelper that derives a salted, iterated SHA-256 hash usingjava.securityclasses already available in the JRE (no new dependencies), producing a self-describingiterations$salt$hashstring. The INSERT now storeshashedPassinstead of the cleartextpass. On hash algorithm failure the request fails closed by redirecting to Register.jsp. All other logic, signatures, and the surrounding (separate) SQL-injection concern are left unchanged, keeping the patch narrowly scoped to the reported CWE-256 issue.Validation
Opened by the vulnerability management platform after human approval.