-
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mutation testing, PHP 7.1 testing #40
Conversation
…`umask()` defaults prevent malicious content injection via race conditions
@@ -89,6 +89,7 @@ public function testDumpVersionsClass() | |||
|
|||
$expectedPath = $vendorDir . '/ocramius/package-versions/src/PackageVersions'; | |||
|
|||
/** @noinspection MkdirRaceConditionInspection */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ocramius : I'd just ignore test-classes in the inspection, bunch of inspection are doing ths already.
. '/src/PackageVersions/Versions.php'; | ||
|
||
file_put_contents($installPath, $versionClassSource); | ||
chmod($installPath, 0664); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ocramius : perhaps we should have an inspection for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A default umask()
will usually be 0022
or such, so it is generally OK to use file_put_contents()
, but this file is a generated PHP file, and therefore vulnerable to code injection if the umask()
is incorrect.
Interestingly, specifying the mask on file_put_contents()
doesn't behave as expected :S
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chmod($installPath, 0664 & ~umask())
?
PS: not tested but takes into account FS attributes
Merging as per @malukenho's approval |
This PR enforces mutation testing on the package.