Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

...

These key words are not to be used as lexicon terms such that any occurrence of them shall be interpreted as key words and are not to be interpreted with their natural language meanings.

1. Scope

This document specifies the method of

...

This document is applicable to all participants engaging in Open Finance in Brasil.

2. Normative references

The following referenced documents are indispensable for the application of this document. For dated references, only the edition cited applied. For undated references, the latest edition of the referenced document (including any amendments) applies.

...

RFC4648 - The Base16, Base32, and Base64 Data Encodings

3. Terms and definitions

For the purpose of this document, the terms defined in RFC6749, RFC6750, RFC7636, OpenID Connect Core and ISO29100 apply.

4. Symbols and Abbreviated terms

  • API - Application Programming Interface

  • CSRF - Cross Site Request Forgery

  • DCR - Dynamic Client Registration

  • FAPI - Financial-grade API

  • HTTP - Hyper Text Transfer Protocol

  • MFA - Multi-Factor Autentication

  • OFBIS - Open Finance Brasil Initial Structure

  • OIDF - OpenID Foundation

  • REST - Representational State Transfer

  • TLS - Transport Layer Security

5. Brasil Open Finance Security Profile

5.1. Introduction

The Brasil Open Finance Security profile specifies additional security and identity requirements for high risk API resources protected by the OAuth 2.0 Authorization Framework that consists of RFC6749, RFC6750, RFC7636, FAPI-1-Baseline, FAPI-1-Advanced and other specifications.

...

  • attacks that address privacy considerations identified in clause 9.1 of [FAPI1 Advanced]

  • the requirement to support fine-grained access to resources for data minimisation purposes

  • the requirement to convey the Authentication Context Request that was performed by an OpenID Provider to a Client to enable a appropriate client management of customer conduct risk.

  • the requirement for clients to assert a pre-existing customer relationship by asserting a customer identity claim as part of the authorization flow.

5.2. Open Finance Brasil security provisions

5.2.1. Introduction

Open Finance Brasil has a requirement to address privacy considerations that were identified but not addressed in the FAPI-1-Advanced final specification without imposing additional requirements on Authorisation Servers being proposed in FAPI-2-Baseline.

...

As a profile of the OAuth 2.0 Authorization Framework, this document mandates the following for the Brasil Open Finance Security profile.

5.2.2. Authorization server

The Authorization Server shall support the provisions specified in clause 5.2.2 of Financial-grade API Security Profile 1.0 - Part 2: Advanced

...

  1. shall support a signed and encrypted JWE request object passed by value or shall require pushed authorization requests PAR;

  2. shall distribute discovery metadata (such as the authorization endpoint) via the metadata document as specified in OIDD and [RFC8414] (".well-known");

  3. shall support the claims parameter as defined in clause 5.5 OpenID Connect Core;

  4. shall support the oidc standard claim "cpf" as defined in clause "sub" Claim clarifications of this document;

  5. shall support the oidc standard claim "cnpj" as defined in clause Requesting the "cpf" Claim of this document if the institution provides accounts for legal person;

  6. shall support the acr "urn:brasil:openbanking:loa2" as defined in clause Requesting the "cnpj" Claim of this document;

  7. should support the acr "urn:brasil:openbanking:loa3" as defined in clause Requesting the "cnpj" Claim of this document;

  8. shall implement the userinfo endpoint as defined in clause 5.3 OpenID Connect Core;

  9. shall support parameterized OAuth 2.0 resource scope consent as defined in clause 6.3.1 OIDF FAPI WG Lodging Intent Pattern;

  10. may support Financial-grade API: Client Initiated Backchannel Authentication Profile;

  11. (withdrawn temporarily);

  12. shall support refresh tokens;

  13. shall issue access tokens with an expiry no greater than 900 seconds and no less than 300 seconds;

  14. shall always include an acr claim in the id_token;

  15. shall support the response_type value code id_token;

  16. may support response_type value code in conjunction with the response_mode value jwt;

  17. should offer the possibility to disable the rotation of refresh token;

  18. shall ensure that, in case of sharing the Authorization Server for other services, in addition to Open Finance, it does not disclose and/or allow the use of non-certified methods in the Open Finance environment;

  19. shall ensure that the settings disclosed to other participants through OpenID Discovery (indicated by the Well-Known file registered in the Directory) are restricted to the operating modes to which the institution has certified;

    1. shall keep in your settings the methods for which there are still active clients;

    2. shall update the records that use non-certified methods, through bilateral treatment between the institutions involved;

  20. shall refuse requests, for the Open Finance environment, that are outside the modes of operation to which the institution has certified its Authorization Server;

  21. must refuse authentication requests that include an id_token_hint, as the id_token held by the requester may contain Personally Identifiable Information, which could be sent unencrypted by the public client;

  22. the minimum expiration time of request_uri must be 60 seconds;

  23. shall deny all requests without header x-fapi-interaction-id on FAPI endpoints;

