Files
trailofbits-buttercup/scripts/download_artifacts.sh
T
Riccardo Schirone c9d49f76f7 feat: save CRS artifacts to run-data directories (#206)
* feat: save CRS artifacts to run-data directories

Add functionality to automatically save POVs, patches, and bundles
received from the CRS into organized run-data-<timestamp> directories
structured by task-id as requested in issue #205.

Changes:
- Add run_data_dir configuration setting to Settings
- Implement save_artifact() utility function with proper base64 decoding
- Modify bundle, patch, and POV endpoints to save artifacts to disk
- Create directory structure: run-data-YYYYMMDDHHMMSS/<task-id>/{povs,patches,bundles}/
- Handle different file types: .json for bundles, .patch for patches, .bin for POVs

Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>

* feat: add hostPath volume for buttercup-ui run data access

- Add run-data-volume hostPath mount to UI deployment for minikube
- Maps container /tmp/buttercup-run-data to host /data/buttercup-run-data
- Enables external access to CRS artifacts (POVs, patches, bundles)
- Falls back to emptyDir for non-minikube environments

Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>

* fix: add BUTTERCUP_UI_RUN_DATA_DIR environment variable to UI deployment

- Set BUTTERCUP_UI_RUN_DATA_DIR to /tmp/buttercup-run-data to match volume mount
- Ensures UI application saves run data artifacts to the correct directory
- Run data will now be accessible outside Kubernetes cluster via hostPath volume

Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>

* fix save-artifact feature

* orchestrator: fix lint

---------

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Riccardo Schirone <ret2libc@users.noreply.github.com>
Co-authored-by: Michael D Brown <michael.brown@trailofbits.com>
2025-07-31 10:10:59 -04:00

8 lines
322 B
Bash
Executable File

#!/bin/bash
# Download all artifacts from the buttercup-ui pod
BUTTERCUP_UI_POD=$(kubectl get pods -n ${BUTTERCUP_NAMESPACE:-crs} -l app=ui -o jsonpath='{.items[0].metadata.name}')
kubectl cp -n crs $BUTTERCUP_UI_POD:/tmp/buttercup-run-data /tmp/buttercup-run-data
echo "Artifacts downloaded to /tmp/buttercup-run-data"