Problem/Motivation
The $key argument is sensitive and should not be leaked in stack traces:
InvalidArgumentException:
Both parameters passed to \Drupal\Component\Utility\Crypt::hmacBase64 must be scalar values.
at core/lib/Drupal/Component/Utility/Crypt.php:30
at Drupal\Component\Utility\Crypt::hmacBase64(array(), 'private_key')
(modules/custom/test/test.module:49)
Steps to reproduce
ini_set('zend.exception_ignore_args', FALSE);
Crypt::hmacBase64([], 'private_key');
Proposed resolution
Add #[SensitiveParameter] to the $key argument.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Comments
Comment #2
sourav_paulHi @prudloff
I'm willing to work on this issue, can you please share reproduction steps in more descriptive way?
Comment #3
prudloff commentedI can't really, because this is not a bug to fix but a best practice to apply to code.
Comment #4
sourav_paulThanks, for your response I've successfully reproduce the error message & verified the vulnerability.
Working on it..
Comment #8
sourav_paulComment #9
smustgrave commentedSeems straight forward, probably should of been tagged a novice task.
Comment #15
godotislateCommitted and pushed 6ade36a to main, a98b684 to 11.x, 922c876 to 11.3.x, and 36f5c46 to 10.6.x. Thanks!
Comment #16
godotislate