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

用户密码长度缺陷问题 #28

Closed
lyswhut opened this issue Jun 8, 2023 · 1 comment
Closed

用户密码长度缺陷问题 #28

lyswhut opened this issue Jun 8, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@lyswhut
Copy link
Owner

lyswhut commented Jun 8, 2023

由于该项目的原始代码来自PC端的同步服务,本项目的用户密码等于PC端同步服务的连接码,当初设计PC端连接码时预计只有6位纯数字,所以没有考虑复杂连接码的情况,就随便弄了个简单的校验方式:

let key = ''.padStart(16, Buffer.from(userInfo.password, 'utf8').toString('hex'))

即:将连接码(密码)以UTF-8编码读取并转hex后取前16位(如果长度不够将重复填充到16位)作为密码。
所以导致现在出现的一个问题是设置的用户密码只有前16个hex有效,16位之后的字符将被丢弃,导致当设置的密码超过一定长度后,连接时不用输入完整的密码都可以连接成功。
一般情况下一个数字、英文字符占2个hex,一个中文字符占6个hex,
这意味着如果你的密码是数字、英文字符的话,只有前8位有效,中文字符只有前三个字有效

由于这涉及各端的修改,所以计划在下个大版本再修复它

@lyswhut lyswhut added the bug Something isn't working label Jun 8, 2023
@lyswhut lyswhut pinned this issue Jun 8, 2023
@lyswhut
Copy link
Owner Author

lyswhut commented Sep 9, 2023

已在v2.0.0修复

@lyswhut lyswhut closed this as completed Sep 9, 2023
@lyswhut lyswhut unpinned this issue Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant