parseWasmFinding parses a single structured finding (object with "message" field).
(policyName string, raw json.RawMessage)
| 245 | |
| 246 | // parseWasmFinding parses a single structured finding (object with "message" field). |
| 247 | func 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). |
no test coverage detected