I am trying to eliminate false positives from an HP Fortify scan of a Java application.
This method causes a "privacy violation" problem (PrintWriter - servlet response)
private void writeOutput(String passwordRules, PrintWriter out) { ... out.print(passwordRules); ... }
This is because Fortify follows naming conventions to decide that passwordRules contains personal data. But my passwordRules not personal data - it contains things like "At least 8 characters."
I can remove the error by changing the variable name. However, in principle, I do not want to compromise the readability of my code in the interests of the source code analyzer.
I expected this to fix:
private void writeOutput(@FortifyNotPassword String passwordRules, PrintWriter out) ...
However, it seems the annotation is not written for this context:
The annotation @FortifyNotPassword is disallowed for this location.
I tried:
private void writeOutput(String passwordRules, PrintWriter out) { ... @FortifyNotPassword String rules = passwordRules; out.print(rules); ... }
... but this does not remove the false positive. (And it jeopardizes my principle of not making the code less readable).
I also tried above with @FortifyNotPrivate with the same results.
So what is the right way to do this?
source share