René's URL Explorer Experiment


Title: Decrypting a zero-length array with SubtleCrypto triggers Assertion failures · Issue #38883 · nodejs/node · GitHub

Open Graph Title: Decrypting a zero-length array with SubtleCrypto triggers Assertion failures · Issue #38883 · nodejs/node

X Title: Decrypting a zero-length array with SubtleCrypto triggers Assertion failures · Issue #38883 · nodejs/node

Description: Version: v16.2.0 Platform: Darwin shinji 20.6.0 Darwin Kernel Version 20.6.0: Mon May 10 03:15:35 PDT 2021; root:xnu-7195.140.13.0.1~20/RELEASE_X86_64 x86_64 i386 MacBookPro16,2 Darwin Subsystem: webcrypto (specifically SubtleCrypto) Wha...

Open Graph Description: Version: v16.2.0 Platform: Darwin shinji 20.6.0 Darwin Kernel Version 20.6.0: Mon May 10 03:15:35 PDT 2021; root:xnu-7195.140.13.0.1~20/RELEASE_X86_64 x86_64 i386 MacBookPro16,2 Darwin Subsystem: w...

X Description: Version: v16.2.0 Platform: Darwin shinji 20.6.0 Darwin Kernel Version 20.6.0: Mon May 10 03:15:35 PDT 2021; root:xnu-7195.140.13.0.1~20/RELEASE_X86_64 x86_64 i386 MacBookPro16,2 Darwin Subsystem: w...

