PHPCS complains about our use of unserialize() being insecure. PHPCS complains about ALL uses of unserialize() because if they process user provided data this can be hazardous.

But the way we use it is in a test case to test serialization of our custom RulesExpressions, which is

  1. Used only when running tests on the testbot, and
  2. Used with fixed and constrained input.

and there is no way this specific usage poses a security vulnerability for any site that has Rules installed.
Additionally, this same usage of unserialize() is done in core too.

Marking these known usages with @phpcs:ignore will prevent the warnings from polluting our test results, and will serve to document the usage as intentional within the code.

Issue fork rules-3456901

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

TR created an issue. See original summary.

tr’s picture

Tests show PHPCS running green again.

  • TR committed 52cf39b7 on 4.0.x
    Issue #3456901 by TR: Add @phpcs:ignore to test cases that unserialize...
tr’s picture

Status: Active » Fixed

  • TR committed 6e43a41b on 8.x-3.x
    Issue #3456901 by TR: Add @phpcs:ignore to test cases that unserialize...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.