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

CSP Not Showing Google Recaptcha #41

Closed
haoqili opened this issue Jul 7, 2011 · 7 comments
Closed

CSP Not Showing Google Recaptcha #41

haoqili opened this issue Jul 7, 2011 · 7 comments

Comments

@haoqili
Copy link
Owner

haoqili commented Jul 7, 2011

In firebug

        CSP: Directive "inline script base restriction" violated
        Recaptcha.widget = Recaptcha.$("recaptch...

I saw the same bug and they fixed it by updating jQuery to 1.5. Well I updated it to 1.6.2 and it's still not working!

(also check out #40)

@haoqili
Copy link
Owner Author

haoqili commented Jul 7, 2011

How can I change this chunk into externalized-jinja-happy template https://github.com/haoqili/MozSecWorld/blob/master/apps/msw/captcha.py#L33-44
:(

haoqili added a commit that referenced this issue Jul 7, 2011
…ined, context_processors, how do I put python into javascript? let me try hard coding the Server and Public key. big mess
@haoqili
Copy link
Owner Author

haoqili commented Jul 7, 2011

^ trying to copy https://github.com/jbalogh/zamboni/blob/master/apps/amo/templates/amo/recaptcha_js.html, get "global name 'settings' is not defined" error

haoqili added a commit that referenced this issue Jul 8, 2011
…xternal js (from same origin, from haoqili.scripts.mit.edu work. Something is wrong with Google Recaptcha and CSP. Possibly 3rd party domains? mcoates debugged with me. --> will ask bsterne
haoqili added a commit that referenced this issue Jul 8, 2011
…e recaptcha js. failed. --> try amo registration recaptcha
@haoqili
Copy link
Owner Author

haoqili commented Jul 8, 2011

^ latest push has https://github.com/haoqili/MozSecWorld/blob/7b4cff394aae590a637c7ad95a79c87dc5e33a29/apps/msw/recaptcha_test.py that gets new challenge strings from recaptcha every time

with the challenge string, append it to the end of "https://www.google.com/recaptcha/api/image?c=" to get a new recaptcha image

@haoqili
Copy link
Owner Author

haoqili commented Jul 9, 2011

Great resource found! https://github.com/mozilla/django-recaptcha

haoqili added a commit that referenced this issue Jul 9, 2011
…ript. Why does theirs work but not me? I have coppied CSP to be identical
@haoqili
Copy link
Owner Author

haoqili commented Jul 9, 2011

Django-recaptcha uses the same recaptcha backend, with the "displayhtml()" function that contains the in-body javascript. The only difference is that they have a custom display. Let me try that.

haoqili added a commit that referenced this issue Jul 11, 2011
…roblem, because it uses a RecaptchaOptions! have a bug in include_tag, almost there though!!!
@haoqili
Copy link
Owner Author

haoqili commented Jul 11, 2011

New Firebug bug

        call to setInterval blocked by CSP            recaptcha.js (line 23)

Because setInterval() is blocked by CSP.

Set it by: https://github.com/mozilla/django-csp/blob/master/README.rst

haoqili added a commit that referenced this issue Jul 11, 2011
…ster's custom RecaptchaOptions to avoid in-body script. BT2: have to allow setInterval like 'CSP_OPTIONS = ("eval-script",)'. Q1 #45 How come amo register does not have "setInterval blocked by CSP" problem even without CSP_OPTIONS?
@haoqili
Copy link
Owner Author

haoqili commented Jul 11, 2011

2 break throughs, 1 question.
BT1: change into amo register's custom RecaptchaOptions to avoid in-body script.
BT2: have to allow setInterval like 'CSP_OPTIONS = ("eval-script",)'.
Q1 #45 How come amo register does not have "setInterval blocked by CSP" problem even without CSP_OPTIONS?

blog post about the in-body javascript

@haoqili haoqili closed this as completed Jul 11, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant