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

[BUG] 访问后台接口出现 JWT 校验异常 #323

Closed
2 of 3 tasks
ZhuoZhuoCrayon opened this issue Dec 7, 2021 · 0 comments
Closed
2 of 3 tasks

[BUG] 访问后台接口出现 JWT 校验异常 #323

ZhuoZhuoCrayon opened this issue Dec 7, 2021 · 0 comments
Assignees
Labels

Comments

@ZhuoZhuoCrayon
Copy link
Member

ZhuoZhuoCrayon commented Dec 7, 2021

问题描述
请求节点管理后台 401

重现方法
访问任务历史详情、插件管理-策略等页面

该问题在全新部署场景下必现

请提供以下信息

  • bk-nodeman 版本 (发布版本号 或 git tag): V2.1.356
  • 蓝鲸PaaS 版本:
  • bk-nodeman 异常日志:
json.asctime:
2021-12-06 19:18:50,745
json.exc_info:
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.6/site-packages/jwt/algorithms.py", line 205, in prepare_key
    key = load_pem_private_key(key, password=None, backend=default_backend())
  File "/app/.heroku/python/lib/python3.6/site-packages/cryptography/hazmat/primitives/serialization/base.py", line 16, in load_pem_private_key
    return backend.load_pem_private_key(data, password)
  File "/app/.heroku/python/lib/python3.6/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 1051, in load_pem_private_key
    password,
  File "/app/.heroku/python/lib/python3.6/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 1277, in _load_key
    self._handle_key_loading_error()
  File "/app/.heroku/python/lib/python3.6/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 1335, in _handle_key_loading_error
    raise ValueError("Could not deserialize key data.")
ValueError: Could not deserialize key data.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/bkoauth/jwt_client.py", line 77, in get_jwt_info
    self.payload = jwt.decode(self.raw_content, public_key, issuer="APIGW")
  File "/app/.heroku/python/lib/python3.6/site-packages/jwt/api_jwt.py", line 92, in decode
    jwt, key=key, algorithms=algorithms, options=options, **kwargs
  File "/app/.heroku/python/lib/python3.6/site-packages/jwt/api_jws.py", line 156, in decode
    key, algorithms)
  File "/app/.heroku/python/lib/python3.6/site-packages/jwt/api_jws.py", line 220, in _verify_signature
    key = alg_obj.prepare_key(key)
  File "/app/.heroku/python/lib/python3.6/site-packages/jwt/algorithms.py", line 207, in prepare_key
    key = load_pem_public_key(key, backend=default_backend())
  File "/app/.heroku/python/lib/python3.6/site-packages/cryptography/hazmat/primitives/serialization/base.py", line 20, in load_pem_public_key
    return backend.load_pem_public_key(data)
  File "/app/.heroku/python/lib/python3.6/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 1077, in load_pem_public_key
    self._handle_key_loading_error()
  File "/app/.heroku/python/lib/python3.6/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 1335, in _handle_key_loading_error
    raise ValueError("Could not deserialize key data.")
ValueError: Could not deserialize key data.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.6/site-packages/blueapps/account/components/bk_jwt/backends.py", line 36, in authenticate
    verify_data = self.verify_bk_jwt_request(request)
  File "/app/.heroku/python/lib/python3.6/site-packages/blueapps/account/components/bk_jwt/backends.py", line 90, in verify_bk_jwt_request
    jwt = JWTClient(request)
  File "/app/bkoauth/jwt_client.py", line 51, in __init__
    self.get_jwt_info()
  File "/app/bkoauth/jwt_client.py", line 90, in get_jwt_info
    self.error_message = error.message
AttributeError: 'ValueError' object has no attribute 'message'
json.funcName:
authenticate
json.levelname:
ERROR
json.lineno:
38
json.message:
[BK_JWT]校验异常: 'ValueError' object has no attribute 'message'
json.pathname:
/app/.heroku/python/lib/python3.6/site-packages/blueapps/account/components/bk_jwt/backends.py
json.process:
20
json.thread:
140594183533832
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants