ElkArte Community

Elk Development => Bug Reports => Topic started by: emanuele on April 16, 2016, 12:13:16 pm

Title: attachments 404
Post by: emanuele on April 16, 2016, 12:13:16 pm
Two problems:
1) for some reason the directory settings were all wiped out during the upgrade,
2) bad behaviour requires a theme and attachments don't load the theme, so the question is: do attachments need bad behaviour? If the answer is no, loadBadBehavior (and maybe loadBBCParsers as well) should be called only with loadTheme, otherwise there is something to tweak.
Title: Re: attachments 404
Post by: Spuds on April 16, 2016, 02:52:51 pm
On BB, you mean for dlattach actions ?
Title: Re: attachments 404
Post by: emanuele on April 16, 2016, 03:01:05 pm
Quote from: Spuds – On BB, you mean for dlattach actions ?
Yep.

What I did here live is:
Code: [Select]
	// Attachments don't require the entire theme to be loaded.
if ($_req->getQuery('action') === 'dlattach' && (!empty($modSettings['allow_guestAccess']) && $user_info['is_guest']) && (empty($maintenance) || allowedTo('admin_forum')))
detectBrowser();
// Load the current theme.  (note that ?theme=1 will also work, may be used for guest theming.)
else
{
loadTheme();

// Load BadBehavior before we go much further
loadBadBehavior();

// The parser is not a DIC just yet
loadBBCParsers();
}
Title: Re: attachments 404
Post by: Spuds on April 16, 2016, 03:05:23 pm
I'd think you would want to protect that action with BB but its not critical
Title: Re: attachments 404
Post by: emanuele on April 16, 2016, 03:09:10 pm
I really don't know (in the sense that I really have no idea what BB does LOL), I assumed BB was intercepting forms POST'ed in order to avoid registrations and stuff like that, so I thought was safe to let attachments be downloaded at will.
But if you say to, then we have to fix the (bad :P) behaviour... what an idiotic joke. LOL
Title: Re: attachments 404
Post by: Spuds on April 16, 2016, 03:21:01 pm
BB also may use the HTTP BL so it can block based on that (at least that was my thought in this case)
Title: Re: attachments 404
Post by: Frenzie on April 16, 2016, 03:31:44 pm
Quote from: emanuele – I really don't know (in the sense that I really have no idea what BB does LOL), I assumed BB was intercepting forms POST'ed in order to avoid registrations and stuff like that, so I thought was safe to let attachments be downloaded at will.
But if you say to, then we have to fix the (bad :P) behaviour... what an idiotic joke. LOL
For me it doesn't do all that much to prevent registrations per se, but rather the enormous bandwidth and CPU leech caused by such bots. Which includes more than just (failed) registrations, although that's what they concentrate on the most.

Or to put it another way, if PHP is involved in loading attachments it'd be a damn shame if Bad Behavior didn't step in to kick out, um, badly behaving/blacklisted entities.