aws / aws/chalice

Chalice does not respect authorizer header argument locally

Open
#1,976 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
11.1k
Forks
1k
Avg merge
1d 22h
Merged PRs (30d)
2

Description

Hi,

I've noticed that if you specify a `header` for the `authorizer` and try it locally it won't work; it will still check for the `Authorization` header rather than the header I specified.

Example:
```python
@app.authorizer(header="Cookie")
def authorizer(auth_request):
token = auth_request.token
```

Here, it will not respect `"Cookie"` and use it as the header for authorization. It will still go for `"Authorization"`.

I dug a little bit, and it turned out that it's fixed to `Authorization` in the code itself.

The behavior is correct when you deploy; the problem is only present locally.

I'm making a PR to create a fix for it.

Thanks

Contributor guide

Open the contributing guide

Research direction

Start by tracing the local handling of the app.authorizer(header="Cookie") entry point and how the authorizer receives auth_request.token. Compare the local behavior with the deployed behavior, then verify that a custom header is used locally instead of Authorization.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.