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

CIBA MUST not become two-legged #268

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

AxelNennker
Copy link
Collaborator

What type of PR is this?

  • correction

What this PR does / why we need it:

User consent cannot be checked based on the login_hint value alone and without sending a message, because then CIBA would be a two-legged flow. In a two-legged flow user consent checking is, probably, not relevant because two-legged flows only consider the API Consumers credentials.

The three-legged CIBA flow is necessary if Consumption Device and Authentication Device are different devices. If Consumption Device and Authentication Device are the same, then OIDC Authentication Code Flow SHOULD be used.

The Authentication Server MUST send a message to the Authentication Device, identified by login_hint, because otherwise there would be no User authentication at all.

Which issue(s) this PR fixes:

Fixes #258

Additional context

Note: In cases where personal data is processed by the API and users can exercise their rights through mechanisms such as opt-in and/or opt-out, the use of three-legged access tokens is mandatory. This ensures that the API remains in compliance with privacy regulations, upholding the principles of transparency and user-centric privacy-by-design.

@Elisabeth-Ericsson
Copy link
Contributor

It is correct that the current CIBA implementations skip the involvement of an authentication device when consent collection is not required.
Only when consent collection is required and the CSP is capable of involving the authentication device, then the resource owner providing consent on the authentication device will be authenticated.

But the fundamental problem here is with the mandate that every privacy sensitive API flow requires three-legged authentication; in fact that is not always true, only the identification of the resource and its resource owner is always required, not their authentication. The access token generated is linked to the decisions made by the authenticated resource owner and therefore is the trustful source for API invocation.

Ways out of the problem could be:
Opt1: we agree in CAMARA that we use CIBA just to identify the target resource (use CIBA in "2-legged" way)
Opt2: we agree in CAMARA that identifying target resource is good enough and allow to use client credential flow with ability to pass target resource identifier in the scope parameter (similar extension as done for purpose)

Having a secure mechanism for identifying the target resource of an API call is a separate issue which should be addressed in another pull request or CAMARA issue.

@AxelNennker
Copy link
Collaborator Author

I assume we are not going back on mandating three-legged tokens as described here:

Note: In cases where personal data is processed by the API and users can exercise their rights through mechanisms such as opt-in and/or opt-out, the use of three-legged access tokens is mandatory. This ensures that the API remains in compliance with privacy regulations, upholding the principles of transparency and user-centric privacy-by-design.

I think Option 1 is not something we can just "agree" upon. We want to be interoperable and we, each API provider, must be compliant with applicable privacy regulations. Privacy regulations exist to protect the end-user/data-subject, and, I think, we cannot ignore them because they lead to inconvenience of the API Consumer or API provider.
@Elisabeth-Ericsson I am not saying that you suggest ignoring privacy rules. Thank you for presenting the options.

Regarding option 2:
The client credentials flow is described in the Client Credentials flow section of our CAMARA Security and Interoperability Profile.

The OAuth 2.0 Client Credentials grant type is used to obtain a 2-legged Access Token that does not represent a user. The grant-type can only be used if agreed between the API consumer and the API provider exposing the API, taking into account the declared purpose for accessing the API (cf. CAMARA API Specification - Authorization and authentication common guidelines).

So, under the provisions above client credentials flow can be used, but then it should be clearly stated instead of turning CIBA into a two-legged flow.

@ALL, please review, provide suggestions and consider approving this PR.

@Elisabeth-Ericsson
Copy link
Contributor

Amongst various timestamps, a 3-legged access token contains client information (client id), audience info, a reference to the data subject (sub) and the list of data scopes (could be privacy sensitive data scopes). The token is generated after successful check with the consent management. Why do you think that this token is not valid ? The consent data was captured by an authorized resource owner for a data subject. It does not lose its credibility, but because the data subject is not authenticated when information related to the data subject is retrieved.

I understand that CIBA flow requires this authentication and it makes sense for the use cases, CIBA was invented.

But why do you see a problem, if the system is using the information which the authorized resource owner has captured earlier?
This does not at all violate the privacy of the resource owner at all.
However if we go for Option 1, we end up with a partial implementation of the CIBA standard.

@chrishowell
Copy link
Collaborator

Whilst we're not using CIBA as it was originally intended in the spec, it's obviously not feasible to always include the end-user's phone as the Authentication Device in the CAMARA Backend Flow, the end-user does not need to be (nor want to be) actively involved in these use cases when consent collection is not required.

