Skip to content

False positive: Allow trimming input before sanitizing #2180

Open
@Luc45

Description

Sometimes, an input is flagged as not sanitized if we trim it:

$foo = absint( $_GET['foo'] ); // OK.

$foo = absint( trim( $_GET['foo'] ) ); // InputNotSanitized.
$foo = absint( ltrim( $_GET['foo'] ) ); // InputNotSanitized.
$foo = absint( rtrim( $_GET['foo'] ) ); // InputNotSanitized.

I believe trimming should be accepted before sanitizing an input.

Maybe we could add ltrim, rtrim, and trim as a trimmingFunctions array and allow them here?

$valid_functions += $this->arrayWalkingFunctions;

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions