Skip to content

Add #[SensitiveParameter] attribute to sensitive parameters#1082

Merged
Slamdunk merged 1 commit into
lcobucci:5.4.xfrom
slknijnenburg:add-sensitiveparam-attribute
Nov 7, 2024
Merged

Add #[SensitiveParameter] attribute to sensitive parameters#1082
Slamdunk merged 1 commit into
lcobucci:5.4.xfrom
slknijnenburg:add-sensitiveparam-attribute

Conversation

@slknijnenburg

Copy link
Copy Markdown
Contributor

Fixes #1081, adds #[SensitiveParameter] to all potentially sensitive parameters, including key material, certificates and passphrases.

I wondered if this would be a BC break, but it seems that that is not the case. Child classes/interface implementations can apparently omit the attribute without any problems.

@Slamdunk Slamdunk changed the title Add SensitiveParameter attribute to sensitive parameters Add #[SensitiveParameter] attribute to sensitive parameters Nov 7, 2024
@Slamdunk Slamdunk added the Bug label Nov 7, 2024

@Slamdunk Slamdunk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this contribution.

As far as I know, #[SensitiveParameter] only makes sense in string parameters, please update the PR to only target:

  1. \Lcobucci\JWT\Signer\Key\InMemory methods
  2. \Lcobucci\JWT\Signer\OpenSSL::createSignature
  3. \Lcobucci\JWT\Signer\OpenSSL::verifySignature

Also, as this can be considered a Bug please target the 5.4.x branch.

@Slamdunk Slamdunk added this to the 5.4.2 milestone Nov 7, 2024
@slknijnenburg
slknijnenburg force-pushed the add-sensitiveparam-attribute branch from b0e12fc to 6be91ef Compare November 7, 2024 11:25
@slknijnenburg
slknijnenburg changed the base branch from 5.5.x to 5.4.x November 7, 2024 11:25
@slknijnenburg
slknijnenburg force-pushed the add-sensitiveparam-attribute branch from 6be91ef to bb807f4 Compare November 7, 2024 11:30
Comment thread src/Signer/Key/InMemory.php
Comment thread src/Signer/OpenSSL.php Outdated
@slknijnenburg
slknijnenburg force-pushed the add-sensitiveparam-attribute branch from bb807f4 to 6a61245 Compare November 7, 2024 11:39

@Slamdunk Slamdunk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, few final fixes and we can 🚢 it 💪

Comment thread src/Signer/Key/InMemory.php
Comment thread src/Signer/Key/InMemory.php
Comment thread src/Signer/OpenSSL.php Outdated
Adds `#[SensitiveParameter]` to all potentially sensitive parameters,
including key material, certificates and passphrases.
@slknijnenburg
slknijnenburg force-pushed the add-sensitiveparam-attribute branch from 6a61245 to 90aab82 Compare November 7, 2024 11:50
@TimWolla

TimWolla commented Nov 7, 2024

Copy link
Copy Markdown

As far as I know, #[SensitiveParameter] only makes sense in string parameters

This is false. The attribute is agnostic to the parameter type and the Exception handler of your choice might opt to also process objects (e.g. by printing their __debugInfo()) output. The attribute should be apply to anything that is sensitive, independent of type.

@Slamdunk

Slamdunk commented Nov 7, 2024

Copy link
Copy Markdown
Collaborator

Mmm, by this logic everything is sensitive, if my debug handler dumps the entire memory and filesystem to the logger.

I think handling the default behaviour is enough for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mark sensitive parameters with #[SensitiveParameter]

4 participants