# Blacklist vs whitelist onebox

**URL:** https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811
**Category:** Feature
**Created:** [November 4, 2014, 11:48am UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811 "2014-11-04T11:48:57Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![evantill](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/evantill/32/116219_2.png) [@evantill](https://meta.discourse.org/u/evantill)
#### Post date: [November 4, 2014, 11:48am UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811/1 "2014-11-04T11:48:57Z")

</div>

Continuing the discussion from [Auto-discoverable oneboxer-able links based on whitelist configurable by admin](https://meta.discourse.org/t/auto-discoverable-oneboxer-able-links-based-on-whitelist-configurable-by-admin/9068/5):

> [@krainboltgreene](#):
>
> Hey, onebox gem “team lead” here. I’ve got an open issue for whitelist/blacklist functionality here: [Whitelist/blacklist certain domains · Issue #124 · discourse/onebox · GitHub](https://github.com/dysania/onebox/issues/124)

I would like to enable onebox for every site that support `oEmbed` or `Open Graph` and be able to blacklist some sites in case of improper usage.

---

<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: [November 4, 2014, 10:36pm UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811/2 "2014-11-04T22:36:12Z")

</div>

This currently isn’t possible. You’d need to make changes to the onebox gem.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [November 4, 2014, 11:55pm UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811/3 "2014-11-04T23:55:08Z")

</div>

Any implementation of this will likely result in your Discourse instance making spurious calls to non-existent websites while someone is typing, which is a bit wasteful.

The client already makes a lot of calls to `/onebox`, maybe they should be debounced.

---

<div class="post-metadata">

### Author: ![evantill](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/evantill/32/116219_2.png) [@evantill](https://meta.discourse.org/u/evantill)
#### Post date: [November 5, 2014, 9:03am UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811/4 "2014-11-05T09:03:18Z")

</div>

and would it be possible to create a plugin to enable OEmbed discovery ?

like this plugin for wordpress [Enable oEmbed Discovery – WordPress plugin | WordPress.org](https://wordpress.org/plugins/enable-oembed-discovery/)

see [oEmbed](http://oembed.com/#section4)

---

<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: [June 17, 2016, 5:25am UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811/5 "2016-06-17T05:25:44Z")

</div>

I just hit this exact issue again today, this is something I would also like build.

In particular for internal Discourse instances there is zero reason to blacklist any sites. In general, I am not really sure what the value is of the whitelist approach. Facebook and Twitter seem to be coping just fine with a blacklist approach.

I guess the big question is:

What kind of abuse does the onebox whitelist only approach prevent? Honestly I am struggling really hard to think of any.

@eviltrout ? @codinghorror ?

---

<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: [June 17, 2016, 5:32am UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811/6 "2016-06-17T05:32:04Z")

</div>

The idea was to be safe by default but relax it over time, as opengraph and oembed become more common on the web. I would still prefer to see mini oneboxer implemented before we do that though.

---

<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: [June 17, 2016, 6:08am UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811/7 "2016-06-17T06:08:12Z")

</div>

> [@codinghorror](#):
>
> The idea was to be safe by default but relax it over time,

That is what I am struggling with, what is “insecure” opening the open-graph floodgates? I just can’t think of anything really, we already download images from arbitrary sources in our pipeline which is far more risky.

Not at all against mini-onebox, in fact this would tie in to mini-onebox work. Just struggling real hard to figure out what we are protecting against here.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [June 17, 2016, 6:00pm UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811/9 "2016-06-17T18:00:32Z")

</div>

For the record I always thought it should be blacklist, not whitelist, but I also had no problem erring on the side of security. In early discussions I believe @codinghorror insisted it should be whitelist.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [June 18, 2016, 12:41am UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811/10 "2016-06-18T00:41:44Z")

</div>

Yeah I think only oEmbed needs whitelisting, and even then most of the oEmbed returns are unusable due to `<script>`s.

---

<div class="post-metadata">

### Author: ![Gargron](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gargron/32/122397_2.png) [@Gargron](https://meta.discourse.org/u/Gargron)
#### Post date: [September 7, 2017, 1:30am UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811/11 "2017-09-07T01:30:12Z")

</div>

Please change this from whitelist to blacklist. This is hurting the decentralized web. With the rise of Mastodon as an alternative federated social media platform I believe this becomes more important than ever. You can’t whitelist every potential Mastodon URL out there - there’s over 2000 different servers. All support OEmbed via discovery, since it’s an open standard specifically for this use case. But Discourse won’t work with any of them because of this choice.

Last time I checked Discourse sanitizes OEmbed html and strips out any scripts, allowing only pure iframes and other safe elements. So I do not see this as an issue defined by security risks.

@codinghorror @eviltrout

---

<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: [September 7, 2017, 1:36am UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811/12 "2017-09-07T01:36:54Z")

</div>

This was changed some time ago and is already how it works today. Did you try it yourself?

---

<div class="post-metadata">

### Author: ![Gargron](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gargron/32/122397_2.png) [@Gargron](https://meta.discourse.org/u/Gargron)
#### Post date: [September 7, 2017, 1:52am UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811/13 "2017-09-07T01:52:04Z")

</div>

Is it behind a setting? I just tried it on my hosted Discourse and it didn’t work.

Excuse me while I try it right here:

> **[Unchained A.I. (@Sparkyopteryx@mastodon.social)](https://mastodon.social/@Sparkyopteryx/17213155)**
>
> Attached: 1 image
> 
> Gotta do more post catch-up here, so here's one commission I finished last week. WWI bat pilot and his Salmson 2 biplane: https://mastodon.social/media/Y325\_B0Vfuuy3D9rklk

Hm nope, doesn’t work - displays the OpenGraph tags instead. Before you ask - I did test the OEmbed discovery implementation on Mastodon’s side using other OEmbed tools.

---

<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: [September 7, 2017, 3:47am UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811/14 "2017-09-07T03:47:58Z")

</div>

Looks correct to me. I see zero issues.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [September 7, 2017, 6:11am UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811/15 "2017-09-07T06:11:30Z")

</div>

They’re saying that the oEmbed format would be preferred, and oembed is still on an (extremely strict) whitelist (because a lot of oembed stuff is broken, so Discourse preferring it by default would result in a lot of broken stuff).

---

<div class="post-metadata">

### Author: ![marcozambi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marcozambi/32/119505_2.png) [@marcozambi](https://meta.discourse.org/u/marcozambi)
#### Post date: [February 11, 2019, 8:17pm UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811/16 "2019-02-11T20:17:56Z")

</div>

How are the entries expected in the blacklist? If I wanted to blacklist the website `https://www.example.com`, can i just enter “example” (seemingly not) or the entire base url (i.e. `https://www.example.com`)?

---

<div class="post-metadata">

### Author: ![chapoi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chapoi/32/537252_2.png) [@chapoi](https://meta.discourse.org/u/chapoi)
#### Post date: [December 4, 2025, 11:32am UTC](https://meta.discourse.org/t/blacklist-vs-whitelist-onebox/21811/17 "2025-12-04T11:32:48Z")

</div>


