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 code scanning alert - Insecure randomness #1104

Open
1 task
afc163 opened this issue Feb 18, 2024 · 3 comments
Open
1 task

Fix code scanning alert - Insecure randomness #1104

afc163 opened this issue Feb 18, 2024 · 3 comments

Comments

@afc163
Copy link
Member

afc163 commented Feb 18, 2024

Tracking issue for:

@DiamondYuan
Copy link
Collaborator

这个应该是误报。

随机数主要用在文件上传的唯一 ID ,不会用在密码里。

@afc163
Copy link
Member Author

afc163 commented Feb 19, 2024

为啥要用 Math.random 啊,试试 https://github.com/react-component/util/blob/master/src/hooks/useId.ts

@imsenyu
Copy link
Collaborator

imsenyu commented Feb 19, 2024

useId 看起来优先用 React 内置实现,考虑到 1 preact 不一定有 2 跨插件上下文维持没法维持全局单例。
看起来搞一个小程序页面级别隔离的 ${pageId}-${page级别自增Id} 更合适

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants