From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 993451FF170 for ; Thu, 10 Jul 2025 15:49:33 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5AD3F35093; Thu, 10 Jul 2025 15:50:17 +0200 (CEST) From: Shannon Sterz To: pbs-devel@lists.proxmox.com Date: Thu, 10 Jul 2025 15:50:09 +0200 Message-Id: <20250710135010.305861-4-s.sterz@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250710135010.305861-1-s.sterz@proxmox.com> References: <20250710135010.305861-1-s.sterz@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.020 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup 2/3] ui: opt into the new http-only ticket authentication flow X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" this should add additional protections for cookie stealing and xss attacks. Signed-off-by: Shannon Sterz --- www/Application.js | 12 +++++++++++- www/LoginView.js | 4 +++- www/MainView.js | 1 + www/Utils.js | 6 ++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/www/Application.js b/www/Application.js index 9e223522..fb0b2e14 100644 --- a/www/Application.js +++ b/www/Application.js @@ -18,7 +18,17 @@ Ext.define('PBS.Application', { logout: function () { var me = this; Proxmox.Utils.authClear(); - me.changeView('loginview', true); + Proxmox.Utils.API2Request({ + url: '/api2/extjs/access/ticket', + method: 'DELETE', + success: function () { + me.changeView('loginview', true); + }, + failure: function ({ response }) { + // logout failed + console.error('could not log out', response); + } + }); }, changeView: function (view, skipCheck) { diff --git a/www/LoginView.js b/www/LoginView.js index 30e70d85..7cdf458b 100644 --- a/www/LoginView.js +++ b/www/LoginView.js @@ -83,6 +83,8 @@ Ext.define('PBS.LoginView', { } sp.set(saveunField.getStateId(), saveunField.getValue()); + creds['http-only'] = true; + try { let resp = await Proxmox.Async.api2({ url: '/api2/extjs/access/ticket', @@ -91,7 +93,7 @@ Ext.define('PBS.LoginView', { }); let data = resp.result.data; - if (data.ticket.startsWith('PBS:!tfa!')) { + if (data.ticket?.startsWith('PBS:!tfa!')) { data = await me.performTFAChallenge(data); } diff --git a/www/MainView.js b/www/MainView.js index b5ae3605..70adfbce 100644 --- a/www/MainView.js +++ b/www/MainView.js @@ -172,6 +172,7 @@ Ext.define('PBS.MainView', { params: { username: Proxmox.UserName, password: ticket, + 'http-only': true, }, url: '/api2/json/access/ticket', method: 'POST', diff --git a/www/Utils.js b/www/Utils.js index 30b4a6e7..7b165b67 100644 --- a/www/Utils.js +++ b/www/Utils.js @@ -8,6 +8,12 @@ Ext.define('PBS.Utils', { missingText: gettext('missing'), updateLoginData: function (data) { + if (data['ticket-info']) { + // we received a http only ticket response, the actually cookie is handled by the browser + // set the ticket field to use the information from `ticket-info` + data.ticket = data['ticket-info']; + } + Proxmox.Utils.setAuthData(data); }, -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel