Tests / Test failed: 4, passed: 744
Replace hand-written f-string + html.escape() rendering in the Host Agent
local console with a module-level Jinja2 Environment configured with
select_autoescape(["html","xml"]). XSS safety now holds by mechanism
rather than per-call discipline — every operator-controlled field
(device name, connection_info, task summary, etc.) is escaped by the
engine uniformly.
Eight templates under host_agent/web/templates/ replace the former
_chrome(), _CSS, escape(), and per-page _xxx_body() helpers: base.html
(header/nav/CSS + {% block body %}), login, dashboard (with the polling
<script> preserved byte-identically inside {% raw %}), devices, account,
history, tasks_list, and task_detail. The task-list and task-detail
templates — added by the just-landed task-execution-progress-visibility
change — were also migrated here rather than left in f-string form,
since this change removes the shared helpers they depended on.
URLs, auth/session/CSRF semantics, redirects, and /api/status JSON are
unchanged. 15 new template tests cover render-smoke, XSS probing, script
byte-identity, and no-autoescape-bypass guards. Tasks 8.1-8.6 (manual
browser verification) remain.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
18 lines
700 B
HTML
18 lines
700 B
HTML
{% extends "base.html" %}
|
|
{% block body %}
|
|
<h1>Account</h1>
|
|
{% if message %}
|
|
<p class="notice">{{ message }}</p>
|
|
{% endif %}
|
|
{% if error %}
|
|
<p class="error">{{ error }}</p>
|
|
{% endif %}
|
|
<form method="post" action="/account">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
|
<label>Current password <input type="password" name="current_password" required></label><br>
|
|
<label>New password <input type="password" name="new_password" required></label><br>
|
|
<label>Confirm new password <input type="password" name="confirm_password" required></label><br>
|
|
<button type="submit">Change password</button>
|
|
</form>
|
|
{% endblock %}
|