Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
58430cd
feat(v2): modular scanner + Slack reporting + whitelist + safe teardo…
tsmith4014 Dec 21, 2025
c3e644c
chore: reorganize repo layout (handlers/docs/tools)
tsmith4014 Dec 21, 2025
05babb7
updated main readme post root reorg
tsmith4014 Dec 21, 2025
53446be
updated diagram, added .sh resource script for building resources for…
tsmith4014 Jan 17, 2026
df713fd
plan update
tsmith4014 Jan 17, 2026
eb82444
Merge pull request #1 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 3, 2026
24f89cb
infra(slack): add Bloodhound-V2 Slack app manifest and update gitigno…
mmccla1n Mar 3, 2026
2843594
feat(infra,docs): introduce Lambda packaging strategy, dev/runtime de…
mmccla1n Mar 4, 2026
e1672a9
bloodhound v2: wire slack commands + terraform safety updates
mmccla1n Mar 6, 2026
675157a
Bloodhound v2: add teardown safety controls, validation guides, and d…
mmccla1n Mar 7, 2026
99f9a2f
Add validation workflow, safety architecture, and configuration docum…
mmccla1n Mar 7, 2026
ca9ddf4
Bloodhound v2: unify Slack command routing, update manifest, and impr…
mmccla1n Mar 7, 2026
f08e4b0
Improve teardown plan Slack messaging and safety visibility
mmccla1n Mar 9, 2026
e751b89
Add /v2_status operational dashboard and finalize Slack command inter…
mmccla1n Mar 10, 2026
073fe9e
Merge pull request #2 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 10, 2026
064ffa0
Bloodhound v2: introduce handlers/services architecture + validation …
mmccla1n Mar 11, 2026
9ecc056
Bloodhound v2: validation harness routing + documentation alignment
mmccla1n Mar 13, 2026
09b00b2
infra: stabilize Lambda validation workflow and packaging
mmccla1n Mar 13, 2026
c8350cc
add teardown validation workflow and safety improvements
mmccla1n Mar 14, 2026
ffc34bd
Merge pull request #3 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 14, 2026
53c90ba
updatineg docs
mmccla1n Mar 14, 2026
e91e61e
updating documentatino. add feautures file
mmccla1n Mar 14, 2026
f89fbbe
Improve GitHub Actions Lambda invocation workflow and documentation
mmccla1n Mar 14, 2026
d608c0e
Merge pull request #4 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 14, 2026
8af92b5
Add GitHub OIDC bootstrap script and switch CI authentication to role…
mmccla1n Mar 14, 2026
f33c065
Merge pull request #5 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 14, 2026
1ee101b
- Allow forks of Bloodhound repo to assume role
mmccla1n Mar 14, 2026
f4b66e7
Merge pull request #6 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 14, 2026
c375c7e
added debug statements for GA to check output, temporary add
mmccla1n Mar 14, 2026
ff2acab
Merge pull request #7 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 14, 2026
69a874a
update GitHub Actions versions for Node 24 compatibility
mmccla1n Mar 14, 2026
34b8c8c
Add decoded Lambda logs to GitHub Actions output for improved debugging
mmccla1n Mar 14, 2026
83cdf88
Merge pull request #8 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 14, 2026
01146bf
Add Bloodhound execution summary to GitHub Actions logs
mmccla1n Mar 14, 2026
34a827f
Merge pull request #9 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 14, 2026
f08f2c2
Adds stdout logging at the end of execute_pipeline() so Lambda execution
mmccla1n Mar 14, 2026
19b8472
Merge pull request #10 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 14, 2026
5d1f474
Split Bloodhound workflows into scheduled scan and manual operations
mmccla1n Mar 14, 2026
ee51539
Merge pull request #11 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 14, 2026
c307b99
space
mmccla1n Mar 14, 2026
5861abf
Merge pull request #12 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 14, 2026
5f18a3c
Added concurrency guard (bloodhound-scan) to prevent overlapping
mmccla1n Mar 14, 2026
398f04d
Merge pull request #13 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 14, 2026
127292c
fix(validation): pass required guard fields to validation_handler
mmccla1n Mar 14, 2026
302fa7f
Merge pull request #14 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 14, 2026
5a581d1
fix(ci): improve Bloodhound workflow validation and Lambda troublesho…
mmccla1n Mar 15, 2026
c270bf7
Merge pull request #15 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 15, 2026
9d8dd3f
Bloodhound: fix CI smoke test and workflow improvements
mmccla1n Mar 15, 2026
529b997
Merge pull request #16 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 15, 2026
5ceb1b2
Bloodhound: mask sensitive env vars in CI logs while preserving full …
mmccla1n Mar 15, 2026
d6a59d4
Merge pull request #17 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 15, 2026
ec50cc2
Bloodhound: CI and validation hardening
mmccla1n Mar 15, 2026
ee45fb8
Merge pull request #18 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 15, 2026
6f083ef
Bloodhound: add CI-safe defaults for teardown validation variables
mmccla1n Mar 15, 2026
5e2ff4e
Merge pull request #19 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 15, 2026
1a567ae
Bloodhound: add Terraform support for validation workflow
mmccla1n Mar 15, 2026
2c5cb7a
Merge pull request #20 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 15, 2026
2d3fbee
Bloodhound: temporarily disable validation workflow in CI
mmccla1n Mar 16, 2026
34128a9
Merge pull request #21 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 16, 2026
742c78a
docs: update GitHub automation documentation and architecture flow
mmccla1n Mar 16, 2026
e79e6fc
update document
mmccla1n Mar 16, 2026
6ca9b87
Merge pull request #22 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 16, 2026
7cb3f62
docs: improve Lambda packaging documentation and add dependency resol…
mmccla1n Mar 16, 2026
a0d1648
docs(infra): standardize Lambda packaging pipeline and build system d…
mmccla1n Mar 18, 2026
9a0e73f
fix(lambda): isolate scheduled execution path to address recursion issue
mmccla1n Mar 20, 2026
a1683f5
fix(lambda): prevent scheduled recursion and add scheduler validation…
mmccla1n Mar 20, 2026
baefba7
Merge pull request #23 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 20, 2026
3beb650
docs: update and synchronize Bloodhound v2 documentation across opera…
mmccla1n Mar 21, 2026
121304e
Add Docker-based Lambda build pipeline for Bloodhound packaging
mmccla1n Mar 23, 2026
1d85f68
Merge pull request #24 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 23, 2026
4bede85
updated doc
mmccla1n Mar 23, 2026
ccfd545
Merge pull request #25 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 23, 2026
6b2b93b
update docs
mmccla1n Mar 24, 2026
69c5d18
docs: align infrastructure and packaging documentation with actual La…
mmccla1n Mar 24, 2026
0bd432d
docs: add Bloodhound demo guide, architecture overview, and supportin…
mmccla1n Mar 27, 2026
9246466
Merge pull request #26 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 27, 2026
7c3bffe
docs: expose quick_demo guide in README and features documentation
mmccla1n Mar 27, 2026
b5c584b
Merge pull request #27 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 27, 2026
101119f
moved screenshot pics
mmccla1n Mar 27, 2026
cdc5d5a
Merge pull request #28 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 27, 2026
cbbbf43
corrected text output
mmccla1n Mar 27, 2026
fb8466b
Merge pull request #29 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 27, 2026
9c43d16
Corrected path to render pdfs correctly
mmccla1n Mar 27, 2026
441e847
Merge pull request #30 from mmccla1n/mmc/bloodhound_v2
mmccla1n Mar 27, 2026
190beb1
corrected doc
mmccla1n Mar 27, 2026
89d0460
Merge pull request #31 from mmccla1n/mmc/bloodhound_v2
mmccla1n Apr 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
343 changes: 343 additions & 0 deletions .github/workflows/bloodhound_ops.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,343 @@
name: Bloodhound Operations
run-name: Bloodhound Operations — ${{ github.event.inputs.mode }}

# ------------------------------------------------------------
# Manual Bloodhound operations workflow
#
# This workflow lets an operator manually run Bloodhound
# tasks from the GitHub Actions UI.
#
# Available operations:
# scan → run infrastructure scan immediately
# validation → check configuration
# status → quick system health check
# validate_scheduler → simulate scheduled EventBridge execution (debug only)
#
# NOTE:
# validate_scheduler is a controlled validation mode used to
# test the scheduled Lambda execution path without relying
# on cron or EventBridge triggers.
# ------------------------------------------------------------

permissions:
id-token: write
contents: read


# ------------------------------------------------------------
# Concurrency Guard
#
# Prevents multiple Bloodhound scans running at the same time.
#
# Example:
# scheduled scan running
# operator triggers manual scan
#
# → GitHub will queue the second run instead of running both.
# ------------------------------------------------------------
concurrency:
group: bloodhound-scan
cancel-in-progress: false


on:

# -------------------------------------------------------
# Manual trigger from GitHub Actions UI
# -------------------------------------------------------
workflow_dispatch:
inputs:
mode:
description: "Bloodhound operation"
required: true
default: "status"
type: choice
options:
- scan
# -------------------------------------------------------
# NOTE:
# Validation workflow is temporarily disabled in CI.
#
# The validation pipeline provisions disposable Terraform
# infrastructure and performs controlled teardown tests.
#
# This workflow currently runs correctly in local
# environments but requires additional CI hardening
# (Terraform variable injection and account guard handling).
#
# The implementation remains in this workflow and will be
# re-enabled prior to GA once the CI validation pipeline
# is fully stabilized.
#
# To re-enable:
# simply add "validation" back to the options list.
# -------------------------------------------------------
#- validation
- status
# -------------------------------------------------------
# Scheduler Validation Mode
#
# validate_scheduler simulates an EventBridge scheduled
# invocation using:
# { "source": "scheduled" }
#
# This is used to validate the scheduled execution path
# before changes are promoted to main.
#
# This is NOT the production scheduler.
#
# The real scheduler is defined in:
# invoke_lambda.yml
# -------------------------------------------------------
- validate_scheduler


