rspec/rules/S2612/php/rule.adoc

65 lines
1.1 KiB
Plaintext
Raw Normal View History

include::../description.adoc[]
include::../ask-yourself.adoc[]
include::../recommended.adoc[]
== Sensitive Code Example
----
chmod("foo", 0777); // Sensitive
----
----
umask(0); // Sensitive
umask(0750); // Sensitive
----
For https://symfony.com/doc/current/components/filesystem.html[Symfony Filesystem]:
----
use Symfony\Component\Filesystem\Filesystem;
$fs = new Filesystem();
$fs->chmod("foo", 0777); // Sensitive
----
For https://laravel.com/api/8.x/Illuminate/Filesystem/Filesystem.html[Laravel Filesystem]:
----
use Illuminate\Filesystem\Filesystem;
$fs = new Filesystem();
$fs->chmod("foo", 0777); // Sensitive
----
== Compliant Solution
----
chmod("foo", 0750); // Compliant
----
----
umask(0027); // Compliant
----
For https://symfony.com/doc/current/components/filesystem.html[Symfony Filesystem]:
----
use Symfony\Component\Filesystem\Filesystem;
$fs = new Filesystem();
$fs->chmod("foo", 0750); // Compliant
----
For https://laravel.com/api/8.x/Illuminate/Filesystem/Filesystem.html[Laravel Filesystem]:
----
use Illuminate\Filesystem\Filesystem;
$fs = new Filesystem();
$fs->chmod("foo", 0750); // Compliant
----
include::../see.adoc[]