Private
Public Access
Allow only http(s) URLs from feeds and OPML, at storage and render (R2-S1, #33)
A feed's channel link, an entry's link and an OPML htmlUrl were stored as given and rendered in href attributes (bulk writes skip model validation), so a malicious feed could supply a javascript: or data: link. CSP is a second layer, not the control. apps.core.urlutils accepts only absolute http(s) URLs. Fetching stores channel/entry links through it — relative links now resolve against the feed's own URL instead of being stored as dead relative paths — OPML import skips non-http(s) feed URLs and blanks unsafe htmlUrl, and the add-feed form rejects non-http(s) (URLField also allows ftp). A safe_http_url template filter guards the two places a feed-supplied URL becomes a link (the article's "Original" link and the dashboard), so values already in the database from before this fix are neutralized too. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
85914f9107
commit
41f99e9405
13 files changed
+192
-7
No files matched your search
@@ -1,4 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
{% load safe_urls %}
|
||||
{% block title %}Dashboard — Evection{% endblock %}
|
||||
{% block content %}
|
||||
<h1>Dashboard</h1>
|
||||
@@ -27,7 +28,7 @@
|
||||
<tbody>
|
||||
{% for feed in erroring_feeds %}
|
||||
<tr>
|
||||
<td><a href="{{ feed.site_url|default:feed.feed_url }}">{{ feed.title|default:feed.feed_url }}</a></td>
|
||||
<td><a href="{{ feed.site_url|default:feed.feed_url|safe_http_url }}">{{ feed.title|default:feed.feed_url }}</a></td>
|
||||
<td>{{ feed.subscriber_count }}</td>
|
||||
<td>{{ feed.get_last_fetch_status_display }}</td>
|
||||
<td>{{ feed.fetch_error_count }}</td>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="article-content-header">
|
||||
{% load safe_urls %}<div class="article-content-header">
|
||||
<h2 class="article-content-title">{{ article.title|default:"(untitled)" }}</h2>
|
||||
<p class="article-meta">
|
||||
{% if article.feed.favicon_url %}<img src="{{ article.feed.favicon_url }}" alt="" class="feed-favicon">{% endif %}
|
||||
@@ -6,7 +6,7 @@
|
||||
{# fetched_at stands in when the feed gave no publish date #}
|
||||
· <time datetime="{{ article.published_at|default:article.fetched_at|date:"c" }}" data-local-format="long">{{ article.published_at|default:article.fetched_at|date:"M j, Y H:i" }}</time>
|
||||
{% if article.author %} · {{ article.author }}{% endif %}
|
||||
{% if article.link %} · <a href="{{ article.link }}" target="_blank" rel="noopener noreferrer">Original ↗</a>{% endif %}
|
||||
{% with safe_link=article.link|safe_http_url %}{% if safe_link %} · <a href="{{ safe_link }}" target="_blank" rel="noopener noreferrer">Original ↗</a>{% endif %}{% endwith %}
|
||||
</p>
|
||||
|
||||
<div
|
||||
|
||||
Reference in new issue
Block a user