mirror of
https://github.com/larksuite/cli.git
synced 2026-08-03 08:32:46 +08:00
1. Add baseline safe protection for Feishu/Lark API endpoints. 2. Add lark-cli config risk-control on|off|default command for workspace-level safety protection control.
29 lines
804 B
Go
29 lines
804 B
Go
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package cmdutil
|
|
|
|
import (
|
|
"github.com/larksuite/cli/internal/core"
|
|
"github.com/larksuite/cli/internal/riskcontrol"
|
|
)
|
|
|
|
type workspaceConfigSource interface {
|
|
MultiAppConfig() (*core.MultiAppConfig, error)
|
|
}
|
|
|
|
// resolveSDKHostSignalSource applies workspace policy at the SDK transport
|
|
// boundary.
|
|
func resolveSDKHostSignalSource(config workspaceConfigSource) riskcontrol.Source {
|
|
if config == nil {
|
|
return nil
|
|
}
|
|
workspace, configErr := config.MultiAppConfig()
|
|
// Default-on means an existing config with no explicit preference. Absent
|
|
// or unreadable config cannot authorize host-signal collection.
|
|
if configErr != nil || !workspace.RiskControlEnabled() {
|
|
return nil
|
|
}
|
|
return riskcontrol.NewHostSource()
|
|
}
|