-
Notifications
You must be signed in to change notification settings - Fork 46
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
How protect an individual process hosted with OGC API Processes? #418
Comments
It depends on whether this information should be in the OpenAPI document, the process description (i.e. OpenAPI security objects can be defined at multiple levels. In the use case above, an OpenAPI document can define a security object. The example below defines an API key requirement for process execution via only POST (see the "/processes/pygeometa-metadata-validate/execution": {
"post": {
"security": {
"my_api_key": {
"type": "apiKey",
"name": "api_key",
"in": "header"
}
},
"description": "Validate metadata from a pygeometa metadata control file (MCF)",
"operationId": "executePygeometa-metadata-validateJob",
"requestBody": {
"content": {
"application/json": {
"example": {
"inputs": {
"mcf": {
"mcf": {
"version": "1.0"
}
}
}
},
"schema": {
"$ref": "https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas/execute.yaml"
}
}
},
"description": "Mandatory execute request JSON",
"required": true
},
"responses": {
"200": {
"$ref": "#/components/responses/200"
},
"201": {
"$ref": "https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/responses/ExecuteAsync.yaml"
},
"404": {
"$ref": "https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/responses/NotFound.yaml"
},
"500": {
"$ref": "https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/responses/ServerError.yaml"
},
"default": {
"$ref": "#/components/responses/default"
}
},
"summary": "Process pygeometa metadata control file (MCF) validation execution",
"tags": [
"pygeometa-metadata-validate"
]
}
}, @securedimensions would this work? Or are you thinking to describe security in Given this is natively supported in OpenAPI by design, at multiple levels (from server wide to path/operation specific), I would prefer delegating this to OpenAPI. |
Ideally, it should be possible to see that these request headers are needed in the process description, so that OGC API - Processes clients that do not parse OpenAPI definition can easily find the information. Also, if using a Note that there's also a proposal to define an OpenAPI process description, which would fit very well with this (but does not remove the need to support this in a process description). For Part 3, there is also the need to pass these authorization headers in execution requests across workflows to nested processes as @gfenoy highlighted before. I would suggest that we consider this authentication header capability in process description for 1.1/2.0 or a future extension. |
I believe that when the HTTP request is sent to The JSON body of the process description does not need to include anything. Using |
@tomkralidis Any process deployed is described via a HTML page or JSON response. Here is an example of a process that requires an API-Key to get executed: Trusted Tea Pot Process. In that response, I can select describe process as JSON. Now, in that response, I would suspect a definition that this particular service needs an Hope you understand. What am I missing? |
@securedimensions this then becomes an addition to the process description response. OpenAPI already has a mechanism to express this. I guess we could consider re-using OpenAPI security object at the process description level as an option, |
@securedimensions https://swagger.io/docs/specification/authentication/api-keys/ That example also shows how the corresponding token header is specified on the OpenAPI interface. The fact that the process description is requested is in itself the way to obtain that information about the applicable tokens for that endpoint. |
If I understand correctly, the goal is to secure access to the execution endpoint for a given set of processes. I agree about using the OpenAPI security section directly in such a situation. If we don't consider the Part 2 draft specification, this solution is an option. If we do, we will have a dynamic However, it seems important to address one question: how do the other endpoints function? Let's consider the endpoint Also, how can the client application specify, at the deployment time, whether a process should be secured? If we add the security information in the process description, as @securedimensions asked and proposed by @jerstlouis and @tomkralidis, then this part is solved, by embedding the information in the process description of the OGC Application Package. So, I am in favor of adding this as well. In the described use case, only the execute endpoint should be secured, but would it be possible to specify which paths should be secured for every deployed process? Indeed, we may think that accessing the Finally, imagine a use case where we support the Part 2 draft specification. We still want a secured execution endpoint for some processes (e.g., In the following prototype Server Instance, the goal was to have a dedicated namespace per user able to access only the resources he created, we handled the security by securing the following paths (meaning all endpoints defined whichever the request method):
As you can deploy processes (using POST on The current security implementation limits the visibility of processes to other users. If we add this security definition to the process description (GET on |
I think a process deployment should NOT include anything to do with authentication, since it might not even be the role of the OGC API - Processes service to be the policy enforcement point. It is in fact much more common to have a separate service (IAM for example on AWS, or Keycloak as seen in previous OGC efforts) to do all authentication/authorization handling. Adding/modifying roles and permissions for an API operation/resource should be entirely separate requests toward those services dedicated for the complex auth operations. This is also how we handle this problem on CRIM's servers, and every endpoint can be controlled for each user/group/path combination without any impact on the OGC API - Processes implementation (or any other service for that matter). Every process and job dynamically created are also protected this way on a per-user basis for our servers, by dynamically creating the auth-roles for the dynamically created resources. I strongly believe that everything is already in place in HTTP to indicate if an authentication detail must be provided. Instead of requesting the OpenAPI, parse it all, and try to detect a specific auth scheme on a given endpoint, one can simply send an HTTP HEAD/GET request to the desired endpoint and receive the relevant 401+ There are already over a dozen of separate standards for handling various auth schemes (see https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml). We should definitely avoid replicating that logic through custom definitions in OGC API - Processes. Note also that "patching" authentication in processes should need the same kind of patching across all OGC APIs to make them work together. Using native HTTP methodology, nothing needs to be adjusted. |
SWG meeting from 2024-12-23: This topic should be discussed in all 4 parts of the standard in the respective security considerations sections. |
Overview
An individual process hosted in a deployment of OGC API Processes shall be protected with an OpenAPI scheme, so for example API-Key. The client must send the HTTP header
X-API-Key
that is to be processed by the individual process.Note
It is not the requirement to protect the entire OGC API Processes deployment.
Question
How would I describe the requirement of an API-Key header in the Process description? At the moment, there seem to be no option to describe the requirement for a particular HTTP header like X-API-Key according to the current Standard.
The text was updated successfully, but these errors were encountered: