Skip to content
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

HKDF&PBKDF2: Dead write to "extractable" bit during importKey operation #377

Closed
BenWiederhake opened this issue Oct 25, 2024 · 1 comment · Fixed by #379
Closed

HKDF&PBKDF2: Dead write to "extractable" bit during importKey operation #377

BenWiederhake opened this issue Oct 25, 2024 · 1 comment · Fixed by #379

Comments

@BenWiederhake
Copy link
Collaborator

BenWiederhake commented Oct 25, 2024

SubtleCrypto.importKey invokes the algorithm's importKey operation in step 3, and overwrites the [[extractable]] internal slot in step 10, regardless what the algorithm wrote into that slot:
Bildschirmfoto_2024-10-25_11-24-49

So why does HKDF's importKey operation write false into that slot?
Bildschirmfoto_2024-10-25_11-23-41

I'm not sure what happened here, and therefore not sure how to resolve this issue:

  • Option 1: There's a good reason why it should be [[extractable]] = false;, the key should not be extractable. In this case, SubtleCrypto.importKey must be changed in order to preserve that flag.
  • Option 2: It's just a dead write that nobody noticed before. In this case, it might be nice to remove the dead write.

EDIT: Also affects PBKDF2's importKey.

Found while combing through the docs for #376, which I in turn found while implementing this from scratch. Shameless plug: Ladybird :)

@BenWiederhake BenWiederhake changed the title HKDF: Dead write to "extractable" bit during importKey operation HKDF&PBKDF2: Dead write to "extractable" bit during importKey operation Oct 25, 2024
@twiss
Copy link
Member

twiss commented Oct 25, 2024

Both algorithms say:

  1. If extractable is not false, then throw a SyntaxError.

So both options are essentially true: extractable must be false, but also the write is dead and can be removed in favor of the one in importKey() as you noted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants