Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an Originating Identity http header #222

Merged
merged 1 commit into from
Sep 26, 2017

Conversation

duglin
Copy link
Contributor

@duglin duglin commented Jun 12, 2017

Per my AI from last week's call, I've created a PR for the proposal so its not hidden within the conversation in #110.

Closes #110

Signed-off-by: Doug Davis dug@us.ibm.com

@cfdreddbot
Copy link

Hey duglin!

Thanks for submitting this pull request! I'm here to inform the recipients of the pull request that you and the commit authors have already signed the CLA.

@duglin duglin changed the title Add a delegation http header Add an Originating Identity http header Jun 12, 2017
@jim-minter
Copy link

(copy from #110) I think there's value in copying the Authorization header more closely as follows:
a) use base64 encoding - less chance of implementers tripping up compared to ;charset; spec makes no comment about what's contained inside
b) prepend an identity scheme in us-ascii followed by space (similar to the 'Basic' or 'Bearer' in the Authorization header); allows some extensibility and allows implementations to recognise a scheme without diving into the base64 blob.

example: X-Broker-API-Originating-Identity: MyJSONUserAndGroupScheme eyJ1c2VyIjoiZm9vIiwiZ3JvdXBzIjpbImJhciIsImJheiJdfQ==

spec.md Outdated
for auditing or authorization purposes. In order to facilitate this, the
platform will need to provide this identification information to the broker
on each request. If the platform wishes to provide this information then
it MUST include an additional HTTP header on all requests it sends to the
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really all requests? Or just creational requests (ie, provision, bind)

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, 'MUST' seems like a backward-incompatible change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its for all requests.

The "MUST" is predicated by the "if". If you want to send this info then it MUST be done this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correction - all except GET /v2/catalog

Copy link
Contributor

Choose a reason for hiding this comment

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

I gotcha, missed the 'if' qualification

spec.md Outdated

