Files
osmedeus/test/testdata/workflows/sample-report-workflow.yaml

114 lines
2.9 KiB
YAML

# Sample Workflow: Generate Security Report
# This workflow demonstrates how to use render_markdown_report() function
# to generate customized security reports from markdown templates.
#
# Usage:
# osmedeus run -m sample-report-workflow -t example.com
#
# Prerequisites:
# - Template file should exist at the specified path
# - Database should have scan data (assets, vulnerabilities)
name: sample-report-workflow
kind: module
description: Generate security report from markdown template
tags: report,markdown,utility
params:
- name: target
required: true
description: Target domain for the report
# Variables available in templates:
# {{Workspace}} - Current workspace name (usually the target)
# {{Target}} - Target domain
# {{Output}} - Output directory path
# {{TaskID}} - Current task/scan ID
# {{TaskDate}} - Current date
# {{Data}} - External data directory
# {{Binaries}} - External binaries directory
steps:
# Step 1: Create the template directory if it doesn't exist
- name: setup-template-dir
type: bash
command: mkdir -p {{Output}}/templates
# Step 2: Create a simple inline template for demonstration
# In production, you would use a pre-existing template file
- name: create-demo-template
type: bash
command: |
cat > {{Output}}/templates/demo-report.md << 'TEMPLATE'
# Security Scan Report
**Workspace**: {{Workspace}}
**Target**: {{Target}}
**Generated**: {{TaskDate}}
**Task ID**: {{TaskID}}
---
## String Functions Demo
```osm-func
"Uppercase target: " + toUpperCase("{{Target}}")
```
```osm-func
"Trimmed text: [" + trim(" hello world ") + "]"
```
```osm-func
"Target length: " + len("{{Target}}")
```
---
## Dynamic Content
| Function | Result |
|----------|--------|
| UUID | ```osm-func
uuid()
``` |
| Random String | ```osm-func
randomString(8)
``` |
| Contains 'example' | ```osm-func
contains("{{Target}}", "example")
``` |
---
## Conditional Logic
```osm-func
contains("{{Target}}", ".com") ? "Target is a .com domain" : "Target is not a .com domain"
```
---
*Report generated by Osmedeus*
TEMPLATE
# Step 3: Render the markdown report
- name: generate-report
type: function
function: 'render_markdown_report("{{Output}}/templates/demo-report.md", "{{Output}}/security-report.md")'
# Step 4: Verify the report was created
- name: verify-report
type: function
function: 'fileExists("{{Output}}/security-report.md")'
# Step 5: Display report path
- name: show-report-path
type: function
function: 'log_info("Report generated at: {{Output}}/security-report.md")'
# Step 6: Print report preview (first 50 lines)
- name: preview-report
type: bash
command: head -50 {{Output}}/security-report.md