Describe the bug
Docker容器设置了CODE="123456" 在前端输入密码123456 提示wrong access code
To Reproduce
Steps to reproduce the behavior:
docker run -d -p 3000:3000 \
-e OPENAI_API_KEY="sk-xxxx" \
-e CODE="123456" \
yidadaa/chatgpt-next-web
Deployment
Desktop (please complete the following information):
- OS: Linux Ubuntu 22.04
- Browser chrome
- Docker version 24.0.5, build ced0996
- Docker images
yidadaa/chatgpt-next-web latest f9e51a3ad227 5 days ago 242MB
经过分析所有的问题突然明朗了,文档中Docker命令为CODE=""
我设置CODE="1" 得到日志:
chatgpt-next-web | [Auth] allowed hashed codes: [ '2f7bb230c70819aeb10b45a709bcf48f' ]
chatgpt-next-web | [Auth] got access code: 1
chatgpt-next-web | [Auth] hashed access code: c4ca4238a0b923820dcc509a6f75849b
通过字符md5我知道 c4ca4238a0b923820dcc509a6f75849b 为1
然后通过一些彩虹表得到了Docker端验证的 2f7bb230c70819aeb10b45a709bcf48f 对应"1" 注意 多了""
问题似乎出在 accessCode 值传递时的引号处理上,导致MD5值计算不一致
以上信息供作者参考,发现当下要解决这个问题有俩个办法:
CODE=123456 这样的格式 客户端使用123456
CODE="123456" 然后客户端使用"123456"
当然除了CODE环境变量 似乎其他变量也是同样的问题,如BASE_URL=值加了"" 即无法工作
Describe the bug
Docker容器设置了
CODE="123456"在前端输入密码123456提示wrong access codeTo Reproduce
Steps to reproduce the behavior:
Deployment
Desktop (please complete the following information):
yidadaa/chatgpt-next-web latest f9e51a3ad227 5 days ago 242MB经过分析所有的问题突然明朗了,文档中Docker命令为
CODE=""我设置
CODE="1"得到日志:通过字符md5我知道
c4ca4238a0b923820dcc509a6f75849b为1然后通过一些彩虹表得到了Docker端验证的
2f7bb230c70819aeb10b45a709bcf48f对应"1"注意 多了""问题似乎出在
accessCode值传递时的引号处理上,导致MD5值计算不一致以上信息供作者参考,发现当下要解决这个问题有俩个办法:
CODE=123456这样的格式 客户端使用123456CODE="123456"然后客户端使用"123456"当然除了
CODE环境变量 似乎其他变量也是同样的问题,如BASE_URL=值加了""即无法工作