Comments

MarkAgarunov’s picture

StatusFileSize
new3.42 KB

Wrong patch attached to the first post, fixed patch is attached.

MGParisi’s picture

I will test this but can not easily run this patch. Can you include the entire .module file?

sun’s picture

This input filter is part of Drupal 8 core now. I would recommend to create feature request against Drupal 8 core.

christefano’s picture

Status: Needs review » Needs work

Patch no longer applies.

dave reid’s picture

If at least we have a patch proposed for Drupal 8 but not committed, I think it would be ok to proceed with committing a patch here.

drumm’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Priority: Normal » Major
Issue summary: View changes
Issue tags: +affects drupal.org

For Drupal.org, we need a whitelist because:

  • Moving to a CDN would likely require moving to www.drupal.org. Both domains should be accepted.
  • Dev & staging sites have a different domain, but should still allow Drupal.org.
  • When using drush, $_SERVER['HTTP_HOST'] isn't set.
drumm’s picture

Issue tags: +Needs tests, +Novice

This must have tests since it is security-related.

And there should be a patch for D8 with added tests that are passing, so this doesn't get out of line.

greggles’s picture

Basic raised a good point in #1952278-17: White list travis-ci.org as a valid source for external images that we should proxy these images and store them locally, temporarily, on behalf of other services. This gets around privacy and stability concerns about those images.

I think the implementation would be something like:
* the images are requested and copied to the local filesystem
* a variable determines how often to go get a new copy of the image
* if the request for the new image fails, the local copy is kept

sun’s picture

Hm... Not sure I agree with that.

  1. If you explicitly whitelist external hosts, then why would you bother with caching them on your CDN to begin with? That only means that the cached resources very potentially get out of date? (especially in the travis-ci example)
  2. A customizable whitelist is plausible, but a download facility for local copies seems out of scope for this filter. (IIRC, there is at least one other module for that though.)
basic’s picture

If an external host is offline pages are not stuck waiting for a connection to the external host. The image cache should respect the cache headers sent by the image. Github uses this for images including travis-ci status. Images are loaded from https://camo.githubusercontent.com/. This also prevents tracking user data and browser data through external servers with all requests for images proxied at drupal.org.

Whitelisting is needed to move drupal.org to www.drupal.org, but I don't consider *.drupal.org external, not sure the download facility is required for that.

drumm’s picture

Let's limit the scope of this issue to whitelisting. We can decide to whitelist travis-ci, or a proxy setup, at #1952278: White list travis-ci.org as a valid source for external images.

drumm’s picture

Assigned: MarkAgarunov » drumm
drumm’s picture

Status: Needs work » Postponed (maintainer needs more info)

#2257291: Handle alternate domains in filter_html_image_secure has a D8 patch. When that has a firm plan, this issue can proceed.

drumm’s picture

Status: Postponed (maintainer needs more info) » Needs work

#2257291: Handle alternate domains in filter_html_image_secure has barely enough feedback for the backport to proceed. Looks like #1 will be a good starting point.

  • Commit c656f0c on 7.x-1.x by drumm:
    #1737022 Handle alternate domains, backporting #2257291
    
drumm’s picture

Status: Needs work » Fixed

I committed the filter code only for the backport. This is an advanced setting, and not providing a UI is okay.

sun’s picture

Priority: Major » Critical
Status: Fixed » Needs work
Issue tags: +Release blocker

@drumm: It is absolutely required for this to come with tests, because this is a security related feature/module.

Adding proper test coverage (once) also ensures that drupal.org works correctly (forever). ;)

m1r1k’s picture

Assigned: drumm » m1r1k
Status: Needs work » Needs review
Issue tags: +Amsterdam2014
StatusFileSize
new6.51 KB

Here is tests and some fixes

m1r1k’s picture

-function filter_html_image_secure_filter_tips($filter, $format, $long = FALSE) {
+function _filter_html_image_secure_filter_tips($filter, $format, $long = FALSE) {

filter_html_image_secire_process == MODULE_NAME_process == implementation of template_process(&$vars, $hook) that means that filter callback is invoked for ALL theme functions.

-    if ($domains = variable_get('filter_html_image_secure_domains', NULL)) {
+    if ($domains = variable_get('filter_html_image_secure_' . $format->format . '_domains', NULL)) {

Allows to specify settings per format.

Status: Needs review » Needs work

The last submitted patch, 18: 1737022-host-whitelist-filter_html_image_secure-18.patch, failed testing.

nick_vh’s picture

Great work!

+++ b/filter_html_image_secure.module
@@ -47,12 +47,14 @@ function filter_html_image_secure_process($text, $format) {
+    if ($domains = variable_get('filter_html_image_secure_' . $format->format . '_domains', NULL)) {

Would be nicer if you take it out of the if. Towards drupal 8 this format will be a bit harder to use.

m1r1k’s picture

Status: Needs work » Needs review
StatusFileSize
new7.29 KB
new2.68 KB

Here is patch with fix for CLI testing.
I'm using $base_url instead if $_SERVER['HTTP_HOST']

Status: Needs review » Needs work

The last submitted patch, 22: 1737022-host-whitelist-filter_html_image_secure-22.patch, failed testing.

m1r1k’s picture

Status: Needs work » Needs review
StatusFileSize
new7.29 KB
new695 bytes

Status: Needs review » Needs work

The last submitted patch, 24: 1737022-host-whitelist-filter_html_image_secure-24.patch, failed testing.

The last submitted patch, 24: 1737022-host-whitelist-filter_html_image_secure-24.patch, failed testing.

jsobiecki’s picture

Issue tags: -Amsterdam2014 +dcwroc2014
hass’s picture

Uninstall of variables is completly missing in this patches. Also in the one that has been committed.

hass’s picture

Status: Needs work » Needs review
hass’s picture

Re-uploading for re-test.

The last submitted patch, whitelist.patch, failed testing.

The last submitted patch, 1: whitelist.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 31: 1737022-host-whitelist-filter_html_image_secure-24.patch, failed testing.

vinay15’s picture

Assigned: m1r1k » vinay15
Status: Needs work » Needs review
StatusFileSize
new7.76 KB
new957 bytes

I have rerolled the patch.

Status: Needs review » Needs work

The last submitted patch, 35: 1737022-host-whitelist-filter_html_image_secure-35.patch, failed testing.

vinay15’s picture

Sorry, that's an incorrect patch.

vinay15’s picture

Assigned: vinay15 » Unassigned