```
X-Broker-API-Originating-Identity: value[;charset=...]
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to send a scheme as well? Ie, 'I am sending a kubernetes identity'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so. Right now the assumption is that there's some out-of-band understanding between the platform and broker on how to interpret this data.

@pmorie
Copy link
Contributor

pmorie commented Jun 12, 2017

We should note specifically in the spec body when the platform should send this header on a request by request basis.

@duglin
Copy link
Contributor Author

duglin commented Jun 12, 2017

@pmorie I like the idea of being more explicit - I think it makes sense to do it for the other http header(s) too - will give it a shot and see how it looks.

@vaikas
Copy link
Contributor

vaikas commented Jun 13, 2017

Can we discuss the base64 encoding brought up by @jim-minter ?

@pmorie
Copy link
Contributor

pmorie commented Jun 13, 2017

I also support @jim-minter's suggestion of base64 encoding the identity payload (comment: #222 (comment))

spec.md Outdated

| Header | Type | Description |
| --- | --- | --- |
| X-Broker-API-Version* | string | See [API Version Header](#api-version-header) |
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should leave the other headers out of this proposal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not comfortable leaving the spec in a 1/2 completed state. Either we add a table for http headers to each API and fill it out completely, or we don't (perhaps leaving it for a new PR). But I'm not keen on a PR that does 1/2 the job.

Copy link
Contributor

Choose a reason for hiding this comment

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

A swagger spec would resolve the need for this duplication

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm in favor of having a headers table for each endpoint.

@shalako
Copy link
Contributor

shalako commented Jun 20, 2017

Thoughts on base64 encoding the header?

Copy link
Contributor

@pmorie pmorie left a comment

Choose a reason for hiding this comment

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

Two questions, close to LGTM

spec.md Outdated
@@ -92,7 +93,7 @@ that do not understand them.

Requests from the platform to the service broker MUST contain a header that declares the version number of the Service Broker API that the marketplace will use:

`X-Broker-Api-Version: 2.11`
`X-Broker-API-Version: 2.11`
Copy link
Contributor

Choose a reason for hiding this comment

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

Opened #246 for this change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any reason you created a dup PR?

spec.md Outdated
Where:
- its REQUIRED `value` is a non-empty string.
- it MAY include a `charset` parameter specifying the character encoding of
the `value`. If not specified, the default value MUST be `us-ascii`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we want to give an example for CF and Kubernetes here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, do we want to discuss that the value may be any scheme? For example, in Kubernetes, we'll probably want to send the base64 encoded userinfo. See kubernetes-retired/service-catalog#939

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd kind of like to leave that up to the platform instead of being prescriptive since the needs of the platform may vary.

@duglin
Copy link
Contributor Author

duglin commented Jun 28, 2017

From today's call I have a few questions about some of the things people were proposing:

  • base64 encoding of the value. I'd like to understand why we should do this. I'm not totally against it but I'm wondering if its because people think it'll be used to send sensitive data? If so we should discuss that because I don't think that was the intent - its meant to just convey the user initiating the request, nothing more. As such, needing something like a scheme seems like an unnecessary thing to me.
  • @mattmcneeney you said you wanted more structure/definition around the value itself. Can you provide a concrete proposal for what you're looking for and why if we limit it to just "the user"?
  • if we extend this beyond a simple string and allow it to be something like a json object, I'm worried that people will use it to store tons of other data that's not really the intent of this header. People should probably be using the Body/Context to send this other info but I'd like to understand the usecases people have in mind so we can make the right decision.
  • @pmorie you were mentioned using it to store data about where in the platform to provision stuff. W/o knowing more about the usecase that would seem to be better placed into the Context object, or someplace else in the body like the parameters, but we can get more info about this use?

At the last f2f we discussed moving the Context into and http header and realized that it would be problematic - not least of which because of the potential to hit a length limit. Encouraging arbitrary data in this PR's header, and not limiting it to something as simple as an email/userID/uuid/etc.. will lead us back to that same state, so it might be best if we only focus on our immediate needs.

@jim-minter
Copy link

jim-minter commented Jun 28, 2017

base64 encoding of the value

My intention when suggesting this was to reuse a standard, recognisable, simple to implement mechanism to allow small amounts of arbitrary data to be reliably exchanged. Not to obfuscate sensitive data.

json object

A relevant example here is sending both the user identifier and their group memberships, for example. Not reams of information, but enough to make a compound object useful (and if it's base64 encoded by default, then there's protection against usernames with non-ascii characters, etc. I'd hope people wouldn't intend to send more than what you might find in a HTTP Authorization header.

People should probably be using the Body/Context to send this other info

Yes, this would probably better, but one issue is the body on DELETE problem, and it would be really nice to have access to user identification on delete to be able to check authorization.

@mattmcneeney
Copy link
Contributor

@duglin As far as I know, we don't have a use case in CF for this today. I can imagine us wanting to use this for either auditing purposes or possibly for asking brokers to perform actions on a users' behalf. The latter would probably require more than one piece of information (ie. an access token and a refresh token?), but without any concrete examples of how we want to use this, it's hard to plan for the future. (cc @avade @shalako in case I've missed something)

I totally agree with you though that I think storing complex objects in the header would be a bad idea as it puts onus on brokers to deal with errors when the value is not in the format it expects. We purposely avoided doing this when discussing how to send context to brokers.

@duglin
Copy link
Contributor Author

duglin commented Jun 28, 2017

@jim-minter yea, DELETE is always the problem child :-) but I'm hoping that the semantics of that operation shouldn't need additional info that would require it to be passed in the body. Besides, there's always query parameters or other HTTP headers if people really need it. Mashing non-user-identifying info into this header should seem non-kosher to me.

I can see why we may need more than a single string, and thus a struct would be nice - if we add words to make it clear that this isn't a grab-bag to stick any random stuff (even though we can't technically stop people). Do we really need a scheme tag or can we just say its always a base64 json object?

@jim-minter
Copy link

@duglin it's definitely valuable to have the user info on delete - as much as we're discussing at the moment - and the header is good enough to provide that. I'm not personally aware of other information that's needed on delete beyond that (the fact that there's no context object on delete isn't blocking me, at least).

I think a scheme tag is valuable for at least the following reasons:
1- hopefully prevents the need to manually configure/match-up the identity scheme that a catalog sends and that a broker receives at broker registration time
2- makes it easy for a broker to tell what scheme it's dealing with and discard early if it doesn't understand it
3- allows implementation of brokers which can understand multiple schemes if needs be (i.e. understands what kubernetes uses, and what CF uses and can be a broker to either catalog).

@duglin
Copy link
Contributor Author

duglin commented Jun 28, 2017

Sorry if i wasn't clear - I do want this header on DELETE

@duglin
Copy link
Contributor Author

duglin commented Jun 28, 2017

re: scheme - I think the assumption here is that the broker knows the platform (and therefore scheme or data it should expect) based on the identity of the auth negotiation of the request itself - and therefore will know the scheme of this header. It would need to know this, along with probably other info, in order to use it to do things like call back into the platform anyway. Not for simple logging purposes though, obviously, but in that case I doubt it needs to understand the json, it would just need to log it.

To be clear, I'm not 100% against adding a scheme, but I want to make sure we're not adding it unnecessarily because the info is already available thru some other means - and it seems to me that in order for someone to really use the data in the json object they'll need to know a lot more than just the scheme anyway. We'd then need to agree on (standardize) the schemes too, no?

@jim-minter
Copy link

@duglin maybe I'm beginning to understand. Perhaps the scheme isn't utterly essential, but I think it does provide some protection, and maybe mandating it in the spec also provides a small foundation in case in the future a platform could handle multiple identities on behalf of a user and send the right one to a broker.

@duglin
Copy link
Contributor Author

duglin commented Jun 28, 2017

Do you have some sample schemes in mind so I can get a sense of how many (and their shape/values) you're thinking of?

@jim-minter
Copy link

Nothing more than "the scheme Kubernetes uses" (user,groups,extra); "the scheme CloudFoundry uses" (sorry, don't know what that is). Perhaps "username on its own" for good measure.

@duglin
Copy link
Contributor Author

duglin commented Jun 28, 2017

hmmm would it make sense to push for it to be the same string that used as the "platform" field in the "context" object? To get some consistency.

@jim-minter
Copy link

Works for me.

lurraca pushed a commit to vmware-archive/cloud_controller_ng that referenced this pull request Aug 16, 2017
* Send the user's guid if available else omit the header

openservicebrokerapi/servicebroker#222

[#149216559]

Signed-off-by: Sam Gunaratne <sgunaratne@pivotal.io>
lurraca pushed a commit to vmware-archive/cloud_controller_ng that referenced this pull request Aug 16, 2017
* Send the user's guid if available else omit the header

openservicebrokerapi/servicebroker#222

[#149216559]

Signed-off-by: Sam Gunaratne <sgunaratne@pivotal.io>
Copy link
Contributor

@pmorie pmorie left a comment

Choose a reason for hiding this comment

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

Not sure about including this on last_operation requests.

| Header | Type | Description |
| --- | --- | --- |
| X-Broker-API-Version* | string | See [API Version Header](#api-version-header). |
| X-Broker-API-Originating-Identity | string | See [Originating Identity](#originating-identity). |
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the identity of the user that initiated the original action or the service account the platform component is running under?

I'm not sure that this makes sense to send on last operation, actually, because it seems like it's just checking the status of an action that's already been triggered.

Copy link
Contributor

Choose a reason for hiding this comment

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

In the Cloud Foundry implementation we omit the header during last_operation and certain orphan mitigation scenarios as it is the platform performing the action.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@mattmcneeney
Copy link
Contributor

A PR for this change has now been submitted to the Cloud Controller in CF as part of the validation through implementation: cloudfoundry/cloud_controller_ng#877

@duglin duglin force-pushed the issue110 branch 3 times, most recently from 23393a4 to b8570de Compare August 29, 2017 16:15
@mattmcneeney mattmcneeney self-assigned this Sep 1, 2017
lurraca pushed a commit to vmware-archive/cloud_controller_ng that referenced this pull request Sep 6, 2017
* Send the user's guid if available else omit the header

openservicebrokerapi/servicebroker#222

[#149216559]

Signed-off-by: Sam Gunaratne <sgunaratne@pivotal.io>
lurraca pushed a commit to vmware-archive/cloud_controller_ng that referenced this pull request Sep 6, 2017
* Send the user's guid if available else omit the header

openservicebrokerapi/servicebroker#222

[#149216559]

Signed-off-by: Sam Gunaratne <sgunaratne@pivotal.io>
@mattmcneeney
Copy link
Contributor

This has been merged into the Cloud Controller and the implementation has been validated.
cloudfoundry/cloud_controller_ng#877

Calling for reviews!
@angarg12 @duglin @pmorie @skaegi @shalako @vaikas-google @fmui @avade

spec.md Outdated
platform will need to provide this identification information to the broker
on each request. Platforms MAY support this feature, and if they do, they
MUST adhere to the following:
- for any OSB API request that is the result of an action taken by
Copy link
Contributor

Choose a reason for hiding this comment

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

Caps?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@angarg12 "Caps?" on which word(s) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

These 3 bullet points begin with a lowercase letter, - for, - any, - if

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah ok, done.

@mattmcneeney
Copy link
Contributor

Let's get this one merged folks. @duglin do you need to change anything following @angarg12's comment or are we good to go?

@angarg12
Copy link
Contributor

Yup, it also needs rebase.

Closes openservicebrokerapi#110

Signed-off-by: Doug Davis <dug@us.ibm.com>
@duglin
Copy link
Contributor Author

duglin commented Sep 18, 2017

addressed comments and rebased.

@mattmcneeney
Copy link
Contributor

mattmcneeney commented Sep 18, 2017

LGTM 👏 👏 👏

Approved with PullApprove

@angarg12
Copy link
Contributor

angarg12 commented Sep 18, 2017

LGTM

Approved with PullApprove

@fmui
Copy link
Member

fmui commented Sep 26, 2017

LGTM

Approved with PullApprove

@avade
Copy link
Contributor

avade commented Sep 26, 2017

lgtm

Approved with PullApprove

@avade avade merged commit ade39a2 into openservicebrokerapi:master Sep 26, 2017
@duglin duglin deleted the issue110 branch October 26, 2017 12:34
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.