Cordoba CSP and GCM (does not work because the online method uses eval in Cordoba)

I had to add CSP to my application, but I had problems.

The application uses the com.phonegap.plugins.PushPlugin plugin, which worked fine, but after adding the CSP in the console, it started throwing such errors:

Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source        of script in the following Content Security Policy directive: "script-src 'self'     https://*.domain.net http://*.domain.net".  cordova.js:1006
processMessage cordova.js:1006
androidExec.processMessages cordova.js:1076
pollOnce cordova.js:944
pollOnceFromOnlineEvent cordova.js:939

processMessage failed: Error: EvalError: Refused to evaluate a string as JavaScript because     'unsafe-eval' is not an allowed source of script in the following Content Security Policy      directive: "script-src 'self' https://*.domain.net http://*.domain.net".
cordova.js:1044

I reviewed the processMessage method and was unable to execute the eval method that it is trying to use (eval (message.slice (1));) it violates the CSP.

Question: Is it possible to use CSP and register for GCM?

If someone has done this, share your methods.

Thanks in advance

+4
source share

Source: https://habr.com/ru/post/1570275/


All Articles