Repository navigation
[Bug]: AES-KW through main process Web Crypto API causes SIGABRT #36256
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
21.2.2
What operating system are you using?
macOS
Operating System Version
Ventura
What arch are you using?
arm64 (including Apple Silicon)
Last Known Working Electron version
n/a
Expected Behavior
I would expect the wrapKey call to be rejected instead of SIGABRT on the account of AES-WRAP not being supported in BoringSSL.
Actual Behavior
/Electron.app/Contents/MacOS/Electron[13257]: ../../third_party/electron_node/src/crypto/crypto_aes.cc:569:static Maybe<bool> node::crypto::AESCipherTraits::AdditionalConfig(CryptoJobMode, const FunctionCallbackInfo<Value> &, unsigned int, WebCryptoCipherMode, AESCipherConfig *): Assertion `(params->cipher) != nullptr' failed.
1: 0x1120e5580 node::FatalException(v8::Isolate*, v8::TryCatch const&) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
2: 0x1120e5374 node::FatalException(v8::Isolate*, v8::TryCatch const&) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
3: 0x1121df1ac node::SetTracingController(v8::TracingController*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
4: 0x1121e0dec node::SetTracingController(v8::TracingController*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
5: 0x10d1be5d0 v8::internal::Accessors::MakeAccessor(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Name>, void (*)(v8::Local<v8::Name>, v8::PropertyCallbackInfo<v8::Value> const&), void (*)(v8::Local<v8::Name>, v8::Local<v8::Value>, v8::PropertyCallbackInfo<v8::Boolean> const&)) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
6: 0x10d1be134 v8::internal::Accessors::MakeAccessor(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Name>, void (*)(v8::Local<v8::Name>, v8::PropertyCallbackInfo<v8::Value> const&), void (*)(v8::Local<v8::Name>, v8::Local<v8::Value>, v8::PropertyCallbackInfo<v8::Boolean> const&)) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
7: 0x147f0cc8c
8: 0x147e89da8
9: 0x147fb2cdc
10: 0x147e8c5a4
11: 0x147e8c5a4
12: 0x147e8c5a4
13: 0x147e8c5a4
14: 0x147ec1db4
15: 0x147f605b8
16: 0x147eb241c
17: 0x147e8a888
18: 0x10d278838 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
19: 0x10d27917c v8::internal::Execution::TryCallScript(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSFunction>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::FixedArray>, v8::internal::Execution::MessageHandling, v8::internal::MaybeHandle<v8::internal::Object>*, bool) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
20: 0x10d2792f0 v8::internal::Execution::TryCall(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*, v8::internal::Execution::MessageHandling, v8::internal::MaybeHandle<v8::internal::Object>*, bool) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
21: 0x10d2a20f0 v8::internal::MicrotaskQueue::PerformCheckpointInternal(v8::Isolate*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
22: 0x112051d14 node::CallbackScope::~CallbackScope() [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
23: 0x112052160 node::CallbackScope::~CallbackScope() [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
24: 0x112064840 node::EmitAsyncDestroy(node::Environment*, node::async_context) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
25: 0x112211ca4 node::SetTracingController(v8::TracingController*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
26: 0x10c368fd4 uv_random [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
27: 0x10c36c414 uv_async_send [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
28: 0x10c37d568 uv_free_interface_addresses [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
29: 0x10c36c820 uv_run [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
30: 0x10c4bc8ac node::FreeArrayBufferAllocator(node::ArrayBufferAllocator*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
31: 0x10ec099d8 v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
32: 0x10ec23d50 v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
33: 0x10ec5dd5c v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
34: 0x10c2fc010 [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
35: 0x10ec5d12c v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
36: 0x18b34da34 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ [/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation]
37: 0x18b34d9c8 __CFRunLoopDoSource0 [/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation]
38: 0x18b34d738 __CFRunLoopDoSources0 [/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation]
39: 0x18b34c33c __CFRunLoopRun [/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation]
40: 0x18b34b8a4 CFRunLoopRunSpecific [/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation]
41: 0x1949bf3bc RunCurrentEventLoopInMode [/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox]
42: 0x1949bf200 ReceiveNextEventCommon [/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox]
43: 0x1949bef48 _BlockUntilNextEventMatchingListInModeWithFilter [/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox]
44: 0x18e5a4630 _DPSNextEvent [/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit]
45: 0x18e5a37c0 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] [/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit]
46: 0x18e597bf0 -[NSApplication run] [/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit]
47: 0x10ec5ece8 v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
48: 0x10ec5cc84 v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
49: 0x10ec24724 v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
50: 0x10ebf15f4 v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
51: 0x10dfbc4c8 v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
52: 0x10dfbddcc v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
53: 0x10dfba1f8 v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
54: 0x10c6056e0 v8::internal::compiler::BasicBlock::set_loop_header(v8::internal::compiler::BasicBlock*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
55: 0x10c606578 v8::internal::compiler::BasicBlock::set_loop_header(v8::internal::compiler::BasicBlock*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
56: 0x10c6063ac v8::internal::compiler::BasicBlock::set_loop_header(v8::internal::compiler::BasicBlock*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
57: 0x10c604db0 v8::internal::compiler::BasicBlock::set_loop_header(v8::internal::compiler::BasicBlock*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
58: 0x10c605268 v8::internal::compiler::BasicBlock::set_loop_header(v8::internal::compiler::BasicBlock*) [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
59: 0x10c37db30 ElectronMain [/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
60: 0x18af43e50 start [/usr/lib/dyld]
/Electron.app/Contents/MacOS/Electron exited with signal SIGABRT
Testcase Gist URL
https://gist.github.com/0a69f62d5d1257956d9556a7451889b5
Additional Information
No response
Reactions are currently unavailable
Activity
panva commentedon Nov 4, 2022
crypto: handle unsupported AES ciphers in webcrypto
codebytere commentedon Nov 6, 2022
@panva that'd be because in the renderer process, you have access to WebCrypto APIs provided by Chromium/Blink, whereas in the main process they're backed by Node.js. I can look into what options we might have.
panva commentedon Nov 6, 2022
codebytere commentedon Nov 6, 2022
yeah - and it does look like it's available in BoringSSL here. Lemme dig into it some more.
FWIW bun seems to roll it all themselves: https://github.com/oven-sh/bun/tree/6142715c06d5eb3dbaa07901a6281ae1394483a9/src/bun.js/bindings/webcrypto
crypto: handle unsupported AES ciphers in webcrypto
crypto: handle unsupported AES ciphers in webcrypto
github-actions commentedon Feb 8, 2023
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
41 remaining items
crypto: wire AES-KW in Web Cryptography when using BoringSSL
crypto: wire ChaCha20-Poly1305 in Web Cryptography when using BoringSSL
crypto: wire ML-DSA and ML-KEM for use when using BoringSSL
src: simplify OpenSSL feature gates
crypto: wire AES-KW in Web Cryptography when using BoringSSL
crypto: wire ChaCha20-Poly1305 in Web Cryptography when using BoringSSL
crypto: wire ML-DSA and ML-KEM for use when using BoringSSL
src: simplify OpenSSL feature gates
crypto: wire AES-KW in Web Cryptography when using BoringSSL
crypto: wire ChaCha20-Poly1305 in Web Cryptography when using BoringSSL
crypto: wire ML-DSA and ML-KEM for use when using BoringSSL