qd-today / qd

QD [v20240210] —— HTTP请求定时任务自动执行框架 base on HAR Editor and Tornado Server
https://qd-today.github.io/qd/
MIT License
4.44k stars 576 forks source link

[Bug] 20230821更新 20240210后登录失败 #520

Closed guvmao closed 7 months ago

guvmao commented 7 months ago

Verify steps

QD Version

20240210

Bug on OS

Linux

Bug on Platform

Docker/Linux 64位

To Reproduce

-

Describe the Bug

容器部署,未更改AES_KEY和 COOKIE_SECRET,修改镜像tag为最新版本部署之后登录失败,回退镜像版本依然登录失败。

QD config

apiVersion: apps/v1
kind: Deployment
metadata:
  name: qd
  namespace: prod
spec:
  replicas: 1
  selector:
    matchLabels:
      app: qd
  minReadySeconds: 5
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
  template:
    metadata:
      labels:
        app: qd
    spec:
      terminationGracePeriodSeconds: 10
      containers:
      - name: qd
        image: qdtoday/qd:20240210
        # image: qdtoday/qd:20230821
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        volumeMounts:
        - name: qd-pvc
          mountPath: /usr/src/app/config
        env:
        - name: TZ
          value: Asia/Shanghai
        - name: DOMAIN
          value: qd.test.cn
        - name: AES_KEY
          value: xxxx
        - name: COOKIE_SECRET
          value: xxxx
        - name: QD_DEBUG
          value: "True"
      volumes:
      - name: qd-pvc
        persistentVolumeClaim:
          claimName: qd-pvc

QD log

Traceback (most recent call last):
  File "/usr/src/app/db/user.py", line 163, in decrypt
    old = tmp = crypto.aes_decrypt(data, userkey)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/app/libs/mcrypto.py", line 72, in aes_decrypt
    aes = AES.new(key, mode, iv)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/Crypto/Cipher/AES.py", line 228, in new
    return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/Crypto/Cipher/__init__.py", line 79, in _create_cipher
    return modes[mode](factory, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/Crypto/Cipher/_mode_cbc.py", line 274, in _create_cbc_cipher
    cipher_state = factory._create_base_cipher(kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/Crypto/Cipher/AES.py", line 89, in _create_base_cipher
    if len(key) not in key_size:
       ^^^^^^^^
TypeError: object of type 'Ext' has no len()

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/tornado/web.py", line 1786, in _execute
    result = await result
             ^^^^^^^^^^^^
  File "/usr/src/app/web/handlers/login.py", line 56, in post
    if await self.db.user.challenge(email, password, sql_session=sql_session):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/app/db/user.py", line 108, in challenge
    password_hash = await self.decrypt(user['id'], user['password'], sql_session=sql_session)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/app/db/user.py", line 172, in decrypt
    raise self.UserDBException('decrypt error')
db.user.User.UserDBException: decrypt error

Expected behavior

-

Screenshots

No response

guvmao commented 7 months ago

无法复现~