mirror of
https://github.com/mandiant/capa.git
synced 2026-03-12 21:23:12 -07:00
* webui: show error when JSON does not follow expected schema Validate result document has required fields (meta, meta.version, meta.analysis, meta.analysis.layout, rules) after parse. Show user-friendly error; for URL loads suggest reanalyzing (e.g. VT). Fixes #2363 * webui: fix array validation bug and deduplicate VT suggestion string - introduce isInvalidObject() helper (checks !v || typeof !== "object" || Array.isArray) so that arrays are correctly rejected in schema validation - extract VT_REANALYZE_SUGGESTION constant to eliminate the duplicated string in loadRdoc() Addresses review feedback on #2871 * webui: address review - validate feature_counts, hoist VT_REANALYZE_SUGGESTION - Add validation for meta.analysis.feature_counts in validateRdocSchema() so parseFunctionCapabilities and other consumers do not hit missing/invalid feature_counts at runtime. - Require feature_counts to have either 'functions' or 'processes' array (static vs dynamic result documents). - Move VT_REANALYZE_SUGGESTION to module top level to avoid redefining on every loadRdoc call. * webui: allow file-scoped-only result documents in schema validation - Validation: allow feature_counts without functions/processes arrays; if present they must be arrays. - rdocParser: default feature_counts.functions to [] when missing so file-scoped-only docs do not throw. * webui: remove leading space from VT_REANALYZE_SUGGESTION constant Per review feedback: the concatenation at call sites handles spacing, so the constant should not carry a leading space.