Jump to content

YOUTUBE - security


mforan

Recommended Posts

I want people to be able to paste the embedded youtube code into a form on mysite. Obviously this is a secuirty threat do to mysql injections. how would the best way to proceed be?

 

"<object width="480" height="385"><param name="movie" value="

name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="
type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>"
Link to comment
Share on other sites

1. It's same SQL injection risk, as with any other data that comes from user, so act in a same way.

2. It is an XSS risk however. Ask them to just paste a url (which you can validate using regex), and let your script generate all the embedding code.

Link to comment
Share on other sites

<object width="480" height="385">
  <param name="movie" value="http://www.youtube.com/v/xFYQQPAOz7Y"></param>
  <param name="allowFullScreen" value="true"></param>
  <param name="allowScriptAccess" value="always"></param>
  <embed src="http://www.youtube.com/v/xFYQQPAOz7Y"
    type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true"
    width="480" height="385">
  </embed>
</object>

 

All you need to ask from the user is xFYQQPAOz7Y through the YouTube API you can ask if it's a valid YouTube Video.

 

http://code.google.com/intl/nl/apis/youtube/overview.html

Link to comment
Share on other sites

ok im confused lol  :-\

 

ignace's way is the best way to go. Read up on the link he provided. In other words you only need to store the information that that the youtube video requires.

 

We would be able to assist you further if we understood what you were trying to do with this? What are they submitting the video into? What are you doing with the video once its submitted? etc etc

Link to comment
Share on other sites

You ask the user to input the Video ID (xFYQQPAOz7Y) afterwards when you want to display the video you do:

 

<object width="480" height="385">
  <param name="movie" value="http://www.youtube.com/v/<?php echo $vid; ?>"></param>
  <param name="allowFullScreen" value="true"></param>
  <param name="allowScriptAccess" value="always"></param>
  <embed src="http://www.youtube.com/v/<?php echo $vid; ?>"
    type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true"
    width="480" height="385">
  </embed>
</object>

 

Personally I would extend this further so I could control which video had fullScreen and scriptAccess, the width and height of the video.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.