{"action":"created","issue":{"url":"https://api.github.com/repos/pagespeed/mod_pagespeed/issues/1111","labels_url":"https://api.github.com/repos/pagespeed/mod_pagespeed/issues/1111/labels{/name}","comments_url":"https://api.github.com/repos/pagespeed/mod_pagespeed/issues/1111/comments","events_url":"https://api.github.com/repos/pagespeed/mod_pagespeed/issues/1111/events","html_url":"https://github.com/pagespeed/mod_pagespeed/issues/1111","id":96127427,"number":1111,"title":"poor interaction with access control","user":{"login":"jeffkaufman","id":262566,"avatar_url":"https://avatars.githubusercontent.com/u/262566?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffkaufman","html_url":"https://github.com/jeffkaufman","followers_url":"https://api.github.com/users/jeffkaufman/followers","following_url":"https://api.github.com/users/jeffkaufman/following{/other_user}","gists_url":"https://api.github.com/users/jeffkaufman/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffkaufman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffkaufman/subscriptions","organizations_url":"https://api.github.com/users/jeffkaufman/orgs","repos_url":"https://api.github.com/users/jeffkaufman/repos","events_url":"https://api.github.com/users/jeffkaufman/events{/privacy}","received_events_url":"https://api.github.com/users/jeffkaufman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"jeffkaufman","id":262566,"avatar_url":"https://avatars.githubusercontent.com/u/262566?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffkaufman","html_url":"https://github.com/jeffkaufman","followers_url":"https://api.github.com/users/jeffkaufman/followers","following_url":"https://api.github.com/users/jeffkaufman/following{/other_user}","gists_url":"https://api.github.com/users/jeffkaufman/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffkaufman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffkaufman/subscriptions","organizations_url":"https://api.github.com/users/jeffkaufman/orgs","repos_url":"https://api.github.com/users/jeffkaufman/repos","events_url":"https://api.github.com/users/jeffkaufman/events{/privacy}","received_events_url":"https://api.github.com/users/jeffkaufman/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-07-20T18:29:14Z","updated_at":"2015-07-20T18:41:42Z","closed_at":null,"body":"When you put in your Apache config:\r\n\r\n```\r\nOrder Allow,Deny\r\nDeny from all\r\n<Files ~ \".(css|jpe?g|png|gif|js|swf|html|htm|eot|woff|ttf|svg|doc|docx|xls|xlsx|ppt|pptx|pdf|map)$\">\r\nAllow from all\r\n</Files>\r\n```\r\n\r\nThen PageSpeed resources will 403.\r\n\r\nReported on the mailing list: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/mod-pagespeed-discuss/ECzn212X8vw/P07WNZZk6cwJ\r\n\r\nReproduced, locally, trying to figure out why it happens."},"comment":{"url":"https://api.github.com/repos/pagespeed/mod_pagespeed/issues/comments/122983141","html_url":"https://github.com/pagespeed/mod_pagespeed/issues/1111#issuecomment-122983141","issue_url":"https://api.github.com/repos/pagespeed/mod_pagespeed/issues/1111","id":122983141,"user":{"login":"jeffkaufman","id":262566,"avatar_url":"https://avatars.githubusercontent.com/u/262566?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffkaufman","html_url":"https://github.com/jeffkaufman","followers_url":"https://api.github.com/users/jeffkaufman/followers","following_url":"https://api.github.com/users/jeffkaufman/following{/other_user}","gists_url":"https://api.github.com/users/jeffkaufman/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffkaufman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffkaufman/subscriptions","organizations_url":"https://api.github.com/users/jeffkaufman/orgs","repos_url":"https://api.github.com/users/jeffkaufman/repos","events_url":"https://api.github.com/users/jeffkaufman/events{/privacy}","received_events_url":"https://api.github.com/users/jeffkaufman/received_events","type":"User","site_admin":false},"created_at":"2015-07-20T18:41:42Z","updated_at":"2015-07-20T18:41:42Z","body":"The problem is really `InstawebHandler::instaweb_map_to_storage`, which has:\r\n\r\n```\r\n  // core_map_to_storage does at least two things:                               \r\n  //  1) checks filename length limits                                           \r\n  //  2) determines directory specific options                                   \r\n  // We want (2) but not (1).  If we simply return OK we will keep               \r\n  // core_map_to_storage from running and let through our long filenames but     \r\n  // resource requests that require regeneration will not respect directory      \r\n  // specific options.                                                           \r\n  //                                                                             \r\n  // To fix this we need to be more dependent on apache internals than we        \r\n  // would like.  core_map_to_storage always calls ap_directory_walk(request),   \r\n  // which does both (1) and (2) and appears to work entirely off of             \r\n  // request->filename.  But ap_directory_walk doesn't care whether the last     \r\n  // request->segment of the path actually exists.  So if we change the          \r\n  // request->filename from something like:                                      \r\n  //    /var/www/path/to/LEAF_WHICH_MAY_BE_HUGE.pagespeed.FILTER.HASH.EXT        \r\n  // to:                                                                         \r\n  //    /var/www/path/to/A                                                       \r\n  // then we will bypass the filename length limit without harming the load of   \r\n  // directory specific options.                                                 \r\n  //                                                                             \r\n  // So: modify request->filename in place to cut it off after the last '/'      \r\n  // character and replace the whole leaf with 'A', and then call                \r\n  // ap_directory_walk to figure out custom options.                             \r\n  char* filename_starting_at_last_slash = strrchr(request->filename, '/');\r\n  if (filename_starting_at_last_slash != NULL &&\r\n      filename_starting_at_last_slash[1] != '\\0') {\r\n    filename_starting_at_last_slash[1] = 'A';\r\n    filename_starting_at_last_slash[2] = '\\0';\r\n  }\r\n  ap_directory_walk(request);\r\n```\r\n\r\nSo when you put in your config:\r\n\r\n```\r\nOrder Allow,Deny\r\nDeny from all\r\n<Files ~ \".jpg$\">\r\n    Allow from all\r\n</Files>\r\n```\r\n\r\nand request `.../xBikeCrashIcn.png.pagespeed.ic.-f3rxqdUg6.jpg` the URL that `ap_directory_walk` works on is `.../A` which doesn't match the filter."}}