jobs:

invoke-lambda:
runs-on: ubuntu-latest

steps:

# -------------------------------------------------------
# Pull repository contents
# -------------------------------------------------------
- name: Checkout repository
uses: actions/checkout@v4


# -------------------------------------------------------
# Authenticate to AWS using GitHub OIDC
#
# This assumes the IAM role configured for GitHub
# so the workflow can invoke the Lambda securely.
# -------------------------------------------------------
- name: Configure AWS credentials via OIDC
uses: aws-actions/configure-aws-credentials@v5
with:
role-to-assume: arn:aws:iam::388691194728:role/BloodhoundGitHubInvokeRole
aws-region: us-west-2

# Install Terraform for validation workflow
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.6.6


# -------------------------------------------------------
# Invoke Bloodhound Lambda
#
# The selected operation from the UI is passed into
# the Lambda payload as JSON.
#
# For standard operations:
#
# scan → { "source": "scan" }
# status → { "source": "status" }
#
# Validation requires additional guard fields because
# the validation handler enforces strict safety checks.
#
# validation →
# {
# "source": "validation",
# "mode": "seek_destroy_validation",
# "target_ids": ["validation-instance"]
# }
#
# -------------------------------------------------------
- name: Invoke Bloodhound Lambda operation
run: |
# fail fast on script errors
set -euo pipefail

echo "::group::Bloodhound Lambda Invocation"

# operation selected in UI
MODE="${{ github.event.inputs.mode }}"

echo ""
echo "========================================"
echo "Bloodhound Operation: $MODE"
echo "========================================"
echo ""

# -------------------------------------------------------
# Validation Mode
#
# Run the full teardown validation workflow instead of
# manually constructing a Lambda payload.
#
# The validation script handles:
# • Terraform test instance creation
# • Lambda invocation
# • teardown verification
# • safety checks
# -------------------------------------------------------
if [ "$MODE" = "validation" ]; then

echo "Running full teardown validation workflow"

