The undefined user_signed_in check above it was replaced with user.is_authenticated. No template in the repository fills {% block side_menu %}, so span12 is the correct class.
Preview links
frontend/frontend/templates/frontend/preview.html now builds item headings with a safeUrl helper:
only http: and https: links become anchors;
file:, javascript:, data: and other schemes are shown as plain text;
the title is inserted with .text() instead of string concatenation;
item descriptions are rendered with .textContent, so feed HTML cannot execute.
That prevents the Security Error: Content at ... may not load or link to file:/// message when a feed item has a local link.
Tests
tests/test_reader_django.py: the index page contains no <%= or content_for? markup; the preview page loads frontend/js/preview.js and
calls PolPreview.renderItems.
tests/js/preview.test.js: Node tests for http(s) links, blocked file:
and javascript: schemes, text-only titles, and rendered anchors.
CI runs node --test tests/js/*.test.js in the Python tests job.
Review fixes
The Greptile comment asked for a behavioral test rather than a substring check.
The preview renderer now lives in frontend/frontend/assets/frontend/js/preview.js,
runs in both the browser and Node, and the new JS tests exercise the link and
title behavior directly.
Verification
Node JS tests: 5 passed.
Playwright E2E: success.
Python tests: success.
Lint & static checks: success.
Docker image build: success.
Codacy Static Code Analysis: success (the innerHTML XSS findings are gone).
Note on the XML error
The XML parsing error comes from the feed response itself, not from the page. If /feed/2?sanitize=Y is malformed or returns an HTML error page, the preview script will still show its failure message. This PR fixes the page markup and the file:// link handling; the feed source still needs to be valid XML.
Clean up the Django templates and harden feed preview rendering against unsafe links and markup.
Bug Fixes:
Remove leftover Rails/ERB markup from the Django base template and use the correct authentication check and full-width content layout.
Prevent unsafe or local feed links from being rendered as clickable preview links.
Render feed titles and descriptions as text to prevent unintended HTML injection.
Enhancements:
Extract feed preview item processing and rendering into a reusable browser/Node-compatible module.
CI:
Run JavaScript preview tests as part of the Python test job.
Tests:
Add Django regression tests for template markup and preview integration.
Add JavaScript tests covering safe URL handling and text-only rendering.
Summary by cubic
Removes leftover Rails/ERB markup from the Django base template and makes the feed preview render links, titles, and descriptions safely.
Replaces the undefined user_signed_in check with user.is_authenticated and always renders the span12 class.
Extracts the preview renderer into frontend/js/preview.js so only http:/https: links become anchors, and titles and descriptions are inserted as text to avoid XSS.
Adds Node unit tests for http(s) links, blocked schemes, and text-only titles, plus Django regression tests; the JS tests run in CI.
This change is
Confidence Score: 5/5
The PR appears safe to merge, with the earlier non-blocking description-display issue still open.
### Issue 1
frontend/frontend/assets/frontend/js/preview.js:undefined-55
`renderItems` now displays description HTML as literal text. Generated feeds keep HTML in descriptions and add `<img>` tags for selected images. `jquery.jfeed.js` reads that markup into `item.description`; it does not remove tags stored as escaped text or CDATA. Users therefore see tags instead of readable descriptions and images.
Convert descriptions to readable plain text, or use a safe HTML renderer, rather than displaying the markup itself.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary
Cleans up the Django layout and makes feed previews safer.
The shared page layout uses Django authentication and full-width content.
Feed previews make only web links clickable and show item content as text.