diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-10-21 12:09:41 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-10-21 12:09:41 +0000 |
commit | 2a0e32644822d34416f4633b4c6fc8674870e6d8 (patch) | |
tree | 72e32a7d4a1bbe07e83bcff6402923e4c1ca9b85 /modules | |
parent | c7e9857de4887d33f8020a4e843ef854848f454e (diff) | |
download | brdo-2a0e32644822d34416f4633b4c6fc8674870e6d8.tar.gz brdo-2a0e32644822d34416f4633b4c6fc8674870e6d8.tar.bz2 |
- Patch #942690 by effulgentsia: security harden stream wrappers by defaulting them as remote.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/system/system.api.php | 31 | ||||
-rw-r--r-- | modules/system/system.module | 4 |
2 files changed, 29 insertions, 6 deletions
diff --git a/modules/system/system.api.php b/modules/system/system.api.php index a5773c300..05c6d4241 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -2297,9 +2297,13 @@ function hook_modules_uninstalled($modules) { * - 'class' A string specifying the PHP class that implements the * DrupalStreamWrapperInterface interface. * - 'description' A string with a short description of what the wrapper does. - * - 'type' A bitmask of flags indicating what type of streams this wrapper - * will access - local or remote, readable and/or writeable, etc. Many - * shortcut constants are defined in stream_wrappers.inc. + * - 'type' (Optional) A bitmask of flags indicating what type of streams this + * wrapper will access - local or remote, readable and/or writeable, etc. + * Many shortcut constants are defined in stream_wrappers.inc. Defaults to + * STREAM_WRAPPERS_NORMAL which includes all of these bit flags: + * - STREAM_WRAPPERS_READ + * - STREAM_WRAPPERS_WRITE + * - STREAM_WRAPPERS_VISIBLE * * @see file_get_stream_wrappers() * @see hook_stream_wrappers_alter() @@ -2311,18 +2315,35 @@ function hook_stream_wrappers() { 'name' => t('Public files'), 'class' => 'DrupalPublicStreamWrapper', 'description' => t('Public local files served by the webserver.'), + 'type' => STREAM_WRAPPERS_LOCAL_NORMAL, ), 'private' => array( 'name' => t('Private files'), 'class' => 'DrupalPrivateStreamWrapper', 'description' => t('Private local files served by Drupal.'), + 'type' => STREAM_WRAPPERS_LOCAL_NORMAL, ), 'temp' => array( 'name' => t('Temporary files'), 'class' => 'DrupalTempStreamWrapper', 'description' => t('Temporary local files for upload and previews.'), - 'type' => STREAM_WRAPPERS_HIDDEN, - ) + 'type' => STREAM_WRAPPERS_LOCAL_HIDDEN, + ), + 'cdn' => array( + 'name' => t('Content delivery network files'), + 'class' => 'MyModuleCDNStreamWrapper', + 'description' => t('Files served by a content delivery network.'), + // 'type' can be omitted to use the default of STREAM_WRAPPERS_NORMAL + ), + 'youtube' => array( + 'name' => t('YouTube video'), + 'class' => 'MyModuleYouTubeStreamWrapper', + 'description' => t('Video streamed from YouTube.'), + // A module implementing YouTube integration may decide to support using + // the YouTube API for uploading video, but here, we assume that this + // particular module only supports playing YouTube video. + 'type' => STREAM_WRAPPERS_READ_VISIBLE, + ), ); } diff --git a/modules/system/system.module b/modules/system/system.module index 6de3a8329..d450eadc5 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -1545,12 +1545,13 @@ function system_stream_wrappers() { 'name' => t('Public files'), 'class' => 'DrupalPublicStreamWrapper', 'description' => t('Public local files served by the webserver.'), + 'type' => STREAM_WRAPPERS_LOCAL_NORMAL, ), 'temporary' => array( 'name' => t('Temporary files'), 'class' => 'DrupalTemporaryStreamWrapper', 'description' => t('Temporary local files for upload and previews.'), - 'type' => STREAM_WRAPPERS_HIDDEN, + 'type' => STREAM_WRAPPERS_LOCAL_HIDDEN, ), ); @@ -1560,6 +1561,7 @@ function system_stream_wrappers() { 'name' => t('Private files'), 'class' => 'DrupalPrivateStreamWrapper', 'description' => t('Private local files served by Drupal.'), + 'type' => STREAM_WRAPPERS_LOCAL_NORMAL, ); } |