gokrazy/assets/status.tmpl
Michael Stapelberg c74265523b implement XSRF/CSRF protection for /stop and /restart
While stopping/restarting processes seems like a nuisance at best, it’s good
style to prevent these attacks.

This commit the Double-Submit Cookie protection, which seems appropriate for our
architecture and demands. See also:
https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet#Double_Submit_Cookie
2018-06-25 18:38:08 +02:00

45 lines
983 B
Cheetah

{{ template "header" . }}
<div class="row">
<div class="col-md-12">
<table>
<tr>
<th>Name</th>
<th>Started</th>
<th>Actions</th>
</tr>
<tr>
<td><a href="#{{ .Service.Name }}">{{ .Service.Name }}</a></td>
<td>{{ .Service.Started }}</td>
<td>
<form method="POST" action="/restart">
<input type="hidden" name="xsrftoken" value="{{ .XsrfToken }}">
<input type="hidden" name="path" value="{{ .Service.Name }}">
<input type="submit" value="restart">
</form>
<form method="POST" action="/stop">
<input type="hidden" name="xsrftoken" value="{{ .XsrfToken }}">
<input type="hidden" name="path" value="{{ .Service.Name }}">
<input type="submit" value="stop">
</form></td>
</tr>
</table>
<h3>stdout</h3>
<pre>
{{ range $idx, $line := .Service.Stdout.Lines -}}
{{ $line }}
{{ end }}
</pre>
<h3>stderr</h3>
<pre>
{{ range $idx, $line := .Service.Stderr.Lines -}}
{{ $line }}
{{ end }}
</pre>
</div>
</div>
{{ template "footer" . }}