Azure-Samples / Azure-Samples/ms-identity-python-samples-common

Intermittent 'Failed to match request state with session state' with Django adaptor

未关闭
#4 1 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
47
派生
42
PR 合并指标
30 天内没有已合并 PR

描述

### This issue is for a: (mark with an `x`)
```
- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
```

### Minimal steps to reproduce
Default Django setup as per [Azure-Samples/ms-identity-python-django-tutorial](https://github.com/Azure-Samples/ms-identity-python-django-tutorial/tree/main/1-Authentication/sign-in)

### Any log messages given by the failure

Django error email report snippet:

```
• /opt/master/venv/lib/python3.8/site-packages/ms_identity_web/__init__.py in _verify_state
259.
260. raise AuthSecurityError("Failed to match request state with session state")
261.
Local Vars
Variable Value
req_params {'code': '0.AQAA',
'session_state': 'aa8b2958-b1c4-4e71-a95c-a682c2180777',
'state': 'c5af71b0-fc95-4d3c-896e-a5c8306d86f7'}
self
session_state None
state 'c5af71b0-fc95-4d3c-896e-a5c8306d86f7'

````

### Expected/desired behavior

`session_state` should not be `None` and should match `state` param at https://github.com/Azure-Samples/ms-identity-python-samples-common/blob/main/ms_identity_web/__init__.py#L258

### OS and Version?
> Django 2.2 using gunicorn on Ubuntu 20.04 EC2

### Versions
> MSAL 1.12.0

### Mention any other details that might be useful
Seems easier to repro using Firefox, but have seen using Edge/Chrome.

贡献指南

打开贡献指南

调研方向

Start at ms_identity_web/__init__.py, especially _verify_state around the reported line, and compare how the session state is stored and read in the Django 2.2 setup using gunicorn. Reproduce the intermittent failure with the linked Django tutorial, paying attention to Firefox, Edge, and Chrome. Done means the callback no longer sees session_state as None and the relevant test or reproduction confirms matching state values.

由索引模型根据 Issue 内容生成。

评估

技术栈
django, python, ubuntu
领域
authentication, backend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
28/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。