fase(18): cli and cicd integration
This commit is contained in:
121
.github/actions/abe-explore/action.yml
vendored
Normal file
121
.github/actions/abe-explore/action.yml
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
name: ABE Explore
|
||||
description: Run ABE autonomous bug exploration against a target web application
|
||||
|
||||
inputs:
|
||||
url:
|
||||
description: Target URL to explore
|
||||
required: true
|
||||
server:
|
||||
description: ABE server URL (if using remote mode)
|
||||
required: false
|
||||
default: ''
|
||||
api-key:
|
||||
description: API key for remote ABE server
|
||||
required: false
|
||||
default: ''
|
||||
max-states:
|
||||
description: Maximum number of states to explore
|
||||
required: false
|
||||
default: '50'
|
||||
seed:
|
||||
description: Deterministic seed for reproducibility
|
||||
required: false
|
||||
default: '42'
|
||||
output:
|
||||
description: Output format (human | json | junit | markdown)
|
||||
required: false
|
||||
default: 'junit'
|
||||
fail-on-severity:
|
||||
description: Fail if findings at or above this severity (low | medium | high | critical)
|
||||
required: false
|
||||
default: 'high'
|
||||
reports-dir:
|
||||
description: Directory for generated reports
|
||||
required: false
|
||||
default: './abe-reports'
|
||||
config:
|
||||
description: Path to ABE JSON config file
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
outputs:
|
||||
findings-count:
|
||||
description: Number of findings discovered
|
||||
value: ${{ steps.explore.outputs.findings-count }}
|
||||
session-id:
|
||||
description: ABE session ID
|
||||
value: ${{ steps.explore.outputs.session-id }}
|
||||
junit-path:
|
||||
description: Path to JUnit XML results file
|
||||
value: './abe-results.xml'
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install ABE dependencies
|
||||
shell: bash
|
||||
run: npm ci
|
||||
working-directory: ${{ github.action_path }}/../../../
|
||||
|
||||
- name: Install Playwright browsers
|
||||
shell: bash
|
||||
run: npx playwright install chromium --with-deps
|
||||
working-directory: ${{ github.action_path }}/../../../
|
||||
|
||||
- name: Run ABE exploration
|
||||
id: explore
|
||||
shell: bash
|
||||
working-directory: ${{ github.action_path }}/../../../
|
||||
env:
|
||||
ABE_API_KEY: ${{ inputs.api-key }}
|
||||
run: |
|
||||
ARGS="--url ${{ inputs.url }}"
|
||||
ARGS="$ARGS --max-states ${{ inputs.max-states }}"
|
||||
ARGS="$ARGS --seed ${{ inputs.seed }}"
|
||||
ARGS="$ARGS --output ${{ inputs.output }}"
|
||||
ARGS="$ARGS --reports-dir ${{ inputs.reports-dir }}"
|
||||
|
||||
if [ -n "${{ inputs.server }}" ]; then
|
||||
ARGS="$ARGS --server ${{ inputs.server }}"
|
||||
fi
|
||||
|
||||
if [ -n "${{ inputs.api-key }}" ]; then
|
||||
ARGS="$ARGS --api-key ${{ inputs.api-key }}"
|
||||
fi
|
||||
|
||||
if [ -n "${{ inputs.fail-on-severity }}" ]; then
|
||||
ARGS="$ARGS --fail-on-severity ${{ inputs.fail-on-severity }}"
|
||||
fi
|
||||
|
||||
if [ -n "${{ inputs.config }}" ]; then
|
||||
ARGS="$ARGS --config ${{ inputs.config }}"
|
||||
fi
|
||||
|
||||
npm run abe -- explore $ARGS
|
||||
EXIT_CODE=$?
|
||||
|
||||
# Parse findings count from JUnit if available
|
||||
if [ -f abe-results.xml ]; then
|
||||
FAILURES=$(grep -oP 'failures="\K[0-9]+' abe-results.xml | head -1 || echo "0")
|
||||
echo "findings-count=$FAILURES" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "findings-count=0" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
exit $EXIT_CODE
|
||||
|
||||
- name: Upload ABE reports
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: abe-reports-${{ github.run_id }}
|
||||
path: |
|
||||
${{ inputs.reports-dir }}/
|
||||
abe-results.xml
|
||||
retention-days: 30
|
||||
96
.github/workflows/abe-example.yml
vendored
96
.github/workflows/abe-example.yml
vendored
@@ -4,45 +4,101 @@ on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
target-url:
|
||||
description: Target URL to explore
|
||||
required: false
|
||||
default: 'http://localhost:3000'
|
||||
max-states:
|
||||
description: Maximum states to explore
|
||||
required: false
|
||||
default: '30'
|
||||
|
||||
jobs:
|
||||
explore:
|
||||
name: Autonomous Bug Exploration
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
run: npm ci
|
||||
|
||||
- name: Start application
|
||||
run: docker-compose up -d app
|
||||
# assumes the project has a docker-compose with the target app
|
||||
- name: Install Playwright browsers
|
||||
run: npx playwright install chromium --with-deps
|
||||
|
||||
- name: Wait for app
|
||||
run: npx wait-on http://localhost:3000 --timeout 30000
|
||||
- name: Start target application
|
||||
run: docker compose up -d app
|
||||
# Replace 'app' with your application's docker-compose service name.
|
||||
# Or start your app however it's normally run in CI.
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run ABE
|
||||
- name: Wait for application to be ready
|
||||
run: |
|
||||
npm run abe -- run \
|
||||
--url http://localhost:3000 \
|
||||
--max-states 30 \
|
||||
npx wait-on \
|
||||
http://localhost:3000 \
|
||||
--timeout 30000 \
|
||||
--interval 2000
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run ABE exploration
|
||||
id: abe
|
||||
run: |
|
||||
npm run abe -- explore \
|
||||
--url "${{ github.event.inputs.target-url || 'http://localhost:3000' }}" \
|
||||
--max-states "${{ github.event.inputs.max-states || '30' }}" \
|
||||
--seed 42 \
|
||||
--output junit \
|
||||
--fail-on-severity high \
|
||||
--output junit
|
||||
--reports-dir ./abe-reports
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: abe-reports
|
||||
path: reports/
|
||||
|
||||
- name: Publish test results
|
||||
- name: Publish JUnit test results
|
||||
if: always()
|
||||
uses: EnricoMi/publish-unit-test-result-action@v2
|
||||
with:
|
||||
files: abe-results.xml
|
||||
check_name: ABE Findings
|
||||
comment_title: ABE Exploration Results
|
||||
|
||||
- name: Upload ABE reports
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: abe-reports
|
||||
path: |
|
||||
abe-reports/
|
||||
abe-results.xml
|
||||
retention-days: 30
|
||||
|
||||
- name: Fail if high/critical findings found
|
||||
if: steps.abe.outcome == 'failure'
|
||||
run: |
|
||||
echo "ABE found high or critical severity bugs. See artifacts for details."
|
||||
exit 1
|
||||
|
||||
# Optional: Use the composite action instead
|
||||
explore-with-action:
|
||||
name: ABE via Composite Action
|
||||
runs-on: ubuntu-latest
|
||||
if: false # Set to true to enable this alternative job
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Run ABE
|
||||
uses: ./.github/actions/abe-explore
|
||||
with:
|
||||
url: http://localhost:3000
|
||||
max-states: '30'
|
||||
fail-on-severity: high
|
||||
output: junit
|
||||
|
||||
Reference in New Issue
Block a user