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

assert missing crypto.randomUUID #8301

Merged
merged 1 commit into from Nov 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/store/addon/-private/caches/identifier-cache.ts
Expand Up @@ -41,6 +41,10 @@ if (macroCondition(getOwnConfig<{ polyfillUUID: boolean }>().polyfillUUID)) {
}

function uuidv4(): string {
assert(
Copy link
Contributor

Choose a reason for hiding this comment

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

note asserts only trigger in dev build, so if deploying to an insecure environment as mentioned in https://discord.com/channels/480462759797063690/486549196837486592/1040645066504556564 the error will still be simply that randomUUID is not a function.

Copy link
Contributor

Choose a reason for hiding this comment

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

(also note, even for internal tools, if you aren't deploying production builds with https you very much should be for a host of reasons)

'crypto.randomUUID needs to be avaliable. Some browsers incorrectly disallow it in insecure contexts. You maybe want to enable the polyfill: https://github.com/emberjs/data#randomuuid-polyfill',
_crypto.randomUUID
);
return _crypto.randomUUID();
}

Expand Down