Skip to content

fix: validate remaining child JSON and demo input fields - #10

Merged
EauDoon merged 1 commit into
mainfrom
devloop/cycle-05-validate-child-json
Aug 30, 2026
Merged

fix: validate remaining child JSON and demo input fields#10
EauDoon merged 1 commit into
mainfrom
devloop/cycle-05-validate-child-json

Conversation

@EauDoon

@EauDoon EauDoon commented Aug 30, 2026

Copy link
Copy Markdown
Owner

What

Fail closed on remaining unvalidated demo inputs and child JSON before those values enter the run report.

  • Cap child stdout at 1 MiB before JSON parse so a runaway tool cannot inflate the bundle.
  • Type-check remaining report-facing fields: decide policy_id/rule_results, act state/fault/action_id/assurance_mode/bundle_verification, prove result.
  • Allowlist MandateBound simulate scenarios (rejects all, path-like, and injection-shaped ids before spawn).
  • Reject --fault values other than none|duplicate as a usage error (exit 2), matching help text and the GUI.

Boolean gate flags and act outcome were already covered.

Why

Non-boolean gates and invalid act outcomes already fail closed, but oversized stdout, mistyped copied fields, unknown prove scenarios, and arbitrary --fault strings could still leak into reports or reach child CLIs.

How tested

  • npm test (37 passing)
  • node --check on bin/aas.mjs, bin/aas-gui.mjs, and scripts/bootstrap.mjs

Devin Review

Cap child stdout before parse, type-check remaining report-facing
payload fields, allowlist MandateBound prove scenarios, and reject
unsupported --fault values as usage errors.
@EauDoon
EauDoon merged commit ba1a21b into main Aug 30, 2026
2 of 5 checks passed
@EauDoon
EauDoon deleted the devloop/cycle-05-validate-child-json branch August 30, 2026 00:06

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

Comment thread bin/aas.mjs
Comment on lines +425 to +426
optionalField(evaluation, "policy_id", ["string"], "decide");
optionalField(evaluation, "rule_results", ["array"], "decide");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Nonzero child JSON bypasses validation

On nonzero child exits, runDecide and runProve return before validating optional fields. Malformed decision metadata enters reports, while malformed proof results enter bundles.

Prompt for agents
In bin/aas.mjs, runDecide and runProve validate optional payload fields only after returning early for a nonzero child status. Reorder payload-shape validation so policy_id/rule_results and result are checked for every successfully parsed child payload, while preserving the existing behavior that nonzero valid JSON produces a failed stage rather than a child-process error.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant