You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

step-01-validate.md 2.8KB

5 päivää sitten
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. ---
  2. name: 'step-01-validate'
  3. description: 'Validate workflow outputs against checklist'
  4. outputFile: '{test_artifacts}/ci-validation-report.md'
  5. validationChecklist: '{skill-root}/checklist.md'
  6. ---
  7. # Step 1: Validate Outputs
  8. ## STEP GOAL:
  9. Validate outputs using the workflow checklist and record findings.
  10. ## MANDATORY EXECUTION RULES (READ FIRST):
  11. ### Universal Rules:
  12. - 📖 Read the complete step file before taking any action
  13. - ✅ Speak in `{communication_language}`
  14. ### Role Reinforcement:
  15. - ✅ You are the Master Test Architect
  16. ### Step-Specific Rules:
  17. - 🎯 Validate against `{validationChecklist}`
  18. - 🚫 Do not skip checks
  19. ## EXECUTION PROTOCOLS:
  20. - 🎯 Follow the MANDATORY SEQUENCE exactly
  21. - 💾 Write findings to `{outputFile}`
  22. ## CONTEXT BOUNDARIES:
  23. - Available context: workflow outputs and checklist
  24. - Focus: validation only
  25. - Limits: do not modify outputs in this step
  26. ## MANDATORY SEQUENCE
  27. **CRITICAL:** Follow this sequence exactly.
  28. ### 1. Load Checklist
  29. Read `{validationChecklist}` and list all criteria.
  30. ### 2. Validate Outputs
  31. Evaluate outputs against each checklist item.
  32. ### 2a. Script Injection Scan
  33. Scan all generated YAML workflow files for unsafe interpolation patterns inside `run:` blocks.
  34. **Unsafe patterns to flag (FAIL):**
  35. - `${{ inputs.* }}` — all workflow inputs are user-controllable
  36. - `${{ github.event.* }}` — treat the entire event namespace as unsafe by default (includes PR titles, issue bodies, comment bodies, label names, etc.)
  37. - `${{ github.head_ref }}` — PR source branch name (user-controlled)
  38. **Detection method:** For each `run:` block in generated YAML, check if any of the above expressions appears in the run script body. If found, flag as **FAIL** with the exact line and recommend converting to the safe `env:` intermediary pattern (pass through `env:`, reference as double-quoted `"$ENV_VAR"`).
  39. **Safe patterns to ignore** (exempt from flagging): `${{ steps.*.outputs.* }}`, `${{ matrix.* }}`, `${{ runner.os }}`, `${{ github.sha }}`, `${{ github.ref }}`, `${{ secrets.* }}`, `${{ env.* }}` — these are safe from GitHub expression injection when used in `run:` blocks.
  40. ### 3. Write Report
  41. Write a validation report to `{outputFile}` with PASS/WARN/FAIL per section.
  42. ## 🚨 SYSTEM SUCCESS/FAILURE METRICS:
  43. ### ✅ SUCCESS:
  44. - Validation report written
  45. - All checklist items evaluated
  46. ### ❌ SYSTEM FAILURE:
  47. - Skipped checklist items
  48. - No report produced
  49. ## On Complete
  50. Run: `python3 {project-root}/_bmad/scripts/resolve_customization.py --skill {skill-root} --key workflow.on_complete`
  51. If the resolver succeeds and returns a non-empty `workflow.on_complete`, execute that value as the final terminal instruction before exiting.
  52. If the resolver fails, returns no output, or resolves an empty value, skip the hook and exit normally.