Loksi 2026.10.0 : source correspondante des quatre applis

Export du dépôt interne d'Aleop, révision 0936ea1 (fichiers publiés identiques à e46bc12).
Paquets construits depuis cette source :
- Android : AAB 2026.10.0, code 4
- iPhone : archive 2026.10.0 (18)
- Bureau : macOS universel build 13, Windows build 14, MSIX build 15
- Extensions Chrome, Edge et Firefox : 2026.10.0.3
Cette révision appartient à :
Aleop a révisé 2026-10-12 17:04:06 +02:00
1 Parent c3608b3938
révision 1c39f76f96
34 fichiers modifiés
+5093 -15

Aucun fichier ne correspond à votre recherche

+27 -3
Voir le fichier
@@ -345,6 +345,8 @@ SUPPORT_ADDRESS = CONFIG["links"]["support"].removeprefix("mailto:")
CONTACT_STRINGS = {
"LoksiOriginNotice": ORIGIN_NOTICE,
"LoksiContactUs": {"en": "Contact us", "fr": "Nous contacter"},
# Source GPL publiée (ordre de Romain du 12/10/2026), même ligne qu'Android.
"LoksiSourceCode": {"en": "Source code", "fr": "Code source"},
# Version de Bitwarden dans À propos, à côté de la mention d'origine (06/10/2026).
"LoksiBasedOnBitwarden": {"en": f"Based on Bitwarden {BITWARDEN_VERSION}.",
"fr": f"Basé sur Bitwarden {BITWARDEN_VERSION}."},
@@ -657,9 +659,19 @@ FRAMEWORK_IDS = {
}
# Ligne d'À propos qui ouvre le coffre web : libellé choisi par Romain le 09/10/2026.
WEB_VAULT_LABEL = {"fr": "Loksi : Coffre-fort Web", "en": "Loksi: Web vault"}
def without_bitwarden():
for relative, suffix in FRAMEWORK_IDS.items():
replace_once(SRC / relative, f"{suffix}\n", suffix.replace("bitwarden", "loksi") + "\n")
for language, label in WEB_VAULT_LABEL.items():
strings = SRC / f"BitwardenResources/Localizations/{language}.lproj/Localizable.strings"
text, count = re.subn(r'^"WebVault" = "[^"]*";$', f'"WebVault" = "{label}";', strings.read_text(), flags=re.M)
if count != 1:
raise RuntimeError(f"WebVault absent de {language}.lproj")
strings.write_text(text)
# Nom de l'appli qui exporte, montré par iOS lors d'un transfert d'identifiants.
replace_once(SRC / "BitwardenShared/Core/Tools/Utilities/CredentialManagerFactory.swift",
'exporterDisplayName: "Bitwarden",', 'exporterDisplayName: "Loksi",')
@@ -968,11 +980,14 @@ public extension EnvironmentURLData {{
f' /// Loksi: the support address, opened in the email app.\n'
f' public static let loksiContactSupport = URL(string: "{CONFIG["links"]["support"]}")!\n\n'
f' /// Loksi: the product page, for whoever is not a customer yet.\n'
f' public static let loksiProduct = URL(string: "{LOKSI_PRODUCT}")!\n')
f' public static let loksiProduct = URL(string: "{LOKSI_PRODUCT}")!\n\n'
f' /// Loksi: the GPL source of the app, required before any distribution.\n'
f' public static let loksiSourceCode = URL(string: "{CONFIG["links"]["source"]}")!\n')
about = SRC / "BitwardenShared/UI/Platform/Settings/Settings/About"
replace_once(about / "AboutAction.swift", " /// The privacy policy button was tapped.\n case privacyPolicyTapped\n",
" /// The privacy policy button was tapped.\n case privacyPolicyTapped\n\n"
" /// Loksi: the contact us button was tapped.\n case contactUsTapped\n")
" /// Loksi: the contact us button was tapped.\n case contactUsTapped\n\n"
" /// Loksi: the source code button was tapped.\n case sourceCodeTapped\n")
replace_once(about / "AboutProcessor.swift", " case .privacyPolicyTapped:\n", """ case .contactUsTapped:
coordinator.showAlert(Alert(
title: Localizations.loksiEmailSupportTitle,
@@ -984,12 +999,15 @@ public extension EnvironmentURLData {{
},
],
))
case .sourceCodeTapped:
state.url = ExternalLinksConstants.loksiSourceCode
case .privacyPolicyTapped:
""")
replace_once(about / "AboutView.swift",
" externalLinkRow(Localizations.privacyPolicy, action: .privacyPolicyTapped)\n\n",
" externalLinkRow(Localizations.privacyPolicy, action: .privacyPolicyTapped)\n\n"
" externalLinkRow(Localizations.loksiContactUs, action: .contactUsTapped)\n\n")
" externalLinkRow(Localizations.loksiContactUs, action: .contactUsTapped)\n\n"
" externalLinkRow(Localizations.loksiSourceCode, action: .sourceCodeTapped)\n\n")
# « En savoir plus sur les organisations » ouvre bitwarden.com : offre Bitwarden sans
# objet pour Loksi, retirée (règle de brand/README.md, « Le nom Bitwarden »).
replace_once(SRC / "BitwardenShared/UI/Platform/Settings/Settings/About/AboutView.swift",
@@ -1275,6 +1293,7 @@ def verify():
assert table.get("LoksiOriginNotice") == notice, f"avis de dérivation {language}"
assert table.get("LoksiBasedOnBitwarden") == CONTACT_STRINGS["LoksiBasedOnBitwarden"][language], \
f"version de Bitwarden dans À propos ({language})"
assert table.get("WebVault") == WEB_VAULT_LABEL[language], f"libellé du coffre web ({language})"
assert ORIGIN_NOTICE["fr"] not in git("show", "HEAD:BitwardenResources/Localizations/fr.lproj/Localizable.strings"), \
"canari : l'avis de dérivation figure déjà dans l'amont"
# Nom de coffre (04/10/2026) : domaine des coffres et page produit dans le code. Canari :
@@ -1283,6 +1302,11 @@ def verify():
"domaine loksi.fr ou lien Découvrir Loksi absent"
assert "loksi.fr" not in git("show", "HEAD:BitwardenShared/UI/Auth/Landing/SelfHosted/SelfHostedProcessor.swift"), \
"canari : loksi.fr déjà dans l'amont"
# Source GPL (12/10/2026) : son adresse exacte dans le code, absente de l'amont figé.
source = CONFIG["links"]["source"].encode()
assert scan(executables, [source]), "adresse de la source GPL absente de l'application"
assert source.decode() not in git("show", "HEAD:BitwardenKit/Core/Platform/Utilities/ExternalLinksConstants.swift"), \
"canari : adresse de la source déjà dans l'amont"
# Plus de Bitwarden sauf obligation (09/10/2026) : aucun identifiant de paquet hors SDK,
# pas de User-Agent Bitwarden_Mobile. Canaris : l'amont figé a les deux.
ids = {plistlib.loads(path.read_bytes()).get("CFBundleIdentifier", "") for path in app.rglob("Info.plist")
+49
Voir le fichier
@@ -0,0 +1,49 @@
/**
* Visuels de l'application iOS Loksi, rendus par Chromium depuis brand/.
*
* node render.mjs <dossier de sortie>
*
* - icon-1024.png : icône d'application, la version Apple pleine page de
* brand/icones.mjs (carré sans ombre portée ni transparence, iOS pose son arrondi) ;
* - logo-clair@{1,2,3}x.png et logo-sombre@{1,2,3}x.png : logo complet (icône et mot)
* depuis brand/sources, 44 points de haut comme le logo amont qu'il remplace.
*
* Lancé par loksi.py depuis mobile/.cache/node, où playwright est installé à la
* version de brand/package-lock.json. N'écrit que dans le dossier donné.
*/
import { readFileSync, mkdirSync } from 'fs';
import { join, dirname, resolve } from 'path';
import { fileURLToPath } from 'url';
import { createRequire } from 'module';
const here = dirname(fileURLToPath(import.meta.url));
const brand = resolve(here, '../../brand');
const out = process.argv[2];
if (!out) throw new Error('dossier de sortie manquant');
mkdirSync(out, { recursive: true });
const { chromium } = createRequire(join(process.cwd(), 'package.json'))('playwright');
const { apple } = await import(join(brand, 'icones.mjs'));
const browser = await chromium.launch();
const page = await browser.newPage();
async function rendre(svg, largeur, hauteur, sortie, fond) {
await page.setViewportSize({ width: largeur, height: hauteur });
await page.setContent(`<style>html,body{margin:0;width:100%;height:100%;background:${fond}}svg{width:100%;height:100%;display:block}</style>${svg}`);
await page.screenshot({ path: join(out, sortie), omitBackground: fond === 'transparent' });
}
// Icône : opaque, iOS refuse la transparence dans une icône d'application.
await rendre(apple(), 1024, 1024, 'icon-1024.png', '#ffffff');
for (const variante of ['clair', 'sombre']) {
const svg = readFileSync(join(brand, 'sources', `loksi-logo-${variante}.svg`), 'utf8');
const [, , w, h] = /viewBox="([-\d.]+) ([-\d.]+) ([\d.]+) ([\d.]+)"/.exec(svg).slice(1).map(Number);
for (const echelle of [1, 2, 3]) {
const hauteur = 44 * echelle;
await rendre(svg, Math.round(hauteur * w / h), hauteur, `logo-${variante}@${echelle}x.png`, 'transparent');
}
}
await browser.close();
console.log('Visuels rendus dans', out);
+95
Voir le fichier
@@ -0,0 +1,95 @@
// GPL-3.0-only. Loksi: vault name or address entered at login (decision of 04/10/2026).
// Copied by mobile/ios/loksi.py into BitwardenShared. Same rule as the Loksi browser
// extension (extensions/loksi-coffre.ts) and the Android app (LoksiVault.kt).
import Foundation
/// Loksi: turns what the user typed into a vault address, and checks that a vault answers.
///
enum LoksiVault {
/// Domain of the Loksi vaults. The vault name "abc" gives https://abc.loksi.fr.
static let domain = "loksi.fr"
/// The name chosen in the order funnel: 2 to 20 lowercase letters or digits, a hyphen
/// allowed but neither first nor last. Never interpolated as typed: it matches this
/// pattern or it is refused.
private static let namePattern = "^[a-z0-9](?:[a-z0-9-]{0,18}[a-z0-9])$"
/// Time allowed for the /api/config check.
private static let timeout: TimeInterval = 10
/// Base address of the vault for what was typed, or `nil` if it is refused.
///
/// A vault name gives https://<name>.loksi.fr. Otherwise a full https address without
/// credentials, query or fragment, for a customer with their own domain.
///
static func address(for input: String) -> URL? {
let value = input.trimmingCharacters(in: .whitespacesAndNewlines)
if value.range(of: namePattern, options: .regularExpression) != nil {
return URL(string: "https://\(value).\(domain)")
}
guard value.hasPrefix("https://"),
let components = URLComponents(string: value),
components.scheme == "https",
let host = components.host, !host.isEmpty,
components.user == nil, components.password == nil,
components.query == nil, components.fragment == nil
else {
return nil
}
var path = components.percentEncodedPath
while path.hasSuffix("/") {
path.removeLast()
}
let port = components.port.map { ":\($0)" } ?? ""
return URL(string: "https://\(host)\(port)\(path)")
}
/// Whether a Vaultwarden server answers on /api/config at `base`.
///
/// - Parameters:
/// - base: The vault address returned by `address(for:)`.
/// - fetch: Returns the body of a successful GET, or `nil`.
///
static func isVault(
_ base: URL,
fetch: (URL) async -> Data? = LoksiVault.get,
) async -> Bool {
guard let body = await fetch(base.appendingPathComponent("api/config")),
let json = try? JSONSerialization.jsonObject(with: body) as? [String: Any],
let server = json["server"] as? [String: Any]
else {
return false
}
return server["name"] as? String == "Vaultwarden"
}
/// A GET without cookies or redirects, the body if the answer is 200.
///
static func get(_ url: URL) async -> Data? {
let configuration = URLSessionConfiguration.ephemeral
configuration.timeoutIntervalForRequest = timeout
let session = URLSession(configuration: configuration, delegate: NoRedirect(), delegateQueue: nil)
defer { session.finishTasksAndInvalidate() }
var request = URLRequest(url: url)
request.setValue("application/json", forHTTPHeaderField: "Accept")
guard let (data, response) = try? await session.data(for: request),
(response as? HTTPURLResponse)?.statusCode == 200
else {
return nil
}
return data
}
/// Refuses redirects: the vault must answer at the address itself.
///
private final class NoRedirect: NSObject, URLSessionTaskDelegate {
func urlSession(
_ session: URLSession,
task: URLSessionTask,
willPerformHTTPRedirection response: HTTPURLResponse,
newRequest request: URLRequest,
) async -> URLRequest? {
nil
}
}
}
+78
Voir le fichier
@@ -0,0 +1,78 @@
// GPL-3.0-only. Loksi: tests of the vault name rule, copied by mobile/ios/loksi.py.
import BitwardenKit
import Networking
import UIKit
import XCTest
@testable import BitwardenShared
class LoksiVaultTests: BitwardenTestCase {
/// A vault name gives https://<name>.loksi.fr.
func test_address_name() {
XCTAssertEqual(LoksiVault.address(for: "aleop")?.absoluteString, "https://aleop.loksi.fr")
XCTAssertEqual(LoksiVault.address(for: " mon-entreprise ")?.absoluteString, "https://mon-entreprise.loksi.fr")
XCTAssertEqual(LoksiVault.address(for: "ab")?.absoluteString, "https://ab.loksi.fr")
}
/// A full https address stays accepted, without its trailing slash.
func test_address_fullHttps() {
XCTAssertEqual(LoksiVault.address(for: "https://coffre.client.fr/")?.absoluteString, "https://coffre.client.fr")
XCTAssertEqual(
LoksiVault.address(for: "https://coffre.client.fr:8443/vault")?.absoluteString,
"https://coffre.client.fr:8443/vault",
)
}
/// Canaries: these must be refused.
func test_address_refused() {
for input in [
"ABC", "abc.evil.test", "ABC/../x", "http://", "http://abc.loksi.fr", "a", "-abc", "abc-",
"abcdefghijklmnopqrstu", "https://user:pass@abc.loksi.fr", "https://abc.loksi.fr?x=1",
"https://abc.loksi.fr#x", "", "https://",
] {
XCTAssertNil(LoksiVault.address(for: input), input)
}
}
/// Only a Vaultwarden answer on /api/config is a vault.
func test_isVault() async {
let base = URL(string: "https://aleop.loksi.fr")!
var asked: URL?
let vaultwarden = await LoksiVault.isVault(base) { url in
asked = url
return Data(#"{"server":{"name":"Vaultwarden"}}"#.utf8)
}
XCTAssertTrue(vaultwarden)
XCTAssertEqual(asked?.absoluteString, "https://aleop.loksi.fr/api/config")
}
/// The server sees the upstream Bitwarden version in Bitwarden-Client-Version, never the
/// displayed Loksi one. Canary: the test host shows Loksi's own version, the header must differ.
func test_serverVersion_isUpstream() async throws {
let handler = DefaultHeadersRequestHandler(
appVersion: LoksiUpstream.bitwardenVersion,
userAgentBuilder: UserAgentBuilder(
appName: "Loksi",
appVersion: LoksiUpstream.bitwardenVersion,
systemDevice: UIDevice.current,
),
)
var request = HTTPRequest(url: URL(string: "https://aleop.loksi.fr/api/config")!)
let handled = try await handler.handle(&request)
let header = handled.headers["Bitwarden-Client-Version"]
XCTAssertEqual(header, LoksiUpstream.bitwardenVersion)
XCTAssertNotEqual(header, Bundle.main.appVersion)
XCTAssertNotEqual(header, "2026.10.0")
}
/// Canaries: another server, a non JSON answer or no answer is not a vault.
func test_isVault_refused() async {
let base = URL(string: "https://abc.loksi.fr")!
for body in [#"{"server":{"name":"Bitwarden"}}"#, "<html>404</html>", #"{"server":null}"#] {
let result = await LoksiVault.isVault(base) { _ in Data(body.utf8) }
XCTAssertFalse(result, body)
}
let none = await LoksiVault.isVault(base) { _ in nil }
XCTAssertFalse(none)
}
}