feat(security): harden gateway boundaries and usage policies

Consolidate subscription usage policy enforcement, privacy-safe persistence, and gateway security hardening into one reviewable change.

Includes bounded HTTP and execution envelopes, header and protocol guards, DNS and relay validation, authentication and secret projection hardening, secure backup/install paths, and regression coverage.
This commit is contained in:
elky
2026-09-04 03:45:52 +08:00
parent ddcbeb3ae9
commit 579f2c7cc1
1019 changed files with 190437 additions and 26080 deletions
@@ -868,6 +868,7 @@ import { useToast } from '@/composables/useToast'
import { useClipboard } from '@/composables/useClipboard'
import { useTotp } from '@/composables/useTotp'
import { parseApiError } from '@/utils/errorParser'
import { safeExternalHttpsUrl } from '@/utils/navigationSecurity'
import { useI18n } from '@/i18n'
import {
startProviderLevelOAuth,
@@ -1550,7 +1551,12 @@ function handleClose() {
function openAuthorizationUrl() {
const url = oauth.value.authorization_url
if (!url) return
window.open(url, '_blank', 'noopener,noreferrer')
const safeUrl = safeExternalHttpsUrl(url)
if (!safeUrl) {
showError(legacyT('OAuth 服务返回了不安全的授权地址'))
return
}
window.open(safeUrl, '_blank', 'noopener,noreferrer')
}
async function initOAuth() {
@@ -2324,7 +2330,13 @@ async function handleCreateAgentIdentity() {
function openDeviceVerificationUrl() {
const url = device.value.verification_uri_complete || device.value.verification_uri
if (url) window.open(url, '_blank', 'noopener,noreferrer')
if (!url) return
const safeUrl = safeExternalHttpsUrl(url)
if (!safeUrl) {
showError(legacyT('OAuth 服务返回了不安全的设备验证地址'))
return
}
window.open(safeUrl, '_blank', 'noopener,noreferrer')
}
function startCountdown() {