5.2.2.1. ID Token as detached signature

The Authorization Server shall support the provisions specified in clause 5.2.2.1 of Financial-grade API Security Profile 1.0 - Part 2: Advanced

...

  1. should not return sensitive PII in the ID Token in the authorization response, but if it needs to, then it shall encrypt the ID Token;

  2. Personally Identifiable Information may include, but is not limited to,:

    1. Claim sub if you use information that makes it possible to identify the natural person;

    2. The default Claims defined in clause 5.1 OIDC, which may contain data such as date of birth, address or telephone;

    3. The new Claim CPF, defined in the next section.

  3. If a Claim containing Personally Identifiable Information is requested:

    1. If this is marked as essential, if there is no encryption key registered for the Customer, the request must fail if requested at the Authorization Endpoint. There are no impediments if the request is made by the Confidential Client through the Token Endpoint;

    2. If this is not marked as essential, the Authorization Server must omit it on the Authorization Endpoint, and it can be answered on the Token Endpoint called by the Confidential Client.

      Âncora
      clarifications
      clarifications

  4. For the encryption of the id_token, a key available in the JWKS informed in the jwks_uri parameter during the client registration must be used, indicated through the kid header of the JWT document;

  5. The use of other headers to indicate the key used, such as x5u, x5c, jku or jkw is prohibited as defined in clause 2 OIDC.

5.2.2.2. "sub" Claim clarifications
Âncora
cpf
cpf

This profile uses the official openId definition found at: Analise requisitos de criptografia ID_TOKEN. This means the sub is a never reassigned identifier for the end user. The value for a given user should never change within an institution, even across diferents consents.

5.2.2.3. Requesting the "cpf" Claim

This profile defines "cpf" as a new standard claim as per clause 5.1 OIDC

...

Name: cpf, Type: String, Regex: 'd{11}$'

5.2.2.4. Requesting the "cnpj" Claim

This profile defines "cnpj" as a new standard claim as per clause 5.1OIDC

...

Name: cnpj, Type: Array of Strings, Array Element Regex: 'd{14}$'

5.2.2.5. Requesting the "urn:brasil:openbanking:loa2" or "urn:brasil:openbanking:loa3" Authentication Context Request

This profile defines "urn:brasil:openbanking:loa2" and "urn:brasil:openbanking:loa3" as new Authentication Context Request (ACR) classes.

...

To performe a MFA authentication is necessary that the end user presents at least two different methods as listed above. A unique method used more than once - ie. presenting passwords - is not accepted as MFA.

5.2.3. Confidential client

A confidential client shall support the provisions specified in clause 5.2.3 of Financial-grade API Security Profile 1.0 - Part 2: Advanced,

...

  1. shall support encrypted request objects;

  2. shall support Pushed Authorisation Requests PAR;

  3. shall use encrypted request objects if not using PAR;

  4. shall support parameterized OAuth 2.0 resource scope consent as defined in clause 6.3.1 OIDF FAPI WG Lodging Intent Pattern;

  5. shall support refresh tokens;

  6. shall not populate the acr claim with required values;

  7. shall require the acr claim as an essential claim;

  8. shall support all authentication methods specified in clause 5.2.2-14 of Financial-grade API Security Profile 1.0 - Part 2: Advanced including diferent combinations of the methods to send requests (using PAR or not - item 11);

  9. shall not allow refresh tokens rotation feature;

  10. should not request authentication requests that include an id_token_hint, as the id_token to be used may contain Personally Identifiable Information, which could be sent unencrypted through the public client;

  11. shall send header x-fapi-interaction-id on FAPI endpoints;

6. Security considerations

Participants shall support all security considerations specified in clause 8 Financial-grade API Security Profile 1.0 - Part 1: Advanced and the Brazilian Central Bank Open Banking Security Manual. The Brazilian ICP issues RSA x509 certificates only therefor section removes for simplicity support for EC algorithms and requires that only IANA recommended encryption algorithms be used.

