fix #14740: guard the backend url and the backend key

BACKEND_URL must never end with "/" (a stored key's base_url is compared
against it byte-for-byte): a unit test now asserts both RELEASE_BACKEND_URL
and DEV_BACKEND_URL have no trailing slash and start with "https://", and
AppState trims it defensively where it is stored (an earlier commit already
carries that trim).

set_api_key/has_api_key now refuse Service::Backend ("Dieser Schlüssel wird
über die Backend-Anmeldung verwaltet"): its key is only ever set by the
backend login, which holds backend_key_lock and binds it to this build's
backend.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
hauke
2026-11-06 15:40:15 +01:00
co-authored by Claude Sonnet 5
parent 96eec22971
commit dad98b4558
2 changed files with 41 additions and 2 deletions
+8
View File
@@ -440,6 +440,14 @@ fn lock<T>(mutex: &Mutex<T>) -> std::sync::MutexGuard<'_, T> {
mod tests {
use super::*;
#[test]
fn backend_urls_have_no_trailing_slash_and_use_https() {
for url in [RELEASE_BACKEND_URL, DEV_BACKEND_URL] {
assert!(!url.ends_with('/'), "{url}");
assert!(url.starts_with("https://"), "{url}");
}
}
#[test]
fn everyone_waiting_gets_the_one_login_result() {
let waiters = LoginWaiters::default();