Closed Bug 902946 Opened 11 years ago Closed 11 years ago

CSP failure in receiptverifier.js

Categories

(Marketplace Graveyard :: Payments/Refunds, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED
2013-08-20

People

(Reporter: eviljeff, Assigned: andy+bugzilla)

Details

fails CSP in privileged apps - https://github.com/mozilla/receiptverifier/blob/master/receiptverifier.js#L1068 new Function(...) is blocked for privileged apps.
We should do this soon, its blocking a privileged app verifying receipts.
good catch eviljeff. Hmm, this might simply be a documentation fix telling apps how to allow it.
whoops, I was mixing up CSP with CORS. Apps cannot solve this. The lib just needs to stop doing 'new Function()' it seems. http://people.mozilla.org/~bsterne/content-security-policy/details.html
Priority: -- → P1
Assignee: nobody → amckay
Target Milestone: --- → 2013-08-13
Target Milestone: 2013-08-13 → 2013-08-20
Version: 1.0 → 1.3
The fact that receiptverifier has a templating engine and a few hundred lines of template generation code seems odd to me. I would imagine most apps would have their own way of doing templating and showing messages to users. The key part is the checking. I'm going to split the lib into two parts, the checking part and the templating part, the templating part will be available as a demo, great for quick example testing, but not for real use. Or perhaps we can deprecate that.
/agree - I think just returning the string for the app to display would be better (+ it would be more consistent in the app's own UX and easier to localise)
Part of the reasoning behind a complete UI is that these failures are kind of corner-cases, and I'm not sure if applications would handle them properly unless it's super-easy to do so. But splitting it into two parts would certainly make sense – one that gives the app a code of sorts to indicate what kind of error there is (and the UI stuff is slightly higher level than the receipt validator itself) and then something that takes that puts up an appropriate blocking error message based on that.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Also the templating is not fancy, so replacing it with string replacement would be fine, e.g.: message = template.replace(/URL/g, quote(url));
(In reply to Ian Bicking (:ianb) from comment #6) > Part of the reasoning behind a complete UI is that these failures are kind > of corner-cases, and I'm not sure if applications would handle them properly > unless it's super-easy to do so. That's true, keeping it easy is an important part of adoption which is our biggest hurdle at the moment.
You need to log in before you can comment on or make changes to this bug.