Opengraph URL: https://github.com/nodejs/node/issues/38883

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Decrypting a zero-length array with SubtleCrypto triggers Assertion failures","articleBody":"\u003c!--\r\nThank you for reporting an issue.\r\n\r\nThis issue tracker is for bugs and issues found within Node.js core.\r\nIf you require more general support please file an issue on our help\r\nrepo. https://github.com/nodejs/help\r\n\r\n\r\nPlease fill in as much of the template below as you're able.\r\n\r\nVersion: output of `node -v`\r\nPlatform: output of `uname -a` (UNIX), or output of `\"$([Environment]::OSVersion | ForEach-Object VersionString) $(if ([Environment]::Is64BitOperatingSystem) { \"x64\" } else { \"x86\" })\"` in PowerShell console (Windows)\r\nSubsystem: if known, please specify affected core module name\r\n--\u003e\r\n\r\n* **Version**: v16.2.0\r\n* **Platform**: `Darwin shinji 20.6.0 Darwin Kernel Version 20.6.0: Mon May 10 03:15:35 PDT 2021; root:xnu-7195.140.13.0.1~20/RELEASE_X86_64 x86_64 i386 MacBookPro16,2 Darwin`\r\n* **Subsystem**: webcrypto (specifically SubtleCrypto)\r\n\r\n### What steps will reproduce the bug?\r\n\r\nAttempting to decrypt a zero-length array crashes node completely. There are two ways to trigger this.\r\n\r\nThe first encrypts a zero length array and then attempts to decrypt that same data:\r\n```\r\nconst crypto = require('crypto').webcrypto;\r\ncrypto.subtle.importKey('raw', new Uint8Array(32), {name: 'AES-GCM'}, false, ['encrypt','decrypt'])\r\n  .then(k =\u003e\r\n    crypto.subtle.encrypt({name: 'AES-GCM', iv: new Uint8Array(12)}, k, new Uint8Array(0))\r\n    .then(e =\u003e\r\n      crypto.subtle.decrypt({name: 'AES-GCM', iv: new Uint8Array(12)}, k, e)\r\n    )\r\n  )\r\n  .then(v =\u003e console.log(v));\r\n```\r\n\r\nThe second simply decrypts a zero length data array:\r\n```\r\nconst crypto = require('crypto').webcrypto;\r\ncrypto.subtle.importKey('raw', new Uint8Array(32), {name: 'AES-GCM'}, false, ['encrypt','decrypt'])\r\n  .then(k =\u003e crypto.subtle.decrypt({name: 'AES-GCM', iv: new Uint8Array(12)}, k, new Uint8Array(0)))\r\n  .then(v =\u003e console.log(v));\r\n```\r\n\r\n### How often does it reproduce? Is there a required condition?\r\n\r\nEvery time.\r\n\r\n### What is the expected behavior?\r\n\r\nThe `decrypt` call should produce a zero-length array in the first case, and fail in the second (chrome rejects with `The provided data is too small`).\r\n\r\n### What do you see instead?\r\n\r\nNode crashes. The two snippets trigger different errors.\r\n\r\nFirst:\r\n```\r\nnode[51088]: ../src/crypto/crypto_cipher.h:261:virtual v8::Maybe\u003cbool\u003e node::crypto::CipherJob\u003cnode::crypto::AESCipherTraits\u003e::ToResult(v8::Local\u003cv8::Value\u003e *, v8::Local\u003cv8::Value\u003e *) [CipherTraits = node::crypto::AESCipherTraits]: Assertion `!errors-\u003eEmpty()' failed.\r\n 1: 0x105ac3832 node::Abort() [/usr/local/bin/node]\r\n 2: 0x105ac36be node::AppendExceptionLine(node::Environment*, v8::Local\u003cv8::Value\u003e, v8::Local\u003cv8::Message\u003e, node::ErrorHandlingMode) [/usr/local/bin/node]\r\n 3: 0x105b93582 node::crypto::CipherJob\u003cnode::crypto::AESCipherTraits\u003e::DoThreadPoolWork() [/usr/local/bin/node]\r\n 4: 0x105b93309 node::crypto::CryptoJob\u003cnode::crypto::AESCipherTraits\u003e::AfterThreadPoolWork(int) [/usr/local/bin/node]\r\n 5: 0x106345d74 uv__work_done [/usr/local/bin/node]\r\n 6: 0x106349528 uv__async_io [/usr/local/bin/node]\r\n 7: 0x106359662 uv__io_poll [/usr/local/bin/node]\r\n 8: 0x10634995e uv_run [/usr/local/bin/node]\r\n 9: 0x105a12624 node::SpinEventLoop(node::Environment*) [/usr/local/bin/node]\r\n10: 0x105afbd35 node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [/usr/local/bin/node]\r\n11: 0x105a9ab72 node::Start(int, char**) [/usr/local/bin/node]\r\n12: 0x7fff20348f5d start [/usr/lib/system/libdyld.dylib]\r\n13: 0x1\r\nAbort trap: 6\r\n```\r\n\r\nSecond:\r\n```\r\nnode[51123]: ../src/crypto/crypto_aes.cc:92:node::crypto::WebCryptoCipherStatus node::crypto::(anonymous namespace)::AES_Cipher(node::Environment *, node::crypto::KeyObjectData *, node::crypto::WebCryptoCipherMode, const node::crypto::AESCipherConfig \u0026, const node::crypto::ByteSource \u0026, node::crypto::ByteSource *): Assertion `params.tag' failed.\r\n 1: 0x10d74e832 node::Abort() [/usr/local/bin/node]\r\n 2: 0x10d74e6be node::AppendExceptionLine(node::Environment*, v8::Local\u003cv8::Value\u003e, v8::Local\u003cv8::Message\u003e, node::ErrorHandlingMode) [/usr/local/bin/node]\r\n 3: 0x10d81ccf3 node::crypto::AES::Initialize(node::Environment*, v8::Local\u003cv8::Object\u003e) [/usr/local/bin/node]\r\n 4: 0x10d81e5d6 node::crypto::CipherJob\u003cnode::crypto::AESCipherTraits\u003e::DoThreadPoolWork() [/usr/local/bin/node]\r\n 5: 0x10dfd1128 worker [/usr/local/bin/node]\r\n 6: 0x7fff2032d8fc _pthread_start [/usr/lib/system/libsystem_pthread.dylib]\r\n 7: 0x7fff20329443 thread_start [/usr/lib/system/libsystem_pthread.dylib]\r\nAbort trap: 6\r\n```\r\n### Additional information\r\n\r\nThese inputs are far from normal, but I figure node should never _crash_.\r\n\r\nThe project I work on has property tests involving webcrypto. We've been using `node-webcrypto-ossl` to run these tests for months; we thought it might be nice to switch to the new built-in webcrypto instead. Our property tests are designed to throw all sorts of invalid values at our own code - but it turns out they throw invalid values at the webcrypto API as well.","author":{"url":"https://github.com/TheSpyder","@type":"Person","name":"TheSpyder"},"datePublished":"2021-06-01T07:00:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/38883/node/issues/38883"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:ef67a947-7995-7257-4116-c4d6985121f4
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8114:3B3BAC:14A20E1:1E16B9F:6A4E4A25
html-safe-nonce94cd1dc9ffe83c590750decc683d5cc9495e1181a3ddaece27e4545c2338651b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTE0OjNCM0JBQzoxNEEyMEUxOjFFMTZCOUY6NkE0RTRBMjUiLCJ2aXNpdG9yX2lkIjoiMjUzNjY1NTg5MjM4NTgxNzk3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac5b3f089aa8cc1d6a4bb2f6b873bf199ed767bed9640d8aa8a83023c3d81a625a
hovercard-subject-tagissue:907966424
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/38883/issue_layout
twitter:imagehttps://opengraph.githubassets.com/45fdb043a8054cbaadd146d74edc995fcc047d6653dbc96b14289b066b22f856/nodejs/node/issues/38883
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/45fdb043a8054cbaadd146d74edc995fcc047d6653dbc96b14289b066b22f856/nodejs/node/issues/38883
og:image:altVersion: v16.2.0 Platform: Darwin shinji 20.6.0 Darwin Kernel Version 20.6.0: Mon May 10 03:15:35 PDT 2021; root:xnu-7195.140.13.0.1~20/RELEASE_X86_64 x86_64 i386 MacBookPro16,2 Darwin Subsystem: w...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameTheSpyder
hostnamegithub.com
expected-hostnamegithub.com
None030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee8506f6d0538364886e3f0153c154c410965e70d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/issues/38883#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F38883
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F38883
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/38883
Reloadhttps://github.com/nodejs/node/issues/38883
Reloadhttps://github.com/nodejs/node/issues/38883
Please reload this pagehttps://github.com/nodejs/node/issues/38883
nodejs https://github.com/nodejs
nodehttps://github.com/nodejs/node
Please reload this pagehttps://github.com/nodejs/node/issues/38883
Notifications https://github.com/login?return_to=%2Fnodejs%2Fnode
Fork 36k https://github.com/login?return_to=%2Fnodejs%2Fnode
Star 118k https://github.com/login?return_to=%2Fnodejs%2Fnode
Code https://github.com/nodejs/node
Issues 1.3k https://github.com/nodejs/node/issues
Pull requests 965 https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality 0 https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Code https://github.com/nodejs/node
Issues https://github.com/nodejs/node/issues
Pull requests https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Decrypting a zero-length array with SubtleCrypto triggers Assertion failureshttps://github.com/nodejs/node/issues/38883#top
confirmed-bugIssues with confirmed bugs.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22confirmed-bug%22
cryptoIssues and PRs related to the crypto subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22crypto%22
webcryptohttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22webcrypto%22
https://github.com/TheSpyder
TheSpyderhttps://github.com/TheSpyder
on Jun 1, 2021https://github.com/nodejs/node/issues/38883#issue-907966424
confirmed-bugIssues with confirmed bugs.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22confirmed-bug%22
cryptoIssues and PRs related to the crypto subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22crypto%22
webcryptohttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22webcrypto%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.