Proposal: Supporting Loose-Coupling in Security Schemes and Security Requirements Objects #5304
Replies: 16 comments 44 replies
-
|
@SensibleWood great to see this proposal- I'm still digesting most of it, but I did want to ask a question about:
The Security Requirement Object is currently a map where all values are arrays of strings (and the I'm not against a redesign, but I think we would have a new name and field for the resulting Objects so that people using the old system can continue to do so without confusion (as we did with adding the new But I want to make sure I'm not misreading this. |
Beta Was this translation helpful? Give feedback.
-
Sounds good @handrews I'm happy with a new, side-by-side object - I used the description of Security Requirement largely for familiarity for anyone reading this - it can be new and called Doris, Gertrude, or Sebastian, as long as folks can make sense of what it is and what does. |
Beta Was this translation helpful? Give feedback.
-
|
@baywet @handrews @lornajane just reflecting the discussion on TDC today, we'd look at using a registry to add a source of truth for the "approved" security profiles |
Beta Was this translation helpful? Give feedback.
-
|
A few notes following on from the TDC meeting. Expanded Design NotesOne of the gaps in the ecosystem alongside loosely coupled profiles such as that proposed is "joining up" what a security scheme is and what operations get invoked. I was therefore thinking there is value in adding another optional parameter here called "Supported Operations" that points to the canonical definitions of what Authorization Server operations (or their equivalent in non-OAuth 2.0 profiles) can look like. To be clear: This points to an OpenAPI description which defines the example Authorization Server operations. components:
securitySchemes:
BrasilOpenFinanceProfile:
type: profile
profileMetadata:
name: fapi-20-security-profile
supportedParametersSchema: https://examples.openapis.org/brasil-fapi20-profile-schema.json
supportedOperations: https://examples.openapis.org/brazil-protected-operations-openapi.yaml
servers:
- name: Development
url: https://examples.openapis.org/dev/.well-known
- name: Production
url: https://examples.openapis.org/prod/.well-knownThen in the Security Requirement object - now rechristened "Security Profile Requirement Object", again thinking on naming because this is so much better than Doris, Gertrude or Sebastian - a JSONPath indicates the correct operation to be invoked. The "Supported Parameters Schema" still provides the source of truth for the parameters, because I think there needs to be loose coupling between the canonical definition of the operations and the parameters, to make for reuse across different operations and avoid having a one-to-one relationship between a Security Profile Requirement Object and an Operation Object in component:
securityProfileRequirements:
AccountConsentClientCredentials:
securityScheme:
$ref: "#/components/schemas/BrasilOpenFinanceProfile"
supportedOperation: "$.paths['/auth/1.0/token'].post"
token_endpoint_auth_methods:
- private_key_jwt
grant_types:
- client_credentials
scopes:
- account-information-consent:write
- account-information-consent:readPros for this kind of thing:
Cons:
Registry@baywet brought up the registry requirement, which I'd thought of but not written down in the initial idea. As the OpenAPI Specification we'd look to register
OR Brasil and UK just use Key points here:
The nice thing is OAI doesn't need to decide this, its for the ecosystems involved to the right thing with the guardrails we set. |
Beta Was this translation helpful? Give feedback.
-
|
@SensibleWood let me see if I have this correct: The
The Security Profile Requirement:
Is this correct? I want to make sure before I start commenting further. |
Beta Was this translation helpful? Give feedback.
-
|
@SensibleWood The fundamental idea of defining / refining profiles of existing standards is excellent. I do have some questions and concerns about the specifics, and also maybe want to split this up a bit as it is trying to do a lot at once. A lot of those things are relevant to other security approaches (or even beyond that), and I want to make sure we take those into account. We already know that the existing Security Scheme approach is inadequate, so we'll be doing more in this area than just adding a TL;DR: This is the right direction, and I am mostly (aside from some confusion about the auth server OAD usage) convinced that it does what you want for the example that you have given. But I think there are a lot of details that need to be considered and shown to work before we can move forward with anything more concrete. NOTE: The remainder of this comment has been moved to individual threads below, each with a large heading, except for the Servers comment which has been moved to issue #2284) |
Beta Was this translation helpful? Give feedback.
-
Restricting profilesI want to push back a bit on using a JSON Schema here (although see other threads for more on where a schema might still be useful). My sense of the metadata files is that they already define an "interface" in the sense of specifying what options are supported, which means that any usage has to pick a specific option from each list. The examples above seem to fit with that, and seem to just further constrict the lists. I am assuming that there is some software out there already that knows how to read the metadata formats and enable selection from the available lists. Making the OAS use a JSON Schema here introduces an additional technology, and one that is best suited to validating a specific input, and notoriously difficult for defining an interface. Parsing a JSON Schema to determine what might constitute a valid instance in advance is highly non-trivial. We already have some wording limiting how much schema parsing is necessary to do in other contexts, becasue without those limits it's just prohibitively difficult. So my question is, why not just use a JSON Merge Patch value to constrain the metadata, and then let whatever existing software knows how to process metadata handle that without bringing a JSON Schema into the mix? We would need to think about how to handle a merge-patch that expands a supported list, as that seems pathological, but if the original metadata is accurate, then attempting to expand it would just fail when the expanded value was used, so maybe that problem takes care of itself. |
Beta Was this translation helpful? Give feedback.
-
Authorization Server OADI agree that there are ambiguities in authorization server interactions, but I am a bit skeptical of solving this with an OAD for the auth server. I am a fan of the idea of enabling auth workflows through Arazzo, but that's more of a "I have a weird experimental new thing and there's no other way to handle it" escape hatch. What are the things that this auth server OAD is supposed to be clarifying? The example just referendes an operation but doesn't show how that actually works. I know that in some OAuth flows, information can be sent or returned in any of several different places. Is the OAD supposed to clarify that? If so, how is that expected to work? I don't think OAS 3.2 can describe things in sufficient detail. I think we need to see a full example of this to understand what is going on. |
Beta Was this translation helpful? Give feedback.
-
Generic OAuth usageWhat would it look like if we wanted to frame all OAuth configurations with this approach? Essentially defining an "empty" profile that allows whatever OAuth allows. Would that work? What would it look like? Or would we require everyone who wants to use OAuth to creae and register a profile before being able to use it? |
Beta Was this translation helpful? Give feedback.
-
InputsThe schema currently being used to restrict the metadata also defines which things require inputs (although as noted above I think this can be done without the compelxity of a schema). But is it only metadata-listed values that are needed for inputs? Are there inputs needed around the auth server OAD usage? Or any other ambiguities that would need to be clarified at the point of use? If so, where are they handled? This probably becomes more important if we are looking at supporting arbitrary OAuth usage where, to the extent that there is a "profile" at all, it is specific to the single API. |
Beta Was this translation helpful? Give feedback.
-
HTTP Auth and other interactionsSometimes it is possible to use different HTTP Auth schemes in the context of OAuth (e.g. My preference is that whether you are using HTTP Auth on its own or in the context of frameworks like OAuth and GNAP, it should look the same (as much as possible). This might require thinking through what we wnat HTTP Auth usage to look like in general (the current Similar interaction concerns might exist for mTLS and other mechanisms that can be used either on their own or as part of a framework. |
Beta Was this translation helpful? Give feedback.
-
GNAPI want to make sure that this profile approach works for GNAP as well, so that we can see if it makes sense for metadata-driven frameworks in general. I don't necessarily need for this to be totally agnostic about OAuth vs GNAP vs whatever; it might make sense to have separate OAuth-by-profile or GNAP-by-profile systems. But they should be conceptually and (where possible) syntactically consistent. |
Beta Was this translation helpful? Give feedback.
-
Rich AuthorizationSome OAuth profiles require the use of Rich Authorization Requests (RAR), which were developed alongside GNAP's largely compatible authorization system. How does this fit into the profile approach? My understanding is that this is an alternative to the traditional OAuth scopes approach that we support today, and that it is even possible to use both at once. |
Beta Was this translation helpful? Give feedback.
-
Separation of concernsWith your Security Profile Requirement Object (SPRO), it seems like you have shifted the boundaries somewhat. Current Security Scheme Objects (SSOs) are just used as-is by Security Requirements, with at most a selection of which scope(s) apply. There's no need to But the SPRO fills out the details of your |
Beta Was this translation helpful? Give feedback.
-
Modeling credential contentsThere have been quite a few requests for modeling credential contents of various sorts. How would that fit in with this proposal? (and yes, I'm aware that some of them are supposed to be opaque, but people use the OAS for different purposes, sometimes more implementation-related and sometimes more interface-related). Many things in the JOSE suite have their own media type, so we can model them with a Media Type Object. The question is where to put the model? |
Beta Was this translation helpful? Give feedback.
-
|
@SensibleWood taking a bit of a step back, I think I do not fully understand exactly who does what (apologies if some of this has been answered and I just missed it, I figure it's good to collect this in one place anyway):
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The OpenAPI Specification provides a number of Security Scheme objects that are, largely speaking a "point in time" view
of a security requirement.
Take OAuth Flow Objects for example. OAuth Flow objects create a description of the security requirements for invoking given Operation that requires providing static properties that may not duplicate properties from the source of truth for the OAuth implementation. This duplication creates an inherent risk of drift, with security properties being updated in two places, with the OpenAPI view of OAuth often often much less rich than say - for example - OAuth Server Metadata.
Security Scheme Objects therefore potentially create a tight coupling between a given Operation Object (or the entire API description) and a snapshot of the OAuth configuration for that Operation. This approach served older versions of the OpenAPI Specification adequately enough, but the evolution of the security space and the creation of profile-based OAuth and OpenID Connect specification, such as the FAPI 2.0 Security Profile, has resulted in a significant gap between what the OpenAPI Specification can describe, and what such security profiles need to describe to API consumers.
This proposal therefore suggest a way forward on unlocking the means to describe security profiles in a suitably deterministic and loosely coupled way that provides API consumers with the affordances required to accurately understand the security requirements for a given Operation.
Principles
Like any good proposal (well you can be the judge of that) some core principles provide useful context for understanding
the design approach.
The table below outlines said principles.
Proposed Changes
Taking these principles as a guide (or maybe just some context) the proposed changes are provided below as building
blocks, to show progression from the most coarse-grained object to the most fine-grained.
This approach is taken to hopefully provide a persuasive view of the proposed changes.
Extensions to the Security Scheme Object
The first step is to extend the capabilities of the Security Scheme Object, to provide a comprehensive view of
Profile Metadata. Given this is aimed at v3.3, and is thus a non-breaking change, the approach is to introduce these
alongside existing OAuth and OpenID Connect objects.
The snippet below provides an example of the proposed change (with objects inline for clarity).
To annotate the example:
typeis introduced calledprofile, which indicates a security scheme based on an external source ofmetadata.
profileMetadatathen provides the metadata describing the profile, namely:apply or adhering to API security.
Discovery data.
openIdConnectUrlparameter significantly, and represents a more accurate representation of OpenID deployments, where multiple
discovery operations are hosted (and it makes sense to provide for them all, not just - yes Overlays, but lots of
organizations aren't there yet).
The job here for OpenAPI is not to provide a canonical view of the profile in its entirety, but instead to provide
enough "pointers" that allow API consumers to establish a source of truth.
Key to this mechanism is the
schemaproperty, which provides the attributes addressable in this profile. The utilityof this is leveraged in a revised Security Requirement object.
Profile Schema
The Profile Schema is a new feature that provides the "glue" between an external profile and what is described in
OpenAPI.
The design intention here is simple: Avoid the need to encode, and therefore maintain, every attribute from an external
security profile. Anecdotally many community members would agree that extending API security mechanisms in the OpenAPI
Specification is a good idea, but with a small team of active contributors there is a need to think more widely, so that
components of the specification can be loosely coupled, and maintained as separate artifacts.
OpenAPI does, of course already incorporate many other established standards, but where we reference RFCs or other
artefacts they tend to be slow moving and relatively straightforward to track. API security is complex, with many
properties, and security profiles are often edited (and frankly, well understood) by similarly small teams.
The loosely coupled approach is therefore intended to address both technical ownership and community needs.
A non-normative example of a JSON Schema that describes OpenAPI Discovery data (which may well exist in the wild - and
all the better if it did) is as follows. In this example OpenID Discovery metadata properties are truncated to -
removing the
_supportedsuffix - to provide concrete lists of what is enforced in a given Security Requirement. Forthe avoidance of doubt, the properties in question are
grant_types_supported,token_endpoint_auth_methods_supported,and
scopes_supported.Extensions to the Security Requirement Object
The new profile-based Security Scheme is therefore intended to significantly "unlock" what a Security Requirement can
provide, by simply referencing attributes of the profile stated in the schema.
The following is an example of a Client Credentials grant type, protected only by a JWT-based Client Assertion, and
based on the JSON Schema example above.
Each of the properties in the example Security Requirement are correlated with the profile metadata, and described by the
schemainprofileMetadata. Here there is only one mandatory property,securitySchemewhich provides the referenceto the Security Scheme object that defines the metadata.
However, ideally this would actually be a Reference Object, with a new Security Requirement Component Object added to the
Component Object:
Evaluation
Again, like any good proposal, and especially the bad ones, this brings pros and cons.
On the pros side of the fence we get:
look after themselves. This could have neat side effects...
on profiles (with appropriate guardrails) without relying on the core standards team, potentially increasing support
across multiple security profiles. The TSC of course remains the arbiters of everything to do with final edits and
merges, and the custodians of the enabling structure.
common complaint in the tooling ecosystem is tooling makers have to implement "everything". The profile model, when
tailored around specific subject areas, provides places to ignore stuff.
On the cons there is:
(in the sense of a layperson who knows about OpenAPI, of course).
continue to the canonical source for all changes, and for the objects that enclose the model).
Next Steps
Let us discuss.
Beta Was this translation helpful? Give feedback.
All reactions