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
+7 -4
View File
@@ -16,10 +16,11 @@ const router = createRouter({
})
router.beforeEach(async (to, from, next) => {
const authStore = useAuthStore()
const moduleStore = useModuleStore()
const requiresAuth = to.matched.some(record => record.meta.requiresAuth !== false)
try {
const authStore = useAuthStore()
const moduleStore = useModuleStore()
const isAuthenticated = await ensureUserLoaded(authStore)
// 首页重定向
@@ -27,7 +28,6 @@ router.beforeEach(async (to, from, next) => {
if (homeRedirect !== null) return next(homeRedirect === '' ? undefined : homeRedirect)
// 需要认证但未认证
const requiresAuth = to.matched.some(record => record.meta.requiresAuth !== false)
if (requiresAuth && !isAuthenticated) {
sessionStorage.setItem('redirectPath', to.fullPath)
log.debug('No valid token found, redirecting to home')
@@ -50,7 +50,10 @@ router.beforeEach(async (to, from, next) => {
next()
} catch (error) {
log.error('Router guard error', error)
// 发生错误时,直接放行,不要乱跳转
if (requiresAuth) {
sessionStorage.setItem('redirectPath', to.fullPath)
return next('/')
}
next()
}
})