Azure / Azure/azure-functions-host
Create hash from key and log this hash with each http request or webhook endpoint (for event grid)
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 36
Description
Currently, if the client sends a request with an invalid or incorrect key, we do not have a way check in the logs if the key is valid. Adding a hash would be useful for CRI investigations.
Scenario:
The customer has set the authorization level to function for their httptrigger (function), so any request must include the key either in the query string or the x-functions-key HTTP header. In the frontend, we do not log the key, so we do not have a way to check if the provided key is correct.
The customer says that they were sending the correct key (they shared a screenshot of applications insights where it shows the key in the query string). In the frontend, we can see the request coming in. In the Functions logs, we can see that the customer was getting a 401 authorized error due to authorizationlevel = "Anonymous". Please correct me if I am wrong, but it looks like frontend or Functions Host checks that key matches what’s in storage, and it does not, the key gets removed from the request and sends it as anonymous, and therefore, getting an 401. With the current logs, we cannot determined if the provided key was correct.
Having a hash that gets generated from the key could help investigate issues like this. This way we could compare the hash for successful vs failed requests.
Contributor guide
Research direction
The issue names HTTP triggers, webhook endpoints, the x-functions-key header, the frontend, and Functions Host logs, but no files or tests. Start by tracing where key validation and 401 authorization logging occur, then determine the appropriate request paths and log fields. Done means successful and failed requests expose a comparable key hash without logging the key itself.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- authentication, backend, observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100