fix(security): /uploads 目录路径遍历防护
- 替换 Static 为受控文件服务 handler (serveUploads) - 添加 filepath.Clean 路径清理 + .. 检测 - 使用 Abs + HasPrefix 限制访问范围在上传目录内 - 添加安全响应头(CSP default-src 'none', X-Content-Type-Options nosniff)
This commit is contained in:
@@ -59,6 +59,10 @@ func (m *mockOAuthManager) ValidateToken(token string) (bool, error) {
|
||||
return token != "", nil
|
||||
}
|
||||
|
||||
func (m *mockOAuthManager) ValidateTokenWithProvider(ctx context.Context, provider auth.OAuthProvider, token string) (bool, error) {
|
||||
return token != "", nil
|
||||
}
|
||||
|
||||
func (m *mockOAuthManager) GetConfig(provider auth.OAuthProvider) (*auth.OAuthConfig, bool) {
|
||||
if m.config != nil {
|
||||
return m.config, true
|
||||
|
||||
Reference in New Issue
Block a user