Files
ksmithandClaude Sonnet 5.5 41f99e9405 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>
2026-11-01 11:57:23 -07:00

57 lines
2.0 KiB
HTML

{% extends "base.html" %}
{% load safe_urls %}
{% block title %}Dashboard — Evection{% endblock %}
{% block content %}
<h1>Dashboard</h1>
<ul class="dashboard-stats">
<li>{{ stats.feed_count }} feed(s) — {{ stats.active_feed_count }} active</li>
<li>{{ stats.subscription_count }} subscription(s)</li>
<li>{{ stats.article_count }} article(s){% if stats.oldest_article_at %}, oldest fetched <time datetime="{{ stats.oldest_article_at|date:"c" }}" data-local-format="long">{{ stats.oldest_article_at|date:"M j, Y H:i" }}</time>{% endif %}</li>
<li>{{ stats.error_feed_count }} feed(s) currently erroring</li>
</ul>
<h2>Feeds with errors</h2>
{% if erroring_feeds %}
<table class="feed-error-table">
<thead>
<tr>
<th>Feed</th>
<th>Subscribers</th>
<th>Status</th>
<th>Error count</th>
<th>Last fetched</th>
<th>Last error</th>
<th></th>
</tr>
</thead>
<tbody>
{% for feed in erroring_feeds %}
<tr>
<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>
<td>
{% if feed.last_fetched_at %}
<time datetime="{{ feed.last_fetched_at|date:"c" }}" data-local-format="long">{{ feed.last_fetched_at|date:"M j, Y H:i" }}</time>
{% else %}
never
{% endif %}
</td>
<td>{{ feed.last_error_message|default:"—" }}</td>
<td>
<form method="post" action="{% url 'core:retry_feed' feed.id %}">
{% csrf_token %}
<button type="submit">Retry now</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No feeds are currently erroring.</p>
{% endif %}
{% endblock %}