# File attachments in restricted categories should be restricted

**URL:** https://meta.discourse.org/t/file-attachments-in-restricted-categories-should-be-restricted/60765
**Category:** Feature
**Created:** [11.Апрель.2017 10:25:06 UTC](https://meta.discourse.org/t/file-attachments-in-restricted-categories-should-be-restricted/60765 "2017-04-11T10:25:06Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [11.Апрель.2017 10:25:06 UTC](https://meta.discourse.org/t/file-attachments-in-restricted-categories-should-be-restricted/60765/1 "2017-04-11T10:25:06Z")

</div>

Currently, files that are uploaded to a restricted category are accessible to anyone, even users who are not logged in. Chances are that these files get indexed by search engines and thus become public. I agree with @tobiaseigen that this is quite a serious issue:

> [@Attachments available to any user with link](https://meta.discourse.org/t/attachments-available-to-any-user-with-link/18868/5):
>
> This is a fairly serious issue because the presumption is that the attached file has the same security settings as the post it goes in.. this is not true at the moment and may result in unpleasant surprises. In the meantime and until this issue is solved, how about adding a warning note to the upload interface along the lines of “Note: attachments to posts in this forum, even in secure categories, are available to any user with the attachment URL.”

But I am not sure what exactly the current state of affairs is regarding this, except that, some time ago, @dmitry_fedyuk created the [restrict files plugin](https://meta.discourse.org/t/restrict-files-plugin-sell-a-digital-content-on-your-discourse-forum-version-1-2-1-2015-07-19/29775) whose [latest version seems to be 2.1](https://discourse.pro/t/topic/33) which is [confirmed to be compatible with discourse v1.7.0.beta9](https://discourse.pro/t/topic/33/6).

I would like to ask conference participants to upload their papers as attachments on my forum but I cannot do this unless I know that only users with access to the specified category can access the uploaded papers.

So my question to @dmitry_fedyuk is: can you confirm that the [current version](https://github.com/discourse-pro/df-restricted-files) is compatible with discourse v1.8.0.beta10? I would also be curious to hear about any user experiences with the plugin.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [11.Апрель.2017 13:08:03 UTC](https://meta.discourse.org/t/file-attachments-in-restricted-categories-should-be-restricted/60765/2 "2017-04-11T13:08:03Z")

</div>

This is something I want core to support out of the box, but it would require a fair bit of internal change.

That said, I don’t think the current state of affairs is terrible, the actual links to the assets contain “secure random” strings, they are not guessable.

Sure, if someone with access shares a link to it then someone unauthorized can download.

But…

What if someone with access downloads the paper and then forwards it via email?

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [11.Апрель.2017 13:33:03 UTC](https://meta.discourse.org/t/file-attachments-in-restricted-categories-should-be-restricted/60765/3 "2017-04-11T13:33:03Z")

</div>

> [@sam](#):
>
> That said, I don’t think the current state of affairs is terrible, the actual links to the assets contain “secure random” strings, they are not guessable.

Correct me if I’m wrong: but what good are those random links if they are indexed by google?

> [@sam](#):
>
> What if someone with access downloads the paper and then forwards it via email?

Maybe I should just save all the papers to `/dev/null`just to be save? LOL  
But seriously (if this is of any concern here): the default mode of distributing work-in-progress papers at (academic) conferences and workshops is that all authors send their paper to the convenor who then circulates them to the registered participants (or whatever was agreed with the authors).

So I’d say that is the security standard to measure this specific use-case against, i.e. the original recipients are by default trusted to not circulate the paper any further, let alone to make it available online. So the question is: what additional threats am I introducing by distributing the papers via the forum? One is the risk of (unintended) online publication via search engines (see above). Another, much smaller one, is the accidental forwarding of the link to wherever due to the fact that some users will not be aware of the link being secret (e.g. when forwarding an email in which they were notified about the topic with the link). Finally, there is perhaps also a small risk of discourse leaking the link for whatever reason (this is something I cannot assess myself).

> [@sam](#):
>
> This is something I want core to support out of the box

That is great news! Will this protect content retrospectively?

> [@sam](#):
>
> but it would require a fair bit of internal change.

Hm, should I read this as saying that the existing plugin is not doing a good job?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [11.Апрель.2017 13:35:52 UTC](https://meta.discourse.org/t/file-attachments-in-restricted-categories-should-be-restricted/60765/4 "2017-04-11T13:35:52Z")

</div>

> [@tophee](#):
>
> Will this protect content retrospectively?

Most likely yes.

> [@tophee](#):
>
> should I read this as saying that the existing plugin is not doing a good job?

The plugin you mentioned is different in that it’s adding a paywall.  
We just want to prevent the download when you don’t have the permission to.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [11.Апрель.2017 13:42:35 UTC](https://meta.discourse.org/t/file-attachments-in-restricted-categories-should-be-restricted/60765/5 "2017-04-11T13:42:35Z")

</div>

> [@tophee](#):
>
> Correct me if I’m wrong: but what good are those random links if they are indexed by google?

How? this is a secure category, Google only has access to public categories. Google can not see this content or links.

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [11.Апрель.2017 13:43:31 UTC](https://meta.discourse.org/t/file-attachments-in-restricted-categories-should-be-restricted/60765/6 "2017-04-11T13:43:31Z")

</div>

> [@zogstrip](#):
>
> The plugin you mentioned is different in that it’s adding a paywall.

No, the above mentioned [restrict files plugin](https://github.com/discourse-pro/df-restricted-files) only restricts file access. At least the author [states that](https://discourse.pro/t/topic/33)

> The «Restricted Files» plugin allows you to restrict access to downloads (attached files) so only users of permitted groups can download files from your Discourse forum. (…) To receive payments from your customers you can use my another Discourse plugin «PayPal Buy Now»

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [11.Апрель.2017 17:26:28 UTC](https://meta.discourse.org/t/file-attachments-in-restricted-categories-should-be-restricted/60765/7 "2017-04-11T17:26:28Z")

</div>

It is highly unlikely we will work on this until a large paying customer asks for it.

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [11.Апрель.2017 19:00:48 UTC](https://meta.discourse.org/t/file-attachments-in-restricted-categories-should-be-restricted/60765/8 "2017-04-11T19:00:48Z")

</div>

> [@sam](#):
>
> How? this is a secure category, Google only has access to public categories. Google can not see this content or links.

Okay, that’s good to know. I was not sure, how discourse treats robots.

So, to conclude, we can say that attachments on discourse are as safe as a Google document with a privately shared link, right?

But what is the issue with the restrict files plugin?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [11.Апрель.2017 19:18:50 UTC](https://meta.discourse.org/t/file-attachments-in-restricted-categories-should-be-restricted/60765/9 "2017-04-11T19:18:50Z")

</div>

> [@tophee](#):
>
> So, to conclude, we can say that attachments on discourse are as safe as a Google document with a privately shared link, right?

Yes, that is the case.

> [@tophee](#):
>
> But what is the issue with the restrict files plugin?

I have no idea, I did not write it or review it

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [11.Апрель.2017 19:37:00 UTC](https://meta.discourse.org/t/file-attachments-in-restricted-categories-should-be-restricted/60765/10 "2017-04-11T19:37:00Z")

</div>

> [@sam](#):
>
> I have no idea, I did not write it or review it

I asked because you said it would require a fair bit of work to implement the apps functionality into core. Which I hear as saying: the plugin is not something we can use in core.
