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

Add some validation for the JSONP callback #1627

Merged
merged 1 commit into from
Apr 20, 2015
Merged

Add some validation for the JSONP callback #1627

merged 1 commit into from
Apr 20, 2015

Conversation

digitalresistor
Copy link
Member

The callback variable could be used to arbitrarily inject javascript
into the response object. This validates that the callback doesn't begin
with a number and is standard US ASCII characters, because trying to
make sure the JavaScript function name is actually valid would require
parsing JavaScript itself...

The callback variable could be used to arbitrarily inject javascript
into the response object. This validates that the callback doesn't begin
with a number and is standard US ASCII characters, because trying to
make sure the JavaScript function name is actually valid would require
parsing JavaScript itself...
@digitalresistor
Copy link
Member Author

Do note that this isn't a HUGE security vulnerability because to allow this to be abused a user has to be able to insert callback variables into the remote page that happens to be doing a JSONP request to a Pyramid application. If you can already insert data into the page to change the callback variable that is sent to Pyramid, you already have access to the site in the first place, and you really don't need to modify the callback variable.

Either way it's a nice to have that we at least sanity check it.

@digitalresistor
Copy link
Member Author

@mcdonc You pulled this into 1.4 and 1.5, but not master, nor 1.6, do you want me to cherry-pick it onto 1.6 too?

mmerickel added a commit that referenced this pull request Apr 20, 2015
Add some validation for the JSONP callback
@mmerickel mmerickel merged commit dfce4e0 into Pylons:master Apr 20, 2015
mmerickel added a commit that referenced this pull request Apr 20, 2015
@mmerickel
Copy link
Member

I've applied this to 1.6-branch.

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.

2 participants