aws / aws/chalice

Running app locally with built-in authorizers does not use specified header

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

Description

As per the documentation, we are able to define a built-in authorizer using the decorator function `authorizer` as in this example:
`@app.authorizer(ttl_seconds=600, header="CustomHeader")`

However, when running locally via the `chalice local` command, the 'header' parameter is ignored and the app will only accept the "authorization" header. The local app should instead use the value "CustomHeader".

Steps to reproduce:
1. Follow example app from here: https://aws.github.io/chalice/topics/authorizers.html#built-in-authorizers
2. Update the annotation to change the header field to "CustomHeader".
3. Run the updated app via `chalice local`.
4. Hit the endpoint as per the documentation except using "CustomHeader" instead of "Authorization". Notice how the request is rejected.

It appears that deployed apps do not have this issue, only when running locally.

Contributor guide

Open the contributing guide

Research direction

Start with the built-in authorizer example in the authorizers documentation and reproduce the failure through the `chalice local` entry point using `@app.authorizer(..., header="CustomHeader")`. Trace local request handling for the authorizer and compare it with the deployed behavior. Done means the local app accepts the configured `CustomHeader` value rather than only `Authorization`.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication, backend, cli
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.