MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / parseWasmFinding

Function parseWasmFinding

pkg/policies/engine/wasm/engine.go:247–253  ·  view source on GitHub ↗

parseWasmFinding parses a single structured finding (object with "message" field).

(policyName string, raw json.RawMessage)

Source from the content-addressed store, hash-verified

245
246// parseWasmFinding parses a single structured finding (object with "message" field).
247func parseWasmFinding(policyName string, raw json.RawMessage) (*engine.PolicyViolation, error) {
248 var obj map[string]any
249 if err := json.Unmarshal(raw, &obj); err != nil {
250 return nil, fmt.Errorf("finding must be a JSON object: %w", err)
251 }
252 return engine.NewStructuredViolation(policyName, obj)
253}
254
255// parseWasmViolation parses a single violation from WASM output.
256// Accepts both strings (legacy) and objects (deprecated, use findings instead).

Callers 1

VerifyMethod · 0.85

Calls 1

NewStructuredViolationFunction · 0.92

Tested by

no test coverage detected