6.1. Message Content Signing Considerations (JWS)

  1. JWS standad defined in RFC7515 shall be adopted to ensure integrity and non-repudiation of information processed in sensitive API's (message sign requirement is indicated at API's documentation/swagger), which includes:

    • Header (JSON Object Signing and Encryption - JOSE Header), which defines the algorithm used and includes information about the public key or certificate that can be used to validate the signature;

    • Payload (JWS Payload): content itself as detailed in the API specification;

    • Digital signature (JWS Signature): digital signature, performed according to header parameters.

  2. Each of elements above must be encoded using the Base64url pattern RFC4648 and the elements must be concatenated with "." (JWS Compact Serialization method as defined in RFC7515).

  3. The payload of signed messages (request JWT and response JWT) shall include the following claims as defined at RFC7519:

    • aud (in the JWT request): the Resource Provider (eg the institution holding the account) must validate if the value of the aud field matches the endpoint being triggered;

    • aud (in JWT response): the API client (eg initiating institution) shall validate if the value of the aud field matches its own organisationId listed in the directory;

    • iss (in the JWT request and in the JWT response): the receiver of the message shall validate if the value of the iss field matches the organisationId of the sender;

    • jti (in the JWT request and in the JWT response): the value of the jti field shall be filled with the UUID defined by the institution according to [RFC4122] version 4;

    • iat (in the JWT request and in the JWT response): the iat field shall be filled with the message generation time and according to the standard established in RFC7519 to the NumericDate format.

    • cty (in the JWT request and in the JWT response): the cty field shall be filled in the normal case in which nested signing or encryption operations are not employed, the use of this Header Parameter is not recommended. In the case that nested signing or encryption is employed, this Header Parameter must be present; in this case, the value must be "JWT", to indicate that a Nested JWT is carried in this JWT. While media type names are not case sensitive, it is recommended that "JWT" always be spelled using uppercase characters for compatibility with legacy implementations.

  4. The HTTP content-type of requests and responses with JWS messages shall be defined as: "application/jwt".

  5. The JOSE header must contain the following attributes:

    • alg - shall be filled with the value PS256";

    • kid - shall be filled with the key identifier value used for the signature;

    • typ - shall be filled with the value JWT.

...

  1. The receiver shall validate the consistency of the JWS message's digital signature exclusively based on the information obtained from the directory, that is, based on the keys published in the institution's JWKS in the directory.

  2. Signatures must be performed using the digital signature certificate specified in the Open Finance Brazil Certificates Standard;

  3. the iat claim must be numeric in Unix Time format GMT+0 with a tolerance of +/- 60 seconds;

  4. the jti claim must be unique for a clientId within a time frame of 86,400 seconds (24h), and cannot be reused within this period. In case of reuse, the HTTP error code 403 shall be return. Any other case must follow RFC 6749 instructions in item 5.2.

6.1.1. Signing algorithm considerations

For JWS, both clients and Authorization Servers

  1. shall use PS256 algorithm;

6.1.2. Encryption algorithm considerations

For JWE, both clients and Authorization Servers

  1. shall use RSA-OAEP with A256GCM

6.1.3. Secure Use of Transport Layer Security considerations

For TLS, Authorization Server endpoints and Resource Server endpoints used directly by the Client

  1. shall support TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

  2. shall support TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384

  3. The "TLS Session Resumption" e "TLS Renegotiation" features shall be disabled

7. Data Sharing Considerations

7.1. Authorisation Mechanism

7.1.1. Introduction

Existing mechanisms for appropriately managing access to resources defined in RFC6749 are insufficient to meet the requirements for a modern data sharing ecosystem. Leveraging static scope strings does not provide consumers control of sufficient granularity to share with third parties. Open Finance Brasil have elected to implement a Consent API as a OAuth 2.0 protected resource that can be used to manage fine grain access to resources. The reference to the Consent Resource will be conveyed as part of an OAuth 2.0 dynamic resource scope.

7.1.2. Dynamic Consent Scope Definition

This profile defines OAuth 2.0 dynamic scope "consent" as follows:

...

  • the Consent Resource Id must include url safe characters only;

  • the Consent Resource Id must be namespaced;

  • the Consent Resource Id must have the properties of a nonce Nonce;

7.1.3. Dynamic Consent Scope Example

consent:urn:bancoex:C1DD33123

7.2. Authorisation Life Cycle

7.2.1. Introduction

The Consent Resource has a life cycle that is managed seperately and distinctly from the OAuth 2.0 Authorisation Framework. The state transitions and expected behaviours and error conditions expected of REST Resources protected with this profile are defined in the functional API specifications published by Open Finance Brasil.

7.2.2. Authorization server

In addition to the requirements outlined in Open Finance Brasil security provisions the Authorization Server

...

  1. shall revoke where possible and cease usage of refresh and access tokens that are bound to a Consent Resource that has been deleted;

  2. shall delete Consent Resource that are expired;

8. Acknowledgements

With thanks to all who have set the foundations for secure and safe data sharing through the formation of the OpenID Foundation FAPI Working Group, the Open Finance Brasil GT Security and to the pioneers who will stand on their shoulders.

...