MCPcopy
hub / github.com/larksuite/cli / ScanForSafety

Function ScanForSafety

internal/output/emit.go:27–37  ·  view source on GitHub ↗

ScanForSafety runs content-safety scanning on the given data. cmdPath is the raw cobra CommandPath(). When MODE=off, no provider registered, or the command is not allowlisted, returns a zero ScanResult.

(cmdPath string, data any, errOut io.Writer)

Source from the content-addressed store, hash-verified

25// When MODE=off, no provider registered, or the command is not allowlisted,
26// returns a zero ScanResult.
27func ScanForSafety(cmdPath string, data any, errOut io.Writer) ScanResult {
28 alert, csErr := runContentSafety(cmdPath, data, errOut)
29 if errors.Is(csErr, errBlocked) {
30 return ScanResult{
31 Alert: alert,
32 Blocked: true,
33 BlockErr: wrapBlockError(alert),
34 }
35 }
36 return ScanResult{Alert: alert}
37}
38
39// wrapBlockError creates a typed error for content-safety block.
40func wrapBlockError(alert *extcs.Alert) error {

Callers 13

HandleResponseFunction · 0.92
servicePaginateFunction · 0.92
apiPaginateFunction · 0.92
emitMethod · 0.92
outFormatMethod · 0.92
WriteSuccessEnvelopeFunction · 0.85

Calls 3

runContentSafetyFunction · 0.85
wrapBlockErrorFunction · 0.85
IsMethod · 0.80