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

Sim Swap Notification subscription yaml #60

Merged
merged 27 commits into from
Nov 20, 2023
Merged

Conversation

bigludo7
Copy link
Collaborator

@bigludo7 bigludo7 commented Oct 2, 2023

What type of PR is this?

  • enhancement/feature

What this PR does / why we need it:

Add a new API to manage sim swap notification subscription & notification.
yaml aligned with CAMARA commonalities design guidelines.

Which issue(s) this PR fixes:

Fixes #47

Special notes for reviewers:

Changelog input

 release-note

Additional documentation

This section can be blank.

docs

Sim Swap Notification subscription yaml aligned with CAMARA commonalities design guidelines.
Copy link
Collaborator

@fernandopradocabrillo fernandopradocabrillo left a comment

Choose a reason for hiding this comment

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

@bigludo7
I leave a few initial comments to discuss.

Thanks for the PR!

Comment on lines 56 to 62
security:
# - {}
- oAuth2ClientCredentials: []
# - BasicAuth: []
# - apiKey: []
- threeLegged:
- sim-swap:subscriptions:create
Copy link
Collaborator

@fernandopradocabrillo fernandopradocabrillo Oct 3, 2023

Choose a reason for hiding this comment

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

A couple comments here:

  1. The use of OpenId securityScheme (the never-ending topic haha)
  2. I think we should have different scopes for each operation:
    • sim-swap:subscriptions:create for the Create operation
    • sim-swap:subscriptions:read for the List and Detail operations
    • sim-swap:subscriptions:delete for the Delete operation

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agree - fixed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@bigludo7
if we already have the security property in every operation, the global security is redundant right? I think we can remove it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

@bigludo7
We can have the security property in every operation or have it global. I think it is better to have it in every endpoint so we can specify the scope that applies to each operation properly

required:
- webhook
properties:
subscriptionDetail:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know this is the same model we are using in Device Status but, and I would like your opinion here too, for me it does not make sense that the suscriptionDetail is optional. I should not be able to make the request without sending the details, what would be the response?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes got your point. As the subscription/notification is still 'fresh' I guess we're still testing it. I changed the cardinality to mandatory.

phoneNumber:
$ref: '#/components/schemas/PhoneNumber'
type:
$ref: '#/components/schemas/SimSwapEventType'
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we refence RoamingNotificationEventType here as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will prefer not. If we list all event type in all API that will be complicated to maintain.
Perhaps we should provide 'somewhere' a listing of all event type managed within our CAMARA APIs?

Copy link
Collaborator

Choose a reason for hiding this comment

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

But currently we list only exact one of them. API client must know what events it can receive and implement corresponding logic. One can keep the list open, but at least base type of events must be described. Events like "even notification subscription ends" and "MSISDN subscription ends" are critically important and must be included in the "base" list of event types.
All above if IMO :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@gregory1g Thanks for the feedback
We have only one type for subscribtion but 2 type are managed by notification. Indeed org.camaraproject.sim-swap.v0.subscription-ends is also described in this yaml. We do not plan to provide subscription for this one and send them automatically once the subscription terminates (for any reason). This is described in the doc part.

We should add in this documentation than the same resource for subscription as notification are managed for all other CAMARA APIs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok.

bigludo7 and others added 4 commits October 9, 2023 21:01
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>

Note: Additionnally to these list, ``org.camaraproject.sim-swa.v0.subscription-ends`` notification `type` is sent when the subscription ends.
This notification did not requires dedicated subscription.
It is used when the subscription expire time (required by the requester) has been reached or if the API server has to stop sending notification prematurely.
Copy link
Collaborator

@gregory1g gregory1g Oct 17, 2023

Choose a reason for hiding this comment

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

"if the API server has to stop sending notification prematurely." sounds a bit unclear, what about using more simple wording like "if the API server has to terminate subscription (e.g. when the corresponding phone number is not served by the operator anymore)"?

# - BasicAuth: []
# - apiKey: []
- openId:
- sim-swap:subscriptions:create
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need independent scopes here?
From the end user privacy point of view, allow someone to subscribe to simswap is equal to allow someone to read simswap timestamp. Or, at least a permission to "subscribe" includes permission to read. Like end user revokes permission to read their SimSwap information, this logically also revokes permission to be notified about such events. This is an API specific logic, and it is too risky to completely delegate it to Auth/Consent configuration.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@gregory1g This is a fair comment. Could we consider from a privacy perspective that checking now is same than checking for a coming period of x days?
I tend to agree with you.
@fernandopradocabrillo @DT-DawidWroblewski : could you please provide your view here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

and isn't it possible to have permission to read but not to subscribe to the notification?

Copy link
Collaborator

Choose a reason for hiding this comment

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

permission to read, but not to subscribe is rather questionable, but still could be needed.
however, permission to subscribe without permission to read sounds like an dangerous security inconsistency

$ref: '#/components/schemas/PhoneNumber'
terminationReason:
type: string
enum: ["SUBSCRIPTION_EXPIRED", "NETWORK_TERMINATED"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

as mentioned above "NETWORK_TERMINTAED" covers a server side termination for whatever reason. Two questions here:

  1. Is "NETWORK_TERMINTAED" a self-explaining term for a server initiated termination? One can expect that user terminated is different from network terminated.
  2. shouldn't we add a possibility for an MNO to provide an optional a human readable text description explaining the reason behind server side termination?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. Not sure to get it. You want me to add USER_TERMINATED ?
  2. Yes make sense - I've add a terminationDescription attribute.

Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. I dot think that we need to be introduce "user terminated" here. But NETWORK_TERMINTAED sounds too narrow. I suggest to consider a more generic term which covers everything which is initiated by the server side, either it is network as such, or user his/her self, or contract between application and MNO or even security conserns.

- specversion
- type
properties:
id:
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about subscription ID, shouldn't it be included in the event as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes - It should be part of the Data structure - I add it.

Copy link
Collaborator Author

@bigludo7 bigludo7 left a comment

Choose a reason for hiding this comment

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

Answered + updated following @gregory1g review.

- specversion
- type
properties:
id:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes - It should be part of the Data structure - I add it.

$ref: '#/components/schemas/PhoneNumber'
terminationReason:
type: string
enum: ["SUBSCRIPTION_EXPIRED", "NETWORK_TERMINATED"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. Not sure to get it. You want me to add USER_TERMINATED ?
  2. Yes make sense - I've add a terminationDescription attribute.

@bigludo7
Copy link
Collaborator Author

bigludo7 commented Nov 2, 2023

Hello @gregory1g
May I ask you to check the answer provided to your comments and let me know if some of them need additional attention. Thanks for your help.

Copy link
Collaborator

@fernandopradocabrillo fernandopradocabrillo left a comment

Choose a reason for hiding this comment

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

@bigludo7
I leave you a few comments I've found in a more detailed review. Some are suggestions and some are small fixes.

bigludo7 and others added 9 commits November 5, 2023 15:52
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Copy link
Collaborator Author

@bigludo7 bigludo7 left a comment

Choose a reason for hiding this comment

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

Thanks @fernandopradocabrillo for your review. I have updated the yaml accordingly (except the error message that I kept).

- sim-swap:subscriptions:create
- sim-swap:subscriptions:read
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hello @gregory1g
For me the simswap and the subscription are 2 different entities. As subscription is a distinct entity it makes sense to have distinct scope to manage it but worth to be discussed.
As we should have same discussion in subscription for device location and device status probably better to bring this discussion to commonalities.

If a user revokes their "read my SimSwap info" for app XYZ, it is Telco commitment to terminate app XYZ subscription (if any) and prevent any sim swap data sharing with XYZ.

Copy link
Collaborator

@fernandopradocabrillo fernandopradocabrillo left a comment

Choose a reason for hiding this comment

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

@bigludo7
A few format-related additional comments.

content:
application/json:
schema:
$ref: '#/components/schemas/SubscriptionInfo'
Copy link
Collaborator

Choose a reason for hiding this comment

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

@bigludo7
One doubt here, in case I've missed something, why do we have the phoneNumber as optional in the request body?

And, even if we have it optional in the request, shouldn't it be required in the response? I think the response must give the complete information of the subscription. Applies the same for the GET endpoints

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes make sense for POST & GET answers --> I've updated.

For POST request, the phoneNumber could be optional as we can have it by the network thru Authorization code flow or CIBA flow.

bigludo7 and others added 9 commits November 6, 2023 16:15
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Co-authored-by: Fernando Prado Cabrillo <fernando.pradocabrillo@telefonica.com>
Changed cardinality for phoneNumber
Copy link
Collaborator Author

@bigludo7 bigludo7 left a comment

Choose a reason for hiding this comment

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

Changed cardinality for phoneNumber as suggested by @fernandopradocabrillo

@bigludo7
Copy link
Collaborator Author

Hello @fernandopradocabrillo @gregory1g @DT-DawidWroblewski Any pending issue preventing to get your approval?
We should probably moving forward with this PR and then use GitHub issue for improving the proposal. Thanks

@gregory1g
Copy link
Collaborator

Any pending issue preventing to get your approval?

nothing from my side.

@fernandopradocabrillo
Copy link
Collaborator

Any pending issue preventing to get your approval?

LGTM from my side too. If we detect something in the future we can always fix it

Copy link
Collaborator

@fernandopradocabrillo fernandopradocabrillo left a comment

Choose a reason for hiding this comment

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

LGTM

- ``org.camaraproject.sim-swap.v0.swapped`` - Event triggered when a sim swap occurs on the associated phoneNumber


Note: Additionnally to these list, ``org.camaraproject.sim-swa.v0.subscription-ends`` notification `type` is sent when the subscription ends.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo:

is:
org.camaraproject.sim-swa.v0.subscription-ends

should be:
org.camaraproject.sim-swap.v0.subscription-ends



Note: Additionnally to these list, ``org.camaraproject.sim-swa.v0.subscription-ends`` notification `type` is sent when the subscription ends.
This notification did not requires dedicated subscription.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Grammar issue:

is:

This notification did not requires dedicated subscription.

should be:
This notification does not require a dedicated subscription.


termsOfService: http://swagger.io/terms/
contact:
email: project-email@sample.com
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we have an explicit email to sub-project owner here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure - I followed here what we have in other API but this is a fair question.
My suggestion is to have an issue in Commonalities to have a common rule.

version: 0.1.0-wip
externalDocs:
description: Product documentation at CAMARA
url: https://github.com/camaraproject/
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think here we should use the following URL:
https://github.com/camaraproject/SimSwap

$ref: "#/components/responses/Generic503"
security:
- { }
- notificationsBearerAuth: [ ]
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there a dedicated security scheme for notifications? or are we following CIBA and use push mode see CIBA spec for reference?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure - I've replicated same thing than in other Subscription API. If we want to provide more we should probably propose someting here: https://github.com/camaraproject/Commonalities/blob/main/documentation/API-design-guidelines.md#security-considerations

enum:
- org.camaraproject.sim-swap.v0.swapped

RoamingNotificationEventType:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Roaming notification in sim swap API? is it a new enhancement coming with sim swap notification?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah ah ah ... no :) good catch Dawid. I've wrongly name this class and forget to use it (2 errors on a same line). I fix it.

Copy link
Collaborator Author

@bigludo7 bigludo7 left a comment

Choose a reason for hiding this comment

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

Updated following @DT-DawidWroblewski review.

Copy link
Collaborator

@DT-DawidWroblewski DT-DawidWroblewski left a comment

Choose a reason for hiding this comment

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

LGTM

@DT-DawidWroblewski DT-DawidWroblewski merged commit c12ac23 into main Nov 20, 2023
@bigludo7 bigludo7 deleted the bigludo7-patch-2 branch April 4, 2024 08:39
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.

GSMA OGW Product WS - Subscription/notification mechanism for SIM SWAP formal request
4 participants