-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Add #[\SensitiveParameter] to more functions taking secrets #23782
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
Changes from all commits
5d1b204
4f7b4aa
ea0cf67
02d7c65
ee89463
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| --TEST-- | ||
| Test that the key/password parameters of mhash() and mhash_keygen_s2k() are marked sensitive. | ||
| --SKIPIF-- | ||
| <?php if (!function_exists('mhash')) { die('skip mhash compatibility layer not available'); } ?> | ||
| --FILE-- | ||
| <?php | ||
| declare(strict_types=1); | ||
|
|
||
| try { | ||
| var_dump(mhash(0, null, 'secret-key')); | ||
| } catch (\Throwable $e) { | ||
| echo $e, PHP_EOL; | ||
| } | ||
| try { | ||
| var_dump(mhash_keygen_s2k(0, 'secret-password', 'salt', 0)); | ||
| } catch (\Throwable $e) { | ||
| echo $e, PHP_EOL; | ||
| } | ||
| ?> | ||
| --EXPECTF-- | ||
| Deprecated: Function mhash() is deprecated since 8.1 in %s on line %d | ||
| TypeError: mhash(): Argument #2 ($data) must be of type string, null given in %s:%d | ||
| Stack trace: | ||
| #0 %s(%d): mhash(0, NULL, Object(SensitiveParameterValue)) | ||
| #1 {main} | ||
|
|
||
| Deprecated: Function mhash_keygen_s2k() is deprecated since 8.1 in %s on line %d | ||
| ValueError: mhash_keygen_s2k(): Argument #4 ($length) must be a greater than 0 in %s:%d | ||
| Stack trace: | ||
| #0 %s(%d): mhash_keygen_s2k(0, Object(SensitiveParameterValue), 'salt', 0) | ||
| #1 {main} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| --TEST-- | ||
| Test that the private key parameter of Phar::setSignatureAlgorithm() is marked sensitive. | ||
| --EXTENSIONS-- | ||
| phar | ||
| --INI-- | ||
| phar.require_hash=0 | ||
| phar.readonly=0 | ||
| --FILE-- | ||
| <?php | ||
| $fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.tar'; | ||
| $p = new PharData($fname); | ||
| $p['file1.txt'] = 'hi'; | ||
|
|
||
| try { | ||
| $p->setSignatureAlgorithm(-1, 'secret-private-key'); | ||
| } catch (\Throwable $e) { | ||
| echo $e, PHP_EOL; | ||
| } | ||
| ?> | ||
| --CLEAN-- | ||
| <?php | ||
| unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.tar'); | ||
| ?> | ||
| --EXPECTF-- | ||
| UnexpectedValueException: Unknown signature algorithm specified in %s:%d | ||
| Stack trace: | ||
| #0 %s(%d): PharData->setSignatureAlgorithm(-1, Object(SensitiveParameterValue)) | ||
| #1 {main} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
What is sensitive about the $community variable?
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.
The community string is basically a plain text password. On SNMPv1/v2c it's the only auth there is, and with
snmpsetit gives write access.