fix: harden share expiry, download token, quota SQL, and CORS

Apply the useful security fixes from PR #494 with review corrections:
validate expire_style through a shared helper, accept previous download
token window, detect SQL dialect via Tortoise capabilities, close remote
download sessions on client abort, and disable invalid CORS credentials.
This commit is contained in:
vastsa committed 2026-07-23 19:38:50 +08:00
1 parent c676458370
commit a41693f90d
7 files changed
+223 -17

No files matched your search

+3 -1
View File
@@ -767,7 +767,9 @@ async def refresh_settings_middleware(request, call_next):
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
# 前端使用 Bearer Token,不依赖 Cookie credentials。
# allow_origins=["*"] 与 allow_credentials=True 组合不符合 CORS 规范。
allow_credentials=False,
allow_methods=["*"],
allow_headers=["*"],
)