testable-eu / sast-testability-patterns

Testability Pattern Catalogs for SAST
https://owasp.org/www-project-testability-patterns-for-web-applications/
Apache License 2.0
29 stars 2 forks source link

Update TP: JS - 48 #47

Open compaluca opened 1 year ago

compaluca commented 1 year ago

Testability pattern

JS pattern 48. It has only one instance.

Problem statement

There is a single pattern instance and it is not having a vulnerability. The expectation in that json file should be fixed. However, other changes could be proposed.

Proposed changes

The obstacle code seems to focus on a variable comparison where one of the variable a is attacker-controlled and b is a constant. However, this variable is strictly constrained to the constant when the dangerous operation is applied:

if(a === b){
            //no vulnerability
            res.write(a);
        }

Multiple instances could then be created:

Other