Skip to content

If orgID already present, rename instead of reject#63

Closed
leth wants to merge 1 commit intomasterfrom
org-id-handling
Closed

If orgID already present, rename instead of reject#63
leth wants to merge 1 commit intomasterfrom
org-id-handling

Conversation

@leth
Copy link
Contributor

@leth leth commented Sep 22, 2017

As discussed in a related private change, I am trying a certain request from an internal service which results in this header already being present.

If we simply rename the offending header, rather than reject the request, then things should work.

@leth leth requested review from jml and rndstr September 22, 2017 23:13
@rade
Copy link
Member

rade commented Sep 22, 2017

Why rename it? What is looking at the new "orig" headers introduced in this PR?

@leth
Copy link
Contributor Author

leth commented Sep 22, 2017

True, I don't plan to look at it. I was mostly thinking it might be useful to have it around for debugging weird issues. I also considered logging a warning or debug message.

Happy to change it, what do people prefer?

Copy link
Contributor

@rndstr rndstr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code implements what the description says 👍 noted one minor cleanup suggestion

newCtx = metadata.NewOutgoingContext(ctx, md)
}
md[lowerOrgIDHeaderName] = []string{orgID}
newCtx = metadata.NewOutgoingContext(ctx, md)

This comment was marked as abuse.

Copy link
Contributor

@jml jml left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand the motivation for this change.

I'm a little worried that by making this succeed rather than fail, we open up opportunities for accidental impersonation.

I think if we do proceed, logging is probably better than passing along the old header.

@leth
Copy link
Contributor Author

leth commented Sep 26, 2017

Going to decline this, in favor of adding a middleware to authfe which drops any offending incoming headers.
Changing it here has complicated implications on other services that use this, and the checks may have some safety/sanity benefit to them.

@leth leth closed this Sep 26, 2017
yeya24 pushed a commit to yeya24/common that referenced this pull request Jun 12, 2024
route: Allow contextFn to return an error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants