# Avoiding false-positives When you run Psalm’s taint analysis for the first time you may see a bunch of false-positives. Nobody likes false-positives! There are a number of ways you can prevent them: ## Escaping tainted input Some operations remove taints from data – for example, wrapping `$_GET['name']` in an `htmlentities` call prevents cross-site-scripting attacks in that `$_GET` call. Psalm allows you to remove taints via a `@psalm-taint-escape ` annotation: ```php '], '', $str); echo $str; } echoVar($_GET["text"]); ``` ## Specializing taints in functions For functions, methods and classes you can use the `@psalm-taint-specialize` annotation. ```php name = $name; } } /** * @psalm-taint-specialize */ function echoUserName(User $user) { echo $user->name; // Error, detected tainted input } $user1 = new User("Keith"); $user2 = new User($_GET["name"]); echoUserName($user1); ``` Adding `@psalm-taint-specialize` to the class fixes the issue. ```php name = $name; } } /** * @psalm-taint-specialize */ function echoUserName(User $user) { echo $user->name; // No error } $user1 = new User("Keith"); $user2 = new User($_GET["name"]); echoUserName($user1); ``` And, because it’s form of purity enforcement, `@psalm-immutable` can also be used: ```php name = $name; } } /** * @psalm-taint-specialize */ function echoUserName(User $user) { echo $user->name; // No error } $user1 = new User("Keith"); $user2 = new User($_GET["name"]); echoUserName($user1); ``` ## Avoiding files in taint paths You can also tell Psalm that you’re not interested in any taint paths that flow through certain files or directories by specifying them in your Psalm config: ```xml ```