element-hq / element-hq/synapse

URL preview whitelisting akin to url_preview_url_blacklist

Open
#6,205 0 comments 0 reactions 0 assignees View on GitHub
A-URL-Preview O-Uncommon S-Minor T-Enhancement z-feature z-p2
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#6205](https://github.com/matrix-org/synapse/issues/6205).

---

In `homeserver.yaml` we have:
```yaml
url_preview_ip_range_blacklist:
...
url_preview_ip_range_whitelist:
...
url_preview_url_blacklist:
```
I propose adding
```yaml
url_preview_url_whitelist:
```
Using the same [urlparse](https://docs.python.org/2/library/urlparse.html#urlparse.urlsplit) scheme as the blacklist.

Instead of blacklisting 99% of domains, one could whitelist just a few - which might have dynamic IP addresses, or IPs that host multiple sites with potentially malicious/invasive owners.

Example:
```yaml
url_preview_url_whitelist:
- netloc: 'my_site.com'
- netloc: '*.my_site.com'
- netloc: 'another_acceptable_site.com' # with the same IP as an unacceptable site
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.