The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(inference): trust custom provider CA certificates
Steven Enamakelc1b6a1fa8591
diff --git a/Cargo.lock b/Cargo.lockindex 2c37bc3a4c..2d88e51381 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2873,6 +2873,7 @@ dependencies = ["hyper","hyper-util","rustls",+ "rustls-native-certs","tokio","tokio-rustls","tower-service",@@ -5742,6 +5743,7 @@ dependencies = ["pin-project-lite","quinn","rustls",+ "rustls-native-certs","rustls-pki-types","serde","serde_json",diff --git a/app/src/components/settings/panels/__tests__/AIPanel.test.tsx b/app/src/components/settings/panels/__tests__/AIPanel.test.tsxindex 8f996f6017..3c4c94ce6d 100644--- a/app/src/components/settings/panels/__tests__/AIPanel.test.tsx+++ b/app/src/components/settings/panels/__tests__/AIPanel.test.tsx@@ -1818,6 +1818,31 @@ describe('AIPanel', () => {);});+ it('sends an uploaded CA certificate with the provider before probing models', async () => {+ vi.mocked(loadAISettings).mockResolvedValue({ ...baseSettings, cloudProviders: [] });+ renderWithProviders(<AIPanel />);+ await openCustomProviderEditor();++ fireEvent.change(screen.getByLabelText(/^Name$/i), { target: { value: 'Team Gateway' } });+ fireEvent.change(screen.getByLabelText(/OpenAI URL/i), {+ target: { value: 'https://gateway.example.com/v1' },+ });+ const pem = '-----BEGIN CERTIFICATE-----\nfixture\n-----END CERTIFICATE-----';+ fireEvent.change(screen.getByLabelText(/CA certificate/i), {+ target: { files: [new File([pem], 'team-ca.pem', { type: 'application/x-pem-file' })] },+ });+ await waitFor(() =>+ expect(screen.getByRole('button', { name: 'Remove CA certificate' })).toBeInTheDocument()+ );+ fireEvent.click(screen.getByRole('button', { name: /Add provider/i }));++ await waitFor(() =>+ expect(vi.mocked(flushCloudProviders)).toHaveBeenCalledWith(+ expect.arrayContaining([expect.objectContaining({ ca_cert_pem: pem })])+ )+ );+ });+// ─── local runtime: Ollama endpoint URL dialog ──────────────────────────────it('toggling Ollama ON shows an Endpoint URL field with localhost default', async () => {diff --git a/app/src/components/settings/panels/ai/CloudProviderEditor.tsx b/app/src/components/settings/panels/ai/CloudProviderEditor.tsxindex 3e0b658f26..6bace047dd 100644--- a/app/src/components/settings/panels/ai/CloudProviderEditor.tsx+++ b/app/src/components/settings/panels/ai/CloudProviderEditor.tsx@@ -41,6 +41,9 @@ export const CloudProviderEditor = ({const [label, setLabel] = useState<string>(initial?.label ?? '');const [endpoint, setEndpoint] = useState(initial?.endpoint ?? '');const [apiKey, setApiKey] = useState('');+ const [caCertPem, setCaCertPem] = useState(initial?.caCertPem ?? '');+ const [readingCert, setReadingCert] = useState(false);+ const [certError, setCertError] = useState<string | null>(null);const [saving, setSaving] = useState(false);const [submitError, setSubmitError] = useState<string | null>(null);// Set once the live `/models` verification has rejected, which unlocks the@@ -83,6 +86,7 @@ export const CloudProviderEditor = ({slug,label: label.trim() || slug,endpoint: endpoint.trim(),+ caCertPem,authStyle: initial?.authStyle ?? 'bearer',maskedKey: maskKeyLabel(hasExistingKey || apiKey.length > 0),},@@ -139,7 +143,13 @@ export const CloudProviderEditor = ({variant="secondary"size="xs"analyticsId="ai-provider-add-without-verifying"- disabled={saving || !endpoint.trim() || Boolean(slugError)}+ disabled={+ saving ||+ readingCert ||+ Boolean(certError) ||+ !endpoint.trim() ||+ Boolean(slugError)+ }onClick={() => void submitProvider({ skipProbe: true })}>{t('settings.ai.probeFailedAddAnyway')}</Button>@@ -147,7 +157,9 @@ export const CloudProviderEditor = ({<Buttonvariant="primary"size="xs"- disabled={saving || !endpoint.trim() || Boolean(slugError)}+ disabled={+ saving || readingCert || Boolean(certError) || !endpoint.trim() || Boolean(slugError)+ }onClick={() => void submitProvider()}>{saving? t('settings.ai.saving')@@ -209,6 +221,45 @@ export const CloudProviderEditor = ({</div>)}</div>+ <div>+ <Label htmlFor="cloud-provider-ca-cert" className="text-xs text-content-secondary">+ {t('settings.ai.caCertificateLabel')}+ </Label>+ <TextField+ id="cloud-provider-ca-cert"+ type="file"+ accept=".pem,.crt,.cer,application/x-pem-file"+ className="mt-1"+ onChange={event => {+ const file = event.target.files?.[0];+ if (!file) return;+ if (file.size > 256 * 1024) {+ setCertError(t('settings.ai.caCertificateTooLarge'));+ return;+ }+ setCertError(null);+ setReadingCert(true);+ void file+ .text()+ .then(setCaCertPem)+ .catch(() => setCertError(t('settings.ai.caCertificateReadError')))+ .finally(() => setReadingCert(false));+ }}+ />+ {certError ? <div className="mt-1 text-xs text-coral-600">{certError}</div> : null}+ {caCertPem ? (+ <Button+ variant="tertiary"+ size="xs"+ analyticsId="ai-provider-remove-ca-certificate"+ onClick={() => {+ setCaCertPem('');+ setCertError(null);+ }}>+ {t('settings.ai.clearCaCertificate')}+ </Button>+ ) : null}+ </div><div><div className="flex items-center justify-between gap-2"><Label htmlFor="cloud-provider-api-key" className="text-xs text-content-secondary">diff --git a/app/src/components/settings/panels/ai/aiPanelTypes.ts b/app/src/components/settings/panels/ai/aiPanelTypes.tsindex 11bfd05add..9285b40f7e 100644--- a/app/src/components/settings/panels/ai/aiPanelTypes.ts+++ b/app/src/components/settings/panels/ai/aiPanelTypes.ts@@ -26,6 +26,7 @@ export type CloudProvider = {endpoint: string;authStyle: AuthStyle;maskedKey: string;+ caCertPem?: string;};/**diff --git a/app/src/components/settings/panels/ai/useAISettingsState.ts b/app/src/components/settings/panels/ai/useAISettingsState.tsindex 1cf5611cc3..d0a890d2f7 100644--- a/app/src/components/settings/panels/ai/useAISettingsState.ts+++ b/app/src/components/settings/panels/ai/useAISettingsState.ts@@ -36,6 +36,7 @@ function toPanelProvider(p: CloudProviderView): CloudProvider {slug: p.slug,label: p.label,endpoint: p.endpoint,+ caCertPem: p.ca_cert_pem ?? '',authStyle: p.auth_style,maskedKey: maskKeyLabel(p.has_api_key),};@@ -70,6 +71,7 @@ function toApiSettings(panel: AISettings): ApiAISettings {slug: p.slug,label: p.label,endpoint: p.endpoint,+ ca_cert_pem: p.caCertPem ?? '',auth_style: p.authStyle,has_api_key: p.maskedKey.startsWith('••••'),})),@@ -136,6 +138,7 @@ export function useAISettings() {slug: p.slug,label: p.label,endpoint: p.endpoint,+ ca_cert_pem: p.caCertPem ?? '',auth_style: p.authStyle,}));flushCloudProviders(wire).catch(err =>diff --git a/app/src/components/settings/panels/ai/useCloudProviderEditorSubmit.ts b/app/src/components/settings/panels/ai/useCloudProviderEditorSubmit.tsindex de0ea08801..6b82103c78 100644--- a/app/src/components/settings/panels/ai/useCloudProviderEditorSubmit.ts+++ b/app/src/components/settings/panels/ai/useCloudProviderEditorSubmit.ts@@ -53,6 +53,7 @@ export function useCloudProviderEditorSubmit({slug: p.slug,label: p.label,endpoint: p.endpoint,+ ca_cert_pem: p.caCertPem ?? '',auth_style: p.authStyle,}));@@ -78,6 +79,7 @@ export function useCloudProviderEditorSubmit({slug: p.slug,label: p.label,endpoint: p.endpoint,+ ca_cert_pem: p.caCertPem ?? '',auth_style: p.authStyle,}));await flushCloudProviders(nextWireProviders);diff --git a/app/src/components/settings/panels/ai/useProviderConnect.ts b/app/src/components/settings/panels/ai/useProviderConnect.tsindex 0a4c0bee03..2b50903e03 100644--- a/app/src/components/settings/panels/ai/useProviderConnect.ts+++ b/app/src/components/settings/panels/ai/useProviderConnect.ts@@ -133,6 +133,7 @@ export function useProviderConnect({slug: p.slug,label: p.label,endpoint: p.endpoint,+ ca_cert_pem: p.caCertPem ?? '',auth_style: p.authStyle,}));diff --git a/app/src/lib/i18n/ar.ts b/app/src/lib/i18n/ar.tsindex afd959467a..6114e116fd 100644--- a/app/src/lib/i18n/ar.ts+++ b/app/src/lib/i18n/ar.ts@@ -3306,6 +3306,10 @@ const messages: TranslationMap = {'settings.ai.providerNamePlaceholder': 'موفر الخدمة الخاص بي','settings.ai.slugLabel': 'الارتباط الثابت:','settings.ai.openAiUrlLabel': 'عنوان URL لـ OpenAI',+ 'settings.ai.caCertificateLabel': 'شهادة المرجع المصدق (اختياري)',+ 'settings.ai.caCertificateTooLarge': 'يجب ألا يتجاوز حجم الشهادة 256 كيلوبايت',+ 'settings.ai.caCertificateReadError': 'تعذرت قراءة الشهادة',+ 'settings.ai.clearCaCertificate': 'إزالة الشهادة','settings.ai.openAiUrlPlaceholder': 'https://api.openai.com/v1','settings.ai.keepExistingKeyPlaceholder': 'اتركه فارغًا للاحتفاظ بالمفتاح الموجود','settings.ai.signInWithOpenRouter': 'قم بتسجيل الدخول باستخدام OpenRouter',diff --git a/app/src/lib/i18n/bn.ts b/app/src/lib/i18n/bn.tsindex a7ff6cb6f8..24fcb30098 100644--- a/app/src/lib/i18n/bn.ts+++ b/app/src/lib/i18n/bn.ts@@ -3365,6 +3365,10 @@ const messages: TranslationMap = {'settings.ai.providerNamePlaceholder': 'আমার প্রদানকারী','settings.ai.slugLabel': 'স্লাগ:','settings.ai.openAiUrlLabel': 'এক্স.x১xxx xx+qx',+ 'settings.ai.caCertificateLabel': 'CA সার্টিফিকেট (ঐচ্ছিক)',+ 'settings.ai.caCertificateTooLarge': 'CA সার্টিফিকেট ২৫৬ কেবি বা কম হতে হবে',+ 'settings.ai.caCertificateReadError': 'CA সার্টিফিকেট পড়া যায়নি',+ 'settings.ai.clearCaCertificate': 'CA সার্টিফিকেট সরান','settings.ai.openAiUrlPlaceholder': 'https://api.openai.com/v1','settings.ai.keepExistingKeyPlaceholder': 'বিদ্যমান কী রাখার জন্য ফাঁকা ছেড়ে দিন','settings.ai.signInWithOpenRouter': 'xqxqx সহযোগে সাইন করুন',diff --git a/app/src/lib/i18n/de.ts b/app/src/lib/i18n/de.tsindex 88959da098..54a00f6ac6 100644--- a/app/src/lib/i18n/de.ts+++ b/app/src/lib/i18n/de.ts@@ -3455,6 +3455,10 @@ const messages: TranslationMap = {'settings.ai.providerNamePlaceholder': 'Mein Anbieter','settings.ai.slugLabel': 'Slug:','settings.ai.openAiUrlLabel': 'OpenAI-URL',+ 'settings.ai.caCertificateLabel': 'CA-Zertifikat (optional)',+ 'settings.ai.caCertificateTooLarge': 'Das CA-Zertifikat darf höchstens 256 KB groß sein',+ 'settings.ai.caCertificateReadError': 'CA-Zertifikat konnte nicht gelesen werden',+ 'settings.ai.clearCaCertificate': 'CA-Zertifikat entfernen','settings.ai.openAiUrlPlaceholder': 'https://api.openai.com/v1','settings.ai.keepExistingKeyPlaceholder': 'Leer lassen, um vorhandenen Schlüssel beizubehalten','settings.ai.signInWithOpenRouter': 'Anmelden mit OpenRouter',diff --git a/app/src/lib/i18n/en.ts b/app/src/lib/i18n/en.tsindex c7f6b55d4d..708b621e37 100644--- a/app/src/lib/i18n/en.ts+++ b/app/src/lib/i18n/en.ts@@ -3920,6 +3920,10 @@ const en: TranslationMap = {'settings.ai.providerNamePlaceholder': 'My Provider','settings.ai.slugLabel': 'Slug:','settings.ai.openAiUrlLabel': 'OpenAI URL',+ 'settings.ai.caCertificateLabel': 'CA certificate (optional)',+ 'settings.ai.caCertificateTooLarge': 'CA certificate must be 256 KB or smaller',+ 'settings.ai.caCertificateReadError': 'Could not read CA certificate',+ 'settings.ai.clearCaCertificate': 'Remove CA certificate','settings.ai.openAiUrlPlaceholder': 'https://api.openai.com/v1','settings.ai.keepExistingKeyPlaceholder': 'Leave blank to keep existing key','settings.ai.signInWithOpenRouter': 'Sign in with OpenRouter',diff --git a/app/src/lib/i18n/es.ts b/app/src/lib/i18n/es.tsindex 1e21a7c84e..c9d5af017e 100644--- a/app/src/lib/i18n/es.ts+++ b/app/src/lib/i18n/es.ts@@ -3417,6 +3417,10 @@ const messages: TranslationMap = {'settings.ai.providerNamePlaceholder': 'Mi proveedor','settings.ai.slugLabel': 'Babosa:','settings.ai.openAiUrlLabel': 'URL de OpenAI',+ 'settings.ai.caCertificateLabel': 'Certificado CA (opcional)',+ 'settings.ai.caCertificateTooLarge': 'El certificado CA debe tener 256 KB o menos',+ 'settings.ai.caCertificateReadError': 'No se pudo leer el certificado CA',+ 'settings.ai.clearCaCertificate': 'Quitar certificado CA','settings.ai.openAiUrlPlaceholder': 'https://api.openai.com/v1','settings.ai.keepExistingKeyPlaceholder': 'Déjelo en blanco para conservar la clave existente','settings.ai.signInWithOpenRouter': 'Iniciar sesión con OpenRouter',diff --git a/app/src/lib/i18n/fr.ts b/app/src/lib/i18n/fr.tsindex 8812297865..487e995f36 100644--- a/app/src/lib/i18n/fr.ts+++ b/app/src/lib/i18n/fr.ts@@ -3433,6 +3433,10 @@ const messages: TranslationMap = {'settings.ai.providerNamePlaceholder': 'Mon fournisseur','settings.ai.slugLabel': 'Slug :','settings.ai.openAiUrlLabel': 'URL OpenAI',+ 'settings.ai.caCertificateLabel': 'Certificat d’autorité (facultatif)',+ 'settings.ai.caCertificateTooLarge': 'Le certificat doit faire au plus 256 Ko',+ 'settings.ai.caCertificateReadError': 'Impossible de lire le certificat',+ 'settings.ai.clearCaCertificate': 'Supprimer le certificat','settings.ai.openAiUrlPlaceholder': 'https://api.openai.com/v1','settings.ai.keepExistingKeyPlaceholder': 'Laisser vide pour conserver la clé existante','settings.ai.signInWithOpenRouter': 'Connectez-vous avec OpenRouter',@@ -5261,7 +5265,7 @@ const messages: TranslationMap = {'memoryPage.engine.badgeDown': 'Injoignable','memoryPage.engine.connecting': 'Connexion…','memoryPage.engine.save': 'Enregistrer',- 'memoryPage.engine.builtin.title': 'CortexDB via TinyHumans',+ 'memoryPage.engine.builtin.title': 'CortexDB par TinyHumans','memoryPage.engine.builtin.signInHint':'Connectez-vous à votre compte TinyHumans pour utiliser CortexDB intégré.','memoryPage.engine.apiKeyOption.title': 'CortexDB avec votre propre clé',diff --git a/app/src/lib/i18n/hi.ts b/app/src/lib/i18n/hi.tsindex ebdb35845a..a3204cbf7b 100644--- a/app/src/lib/i18n/hi.ts+++ b/app/src/lib/i18n/hi.ts@@ -3366,6 +3366,10 @@ const messages: TranslationMap = {'settings.ai.providerNamePlaceholder': 'मेरा प्रदाता','settings.ai.slugLabel': 'स्लग:','settings.ai.openAiUrlLabel': 'xxxxxxxxxxxx',+ 'settings.ai.caCertificateLabel': 'CA प्रमाणपत्र (वैकल्पिक)',+ 'settings.ai.caCertificateTooLarge': 'CA प्रमाणपत्र 256 KB या उससे छोटा होना चाहिए',+ 'settings.ai.caCertificateReadError': 'CA प्रमाणपत्र पढ़ा नहीं जा सका',+ 'settings.ai.clearCaCertificate': 'CA प्रमाणपत्र हटाएँ','settings.ai.openAiUrlPlaceholder': 'https://api.openai.com/v1','settings.ai.keepExistingKeyPlaceholder': 'मौजूदा कुंजी रखने के लिए खाली छोड़ दें','settings.ai.signInWithOpenRouter': 'OpenRouter से साइन इन करें',diff --git a/app/src/lib/i18n/id.ts b/app/src/lib/i18n/id.tsindex b7e8bc3128..373beb6482 100644--- a/app/src/lib/i18n/id.ts+++ b/app/src/lib/i18n/id.ts@@ -3387,6 +3387,10 @@ const messages: TranslationMap = {'settings.ai.providerNamePlaceholder': 'Penyedia Saya','settings.ai.slugLabel': 'Siput:','settings.ai.openAiUrlLabel': 'URL OpenAI',+ 'settings.ai.caCertificateLabel': 'Sertifikat CA (opsional)',+ 'settings.ai.caCertificateTooLarge': 'Sertifikat CA harus berukuran 256 KB atau kurang',+ 'settings.ai.caCertificateReadError': 'Sertifikat CA tidak dapat dibaca',+ 'settings.ai.clearCaCertificate': 'Hapus sertifikat CA','settings.ai.openAiUrlPlaceholder': 'https://api.openai.com/v1','settings.ai.keepExistingKeyPlaceholder': 'Biarkan kosong untuk mempertahankan kunci yang ada','settings.ai.signInWithOpenRouter': 'Masuk dengan OpenRouter',diff --git a/app/src/lib/i18n/it.ts b/app/src/lib/i18n/it.tsindex ba6fbcf7c9..a269d1bfcc 100644--- a/app/src/lib/i18n/it.ts+++ b/app/src/lib/i18n/it.ts@@ -3414,6 +3414,10 @@ const messages: TranslationMap = {'settings.ai.providerNamePlaceholder': 'Il mio provider','settings.ai.slugLabel': 'Lumaca:','settings.ai.openAiUrlLabel': 'URL OpenAI',+ 'settings.ai.caCertificateLabel': 'Certificato CA (facoltativo)',+ 'settings.ai.caCertificateTooLarge': 'Il certificato CA deve essere al massimo 256 KB',+ 'settings.ai.caCertificateReadError': 'Impossibile leggere il certificato CA',+ 'settings.ai.clearCaCertificate': 'Rimuovi certificato CA','settings.ai.openAiUrlPlaceholder': 'https://api.openai.com/v1','settings.ai.keepExistingKeyPlaceholder': 'Lascia vuoto per mantenere la chiave esistente','settings.ai.signInWithOpenRouter': 'Accedi con OpenRouter',diff --git a/app/src/lib/i18n/ja.ts b/app/src/lib/i18n/ja.tsindex 5d6a60e3bf..489ec322aa 100644--- a/app/src/lib/i18n/ja.ts+++ b/app/src/lib/i18n/ja.ts@@ -3948,6 +3948,10 @@ const messages: TranslationMap = {'settings.ai.providerNamePlaceholder': 'マイプロバイダー','settings.ai.slugLabel': 'スラッグ:','settings.ai.openAiUrlLabel': 'OpenAI URL',+ 'settings.ai.caCertificateLabel': 'CA 証明書(任意)',+ 'settings.ai.caCertificateTooLarge': 'CA 証明書は 256 KB 以下にしてください',+ 'settings.ai.caCertificateReadError': 'CA 証明書を読み取れませんでした',+ 'settings.ai.clearCaCertificate': 'CA 証明書を削除','settings.ai.openAiUrlPlaceholder': 'https://api.openai.com/v1','settings.ai.keepExistingKeyPlaceholder': '既存のキーを保持するには空白のままにしてください','settings.ai.signInWithOpenRouter': 'OpenRouterでサインイン',diff --git a/app/src/lib/i18n/ko.ts b/app/src/lib/i18n/ko.tsindex 2dd85833f5..bea197251a 100644--- a/app/src/lib/i18n/ko.ts+++ b/app/src/lib/i18n/ko.ts@@ -3343,6 +3343,10 @@ const messages: TranslationMap = {'settings.ai.providerNamePlaceholder': '내 공급자','settings.ai.slugLabel': '슬러그:','settings.ai.openAiUrlLabel': 'OpenAI URL',+ 'settings.ai.caCertificateLabel': 'CA 인증서(선택 사항)',+ 'settings.ai.caCertificateTooLarge': 'CA 인증서는 256KB 이하여야 합니다',+ 'settings.ai.caCertificateReadError': 'CA 인증서를 읽을 수 없습니다',+ 'settings.ai.clearCaCertificate': 'CA 인증서 제거','settings.ai.openAiUrlPlaceholder': 'https://api.openai.com/v1','settings.ai.keepExistingKeyPlaceholder': '기존 키를 유지하려면 비워 두세요.','settings.ai.signInWithOpenRouter': 'OpenRouter로 로그인',diff --git a/app/src/lib/i18n/pl.ts b/app/src/lib/i18n/pl.tsindex 24f98ebbdc..6ed266ce55 100644--- a/app/src/lib/i18n/pl.ts+++ b/app/src/lib/i18n/pl.ts@@ -3406,6 +3406,10 @@ const messages: TranslationMap = {'settings.ai.providerNamePlaceholder': 'Mój dostawca','settings.ai.slugLabel': 'Slug identyfikatora:','settings.ai.openAiUrlLabel': 'URL OpenAI',+ 'settings.ai.caCertificateLabel': 'Certyfikat CA (opcjonalnie)',+ 'settings.ai.caCertificateTooLarge': 'Certyfikat CA nie może przekraczać 256 KB',+ 'settings.ai.caCertificateReadError': 'Nie udało się odczytać certyfikatu CA',+ 'settings.ai.clearCaCertificate': 'Usuń certyfikat CA','settings.ai.openAiUrlPlaceholder': 'https://api.openai.com/v1','settings.ai.keepExistingKeyPlaceholder': 'Pozostaw puste, aby zachować istniejący klucz','settings.ai.signInWithOpenRouter': 'Zaloguj się z OpenRouter',diff --git a/app/src/lib/i18n/pt.ts b/app/src/lib/i18n/pt.tsindex d1e6f2451a..d95ce4b6fd 100644--- a/app/src/lib/i18n/pt.ts+++ b/app/src/lib/i18n/pt.ts@@ -3409,6 +3409,10 @@ const messages: TranslationMap = {'settings.ai.providerNamePlaceholder': 'Meu provedor','settings.ai.slugLabel': 'Lesma:','settings.ai.openAiUrlLabel': 'URL da OpenAI',+ 'settings.ai.caCertificateLabel': 'Certificado CA (opcional)',+ 'settings.ai.caCertificateTooLarge': 'O certificado CA deve ter no máximo 256 KB',+ 'settings.ai.caCertificateReadError': 'Não foi possível ler o certificado CA',+ 'settings.ai.clearCaCertificate': 'Remover certificado CA','settings.ai.openAiUrlPlaceholder': 'https://api.openai.com/v1','settings.ai.keepExistingKeyPlaceholder': 'Deixe em branco para manter a chave existente','settings.ai.signInWithOpenRouter': 'Faça login com OpenRouter',@@ -5210,7 +5214,7 @@ const messages: TranslationMap = {'memoryPage.engine.badgeDown': 'Inacessível','memoryPage.engine.connecting': 'Conectando…','memoryPage.engine.save': 'Salvar',- 'memoryPage.engine.builtin.title': 'CortexDB via TinyHumans',+ 'memoryPage.engine.builtin.title': 'CortexDB da TinyHumans','memoryPage.engine.builtin.signInHint':'Entre na sua conta TinyHumans para usar o CortexDB integrado.','memoryPage.engine.apiKeyOption.title': 'CortexDB com sua própria chave',diff --git a/app/src/lib/i18n/ru.ts b/app/src/lib/i18n/ru.tsindex 010c928393..b463e56e4e 100644--- a/app/src/lib/i18n/ru.ts+++ b/app/src/lib/i18n/ru.ts@@ -3395,6 +3395,10 @@ const messages: TranslationMap = {'settings.ai.providerNamePlaceholder': 'Мой провайдер','settings.ai.slugLabel': 'Слаг:','settings.ai.openAiUrlLabel': 'URL OpenAI',+ 'settings.ai.caCertificateLabel': 'Сертификат CA (необязательно)',+ 'settings.ai.caCertificateTooLarge': 'Размер сертификата CA не должен превышать 256 КБ',+ 'settings.ai.caCertificateReadError': 'Не удалось прочитать сертификат CA',+ 'settings.ai.clearCaCertificate': 'Удалить сертификат CA','settings.ai.openAiUrlPlaceholder': 'https://api.openai.com/v1','settings.ai.keepExistingKeyPlaceholder': 'Оставьте пустым, чтобы сохранить существующий ключ.','settings.ai.signInWithOpenRouter': 'Войдите с помощью OpenRouter',diff --git a/app/src/lib/i18n/tr.ts b/app/src/lib/i18n/tr.tsindex e7754b7b5c..c5fd403404 100644--- a/app/src/lib/i18n/tr.ts+++ b/app/src/lib/i18n/tr.ts@@ -3631,6 +3631,10 @@ const messages: TranslationMap = {'settings.ai.providerNamePlaceholder': 'Sağlayıcım','settings.ai.slugLabel': 'Kısa ad:','settings.ai.openAiUrlLabel': "OpenAI URL'si",+ 'settings.ai.caCertificateLabel': 'CA sertifikası (isteğe bağlı)',+ 'settings.ai.caCertificateTooLarge': 'CA sertifikası en fazla 256 KB olmalıdır',+ 'settings.ai.caCertificateReadError': 'CA sertifikası okunamadı',+ 'settings.ai.clearCaCertificate': 'CA sertifikasını kaldır','settings.ai.openAiUrlPlaceholder': 'https://api.openai.com/v1','settings.ai.keepExistingKeyPlaceholder': 'Mevcut anahtarı korumak için boş bırakın','settings.ai.signInWithOpenRouter': 'OpenRouter ile oturum aç',diff --git a/app/src/lib/i18n/zh-CN.ts b/app/src/lib/i18n/zh-CN.tsindex 94c99ca531..5bb0019806 100644--- a/app/src/lib/i18n/zh-CN.ts+++ b/app/src/lib/i18n/zh-CN.ts@@ -3176,6 +3176,10 @@ const messages: TranslationMap = {'settings.ai.providerNamePlaceholder': '我的提供商','settings.ai.slugLabel': '蛞蝓:','settings.ai.openAiUrlLabel': 'OpenAI URL',+ 'settings.ai.caCertificateLabel': 'CA 证书(可选)',+ 'settings.ai.caCertificateTooLarge': 'CA 证书不得超过 256 KB',+ 'settings.ai.caCertificateReadError': '无法读取 CA 证书',+ 'settings.ai.clearCaCertificate': '移除 CA 证书','settings.ai.openAiUrlPlaceholder': 'https://api.openai.com/v1','settings.ai.keepExistingKeyPlaceholder': '留空以保留现有密钥','settings.ai.signInWithOpenRouter': '使用 OpenRouter 登录',diff --git a/app/src/services/api/__tests__/aiSettingsApi.test.ts b/app/src/services/api/__tests__/aiSettingsApi.test.tsindex 7b113c8159..3354196124 100644--- a/app/src/services/api/__tests__/aiSettingsApi.test.ts+++ b/app/src/services/api/__tests__/aiSettingsApi.test.ts@@ -613,6 +613,20 @@ describe('saveAISettings', () => {expect(patch.cloud_providers![0]).not.toHaveProperty('has_api_key');});+ it('saves an edited provider CA certificate even when the endpoint is unchanged', async () => {+ const prev = makeSettings();+ const next = makeSettings({+ cloudProviders: [+ { ...prev.cloudProviders[0], ca_cert_pem: '-----BEGIN CERTIFICATE-----\nCA' },+ ],+ });++ await saveAISettings(prev, next);++ const patch = mockOpenhumanUpdateModelSettings.mock.calls[0][0];+ expect(patch.cloud_providers?.[0].ca_cert_pem).toBe('-----BEGIN CERTIFICATE-----\nCA');+ });+it('preserves local runtime providers in the cloud_providers payload', async () => {const prev = makeSettings({ cloudProviders: [] });const next = makeSettings({diff --git a/app/src/services/api/aiSettingsApi.ts b/app/src/services/api/aiSettingsApi.tsindex c1e1c35579..1584893542 100644--- a/app/src/services/api/aiSettingsApi.ts+++ b/app/src/services/api/aiSettingsApi.ts@@ -369,18 +369,20 @@ export async function saveAISettings(prev: AISettings, next: AISettings): Promisn.slug !== p.slug ||n.label !== p.label ||n.endpoint !== p.endpoint ||+ n.ca_cert_pem !== p.ca_cert_pem ||n.auth_style !== p.auth_style);})) {patch.cloud_providers = next.cloudProviders.filter(p => !['', 'cloud', 'openhuman', 'pid'].includes(p.slug.trim()))- .map(({ id, slug, label, endpoint, auth_style }) => ({+ .map(({ id, slug, label, endpoint, auth_style, ca_cert_pem }) => ({id,slug,label,endpoint,auth_style,+ ca_cert_pem,}));}diff --git a/app/src/utils/tauriCommands/config.ts b/app/src/utils/tauriCommands/config.tsindex b32f90d1aa..a32a4cf4ce 100644--- a/app/src/utils/tauriCommands/config.ts+++ b/app/src/utils/tauriCommands/config.ts@@ -48,6 +48,8 @@ export interface CloudProviderCreds {label: string;endpoint: string;auth_style: AuthStyle;+ /** Optional PEM CA bundle trusted only for this provider. */+ ca_cert_pem?: string | null;}/**diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.tomlindex 1f5af777d2..ea2054a7df 100644--- a/crates/openhuman-core/Cargo.toml+++ b/crates/openhuman-core/Cargo.toml@@ -344,14 +344,14 @@ serde_path_to_error = "0.1"# providers/gmail/post_process.rs) and prefer the email's# `text/plain` MIME part when available.)# TLS: rustls only in the base declaration, so Linux/macOS — including the-# headless embedding target (#5046) — link a single TLS stack + cert set-# (Mozilla webpki-roots). Windows re-adds `native-tls` via the+# headless embedding target (#5046) — link a single TLS stack with Mozilla+# roots plus OS/user-installed roots (including SSL_CERT_FILE). Windows re-adds `native-tls` via the# `[target.'cfg(windows)'.dependencies]` block below (Cargo unions features# per target), because `crates/openhuman-core/src/tls/mod.rs` deliberately routes the# Windows client through the SChannel/OS cert store for corporate MITM +# AV root CAs. So the two TLS backends coexist only on Windows, never on# the RAM-sensitive platforms.-reqwest = { version = "0.12", default-features = false, features = ["json", "blocking", "rustls-tls", "stream", "http2", "multipart", "socks"] }+reqwest = { version = "0.12", default-features = false, features = ["json", "blocking", "rustls-tls", "rustls-tls-native-roots", "stream", "http2", "multipart", "socks"] }# Already in-tree via reqwest/hyper; named directly so `IntegrationClient::get_bytes`# can return `bytes::Bytes` without a copy.bytes = "1"@@ -629,8 +629,9 @@ windows-sys = { version = "0.61", features = [] }[target.'cfg(not(windows))'.dependencies]-# macOS / Linux: keep rustls + Mozilla webpki-roots — the historical-# default. Avoids pulling OpenSSL as a runtime dep on Linux.+# macOS / Linux: keep rustls + Mozilla webpki-roots and load native roots too.+# This accepts corporate CAs from the OS store or SSL_CERT_FILE without+# pulling OpenSSL in as a runtime dependency on Linux.tokio-tungstenite = { version = "0.29", default-features = false, features = ["connect", "handshake", "rustls-tls-webpki-roots"] }[dev-dependencies]diff --git a/crates/openhuman-core/src/config/ops/loader/snapshot.rs b/crates/openhuman-core/src/config/ops/loader/snapshot.rsindex b52837e8c8..521c081958 100644--- a/crates/openhuman-core/src/config/ops/loader/snapshot.rs+++ b/crates/openhuman-core/src/config/ops/loader/snapshot.rs@@ -56,6 +56,7 @@ pub fn client_config_json(config: &Config) -> serde_json::Value {"label": c.label,"endpoint": c.endpoint,"auth_style": c.auth_style.as_str(),+ "ca_cert_pem": config.cloud_provider_ca_certs.get(&c.slug),})}).collect();diff --git a/crates/openhuman-core/src/config/ops/model.rs b/crates/openhuman-core/src/config/ops/model.rsindex ea0dc09c6f..3a172e49b2 100644--- a/crates/openhuman-core/src/config/ops/model.rs+++ b/crates/openhuman-core/src/config/ops/model.rs@@ -25,6 +25,8 @@ pub struct ModelSettingsPatch {/// `auth-profiles.json` via [`crate::security::credentials::AuthService`])./// Pass `Some(vec![])` to clear all third-party cloud providers.pub cloud_providers: Option<Vec<crate::config::schema::cloud_providers::CloudProviderCreds>>,+ /// PEM CA bundle changes keyed by provider slug; empty values remove one.+ pub cloud_provider_ca_certs: Option<std::collections::HashMap<String, String>>,/// When `Some`, REPLACES the entire `config.model_registry` array. Carries/// each model's user-set `vision` flag (Settings → Advanced LLM → custom/// model → "Supports vision"). Pass `Some(vec![])` to clear; `None` keeps it.@@ -322,6 +324,12 @@ pub async fn apply_model_settings(preserved.len());config.cloud_providers = providers;+ config.cloud_provider_ca_certs.retain(|slug, _| {+ config+ .cloud_providers+ .iter()+ .any(|entry| entry.slug == *slug)+ });let before_reinject = config.cloud_providers.len();for entry in preserved {let preserved_slug = entry.slug.trim();@@ -338,6 +346,19 @@ pub async fn apply_model_settings(config.cloud_providers.len() - before_reinject);}+ if let Some(certs) = update.cloud_provider_ca_certs {+ for (slug, pem) in certs {+ if pem.is_empty() {+ config.cloud_provider_ca_certs.remove(&slug);+ } else if config+ .cloud_providers+ .iter()+ .any(|entry| entry.slug == slug)+ {+ config.cloud_provider_ca_certs.insert(slug, pem);+ }+ }+ }if let Some(primary) = update.primary_cloud {let trimmed = primary.trim();config.primary_cloud = if trimmed.is_empty() {diff --git a/crates/openhuman-core/src/config/ops_provider_ca_tests.rs b/crates/openhuman-core/src/config/ops_provider_ca_tests.rsnew file mode 100644index 0000000000..bb1b74a552--- /dev/null+++ b/crates/openhuman-core/src/config/ops_provider_ca_tests.rs@@ -0,0 +1,57 @@+use super::*;++#[tokio::test]+async fn provider_ca_cert_is_scoped_to_its_slug_and_removed_with_provider() {+ use crate::config::schema::cloud_providers::CloudProviderCreds;+ let tmp = tempdir().unwrap();+ let mut cfg = tmp_config(&tmp);+ let provider = CloudProviderCreds {+ slug: "team-gateway".into(),+ endpoint: "https://gateway.example.test/v1".into(),+ ..Default::default()+ };+ let pem = include_str!("../util/tls/test-ca.pem").to_string();+ apply_model_settings(+ &mut cfg,+ ModelSettingsPatch {+ cloud_providers: Some(vec![provider]),+ cloud_provider_ca_certs: Some(std::collections::HashMap::from([(+ "team-gateway".into(),+ pem.clone(),+ )])),+ ..Default::default()+ },+ )+ .await+ .unwrap();+ assert_eq!(cfg.cloud_provider_ca_certs["team-gateway"], pem);+ let snapshot = crate::config::ops::loader::client_config_json(&cfg);+ assert_eq!(snapshot["cloud_providers"][0]["ca_cert_pem"], pem);++ apply_model_settings(+ &mut cfg,+ ModelSettingsPatch {+ cloud_provider_ca_certs: Some(std::collections::HashMap::from([(+ "team-gateway".into(),+ String::new(),+ )])),+ ..Default::default()+ },+ )+ .await+ .unwrap();+ assert!(cfg.cloud_provider_ca_certs.is_empty());+ cfg.cloud_provider_ca_certs+ .insert("team-gateway".into(), pem);++ apply_model_settings(+ &mut cfg,+ ModelSettingsPatch {+ cloud_providers: Some(vec![]),+ ..Default::default()+ },+ )+ .await+ .unwrap();+ assert!(cfg.cloud_provider_ca_certs.is_empty());+}diff --git a/crates/openhuman-core/src/config/ops_tests.rs b/crates/openhuman-core/src/config/ops_tests.rsindex b2b1ae446f..18c644a94c 100644--- a/crates/openhuman-core/src/config/ops_tests.rs+++ b/crates/openhuman-core/src/config/ops_tests.rs@@ -23,5 +23,7 @@ mod files_dir_tests;mod loader_and_search_tests;#[path = "ops_model_and_local_ai_tests.rs"]mod model_and_local_ai_tests;+#[path = "ops_provider_ca_tests.rs"]+mod provider_ca_tests;#[path = "ops_voice_and_autonomy_tests.rs"]mod voice_and_autonomy_tests;diff --git a/crates/openhuman-core/src/config/schema/types/config.rs b/crates/openhuman-core/src/config/schema/types/config.rsindex 66fbd56d24..a3844ad03d 100644--- a/crates/openhuman-core/src/config/schema/types/config.rs+++ b/crates/openhuman-core/src/config/schema/types/config.rs@@ -357,6 +357,10 @@ pub struct Config {#[serde(default)]pub cloud_providers: Vec<crate::config::schema::cloud_providers::CloudProviderCreds>,+ /// Optional PEM CA bundles keyed by cloud provider slug.+ #[serde(default)]+ pub cloud_provider_ca_certs: HashMap<String, String>,+/// Id of the `cloud_providers` entry that "cloud" and "primary" resolve to./// When `None`, the factory falls back to the OpenHuman entry.#[serde(default)]diff --git a/crates/openhuman-core/src/config/schema/types/config_clone.rs b/crates/openhuman-core/src/config/schema/types/config_clone.rsindex 6179ef88b3..e936118a96 100644--- a/crates/openhuman-core/src/config/schema/types/config_clone.rs+++ b/crates/openhuman-core/src/config/schema/types/config_clone.rs@@ -77,6 +77,7 @@ impl Clone for Config {local_ai: self.local_ai.clone(),claude_agent_sdk: self.claude_agent_sdk.clone(),cloud_providers: self.cloud_providers.clone(),+ cloud_provider_ca_certs: self.cloud_provider_ca_certs.clone(),primary_cloud: self.primary_cloud.clone(),ephemeral_route: self.ephemeral_route.clone(),chat_provider: self.chat_provider.clone(),diff --git a/crates/openhuman-core/src/config/schema/types/defaults.rs b/crates/openhuman-core/src/config/schema/types/defaults.rsindex 55ea59b7ea..6c99ae40ef 100644--- a/crates/openhuman-core/src/config/schema/types/defaults.rs+++ b/crates/openhuman-core/src/config/schema/types/defaults.rs@@ -91,6 +91,7 @@ impl Default for Config {local_ai: LocalAiConfig::default(),claude_agent_sdk: ClaudeAgentSdkConfig::default(),cloud_providers: Vec::new(),+ cloud_provider_ca_certs: HashMap::new(),primary_cloud: None,chat_provider: None,reasoning_provider: None,diff --git a/crates/openhuman-core/src/config/schemas/controllers/inference.rs b/crates/openhuman-core/src/config/schemas/controllers/inference.rsindex 537afa6148..e3d9069aba 100644--- a/crates/openhuman-core/src/config/schemas/controllers/inference.rs+++ b/crates/openhuman-core/src/config/schemas/controllers/inference.rs@@ -36,6 +36,7 @@ pub(super) fn handle_update_model_settings(params: Map<String, Value>) -> Controapi_key: update.api_key,default_model: update.default_model,default_temperature: update.default_temperature,+ cloud_provider_ca_certs: None,model_routes: update.model_routes.map(|routes| {routes.into_iter()diff --git a/crates/openhuman-core/src/config/schemas/helpers.rs b/crates/openhuman-core/src/config/schemas/helpers.rsindex 4c024ec53b..1dd0369c89 100644--- a/crates/openhuman-core/src/config/schemas/helpers.rs+++ b/crates/openhuman-core/src/config/schemas/helpers.rs@@ -26,6 +26,9 @@ pub(super) struct CloudProviderUpdate {/// Auth style: "bearer" | "anthropic" | "openhuman_jwt" | "none".#[serde(default)]pub(super) auth_style: Option<String>,+ /// Optional PEM CA bundle for this provider. Empty string removes it.+ #[serde(default)]+ pub(super) ca_cert_pem: Option<String>,/// Legacy field — tolerated on read for back-compat but not required.#[serde(rename = "type", default)]pub(super) legacy_type: Option<String>,diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rsindex a556573b50..296b68ace5 100644--- a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs@@ -11,7 +11,7 @@ use tinyinference_llm::providers::anthropic::{build_anthropic_model, endpoint_is_anthropic_messages, AnthropicConfig,};use tinyinference_llm::providers::openai::{- build_openai_model, endpoint_is_openrouter, OpenAiConfig,+ build_openai_model, build_openai_model_with_http, endpoint_is_openrouter, OpenAiConfig,};/// Look up a `cloud_providers` entry by slug and build the provider.@@ -398,7 +398,7 @@ pub(super) fn try_create_cloud_slug_chat_model_from_string_with_native_tools();let unsupported = config.temperature_unsupported_models.clone();- let chat = build_openai_model(OpenAiConfig {+ let provider_config = OpenAiConfig {provider_name: slug.as_str(),endpoint: endpoint.as_str(),api_key: key.as_str(),@@ -422,7 +422,16 @@ pub(super) fn try_create_cloud_slug_chat_model_from_string_with_native_tools(// without them; hosted OpenAI rejects unknown part fields, so the// flag is keyed on the relay, not on by default.explicit_cache_control: endpoint_is_openrouter(&endpoint),- });+ };+ let chat = if let Some(pem) = config.cloud_provider_ca_certs.get(&slug) {+ let http = match crate::util::tls::client_with_ca_bundle(pem, "providers.inference") {+ Ok(http) => http,+ Err(error) => return Some(Err(anyhow::anyhow!(error))),+ };+ build_openai_model_with_http(provider_config, http)+ } else {+ build_openai_model(provider_config)+ };Some(Ok((chat, effective_model)))}diff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rsindex 6ac7324903..a8c2b9d47b 100644--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs@@ -1,6 +1,30 @@use super::*;use crate::inference::provider::factory::cloud_slug::try_create_cloud_slug_chat_model_from_string_with_native_tools;++#[test]+fn custom_ca_bundle_builds_a_provider_scoped_chat_client() {+ let _guard = crate::inference::inference_test_guard();+ let mut config = Config::default();+ config.cloud_providers.push(openai_entry("p_team", "team"));+ config.cloud_provider_ca_certs.insert(+ "team".into(),+ include_str!("../../util/tls/test-ca.pem").into(),+ );+ let (model, model_id) = try_create_cloud_slug_chat_model_from_string_with_native_tools(+ "chat",+ "team:private-model",+ &config,+ true,+ )+ .expect("configured provider")+ .expect("custom CA client should build");+ assert_eq!(model_id, "private-model");+ assert_eq!(+ model.profile().and_then(|profile| profile.provider.clone()),+ Some("team".into())+ );+}#[test]fn enforce_local_only_inference_errors_on_external_when_local_only() {// Drive the live-policy-backed wrapper: install a LocalOnly policy, thendiff --git a/crates/openhuman-core/src/inference/provider/ops/models/catalog_listing.rs b/crates/openhuman-core/src/inference/provider/ops/models/catalog_listing.rsindex 5b8d7e2df2..656e175dec 100644--- a/crates/openhuman-core/src/inference/provider/ops/models/catalog_listing.rs+++ b/crates/openhuman-core/src/inference/provider/ops/models/catalog_listing.rs@@ -105,8 +105,11 @@ pub async fn list_configured_models_from_config(routing.account_id.is_some());- let client =- crate::config::build_runtime_proxy_client_with_timeouts("providers.list_models", 30, 10);+ let client = if let Some(pem) = config.cloud_provider_ca_certs.get(&entry.slug) {+ crate::util::tls::client_with_ca_bundle_with_timeouts(pem, "providers.list_models", 30, 10)?+ } else {+ crate::config::build_runtime_proxy_client_with_timeouts("providers.list_models", 30, 10)+ };use crate::config::schema::cloud_providers::AuthStyle;diff --git a/crates/openhuman-core/src/inference/provider/ops_tests_models_parsing_tests.rs b/crates/openhuman-core/src/inference/provider/ops_tests_models_parsing_tests.rsindex d069501845..6622f4dc39 100644--- a/crates/openhuman-core/src/inference/provider/ops_tests_models_parsing_tests.rs+++ b/crates/openhuman-core/src/inference/provider/ops_tests_models_parsing_tests.rs@@ -32,6 +32,26 @@ async fn list_models_valid_json_still_succeeds() {assert_eq!(outcome.value["models"][0]["id"], "some-model");}+#[tokio::test]+async fn list_models_uses_provider_ca_bundle_client() {+ let tmp = tempfile::tempdir().expect("tempdir");+ let endpoint = spawn_static_models_server(+ StatusCode::OK,+ r#"{"data":[{"id":"private-model","owned_by":"team"}]}"#,+ )+ .await;+ let mut config = configure_generic_workspace(&tmp, endpoint).await;+ config.cloud_provider_ca_certs.insert(+ "generic-test".into(),+ include_str!("../../util/tls/test-ca.pem").into(),+ );++ let outcome = list_configured_models_from_config("generic-test", &config)+ .await+ .expect("custom CA client should list models");+ assert_eq!(outcome.value["models"][0]["id"], "private-model");+}+// ── synthesize_local_runtime_entry (TAURI-RUST-28Z fallback) ────────────#[test]diff --git a/crates/openhuman-core/src/inference/schemas/settings_handlers.rs b/crates/openhuman-core/src/inference/schemas/settings_handlers.rsindex ed4e25f196..e2d0239e81 100644--- a/crates/openhuman-core/src/inference/schemas/settings_handlers.rs+++ b/crates/openhuman-core/src/inference/schemas/settings_handlers.rs@@ -31,6 +31,8 @@ pub(super) struct InferenceCloudProviderUpdate {endpoint: String,#[serde(default)]auth_style: Option<String>,+ #[serde(default)]+ ca_cert_pem: Option<String>,#[serde(rename = "type", default)]legacy_type: Option<String>,#[serde(default)]@@ -112,12 +114,29 @@ pub(super) fn handle_inference_update_model_settings() -> ControllerFuture {Box::pin(async move {let update = deserialize_params::<InferenceUpdateModelSettingsParams>(params)?;+ let ca_certs = update.cloud_providers.as_ref().map(|providers| {+ providers+ .iter()+ .filter_map(|provider| {+ provider+ .ca_cert_pem+ .as_ref()+ .map(|pem| (provider.slug.clone(), pem.clone()))+ })+ .collect::<std::collections::HashMap<_, _>>()+ });+ if let Some(certs) = &ca_certs {+ for pem in certs.values().filter(|pem| !pem.is_empty()) {+ crate::util::tls::parse_ca_bundle(pem)?;+ }+ }let patch = config_rpc::ModelSettingsPatch {api_url: update.api_url,inference_url: update.inference_url,api_key: update.api_key,default_model: update.default_model,default_temperature: update.default_temperature,+ cloud_provider_ca_certs: ca_certs,model_routes: update.model_routes.map(|routes| {routes.into_iter()diff --git a/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rs b/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rsindex 2569a7326a..794796629d 100644--- a/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rs+++ b/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rs@@ -82,7 +82,7 @@ Capability {name: "Configure AI",domain: "settings",category: CapabilityCategory::Settings,- description: "Configure managed, local, custom, and built-in BYOK LLM providers, including SumoPod and other OpenAI-compatible gateways, plus per-workload routing preferences.",+ description: "Configure managed, local, custom, and built-in BYOK LLM providers, including SumoPod and other OpenAI-compatible gateways. Custom providers can trust an uploaded PEM CA certificate for model listing and inference. Set per-workload routing preferences here too.",how_to: "Connections → API keys → LLM",status: CapabilityStatus::Stable,privacy: None,diff --git a/crates/openhuman-core/src/util/tls/README.md b/crates/openhuman-core/src/util/tls/README.mdindex fa055e5cf5..d591b55e4d 100644--- a/crates/openhuman-core/src/util/tls/README.md+++ b/crates/openhuman-core/src/util/tls/README.md@@ -5,25 +5,29 @@ Platform-conditional TLS backend selection for `reqwest` HTTP clients. A single## Responsibilities- Provide one canonical `reqwest::ClientBuilder` factory pre-configured with the platform-appropriate TLS backend.+- Parse a user-provided PEM CA bundle and attach its roots to a provider-scoped HTTP client.- Encode the cross-platform TLS policy:- Windows uses `native-tls` (schannel). It honors the Windows certificate store, including corporate, AV, or TLS-inspecting-proxy CAs. `rustls` plus webpki-roots only knows Mozilla CAs and fails such environments with `UnknownIssuer`.- - macOS and Linux use `rustls` plus webpki-roots, which avoids the OpenSSL runtime dependency on Linux and has historically been more reliable than `native-tls` on macOS staging TLS handshakes.+ - macOS and Linux use `rustls` with Mozilla and native roots. Corporate CAs installed in the OS trust store or supplied through `SSL_CERT_FILE` are accepted without an OpenSSL runtime dependency on Linux.## Key files| File | Role || --- | --- |-| `crates/openhuman-core/src/util/tls/mod.rs` | Entire module: module docstring (policy) plus the single `tls_client_builder()` function. No `mod`/`pub mod` declarations, no submodules. |+| `crates/openhuman-core/src/util/tls/mod.rs` | TLS policy, CA bundle parsing, and client builders. |+| `crates/openhuman-core/src/util/tls/mod_tests.rs` | TLS builder and CA validation tests. |## Public surface- `tls_client_builder() -> reqwest::ClientBuilder`: returns a `reqwest::Client::builder()` with `.use_native_tls()` on Windows and `.use_rustls_tls()` elsewhere, selected at compile time via `cfg`. It is the starting point for any client reaching external HTTPS endpoints; callers chain `.timeout(...)`, `.http1_only()`, proxy config, and so on, then `.build()`.+- `parse_ca_bundle(pem)` rejects oversized, malformed, or private-key-bearing data and returns the CA certificates.+- `client_with_ca_bundle` and `client_with_ca_bundle_with_timeouts` add those certificates alongside the platform roots and apply the configured proxy policy.No RPC surface, agent tools, bus events, or persistence. It is a stateless factory function.## Dependencies-Only the external crate `reqwest` (and its `native-tls` / `rustls` feature backends). No `use crate::*` or `use crate::core::*` imports; this is a leaf utility module with zero internal dependencies.+`reqwest` supplies the TLS backends and certificate parser. The provider-scoped builders also use the core's runtime proxy policy.## Used bydiff --git a/crates/openhuman-core/src/util/tls/mod.rs b/crates/openhuman-core/src/util/tls/mod.rsindex cb9a644424..ed468fe810 100644--- a/crates/openhuman-core/src/util/tls/mod.rs+++ b/crates/openhuman-core/src/util/tls/mod.rs@@ -9,9 +9,9 @@//! including any corporate CA installed by AV / TLS-inspecting proxies that//! re-sign certificates with a private root. `rustls` + webpki-roots only knows//! Mozilla CAs and fails such environments with `UnknownIssuer`.-//! - **macOS / Linux**: `rustls` + webpki-roots — avoids the OpenSSL runtime-//! dependency on Linux and has historically been more reliable on macOS staging-//! TLS handshakes than `native-tls`.+//! - **macOS / Linux**: `rustls` with Mozilla and native roots — trusts corporate+//! CAs in the OS store or `SSL_CERT_FILE` while avoiding the OpenSSL runtime+//! dependency on Linux./// Return a `reqwest::ClientBuilder` pre-configured with the platform-appropriate/// TLS backend.@@ -29,6 +29,53 @@ pub fn tls_client_builder() -> reqwest::ClientBuilder {#[cfg(target_os = "windows")]let b = b.use_native_tls();#[cfg(not(target_os = "windows"))]- let b = b.use_rustls_tls();+ let b = b.use_rustls_tls().tls_built_in_native_certs(true);b}++/// Parse a user-supplied PEM CA bundle without accepting private-key material.+pub fn parse_ca_bundle(pem: &str) -> Result<Vec<reqwest::Certificate>, String> {+ if pem.len() > 256 * 1024 || pem.contains("PRIVATE KEY") {+ return Err("CA bundle must contain certificates only and be at most 256 KiB".into());+ }+ let certificates = reqwest::Certificate::from_pem_bundle(pem.as_bytes())+ .map_err(|_| "CA bundle is not valid PEM certificate data".to_string())?;+ if certificates.is_empty() {+ return Err("CA bundle contains no certificates".into());+ }+ Ok(certificates)+}++/// Build a provider-scoped client builder with extra trusted CA certificates.+fn ca_client_builder(pem: &str, service_key: &str) -> Result<reqwest::ClientBuilder, String> {+ let mut builder =+ crate::config::apply_runtime_proxy_to_builder(tls_client_builder(), service_key);+ for certificate in parse_ca_bundle(pem)? {+ builder = builder.add_root_certificate(certificate);+ }+ Ok(builder)+}++pub fn client_with_ca_bundle(pem: &str, service_key: &str) -> Result<reqwest::Client, String> {+ let builder = ca_client_builder(pem, service_key)?;+ builder+ .build()+ .map_err(|error| format!("Could not build provider TLS client: {error}"))+}++pub fn client_with_ca_bundle_with_timeouts(+ pem: &str,+ service_key: &str,+ timeout_secs: u64,+ connect_timeout_secs: u64,+) -> Result<reqwest::Client, String> {+ ca_client_builder(pem, service_key)?+ .timeout(std::time::Duration::from_secs(timeout_secs))+ .connect_timeout(std::time::Duration::from_secs(connect_timeout_secs))+ .build()+ .map_err(|error| format!("Could not build provider TLS client: {error}"))+}++#[cfg(test)]+#[path = "mod_tests.rs"]+mod tests;diff --git a/crates/openhuman-core/src/util/tls/mod_tests.rs b/crates/openhuman-core/src/util/tls/mod_tests.rsnew file mode 100644index 0000000000..eafe6d7bdc--- /dev/null+++ b/crates/openhuman-core/src/util/tls/mod_tests.rs@@ -0,0 +1,21 @@+use super::*;++#[test]+fn platform_tls_client_builds_with_native_roots_enabled() {+ // The native-roots setter is gated behind reqwest's feature. On macOS and+ // Linux, removing that feature makes tls_client_builder fail to compile.+ assert!(tls_client_builder().build().is_ok());+}++#[test]+fn private_ca_bundle_is_accepted_without_disabling_public_roots() {+ let pem = include_str!("test-ca.pem");+ assert_eq!(parse_ca_bundle(pem).unwrap().len(), 1);+ assert!(client_with_ca_bundle(pem, "providers.list_models").is_ok());+}++#[test]+fn invalid_ca_bundle_and_private_key_material_are_rejected() {+ assert!(parse_ca_bundle("not a PEM certificate").is_err());+ assert!(parse_ca_bundle("-----BEGIN PRIVATE KEY-----").is_err());+}diff --git a/crates/openhuman-core/src/util/tls/test-ca.pem b/crates/openhuman-core/src/util/tls/test-ca.pemnew file mode 100644index 0000000000..1efddf755c--- /dev/null+++ b/crates/openhuman-core/src/util/tls/test-ca.pem@@ -0,0 +1,19 @@+-----BEGIN CERTIFICATE-----+MIIDGTCCAgGgAwIBAgIUUn0ZmJoNwulq1RyLzTioAcehWfEwDQYJKoZIhvcNAQEL+BQAwHDEaMBgGA1UEAwwRT3Blbkh1bWFuIHRlc3QgQ0EwHhcNMjYxMDA5MTc1NTMy+WhcNMzYxMDA2MTc1NTMyWjAcMRowGAYDVQQDDBFPcGVuSHVtYW4gdGVzdCBDQTCC+ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKeUWd1FQhOwnklz9OuG1FnI+9gR0KfGlYjrDqWw9048hMbOLimnwYvOdMeXUcJg94T2z9YXYDE01L/l/CoMQFV+f+39eGgq1OPY+U87dzs4ZsTShrtFQYbvUZXEq3y4a62Q6w/mIfIIB878i7sO5rI+tF+t04zIkszXzKx5pHgm1OUCo9SFouvmBQ8LKhtVshDCH73cLOC+wdQb3k/N/Qq8S6X+VqkDeeoDWNkFifBvxSQs0qfpSFzO55boZneDZff7NIS0wCIgtbXaPYyhGoF+qbLK+swgtQodi2nGenCMzu7PT9ZY7H5SOAq6d+PPPhDYKP4uVDCQHFsvVUAHsIQ3r6P8C+AwEAAaNTMFEwHQYDVR0OBBYEFI5uvUJDNQbhWg8L3Fe6o+Y3M/QaMB8GA1UdIwQY+MBaAFI5uvUJDNQbhWg8L3Fe6o+Y3M/QaMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI+hvcNAQELBQADggEBADqj9JuAIqvJN4gdI0prv0y0mqM02lRQh++emO+Y8nCl+hi2+wLffv/Mh7whySWlEHF1Wsbw5WETFNbtMfOzWu8PJyd+MVhB7Jt1QxebiUpq/Xcmf+KWBXdFEp+EiS8wOx8kyzaUFJlcC0KUwnZEnKe1vcEJToQS83H0NF+dHJM2WJaMSP+XhvxphatMiVeIYY9tr1lb7UkbPmNpnafU+ZJUGTQQgdLHLbDGF114YRZlfrXKkyh+OFp/32ocEBc99kBCznmFTObC/3/9zskzYSOZRrVayLVcc6qVW2K4fKIuOy5XxZCj+OkYVVNnU9jpiH4gYibhW9P4LmFZirI5OZcrh8GY=+-----END CERTIFICATE-----diff --git a/gitbooks/features/model-routing/local-and-byok-models.md b/gitbooks/features/model-routing/local-and-byok-models.mdindex 8e76ec15d4..5bcecc9214 100644--- a/gitbooks/features/model-routing/local-and-byok-models.md+++ b/gitbooks/features/model-routing/local-and-byok-models.md@@ -130,6 +130,8 @@ Add your key in the desktop app under the LLM settings. It is stored in the OS kAnything else that speaks the OpenAI-compatible API also works. Register it with your own slug and endpoint, and it routes the same way.+For an HTTPS endpoint signed by a private or corporate CA, upload its PEM CA certificate in the custom provider editor. OpenHuman trusts that certificate for this provider's model listing and inference requests. You can also install the CA in the operating system's trust store; on macOS and Linux, `SSL_CERT_FILE` supplies a PEM bundle to the core process.+On a headless core (`openhuman-core serve`), custom cloud providers are built only when a backend session or TinyHumans API key is present. If you run the core with no account, set the endpoint up as the `local-openai` runtime instead: set `LOCAL_OPENAI_URL`, put the key in `local_ai.api_key`, and pin workloads to `local-openai:<model>`. See [Headless without a TinyHumans account](../cloud-deploy.md#headless-without-a-tinyhumans-account).### 2. Route workloads to itdiff --git a/vendor/tinyagents b/vendor/tinyagentsindex 33a86887d5..87d2703a55 160000--- a/vendor/tinyagents+++ b/vendor/tinyagents@@ -1 +1 @@-Subproject commit 33a86887d52f1dba4e39fdb598b7694c20cfdc84+Subproject commit 87d2703a5517bf26f55c7620526d45c5439374c6