Azure / Azure/azure-functions-host
POST systemkey should return 409 if resource is already existed
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
#### Expected behavior
POST http://myApp.azurewebsites.net/admin/host/systemkeys/Key1?code=adminKey
would return HTTP 409 if `Key1` already existed: [a stackoverflow answer on using POST for creation](https://stackoverflow.com/questions/3825990/http-response-code-for-post-when-resource-already-exists)
#### Actual behavior
it overrides existing systemkey with a new value
I feel like overriding a systemkey is pretty significant, since it invalidates previously created authenticated URLs, if we still want the ability to update a systemkey with a non-user specified value, we would expand the PUT API
https://github.com/Azure/azure-webjobs-sdk-script/blob/56d2014240e8f7d577c81dd723fead0030ca95eb/src/WebJobs.Script.WebHost/Controllers/KeysController.cs#L103-L113
Contributor guide
Research direction
Read KeysController.cs around lines 103-113 and trace the POST systemkey path for an existing Key1. Confirm the desired behavior is a 409 response without replacing the current value, while preserving creation of new keys. The issue does not name a test file, so locate the existing controller coverage before verifying both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, authentication
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100