Repository navigation
Allow App Service callers without a principal name - #479
Open
Hyun Lee (dlwhdgus0810) wants to merge 1 commit into
Open
Hyun Lee (dlwhdgus0810) wants to merge 1 commit into
Hyun Lee (dlwhdgus0810) wants to merge 1 commit into
Conversation
App Service Authentication sends no x-ms-client-principal-name header when the caller has no name claim, as with a service principal. Reading request.user then threw an internal error. The username is now empty for such callers. Fixes Azure#374
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #374
Problem
App Service Authentication sends no
x-ms-client-principal-nameheader when the caller has no name claim. A service principal that calls the API with a client credentials token is one such caller. The other headers are still sent:x-ms-client-principal-id,x-ms-client-principal-idpandx-ms-client-principal.extractHttpUserFromHeadersrequired the name header throughnonNullValue, so readingrequest.userthrew:Changes
AppServicebranch uses an emptyusernamewhenx-ms-client-principal-nameis missing. The id and identity provider headers are still required.usernamedoc comment intypes/http.d.tssays when it is empty.The type stays
string, so existing code keeps compiling.username?: stringwould describe the service principal case more exactly, but it changes the public type. I can switch to that if you prefer it.Testing
test/http/extractHttpUserFromHeaders.test.ts: AppService headers withoutx-ms-client-principal-namegive anAppServiceuser with an emptyusername. Without the change, the test fails with the error above.npm test: 463 passing.eslint,prettier --checkandnpm run buildpass.