浏览代码

LibWeb: Set key extractability in SubtleCrypto::derive_key()

None of the algorithms actually set the `extractable` internal slot in
their implementations, and looking at `SubtleCrypto::import_key()` it
seems likely that a step is missing here.
Jelle Raaijmakers 8 月之前
父节点
当前提交
f7993495bd
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      Libraries/LibWeb/Crypto/SubtleCrypto.cpp

+ 6 - 1
Libraries/LibWeb/Crypto/SubtleCrypto.cpp

@@ -719,8 +719,13 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<WebIDL::Promise>> SubtleCrypto::derive_ke
             return;
             return;
         }
         }
 
 
+        // AD-HOC: Set the [[extractable]] internal slot of key to be extractable.
+        //         See: https://github.com/w3c/webcrypto/issues/383
+        auto key = result.release_value();
+        key->set_extractable(extractable);
+
         // 17. Resolve promise with result.
         // 17. Resolve promise with result.
-        WebIDL::resolve_promise(realm, promise, result.release_value());
+        WebIDL::resolve_promise(realm, promise, key);
     }));
     }));
 
 
     return promise;
     return promise;