-
Notifications
You must be signed in to change notification settings - Fork 23
Enable playlist functions for youtube. #48
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
Conversation
Added a case for embedding a playlist using youtube.
syntax.php
Outdated
| foreach($paramm as $key => $value) { | ||
| switch($key) { | ||
| case 'list': | ||
| $urlparam[] = $key . '=' . $paramm[$key]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since the set parameter is later printed without any further sanitation, it needs to be sanitized here. The way it is implemented currently would open an XSS vulnerability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also $param[$key] is the same as $value, so why not use that - it's a bit cleaner.
|
I corrected to use the $value variable as recommended, I had used the other format to match the existing code. I additionally added a check that the playlist id is a string, not sure if further sanitization is necessary, as I typically do not work on web programming. Happy to work out a more complicated check, if you could be more specific on what is necessary. |
|
The value will be a string for sure because it comes from the syntax. The problem arises when it contains HTML tags. I don't know what format youtube playlist identifiers have, but this format should be checked (probably using a regexp). |
|
Okay, I've created a regex match to ensure it has the format ID used by youtube playlists of alphanumeric strings with underscores and dashes. |
syntax.php
Outdated
| foreach($paramm as $key => $value) { | ||
| switch($key) { | ||
| case 'list': | ||
| if(preg_match('/(\w|-)+/',$value)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the regexp isn't anchored it would still match anything as long as it contains at least one letter. try /^[-\w]+$/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
corrected
|
thx |
Added a case for embedding a playlist using youtube.