mirror of
https://github.com/j3ssie/osmedeus.git
synced 2026-09-12 04:37:47 +02:00
- Add stripTemplateVarsForJS() to convert {{var}} outside quotes to bare JS variable names, enabling direct param/export access in condition expressions
- Add normalizeBoolStringsForJS() to convert string 'true'/'false' to actual booleans for correct JS truthiness evaluation
- Auto-classify asset types in db_import_asset_from_file() and default source to 'web' when empty
- Improve table display with terminal auto-width detection via term.GetSize(), custom column weights, and display name aliases (status_code → status)
- Change default --width to 0 (auto-detect) with weighted column distribution and minimum header-based sizing
- Add comprehensive tests for param-based conditions and JSON asset imports
- Update test data to use direct param references in conditions instead of exports
75 lines
2.0 KiB
YAML
75 lines
2.0 KiB
YAML
name: test-decision-conditions
|
|
kind: module
|
|
description: Test condition-based decision routing with JS boolean expressions
|
|
tags: test,decision,conditions
|
|
|
|
params:
|
|
- name: target
|
|
required: true
|
|
- name: enable_extra
|
|
type: string
|
|
default: "true"
|
|
- name: scan_depth
|
|
type: string
|
|
default: "3"
|
|
|
|
steps:
|
|
# Step 1: Single condition match — uses params directly (no exports needed)
|
|
- name: check-target
|
|
type: bash
|
|
command: echo "Checking target"
|
|
decision:
|
|
conditions:
|
|
- if: "{{enable_extra}} && {{target}} != ''"
|
|
function: "log_info('[COND] Target is present')"
|
|
|
|
# Step 2: Multiple conditions - all matching ones execute
|
|
- name: check-flags
|
|
type: bash
|
|
command: echo "Checking flags"
|
|
exports:
|
|
flag_a: "true"
|
|
flag_b: "true"
|
|
flag_c: "false"
|
|
decision:
|
|
conditions:
|
|
- if: "{{flag_a}}"
|
|
function: "log_info('[COND-A] Flag A is true')"
|
|
- if: "{{flag_b}}"
|
|
function: "log_info('[COND-B] Flag B is true')"
|
|
- if: "{{flag_c}}"
|
|
function: "log_info('[COND-C] Flag C should not appear')"
|
|
|
|
# Step 3: Condition with inline command
|
|
- name: check-extra
|
|
type: bash
|
|
command: echo "Checking extra"
|
|
exports:
|
|
run_extra: "{{enable_extra}}"
|
|
decision:
|
|
conditions:
|
|
- if: "{{run_extra}}"
|
|
command: echo "[COND-CMD] Extra command executed"
|
|
|
|
# Step 4: Condition with goto
|
|
- name: check-skip
|
|
type: bash
|
|
command: echo "Checking skip condition"
|
|
exports:
|
|
should_skip: "true"
|
|
decision:
|
|
conditions:
|
|
- if: "{{should_skip}}"
|
|
function: "log_info('[COND-GOTO] Jumping to final')"
|
|
goto: final-step
|
|
|
|
# This step should be skipped via goto
|
|
- name: skipped-step
|
|
type: bash
|
|
command: echo "[SKIPPED] This should not appear"
|
|
|
|
# Step 5: Conditions coexisting with switch/cases
|
|
- name: final-step
|
|
type: bash
|
|
command: echo "[FINAL] Scan complete for {{target}}"
|