mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-01 08:26:03 +00:00
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. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
8 lines
387 B
JavaScript
8 lines
387 B
JavaScript
// 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();
|
|
}
|