humhub / fcm-push

Enables your users to receive push notifications from your network.
4 stars 5 forks source link

Module Config - Validator for GoogleService Account JSON #19

Closed ArchBlood closed 1 year ago

ArchBlood commented 1 year ago

There should be a check to validate the Service Account JSON field is in JSON format else a warning should be thrown warning the user.

serh-mosk commented 1 year ago

As far as I can see, there is already a check of the JSON field and if you enter an incorrect JSON string, we will see the message 'Invalid JSON input.' Maybe you need to add some more validation or do something differently?

ArchBlood commented 1 year ago

Currently the only validation implemented is that it's a JSON input, this means any JSON code can be placed in the field and be saved and shown as a valid format. There should be a way to validate that the JSON strings are related to the Google Services not just any JSON string entered.

luke- commented 1 year ago

I think a check for valid JSON is most important. Maybe we can additionally check for type = service_account to be sure that it is a correct dataa.

example header of a valid json:

{
  "type": "service_account",
  "project_id": "humhub-push-service",
  "private_key_id": "....",
  "private_key": "....",