We could posit that CAMARA is compliant with the spec by considering that the Resource Owner delegates their authentication/authorisation to the Consent Master when they grant consent (or when consent isn't required as a legal basis). They haven't given up their privacy rights, they've just delegated the parroting of their current choices to the Consent Master.

When CIBA is used and consent needs to be collected, the end-user's phone is the Authentication Device; when consent does not need to be collected the Consent Master acts as the Authentication Device.

@thanh3f
Copy link

thanh3f commented Feb 17, 2025

What if some bad service providers mis-use checking APIs to check information from subscribers who are not their customers. When we detect and punish the service providers, subscribers information is already compromised. It would not pass the regulator's rules in my country. So we need 3-legged option to deploy in Vietnam. Otherwise we cannot comply with CAMARA in this case and have to deploy a variant CIBA flow in fact.

@gauravji2192
Copy link
Collaborator

CAMARA mandates that every privacy sensitive information API requires 3-legged authentication including consent capture.
However, this does not imply that authentication has to be done at each API call. There are 2 cases:

Case 1: valid access token!
Once a valid access token has been obtained (and hence authN / authZ / consent has been done) no further authN/Z/C is needed until either the access token expires or the consent validity duration has been reached. Hence during that "valid" period, no call to the 3rd leg will be done. This is part of standard CIBA flow.

Case 2: consent is not required
Furthermore CAMARA (in its CIBA flow) defines that it is not mandatory to authenticate an end-user when consent is not required. This may be the case when

  • GDPR legal basis is the purpose for the API use, or
  • consent was already captured and is still valid.

So, we don’t see a challenge in using the CIBA flow as defined by the CAMARA ICM guidelines.

ExpO->>BE: HTTP 200 OK {"auth_req_id": "{OperatorAuthReqId}"}
end
loop Invoker polls until consent is granted or until expires. If granted in advance, token returned in first poll
Exp0->>FE: Out-of-band consent capture Push/SMS/Email/other

Choose a reason for hiding this comment

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

should this not go to the Auth Device (User) instead of to BE ?

Choose a reason for hiding this comment

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

Should this CIBA flow not also show the different cases (as per Gaurav's comment (consent not yet granted, consent already granted, no consent needed, consent validity expiry), to stress that consent is only asked for when needed ?
The out of band consent request, and the loop on the back-end is only needed if consent was not yet granted, or if the consent validity expired.

I understand that this flow assumes that it is sufficient that the current step 2 identifies the "End User" (on the Auth Device) based on a valid login_hint, so no additional authentication of that "End User" is imposed. However that does not it mean it could not be done (with its own validity duration) if the Operator so desires.

so something like

opt If User Consent is required for the legal basis of the purpose
ExpO->>Consent: Check if Consent is granted
end
alt If Consent is Granted or Consent not needed for legal basis
ExpO-->>FE: 302
Location: invoker_callback?code=Operatorcode
else If Consent is NOT granted - Out of Band Consent Capture within CIBA Flow
Note over FE,ExpO: Start user consent capture process
following Section 3.1.2.4 of the OIDC Core 1.0 spec.
ExpO-->FE: Out-of-band consent capture Push/SMS/Email/other
Loop with polling .... (from current CIBA flow)
If the user refuses consent
ExpO-->>FE: 302
Location: invoker_callback?error=access_denied
else If the user grants consent
ExpO-->>FE: 302
Location: invoker_callback?code=Operatorcode
end

or something like that ?

Copy link
Collaborator

@jpengar jpengar Feb 18, 2025

Choose a reason for hiding this comment

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

The flow in the PR is "broken", you can check the existing one here https://github.com/camaraproject/IdentityAndConsentManagement/blob/main/documentation/CAMARA-API-access-and-user-consent.md#ciba-flow-backend-flow. Which, of course, would need to be edited with whatever changes we end up agreeing here.

image

@jpengar
Copy link
Collaborator

jpengar commented Feb 18, 2025

I think this issue/PR raises a valid and fair technical concern. But at the same time, when the existing documented flows were agreed, it was generally assumed that API providers would integrate with partners under a contractual agreement that limited their actions (e.g. only using the phone number in their user base, etc...) and established a certain level of trust.

As mentioned in the past, there was concern about contacting the user every time a new access token was requested.

Again, I'm not saying that what is reported in this issue is wrong, but there is also some context behind these flows that the WG should already know or at least be reminded of.

Also, the existing flows do not convert CIBA into a two-legged flow. The user rights to opt-in and opt-out are still maintained, and the access token is indeed associated with the user identifier.

If CAMARA, or CAMARA ICM, now wants to question if the level of trust in the API consumer is not sufficient, that is what can be re-evaluated and agreed in this PR and issue. But the WG should also consider this context and the usability aspects.

@AxelNennker
Copy link
Collaborator Author

Hi @Elisabeth-Ericsson ,

I do not understand your comment.
#268 (comment)

"Why do you think that this token is not valid"

My comment does not contain the word valid.

In GDPR the data-subject is the one granting consent or not.
In CIBA the API Consumer tells the API Provider that their API Consumer user has e.g. the phone number +123456789.
The API Provider could trust the API Consumer that the number is true but the API Consumer has no prove for that fact - the User is not authenticated.

The API Consumer can now send

  • CIBA request login_hint=+123456789
  • CIBA request login_hint=+123456799
  • CIBA request login_hint=+123458089
  • CIBA request login_hint=+123256789
  • CIBA request login_hint=+123356789
  • CIBA request login_hint=+123856789

The API Consumer would learn whether all those individuals who are associated with those phone numbers opted out, granted consent or not
This validates the privacy of those individuals.

This is maybe more obvious with a login_hint=ipport:80.144.147.25:12345.
Why should the API provider believe that this ipport belongs to a user that is really currently opening a bank account?

@AxelNennker
Copy link
Collaborator Author

AxelNennker commented Feb 18, 2025

Also, the existing flows do not convert CIBA into a two-legged flow.

The "legs" in a three-legged flow are: Client, end-user, Authentication Server.

If CIBA does not send a message to the user's authentication device then there is no User-leg. I think that is then a two-legged flow and no personal information should be processed.

The user rights to opt-in and opt-out are still maintained, and the access token is indeed associated with the user identifier.

The user's rights cannot be maintained if the user is not involved in the process.

Consent must be freely given, specific, informed and unambiguous

The consent cannot be "informed" if the user is not in the process.

the access token is indeed associated with the user identifier

Yes, there is some User identifier but we do not know much about that identifier. Maybe that is easier to see if we consider the login_hint to be an IP-address, which was re-assigned by the CSP to a different user device 5 minutes ago.

@AxelNennker
Copy link
Collaborator Author

If CAMARA, or CAMARA ICM, now wants to question if the level of trust in the API consumer is not sufficient, that is what can be re-evaluated and agreed in this PR and issue. But the WG should also consider this context and the usability aspects.

If we were a ferry provider and the law requires us to provide lifeboats, then we have to provide lifeboats regardless whether our ferry service exists since 1900 and never provided lifeboats. The lifeboat drill is inconvenient for crew and passengers, but if the ferry sinks passengers are happy it happened and we are happy because the insurance is paying us. And the captain and ferry owner don't go to jail.

Yes, ICM should consider privacy and user consent, and user experience and usability.

@jpengar
Copy link
Collaborator

jpengar commented Feb 18, 2025

If CAMARA, or CAMARA ICM, now wants to question if the level of trust in the API consumer is not sufficient, that is what can be re-evaluated and agreed in this PR and issue. But the WG should also consider this context and the usability aspects.

If we were a ferry provider and the law requires us to provide lifeboats, then we have to provide lifeboats regardless whether our ferry service exists since 1900 and never provided lifeboats. The lifeboat drill is inconvenient for crew and passengers, but if the ferry sinks passengers are happy it happened and we are happy because the insurance is paying us. And the captain and ferry owner don't go to jail.

Very ingenious. Please don't twist my words, I just gave the context. Now the WG can discuss and agree what is best for the users and for CAMARA.

Yes, ICM should consider privacy and user consent, and user experience and usability.

100%

@eric-murray
Copy link
Collaborator

eric-murray commented Feb 18, 2025

Does GDPR not allow for "enduring consent", where an end user effectively says to an API provider "any time API consumer <insert name here> asks for personal information <insert personal information here>, you can give it to them until I tell you otherwise"?

Or does GDPR require that the end user be given the opportunity to modify their consent each and every time their personal information is provided to or processed on behalf of that API consumer?

@chrishowell
Copy link
Collaborator

chrishowell commented Feb 19, 2025

GDPR absolutely allows for consent decisions to persist and not require confirmation on every processing; otherwise the whole world would grind to a halt.

If you tick a box to consent to marketing information being sent, and then leave the website or shop or whatever, there's no opportunity for a company to access the individual to re-check that consent every time they want to send marketing information. This is the same situation. The user has consented to their data being processed for a purpose, and the ASP/CSP can continue processing data for that purpose until/unless the user opts-out; the option to opt-out doesn't have to be provided on every processing.

@AxelNennker
Copy link
Collaborator Author

GDPR absolutely allows for consent decisions to persist and not require confirmation on every processing; otherwise the whole world would grind to a halt.

True, but not the topic

If you tick a box to consent to marketing information being sent, and then leave the website or shop or whatever, there's no opportunity for a company to access the individual to re-check that consent every time they want to send marketing information.

This is the same situation. The user has consented to their data being processed for a purpose, and the ASP/CSP can continue processing data for that purpose until/unless the user opts-out; the option to opt-out doesn't have to be provided on every processing.

The problem is different. The API Consumer could use CIBA to ask for an end-user authentication and consent for any user identifier. If CIBA does not send a message to the authentication device there is not User authentication at all, and we are sending personal information back to the API Consumer without User authentication and without end-user consent.

ps: OIDC Authorization Code Flow is different because there we have network-based authentication of the User. So, OIDC ACF does not have this privacy problem, if we are reasonably sure that subscriber equals end-user, and OIDC ACF does not have the problem that the flow degenerates to a two-legged flow.

@eric-murray
Copy link
Collaborator

If CIBA does not send a message to the authentication device there is not User authentication at all, and we are sending personal information back to the API Consumer without User authentication and without end-user consent.

But if the end user has already consented to provide that personal information to that specific API consumer, why do they need to re-confirm that consent every time the data is requested? End user authentication is not required - they have already agreed that the information can be provided to the API consumer whenever they ask.

The end user should have been told how that consent can be revoked, and not need to constantly be given an unsolicited opportunity to do that.

@AxelNennker
Copy link
Collaborator Author

If CIBA does not send a message to the authentication device there is not User authentication at all, and we are sending personal information back to the API Consumer without User authentication and without end-user consent.

But if the end user has already consented to provide that personal information to that specific API consumer, why do they need to re-confirm that consent every time the data is requested? End user authentication is not required - they have already agreed that the information can be provided to the API consumer whenever they ask.

The end user should have been told how that consent can be revoked, and not need to constantly be given an unsolicited opportunity to do that.

The difference between the current OIDC Authorization Code Flow and the CIBA Flow in described in CAMARA API Access and User Consent is that in OIDC ACF we always have a subscriber authentication through network-based authentication or the end-user authentication by whatever authentication method the API provider supports. The topic of this issue is, that in many cases there is NO User authentication in CIBA. The end-user might have already consented but without any User authentication we no not know who the User is. Even if there is a contract that binds the API Consumer to behave according to the relevant legislation that might no be enough.

One end-user (attacker) might enter a MSISDN of a different end-user (victim) into the API providers web-form, who then sends a CIBA request to the API Provider who then leaks personal information, the consent status, about the victim to the attacker.

@eric-murray
Copy link
Collaborator

The end-user might have already consented but without any User authentication we no not know who the User is.

Either the MSISDN is a valid user identifier or it is not, This is a legal question, not a technical question, and so CAMARA are not best placed to answer this. The user does not have to be the human who happens to be holding the mobile device when the API request is received.

If the MSISDN can be a valid user identifier, then API providers should be allowed to fulfil requests based on enduring consent when they consider that it does identify the end user, without CAMARA mandating that the user has to be included in the loop somehow. If they are wrong, that's their problem.

If it can never be a valid user identifier under any circumstances, but simply a clue as to who the user might be or how they can be contacted, then maybe CAMARA should remove MSISDN as an option and mandate API consumers provide unique and unambiguous user identifiers. But I do not think this is true - MSISDN can be an user identifier for many use cases.

@AxelNennker
Copy link
Collaborator Author

The end-user might have already consented but without any User authentication we no not know who the User is.

Either the MSISDN is a valid user identifier or it is not, This is a legal question, not a technical question, and so CAMARA are not best placed to answer this. The user does not have to be the human who happens to be holding the mobile device when the API request is received.

If the MSISDN can be a valid user identifier, then API providers should be allowed to fulfil requests based on enduring consent when they consider that it does identify the end user, without CAMARA mandating that the user has to be included in the loop somehow. If they are wrong, that's their problem.

If it can never be a valid user identifier under any circumstances, but simply a clue as to who the user might be or how they can be contacted, then maybe CAMARA should remove MSISDN as an option and mandate API consumers provide unique and unambiguous user identifiers. But I do not think this is true - MSISDN can be an user identifier for many use cases.

It is true that the MSISDN is a User identifier. No doubt about that. The question in this issue is not whether the MSISDN is an User identifier. The question is whether it is OK to use CIBA without any authentication. We have client credentials which authorize the API consumer, but no User authentication if CIBA does not send the authentication message to the authentication device. That might be OK in some circumstances but I still think that if no authentication message is sent to the authentication device then CIBA is a two-legged flow which should not be used if personal data is processed.

@eric-murray
Copy link
Collaborator

The question is whether it is OK to use CIBA without any authentication

I think we can leave that to API Providers based on their own confidence as to whether the personal information they are processing is that of the user identified by the MSISDN. The only guidance CAMARA should give is "do not break the law".

@AxelNennker
Copy link
Collaborator Author

The question is whether it is OK to use CIBA without any authentication

I think we can leave that to API Providers based on their own confidence as to whether the personal information they are processing is that of the user identified by the MSISDN. The only guidance CAMARA should give is "do not break the law".

The PR proposes some text, please review and propose suggestions how to improve that proposal.

@AxelNennker
Copy link
Collaborator Author

In Authorization Code Flow the API Provider's Authorization Server can do network-based authentication and in some cases that is enough that we are "sure enough" that subscriber equals end-user (data-subject). If the Authorization Server is not "sure enough" then the Authorization Server cannot determine the consent status of the end-user and SHOULD proceed with end-user authentication and end-user consent collection if there is no "prompt=none" in the request. If there is a prompt=none then "consent_required" should be returned in the error response.

With CIBA in contrast to Authorization Code Flow, the Authorization Server would rely on the user identifier from the Authorization Reqest (login_hint) which even the API Consumer does not know whether that user identifier belongs to the end-user sitting in front of the e.g. laptop.

CIBA is an authentication protocol that authenticates the end-user and gather their consent. Neither the API Consumer nor the API Provider's Authorization Server can rely on the value of login_hint. If the Authorization Server cannot rely on login_hint's value, the user identifier, then the Authorization Server cannot check the consent status based on that user identifier. Relying on the user identifier would defeat the purpose of CIBA which is to authenticate the user and collect their consent by sending a message to the authentication device.

@AxelNennker
Copy link
Collaborator Author

The question is whether it is OK to use CIBA without any authentication

I think we can leave that to API Providers based on their own confidence as to whether the personal information they are processing is that of the user identified by the MSISDN. The only guidance CAMARA should give is "do not break the law".

Many readers and many API Providers of our ICM documents are new to CIBA and consent.
We should provide guidance if CIBA is used as described to process personal information in a two-legged manner.
I think "confidence" is often ignorance when it comes to privacy and consent.

I think privacy and consent is very important for many API providers.
ICM insists that the following text is in all API yaml files.

In cases where personal data is processed by the API and users can exercise their rights through mechanisms such as opt-in and/or opt-out, the use of three-legged access tokens is mandatory. This ensures that the API remains in compliance with privacy regulations, upholding the principles of transparency and user-centric privacy-by-design.

If CIBA is used in the way described then it is a two-legged flow and the above mandatory use of three-legged access tokens is not met.

If necessary, it will be checked in the operator's consent master whether user consent has already been given to the application for the user identifier and declared purpose.

I think this part "whether user consent has already be given" cannot be implemented without some confidence that the user is authenticated or was authenticated in the past. A phonenumber provided by an attacker or the API provider just does not provide that confidence.

If an API Provider is only offering two legged flows and does not need to care about privacy and consent with their use cases, then they should use a two legged flow and they should not use CIBA.

I think readers of CAMARA APIs Access and User Consent Management might think that they are using a three-legged flow if they use CIBA while the current description of the CIBA flow is not a three-legged flow if no message is sent to the authentication device.

@AxelNennker
Copy link
Collaborator Author

Sorry, @Elisabeth-Ericsson by committing d6c76a5 your suggestions became outdated.

I am going to address your comments/suggestions now

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.

CIBA Privacy
8 participants