Aviberry Drupal Video Conversion Module extends Drupal Video module, offering an enhanced video converter in addition to the default engine.
The module ensures professional video quality and stable encoding to formats perfect for a chosen media player.
Learn more on supported formats at http://www.aviberry.com/supported_formats.html

This module is built into the Video module as a new video Transcoder.
To use the module, you must have a registered account on the service Aviberry.com

Project page: http://drupal.org/sandbox/Movavi/1676658
Git clone: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/Movavi/1676658.git aviberry
Drupal version: 7

Comments

heine’s picture

I've only looked at a part of the code and haven't tried to run this, but I'm a bit worried about the xmlrpc callbacks.

It appears as if unauthenticated, unauthorized users can call the xmlrpc callback _aviberry_server_callback via the xmlrpc method aviberry.callback.

At least, there's no check I can see that verifies this request comes from the aviberry server and/or needs additional permissions and/or has not been tampered with.

The callback then proceeds to do a lot of work and gets to saving of the thumbnail if $conversion['status'] == 'finished':

 106     $thumbscheme = !empty($field['settings']['uri_scheme_thumbnails']) ? $field['settings']['uri_scheme_thumbnails'] : 'public';
 107     $thumburibase =  $thumbscheme . '://' . variable_get('video_thumbnail_path', 'videos/thumbnails') . '/' . $video->fid . '/';
 108     file_prepare_directory($thumburibase, FILE_CREATE_DIRECTORY);
 109     $thumbwrapper = file_stream_wrapper_get_instance_by_scheme($thumbscheme);
 110 
 111     $thumbnail['url'] = $conversion['result'][0][0][0]['preview_url']; // <- !!
 112 
 113     $existingthumbs = db_query('SELECT f.uri, f.fid FROM {file_managed} f INNER JOIN {video_thumbnails} t ON (f.fid = t.thumbnailfid) WHERE t.videofid = :fid', array(':fid' => $video->fid))->fetchAllKeyed();
 114 
 115     $urlpath = parse_url($thumbnail['url'], PHP_URL_PATH); // <- !!
 116     $ext = video_utility::getExtension($urlpath);                   // <- !!
 117     $thumb = new stdClass();
 118     $thumb->uid = $entity->uid;
 119     $thumb->status = FILE_STATUS_PERMANENT;
 120     $thumb->filename = 'thumbnail-' . $video->fid . '_' . sprintf('%04d', 0) . '.' . $ext; // <- !!
 121     $thumb->uri = $thumburibase . $thumb->filename;
 122     $thumb->filemime = $thumbwrapper->getMimeType($thumb->uri);
 123     $thumb->type = 'image'; // For the media module
 124     if (isset($existingthumbs[$thumb->uri])) {
 125       $thumb->fid = intval($existingthumbs[$thumb->uri]);
 126     }
 127 
 128     if (!copy($thumbnail['url'], $thumb->uri)) {  // <- !!
 129       watchdog('transcoder', 'Could not copy @thumbsrc to @thumbdest.', array('@thumbsrc' => $thumbnail['url'], '@thumbdest' => $thumb->uri), WATCHDOG_ERROR);
 130       return false;
 131     }
 132 
 133     file_save($thumb);

The extension of the thumbnail is derived from conversion data, which is in effect user-supplied data. This allows an attacker to copy executable (eg php) files onto the system.

Mitigation: In many cases, the .htaccess in the files directory protects against PHP execution. An exploit might need a video in the queue.

Movavi’s picture

Thank you for your feedback.
I made ​​adjustments to the code according to your comments.
Changes have been made:
- checks the user's authorization in callback function
- more strict validation of input parameter in callback function(including checking pictures extension)

Release: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/Movavi/1676658.git aviberry

sanchi.girotra’s picture

Status: Needs review » Needs work

Please see the automated review report here.
Manual Review:

  1. .info file - Remove version = 7.x-1.0 as added by drupal.org when a release is created refer http://drupal.org/node/231036.
  2. Suggestion:Form element name and function name should start with module name as _loadVideoQueue(); to _aviberry_loadVideoQueue();

others to be modified:$form['settings']['video']['video_aviberry_preset']
_check_callback_param();

Movavi’s picture

Status: Needs work » Needs review

Hi, sanchi.girotra

We have corrected the code in line with your(and the automated review report) comments.

$form['settings']['video']['video_aviberry_preset'] is used because it is a variable of the module Video that integrates the module Aviberry.

Thanks for your feedback!

Movavi’s picture

Hi.

Now the module supports the latest Video Module version 7.x-2.7
We need a code review.

patrickd’s picture

I'm sorry for the delay!
There are about 100 other applications waiting for review and only a hand full of active reviewers.
We do really need more hands in the application queue and highly recommend to get a review bonus so we can come back to your application sooner.

klausi’s picture

Assigned: Unassigned » klausi
klausi’s picture

Assigned: klausi » Unassigned
Priority: Major » Normal
Status: Needs review » Reviewed & tested by the community

manual review:

  1. Remove the licensing header from all PHP files, you can give credit in README.txt and a license file is added automatically for downloadable releases.
  2. aviberry_uninstall(): remove that function, Drupal 7 will remove the tables automatically for you.
  3. "variable_get('video_aviberry_ftp_connect_string', NULL)": does the video module remove those variables upon uninstallation for you? If not, you should do that in hook_uninstall().
  4. Project page is too short, see http://drupal.org/node/997024

Although you should definitively fix those issues they are not hard blockers. Otherwise RTBC to me.

patrickd’s picture

Status: Reviewed & tested by the community » Fixed

Please make sure to fix the issues pointed out by klausi,
however there were no further issues I could find.

Thanks for your contribution!

I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

Movavi’s picture

We have corrected the code in line with your comments.

Thank you for your review!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.