mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 01:16:10 +00:00
fix(accounts): the mailed OTP link keeps its token out of the access logs
The link to the OTP QR code carried its signed token in the path, so gunicorn's access log (docker logs, the journal) and nginx's held it: anyone reading them within the hour could open the code and take the TOTP secret. The token is now the URL's fragment, which no request carries; the page posts it (otp_qr.js) and the answer shows the code.
This commit is contained in:
parent
1cc16c10d7
commit
7edfdca2da
10 changed files with 50 additions and 15 deletions
8
static/js/otp_qr.js
Normal file
8
static/js/otp_qr.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// The mailed OTP link carries its token after "#", which no request sends,
|
||||
// so it is in no access log: the page posts it to get the QR code.
|
||||
var otpQrForm = document.getElementById("otp-qr-form");
|
||||
if (otpQrForm && location.hash.length > 1) {
|
||||
otpQrForm.elements.token.value = location.hash.slice(1);
|
||||
history.replaceState(null, "", location.pathname);
|
||||
otpQrForm.submit();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue