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

fix(editor): Polyfill crypto.randomUUID #12052

Merged
merged 1 commit into from
Dec 5, 2024
Merged

Conversation

netroy
Copy link
Member

@netroy netroy commented Dec 4, 2024

Summary

When n8n is used in an insecure context, window.crypto is an empty object, because crypto API is only available in secure contexts.
This PR uses the uuid package to polyfill crypto.randomUUID for such cases.

Related Linear tickets, Github issues, and Community forum posts

CAT-398
Fixes #12051

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@netroy netroy added the release/backport Changes that need to be backported to older releases. label Dec 4, 2024
@n8n-assistant n8n-assistant bot added n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Dec 4, 2024
Copy link

codecov bot commented Dec 4, 2024

Codecov Report

Attention: Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/editor-ui/src/App.vue 0.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

Comment on lines +21 to +24
// Polyfill crypto.randomUUID
if (!('randomUUID' in crypto)) {
Object.defineProperty(crypto, 'randomUUID', { value: uuid });
}
Copy link
Member

Choose a reason for hiding this comment

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

Just to be sure. The window.crypto object is always defined, and it's just randomUUID that's missing?

Copy link

cypress bot commented Dec 5, 2024

n8n    Run #8219

Run Properties:  status check passed Passed #8219  •  git commit e16cb880a9: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 netroy 🗃️ e2e/*
Project n8n
Branch Review CAT-398-polyfill-randomUUID
Run status status check passed Passed #8219
Run duration 04m 25s
Commit git commit e16cb880a9: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 netroy 🗃️ e2e/*
Committer कारतोफ्फेलस्क्रिप्ट™
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 2
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 480
View all changes introduced in this branch ↗︎

Copy link
Contributor

github-actions bot commented Dec 5, 2024

✅ All Cypress E2E specs passed

@netroy netroy merged commit 0537524 into master Dec 5, 2024
50 of 51 checks passed
@netroy netroy deleted the CAT-398-polyfill-randomUUID branch December 5, 2024 09:09
ivov pushed a commit that referenced this pull request Dec 5, 2024
@github-actions github-actions bot mentioned this pull request Dec 5, 2024
@janober
Copy link
Member

janober commented Dec 5, 2024

Got released with n8n@1.70.3

ivov pushed a commit that referenced this pull request Dec 6, 2024
This was referenced Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team release/backport Changes that need to be backported to older releases. Released ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error Message window.crypto.randomUUID
3 participants