chmod +x tools/run_validation_workflow.sh
./tools/run_validation_workflow.sh

exit 0

fi


# -------------------------------------------------------
# Standard Lambda operations (scan / status) + scheduler validation
# -------------------------------------------------------
# validate_scheduler simulates EventBridge scheduled trigger
if [ "$MODE" = "validate_scheduler" ]; then
echo "===== VALIDATING SCHEDULER PATH ====="
echo "Simulating EventBridge scheduled event"
echo '{"source":"scheduled"}' > event.json
else
echo "{\"source\":\"$MODE\"}" > event.json
fi

# show payload being sent to Lambda
cat event.json

echo ""
echo "Invoking Bloodhound Lambda"

# invoke Lambda
aws lambda invoke \
--function-name BloodhoundLambdaV2 \
--cli-binary-format raw-in-base64-out \
--payload file://event.json \
--log-type Tail \
output.json \
--region us-west-2 \
> lambda_meta.json

echo "::endgroup::"


# -------------------------------------------------------
# Print Lambda response payload
# -------------------------------------------------------
echo "::group::Lambda Response Payload"
cat output.json
echo "::endgroup::"


# -------------------------------------------------------
# Print Bloodhound operational summary results returned from Lambda
# -------------------------------------------------------
echo "::group::Bloodhound Summary"

echo "Scan Summary:"
jq '.scan' output.json || true

echo ""
echo "Budget Snapshot:"
jq '.budget' output.json || true

echo ""
echo "Teardown Plan:"
jq '.teardown' output.json || true

echo "::endgroup::"


# -------------------------------------------------------
# AWS invocation metadata
#
# Shows request ID, status code, and other
# Lambda invocation information.
# -------------------------------------------------------
echo "::group::Lambda Invocation Metadata"
cat lambda_meta.json
echo "::endgroup::"


# -------------------------------------------------------
# Decode Lambda logs returned in the invocation
#
# AWS embeds the last ~4KB of logs in base64.
# -------------------------------------------------------
echo "::group::Decoded Lambda Logs"

if jq -e '.LogResult' lambda_meta.json > /dev/null; then
cat lambda_meta.json | jq -r '.LogResult' | base64 -d
else
echo "No embedded logs returned from Lambda."
fi

echo "::endgroup::"


# -------------------------------------------------------
# Detect Lambda failures
#
# Ensures CI fails if Lambda execution fails.
# -------------------------------------------------------
echo "::group::Lambda Error Check"

if grep -q "FunctionError" lambda_meta.json; then
echo "ERROR: Lambda reported FunctionError"
exit 1
fi

if ! grep -q '"StatusCode": 200' lambda_meta.json; then
echo "ERROR: Lambda invocation returned non-200 status"
exit 1
fi

echo "Lambda invocation completed successfully"

echo "::endgroup::"


# -------------------------------------------------------
# Pull recent logs from CloudWatch
# -------------------------------------------------------
- name: Fetch Lambda Logs
run: |

echo "::group::Lambda CloudWatch Logs"

LOG_GROUP="/aws/lambda/BloodhoundLambdaV2"

# find most recent log stream
LOG_STREAM=$(aws logs describe-log-streams \
--log-group-name $LOG_GROUP \
--order-by LastEventTime \
--descending \
--limit 1 \
--query 'logStreams[0].logStreamName' \
--output text)

echo "Latest log stream:"
echo $LOG_STREAM

echo ""
echo "Recent log events:"

aws logs get-log-events \
--log-group-name $LOG_GROUP \
--log-stream-name $LOG_STREAM \
--limit 50 \
--query 'events[*].message' \
--output text

echo "::endgroup::"

# -------------------------------------------------------
# Upload validation logs
#
# If validation mode ran, upload the generated
# validation logs as CI artifacts so engineers
# can download them from the workflow run page.
# -------------------------------------------------------
- name: Upload validation logs
if: always() && github.event.inputs.mode == 'validation'
uses: actions/upload-artifact@v4
with:
name: validation-logs
path: logs/validation
Loading