-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.md.bak
More file actions
1857 lines (1430 loc) · 81.2 KB
/
Copy pathREADME.md.bak
File metadata and controls
1857 lines (1430 loc) · 81.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# EPYON
**Absolute Security Control**
Epyon is a comprehensive DevSecOps security architecture designed to orchestrate, execute, and consolidate security scanning across the entire software delivery lifecycle.
Built for modern pipelines, Epyon provides:
- Unified orchestration of multiple security tools
- Consistent, repeatable security enforcement
- Centralized reporting and visibility
- Extensible architecture for evolving security needs
Epyon is designed to be opinionated, automated, and decisive — empowering teams to move fast without sacrificing security.
---
## Overview
Epyon is a **production-ready, enterprise-grade** 17-layer DevSecOps security platform with a FastAPI-backed web UI, comprehensive test coverage, baseline scanning, automated comparison, and isolated scan directory architecture. Built for real-world applications with Docker-based tooling and 789 automated tests.
**Version: 3.7.0** · **Updated: June 16, 2026**
## 📋 Prerequisites
Before using this security architecture, ensure you have the following tools installed and configured.
### 🐳 Container Runtime (Required)
All security tools run in containers. **Epyon is container-engine-agnostic** and supports multiple runtimes:
**Supported Container Runtimes:**
- **Docker** (Docker Engine, Docker Desktop) - Most common
- **Podman** - Rootless alternative, no daemon required
- **nerdctl** - containerd CLI, Docker-compatible
- **Alternative distributions** - Colima, Rancher Desktop, OrbStack
Scripts automatically detect and use whichever runtime you have installed.
**Docker Engine (Recommended for Linux/CI):**
```bash
# Ubuntu/Debian
sudo apt-get update && sudo apt-get install docker.io docker-compose
sudo systemctl start docker && sudo systemctl enable docker
sudo usermod -aG docker $USER # Add your user to docker group
# IMPORTANT: After adding to docker group, you must:
# - Log out and log back in, OR
# - Open a new terminal session, OR
# - Run: exec su -l $USER
```
**Podman (Docker Alternative - No Daemon Required):**
```bash
# Ubuntu/Debian
sudo apt-get update && sudo apt-get install podman
# Fedora/RHEL
sudo dnf install podman
# Verify
podman info
```
**Docker Desktop (GUI Option for macOS/Windows):**
```bash
# macOS
brew install --cask docker
# Or download from https://docker.com
```
**Docker Alternatives (macOS):**
```bash
# Colima (Lightweight, no GUI)
brew install colima docker docker-compose
colima start
# Rancher Desktop (GUI alternative to Docker Desktop)
brew install --cask rancher
# OrbStack (Fast, native macOS)
brew install --cask orbstack
```
**Verify Installation:**
```bash
# Method 1: Use the built-in runtime check (recommended)
./scripts/shell/check-docker-runtime.sh
# Method 2: Manual verification
docker --version # or: podman --version
docker info # Should show your runtime details
docker run hello-world
# If you see permission errors, see Troubleshooting section below
```
### ☁️ AWS CLI (Required for ECR Integration)
Required for AWS ECR authentication and container registry operations:
```bash
# macOS
brew install awscli
# Ubuntu/Debian
sudo apt-get install awscli
# Configure AWS credentials
aws configure
# Enter: AWS Access Key ID, Secret Access Key, Region (e.g., us-east-1)
# Verify installation
aws --version
aws sts get-caller-identity
```
### 📊 SonarQube Setup (Layer 7 - Code Quality Analysis)
SonarQube provides code quality analysis, test coverage metrics, and security vulnerability detection. You can use either a hosted SonarQube server or run one locally.
#### Option A: Using an Existing SonarQube Server
If your organization has a SonarQube server, create a `.env.sonar` file in the repository root:
```bash
# .env.sonar - SonarQube authentication configuration
export SONAR_HOST_URL='https://your-sonarqube-server.com'
export SONAR_TOKEN='your_sonarqube_token_here'
```
**To generate a SonarQube token:**
1. Log in to your SonarQube server
2. Go to **My Account** → **Security** → **Generate Tokens**
3. Create a new token with appropriate permissions
4. Copy the token to your `.env.sonar` file
#### Option B: Running SonarQube Locally with Docker
For local development or testing, run SonarQube using Docker:
```bash
# Create a Docker network for SonarQube
docker network create sonarqube-network
# Start SonarQube server (Community Edition - free)
docker run -d --name sonarqube \
--network sonarqube-network \
-p 9000:9000 \
-v sonarqube_data:/opt/sonarqube/data \
-v sonarqube_logs:/opt/sonarqube/logs \
-v sonarqube_extensions:/opt/sonarqube/extensions \
sonarqube:lts-community
# Wait for SonarQube to start (may take 1-2 minutes)
echo "Waiting for SonarQube to start..."
until curl -s http://localhost:9000/api/system/status | grep -q '"status":"UP"'; do
sleep 5
done
echo "SonarQube is ready!"
```
**Initial SonarQube Configuration:**
1. Open http://localhost:9000 in your browser
2. Login with default credentials: `admin` / `admin`
3. **Change the default password immediately** when prompted
4. Generate an authentication token:
- Go to **My Account** → **Security** → **Generate Tokens**
- Name: `security-scanner` (or any descriptive name)
- Type: **Global Analysis Token**
- Click **Generate** and copy the token
5. Create your `.env.sonar` file:
```bash
# .env.sonar - Local SonarQube configuration
export SONAR_HOST_URL='http://localhost:9000'
export SONAR_TOKEN='your_generated_token_here'
```
#### Option C: SonarQube with Docker Compose
For a more robust local setup with persistent storage:
```yaml
# docker-compose.sonarqube.yml
version: '3.8'
services:
sonarqube:
image: sonarqube:lts-community
container_name: sonarqube
ports:
- "9000:9000"
environment:
- SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true
volumes:
- sonarqube_data:/opt/sonarqube/data
- sonarqube_logs:/opt/sonarqube/logs
- sonarqube_extensions:/opt/sonarqube/extensions
networks:
- sonarqube-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/api/system/status"]
interval: 30s
timeout: 10s
retries: 5
volumes:
sonarqube_data:
sonarqube_logs:
sonarqube_extensions:
networks:
sonarqube-network:
driver: bridge
```
```bash
# Start SonarQube with Docker Compose
docker-compose -f docker-compose.sonarqube.yml up -d
# Check status
docker-compose -f docker-compose.sonarqube.yml ps
# View logs
docker-compose -f docker-compose.sonarqube.yml logs -f sonarqube
# Stop SonarQube
docker-compose -f docker-compose.sonarqube.yml down
```
#### SonarQube Project Configuration
For projects you want to analyze, create a `sonar-project.properties` file in the project root:
```properties
# sonar-project.properties - Project configuration
sonar.projectKey=your-project-key
sonar.projectName=Your Project Name
sonar.projectVersion=1.0
# Source directories
sonar.sources=src
sonar.tests=src
sonar.test.inclusions=**/*.test.ts,**/*.test.tsx,**/*.spec.ts,**/*.spec.tsx
# Exclusions
sonar.exclusions=**/node_modules/**,**/dist/**,**/coverage/**,**/*.config.*
# Coverage (if using LCOV format)
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.typescript.lcov.reportPaths=coverage/lcov.info
# Language settings
sonar.language=ts
sonar.sourceEncoding=UTF-8
```
> **GitHub Actions**: When using `scan-private-repo.yml` or `scan-public-repo.yml`, the `SONAR_PROJECT_KEY` is automatically derived from `GITHUB_REPOSITORY` (e.g., `owner_repo`) if the `SONAR_PROJECT_KEY` Actions variable is not set. Subdirectory scans append a sanitized directory suffix (e.g., `owner_repo_apps_api`). A `sonar-project.properties` file in the target repo takes priority over auto-derivation.
### 🔧 Other Tool Dependencies
The remaining security tools run entirely in Docker and require no additional setup:
| Tool | Docker Image | Auto-Pulled |
|------|-------------|-------------|
| **TruffleHog** | `dhi.io/trufflehog` | ✅ Yes |
| **ClamAV** | `clamav/clamav` | ✅ Yes |
| **Checkov** | `bridgecrew/checkov` | ✅ Yes |
| **Grype** | `anchore/grype` | ✅ Yes |
| **Trivy** | `dhi/trivy` (with `aquasec/trivy` fallback) | ✅ Yes |
| **Xeol** | `xeol/xeol` | ✅ Yes |
| **Helm** | `alpine/helm` | ✅ Yes |
### ✅ Verify Prerequisites
#### Quick Docker Runtime Check
Use the built-in Docker runtime detection utility to verify your Docker setup:
```bash
# Check Docker runtime and compatibility
./scripts/shell/check-docker-runtime.sh
```
This utility will:
- ✅ Detect which Docker runtime you're using (Docker Desktop, Colima, Rancher Desktop, etc.)
- ✅ Show available Docker contexts and endpoints
- ✅ Test Docker functionality with image pull and container run
- ✅ Display all installed Docker runtimes on your system
#### Manual Verification Script
Alternatively, run this quick verification script to check your setup:
```bash
#!/bin/bash
echo "🔍 Checking prerequisites..."
# Docker
if command -v docker &> /dev/null && docker info &> /dev/null; then
echo "✅ Docker: $(docker --version)"
else
echo "❌ Docker: Not installed or not running"
fi
# AWS CLI
if command -v aws &> /dev/null; then
echo "✅ AWS CLI: $(aws --version 2>&1 | head -1)"
else
echo "⚠️ AWS CLI: Not installed (required for ECR integration)"
fi
# SonarQube configuration
if [ -f ".env.sonar" ]; then
echo "✅ SonarQube: .env.sonar file found"
else
echo "⚠️ SonarQube: .env.sonar not found (Layer 7 will be skipped)"
fi
echo "🎯 Prerequisites check complete!"
```
## 🖥️ Web Dashboard (GUI)
Epyon ships a FastAPI-backed single-page web UI for running scans, browsing results, viewing SBOMs, managing suppressed findings, and analyzing security posture with the Security Score Card.
**Key Features:**
- **Security Score Card**: 6-dimensional weighted scoring (Security, Supply Chain, Code Quality, Compliance, Operational, MOSA) with TRL 1-9 mapping and letter grades
- **STIG History with Evidence Tracking**: View complete evidence timeline, confidence scores, and status change reasoning with visual indicators
- **Interactive Scan Management**: Run scans, browse results, filter findings, and manage suppressions
- **SBOM & Dependency Analysis**: Interactive tables with sorting, searching, and supply chain verification
- **Metrics Dashboard**: MTTR tracking, vulnerability trends, app monitoring classification, GitHub signals, SLA compliance, and suppression rate tracking
- **ISSO Compliance Summary**: Per-application ISSO compliance report combining STIG controls, severity findings, and suppression data — exportable as a structured document
- **Summary Document Export**: One-click export of AI-generated executive + technical summaries with embedded metrics and ISSO compliance table
### Setup (first time only)
Create a virtual environment (optional but recommended):
```bash
# From the repo root
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
```
> Dependencies are installed automatically when you run `start.sh`, so no manual `pip install` is needed.
### Start the server
```bash
# Option A — convenience script (recommended)
# Installs/updates dependencies automatically, then starts the server
cd web
./start.sh
# Option B — manual uvicorn
source .venv/bin/activate
cd web
pip install -q -r api/requirements.txt
python3 -m uvicorn api.main:app --host 127.0.0.1 --port 8000 --app-dir .
# Option C — hot-reload during development
pip install -q -r api/requirements.txt
python3 -m uvicorn api.main:app --host 127.0.0.1 --port 8000 --app-dir . --reload
```
Then open **http://127.0.0.1:8000** in your browser.
### Environment variables
| Variable | Default | Description |
|---|---|---|
| `HOST` | `127.0.0.1` | Bind address for `start.sh` |
| `PORT` | `8000` | Port for `start.sh` |
| `EPYON_SCANS_DIR` | `../scans` (relative to `web/`) | Directory where scan results are stored |
| `OPENAI_API_KEY` | *(optional)* | Enables AI-powered scan summaries |
| `NVD_API_KEY` | *(optional)* | NVD API key for CVSS enrichment (50 req/30s vs 5 req/30s unauthenticated). Get one at [nvd.nist.gov/developers/request-an-api-key](https://nvd.nist.gov/developers/request-an-api-key). Also configurable via web UI Settings page. |
| **Anchore/Grype Auto-Detection (v3.9.0+)** |||
| *(auto)* | *(inspects images)* | **Automatically detects**: architecture (ARM64/AMD64), base OS (Alpine/Debian/Ubuntu), runtime (Node.js/Python/Go/Java), and excludes build-stage dependencies. No configuration needed for GitHub Actions. |
| **Anchore Manual Overrides (optional)** |||
| `ANCHORE_PLATFORM` | Auto-detected | Override platform: `linux/amd64`, `linux/arm64`, `linux/aarch64` |
| `ANCHORE_EXCLUDE_TYPES` | Auto-configured | Override exclusions (comma-separated): `python,go,java,ruby` |
| `ANCHORE_SHOW_DISTRO` | `true` | Log detected OS/distro after each scan for debugging false positives |
| `ANCHORE_SKIP_BUILD` | `false` | Skip `docker compose build`, pull images from registry instead |
> **Note:** The scans displayed in the UI are read from the `scans/` directory at the repo root by default. Point `EPYON_SCANS_DIR` to a different path if your results live elsewhere.
>
> **Anchore v3.9.0+:** The scanner **automatically detects** image characteristics (OS, architecture, runtime) and prevents false positives without manual configuration. Manual overrides (`ANCHORE_*` env vars) are only needed for special cases. See **[documentation/ANCHORE_CONFIGURATION_GUIDE.md](documentation/ANCHORE_CONFIGURATION_GUIDE.md)** for details.
---
## 🤖 GitHub Actions Integration
**Use Epyon as a GitHub Action to automatically scan repositories!**
### 🎟️ Jira Ticket Creation
Epyon automatically creates Jira Cloud tickets for critical and high severity findings.
**Setup (one-time, in GitHub repo or org secrets):**
| Secret | Value |
|--------|-------|
| `JIRA_BASE_URL` | `https://yourcompany.atlassian.net` |
| `JIRA_USER_EMAIL` | Email tied to your Jira API token |
| `JIRA_API_TOKEN` | [Jira Cloud personal API token](https://id.atlassian.com/manage-profile/security/api-tokens) |
| `JIRA_PROJECT_KEY` | Project key in uppercase (e.g. `SAP`, `SEC`) |
**Behavior:**
- One ticket is created per severity group per repo: critical, high, medium, and low
- Each ticket contains an ADF table listing CVE/ID, package, version, and scanner tool for every finding
- Tickets are labeled `epyon`, `security`, `epyon-critical`/`epyon-high`/`epyon-medium`/`epyon-low`, and a repo slug
- **Deduplication**: if an unresolved ticket with matching labels already exists, creation is skipped and the existing ticket URL is logged
- Ticket creation is skipped entirely if `JIRA_*` secrets are not configured
### Quick Start - Scan Any Repository
1. **Go to your Epyon repository** on GitHub: `https://github.com/MetroStar/epyon`
2. **Click the "Actions" tab** at the top
3. **Select "Scan External Repository"** from the left sidebar
4. **Click "Run workflow"** (green button on the right)
5. **Enter the repository URL** you want to scan (e.g., `https://github.com/owner/repo.git`)
6. **Optional: Enter subdirectory path** to scan only part of a monorepo (e.g., `apps/api`)
7. **Select scan mode**:
- **quick** - Fast scan (~2-4 minutes) ⚡
- **full** - Complete analysis (~10-20 minutes) 🔍
- **nightly** - Full layers 1–12 without STIG, for scheduled runs 🌙
- **stig** - STIG-only assessment (Layer 13) 📋
8. **Click "Run workflow"** to start
9. **View results**:
- Click on the workflow run
- Click **"Summary"** in the left sidebar
- Scroll down to **"Artifacts"** section
- Download the ZIP file with all reports
### Automated Scan Mode Defaults
`scan-private-repo.yml` uses fixed automated defaults:
| Trigger | Scan Mode | Approx. Time |
|---------|-----------|-------------|
| `pull_request` | `quick` | 2–4 min |
| `push` (post-merge) | `full` | 10–20 min |
| `schedule` | `full` | 10–20 min |
| `workflow_dispatch` | your choice | varies |
This gives fast PR feedback and deeper security checks after merge. Quick mode automatically skips ClamAV, NVD enrichment, Checkov, and Xeol image pre-pulls.
### Garak (LLM) Workflow Inputs
The manual workflows expose Garak configuration fields directly in the Actions UI.
For `scan-private-repo.yml` and `scan-public-repo.yml`:
- `garak_target_type` (dropdown): `openai`, `test`, `huggingface`, `ollama`, `litellm`
- `garak_target_name` (dropdown): includes `gpt-4o-mini`, `gpt-4.1-mini`, and test presets
- `garak_target_name_custom` (text): optional override for any custom model name
- `garak_probes` (dropdown): includes `promptinject`, `dan`, `encoding`, `xss`, `all`
Production defaults are set to:
- `garak_target_type: openai`
- `garak_target_name: gpt-4o-mini`
- `garak_probes: promptinject`
### Garak API Key Requirements
For production Garak runs against OpenAI models, configure this GitHub Actions secret:
- `OPENAI_API_KEY`
Optional (only if using Anthropic-backed targets):
- `ANTHROPIC_API_KEY`
Without required provider keys, the Garak step runs but will not produce real target results.
### Scan a Specific PR or Branch (Manual)
When running `scan-private-repo.yml` or `scan-public-repo.yml` manually (`workflow_dispatch`), you can target a specific PR or branch:
- **PR scan**: set `pr_number` (example: `123`)
- **Branch/tag/commit scan**: set `target_ref` (examples: `feature/my-branch`, `refs/heads/main`, commit SHA)
- If both are provided, `pr_number` takes precedence
> For `scan-public-repo.yml`, PR targeting (`pr_number`) is intended for GitHub-hosted repositories.
Examples:
```text
pr_number: 123
target_ref: (empty)
```
```text
pr_number: (empty)
target_ref: feature/security-hardening
```
### Scan Specific Directories (Monorepos)
Epyon supports scanning specific subdirectories within repositories:
**Examples:**
```yaml
# Scan only the API directory in a monorepo
Repository: https://github.com/MetroStar/sapphire.git
Subdirectory: apps/sapphire-splunk/sapphire-ai-api
# Scan specific microservice
Repository: https://github.com/company/monorepo.git
Subdirectory: services/auth-service
# Leave subdirectory empty to scan entire repository
Repository: https://github.com/company/app.git
Subdirectory: (empty)
```
**Benefits:**
- 🚀 **Faster**: Only downloads needed files (sparse-checkout)
- 💾 **Less storage**: Doesn't clone entire monorepo
- 🎯 **Focused results**: Security findings for specific component
- 📊 **Better reports**: Scan name uses subdirectory (e.g., `sapphire-ai-api_user_2026-02-06`)
### Scan Integrity and Verification
Every scan automatically generates a **cryptographic manifest** for tamper detection and audit trails:
**Automatic Features:**
- 🔐 **SHA-256 hashes** of all report files
- 👤 **Attribution**: User, hostname, timestamp
- 📌 **Reproducibility**: Tool versions, git commit SHA
- ✅ **Verification**: Detect if reports are modified
- 📋 **STIG compliance**: AU-10, SI-7, AC-16 evidence
**Verify scan integrity:**
```bash
# Verify a scan hasn't been tampered with
./scripts/shell/verify-scan-manifest.sh scans/<scan_id>
# View manifest summary
cat scans/<scan_id>/manifest-summary.txt
```
**Exit codes for CI/CD:**
- `0` - All files verified (✅ Pass)
- `1` - Tampering detected (❌ Fail)
- `2` - Files missing (⚠️ Warning)
See [Scan Manifest Guide](documentation/SCAN_MANIFEST_GUIDE.md) for complete details.
### Add to Your Own Repository
Want automatic scanning on every push and PR?
#### Option A — npm (recommended)
```bash
npm install github:MetroStar/epyon --save-dev
```
The postinstall script automatically writes `.github/workflows/scan-private-repo.yml` into your project. Re-running `npm install` or `npm update` always pulls the latest workflow.
Then commit and push:
```bash
git add .github/workflows/scan-private-repo.yml
git commit -m "Add Epyon security scanning"
git push
```
#### Option B — curl
```bash
# In your repository directory
mkdir -p .github/workflows
curl -o .github/workflows/scan-private-repo.yml \
https://raw.githubusercontent.com/MetroStar/epyon/main/.github/workflows/scan-private-repo.yml
```
Then commit and push:
```bash
git add .github/workflows/scan-private-repo.yml
git commit -m "Add Epyon security scanning"
git push
```
#### Required secrets (both options)
Configure these in your GitHub repo **Settings → Secrets and variables → Actions**:
| Secret | Required | Purpose |
|--------|----------|---------|
| `SONAR_TOKEN` + `SONAR_HOST_URL` | Optional | Enables SonarQube layer |
| `JIRA_BASE_URL` + `JIRA_USER_EMAIL` + `JIRA_API_TOKEN` + `JIRA_PROJECT_KEY` | Optional | Enables Jira ticket creation |
| `OPENAI_API_KEY` | Optional | Enables Garak LLM probing + STIG assessment |
Once configured, Epyon will automatically:
- ✅ Scan every push to `main` or `develop`
- ✅ Scan all pull requests
- ✅ Run daily security scans at 2 AM UTC
- ✅ Comment on PRs with findings
- ✅ Fail builds on critical vulnerabilities
**How it works:**
The workflow checks out both your repository and Epyon, then runs Epyon's scanners against your code. No need to install anything in your repo!
### What You Get
**📦 Artifacts (downloadable):**
- Interactive HTML dashboard with executive + technical summaries
- ISSO compliance summary document (exportable)
- Individual tool reports (HTML, Markdown, CSV)
- Raw JSON data
- Complete SBOM
**📊 In Pull Requests:**
- Automated security comments
- Severity summary
- Links to detailed reports
**⚡ Fast Feedback:**
- Quick mode: 2-5 minutes
- Full mode: 10-20 minutes
- Runs in parallel with your CI/CD
👉 **Full documentation**: [.github/README.md](.github/README.md)
## 🏗️ Architecture Components
### 🐳 Approved Base Images
Epyon uses **Docker Hardened Images (DHI)** as the default baseline for container security scans:
**Primary Baseline Image:** `dhi/caddy:latest`
**Why Docker Hardened Images?**
- 🔒 **Distroless**: Minimal attack surface with no package manager
- ✅ **Reduced CVEs**: Significantly fewer vulnerabilities than traditional base images
- 🛡️ **Security First**: Built with security as the primary design principle
- 📜 **FIPS Compliant**: Meets federal security standards
- 🔄 **Regular Updates**: Maintained with latest security patches
**Available DHI Images:**
- `dhi/caddy` - Web server and reverse proxy
- `dhi/node` - Node.js runtime
- `dhi/nginx` - High-performance web server
- `dhi/httpd` - Apache HTTP server
- `dhi/python` - Python runtime
**Configuration:** Baseline images are defined in [configuration/approved-base-images.conf](configuration/approved-base-images.conf)
**More Info:** [Docker Hardened Images Catalog](https://hub.docker.com/hardened-images/catalog)
---
### Current Security Layers (17 Operational):
1. **� SBOM Generation** - Complete Software Bill of Materials with Syft (CycloneDX + SPDX)
2. **🔍 TruffleHog** - Multi-target secret detection with filesystem, container, and registry scanning
3. **📊 SonarQube** - Code quality analysis with test coverage metrics
4. **🦠 ClamAV** - Enterprise antivirus scanning with real-time virus definition updates
5. **⚓ Helm** - Kubernetes chart validation, linting, and packaging
6. **🔒 Checkov** - Infrastructure as Code security scanning (Terraform, Kubernetes, Docker)
7. **🐳 Trivy** - Comprehensive security scanner for containers, filesystems, and Kubernetes
8. **🎯 Grype** - Advanced vulnerability scanning with SBOM generation and multi-format support
9. **🐍 pip-audit** - Direct Python dependency CVE scanning from dependency files
10. **🛡️ Safety** - Python vulnerability scanning with OSV-backed advisory coverage
11. **⏰ Xeol** - End-of-Life software detection for proactive dependency management
12. **⚓ Anchore** - Deep container and software composition analysis
13. **🔍 API Discovery** - Automatic API endpoint detection (OpenAPI, Express, Flask, Django, Next.js App Router)
14. **🤖 Garak** - LLM vulnerability probing and red-team style safety testing
15. **🌐 Network Discovery** - Port, protocol, and service enumeration from config files and manifests
16. **🥒 PickleScan** - ML model serialization safety scanning (`.pkl`, `.pt`, `.bin`, `.h5`, `.ckpt`, etc.)
17. **📄 Model Card Compliance** - HuggingFace model card validation against documentation standards
### Quality Assurance
**✅ Comprehensive Test Coverage:**
- **789 automated tests** across 50 test files (100% pass rate)
- **48 shell scripts** fully covered with unit tests
- **BATS** (Bash Automated Testing System) framework
- Validates scanner integration, orchestration, dashboards, exports, and utilities
**✅ Fixed Critical Bugs:**
- **CVE GHSA-5xr6-xhww-33m4**: Updated artifact download action (v3→v6)
- **API Discovery**: Fixed duplicate `fi` syntax error breaking Next.js detection
- **Checkov Parsing**: Fixed array format handling in dashboard generation
- **Safety Artifact Upload**: Fixed self-referential symlink loop causing GitHub Actions `upload-artifact` `ELOOP` failures
- **Python CVE Layer Reliability**: CI now installs `pip-audit` and `safety` explicitly so dependency CVEs are detected and rendered into dashboards consistently
- **Athena Parity Improvements**: pip-audit scanner now uses OSV-backed compatible CLI flags for v2.10+, writes parser-compatible `scan_results` output, and adds resolved environment auditing to catch transitive CVEs not visible from raw requirements files alone
- **Dashboard corruption from CVE descriptions**: Fixed `generate-dashboard.py` to escape `</script>` sequences in embedded scan JSON so long/complex CVE descriptions (e.g. DOMPurify disclosures) can no longer break the stakeholder dashboard
**✅ Baseline Scanning:**
- Scans DHI baseline images (`dhi/caddy:latest`)
- Automated comparison with previous scans
- Detects scanner drift and tool consistency issues
- Scheduled runs every 89 days to maintain artifact retention
## 📁 Directory Structure
```
epyon/
├── .github/workflows/ # GitHub Actions workflows
│ ├── epyon-scan.yml # Reusable security scan workflow
│ ├── target-scan.yml # Target repository scanning
│ └── scan-private-repo.yml # Reusable workflow for any repository
├── scripts/shell/ # Shell scripts (Bash-compatible)
│ ├── run-target-security-scan.sh # Main orchestrator
│ ├── run-baseline-scan.sh # Baseline scanning with DHI
│ ├── run-api-discovery.sh # API endpoint detection
│ ├── generate-security-dashboard.sh # Interactive HTML dashboard
│ ├── generate-interactive-dashboard.sh # Enhanced dashboard with filtering
│ ├── generate-remediation-suggestions.sh # Automated fix recommendations
│ ├── consolidate-security-reports.sh # Unified reporting
│ ├── run-sonar-analysis.sh
│ ├── run-trufflehog-scan.sh
│ ├── run-clamav-scan.sh
│ ├── run-helm-build.sh
│ ├── run-checkov-scan.sh
│ ├── run-garak-scan.sh
│ ├── run-trivy-scan.sh
│ ├── run-grype-scan.sh
│ ├── run-xeol-scan.sh
│ ├── run-sbom-scan.sh
│ ├── export-api-discovery.sh
│ ├── export-sbom.sh
│ ├── check-severity-gate.sh
│ ├── update-base-images.sh
│ └── ... (48 scripts total)
├── tests/shell/ # Test suite (BATS)
│ ├── test-run-*.bats # Scanner tests (11 files)
│ ├── test-generate-*.bats # Dashboard/report tests (4 files)
│ ├── test-export-*.bats # Export tests (2 files)
│ ├── test-check-*.bats # Validation tests (2 files)
│ ├── test-consolidate-*.bats # Consolidation tests
│ └── run-tests.sh # Test runner
├── configuration/
│ └── approved-base-images.conf # DHI baseline images
├── documentation/ # Essential documentation
│ ├── SECURITY_REVIEW_AND_TEST_COVERAGE.md # Security review (Feb 2026)
│ ├── SCAN_DIRECTORY_ARCHITECTURE.md # Scan organization
│ ├── OFFLINE_AIR_GAPPED_SETUP.md # Air-gapped deployment
│ └── README.md # Documentation index
├── scans/ # Scan results (isolated directories)
│ └── {project}_{user}_{timestamp}/
│ ├── trivy/
│ ├── grype/
│ ├── checkov/
│ ├── trufflehog/
│ ├── clamav/
│ ├── xeol/
│ ├── garak/
│ ├── sbom/
│ ├── api-discovery/
│ └── consolidated-reports/
│ └── dashboards/
│ └── security-dashboard.html
└── baseline/ # Baseline scan repository
└── comet-starter/ # MetroStar baseline project
```
│ ├── html-reports/ # Tool-specific HTML reports
│ ├── markdown-reports/ # Summary reports
│ └── csv-reports/ # Data exports
└── documentation/ # Complete setup and architecture guides
├── SECURITY_AND_QUALITY_SETUP.md
└── COMPREHENSIVE_SECURITY_ARCHITECTURE.md
```
## 🚀 Quick Start
### 1. Verify Container Runtime
Before running scans, verify your container runtime is properly configured:
```bash
# Check Docker/Podman/nerdctl detection and permissions
./scripts/shell/check-docker-runtime.sh
# If you see "Container runtime requires elevated permissions"
# Follow the instructions to activate your docker group membership
# (typically requires logging out and back in)
# Temporary workaround: run with sudo
sudo ./scripts/shell/check-docker-runtime.sh
```
**Supported Container Runtimes:**
- Docker (Docker Engine, Docker Desktop)
- Podman (rootless or rootful)
- nerdctl (containerd CLI)
- Alternative Docker distributions (Colima, Rancher Desktop, OrbStack)
All scripts automatically detect and use whichever runtime is available.
### 2. Target-Aware Security Scanning (Recommended)
Scan any external application or directory with comprehensive security analysis and centralized output:
```bash
# Quickest start — use the root entry point (no need to remember script paths)
./epyon.sh /path/to/your/project # Full scan (all 15 layers)
./epyon.sh /path/to/your/project quick # Quick scan
./epyon.sh --help # Full option reference
# Or call the scanner directly
# Quick scan (core tools: Syft, TruffleHog, ClamAV, Trivy, Grype)
./scripts/shell/run-target-security-scan.sh "/path/to/your/project" quick
# Full scan (all layers)
./scripts/shell/run-target-security-scan.sh "/path/to/your/project" full
# Scan a Git repository directly
./scripts/shell/run-target-security-scan.sh "https://github.com/user/repo.git" full
# Image-focused security scan (6 container tools)
./scripts/shell/run-target-security-scan.sh "/path/to/your/project" images
# Analysis-only mode (existing reports)
./scripts/shell/run-target-security-scan.sh "/path/to/your/project" analysis
# Windows with WSL (Windows Subsystem for Linux)
# Ensure you're in the epyon repository directory
cd C:\path\to\epyon
# Quick scan - local directory
wsl ./scripts/shell/run-target-security-scan.sh "/mnt/c/path/to/your/project" quick
# Full scan - local directory (convert Windows paths to WSL format)
wsl ./scripts/shell/run-target-security-scan.sh "/mnt/c/Users/username/Desktop/project" full
# Full scan - Git repository
./scripts/shell/run-target-security-scan.sh "https://github.com/user/repo.git" full
# Image-focused security scan
./scripts/shell/run-target-security-scan.sh "/path/to/project" images
# Scan specific subdirectory within a Git repository (sparse-checkout)
./scripts/shell/run-target-security-scan.sh --subdir apps/api "https://github.com/user/repo.git" full
./scripts/shell/run-target-security-scan.sh --subdir apps/sapphire-splunk/sapphire-ai-api "https://github.com/MetroStar/sapphire.git"
```
**Windows Users - Path Conversion:**
When using WSL, Windows paths must be converted to WSL format:
- Windows: `C:\Users\username\project` → WSL: `/mnt/c/Users/username/project`
- Windows: `D:\repos\myapp` → WSL: `/mnt/d/repos/myapp`
**Windows Users - WSL Prerequisites:**
```bash
# 1. Enable WSL (if not already enabled)
wsl --install
# 2. Ensure Docker Desktop is running with WSL 2 backend
# Open Docker Desktop → Settings → Resources → WSL Integration
# Enable integration with your WSL distribution
# 3. Verify Docker is accessible from WSL
wsl docker --version
wsl docker ps
# 4. Fix line endings for shell scripts (one-time setup)
wsl bash -c "find ./scripts/shell -name '*.sh' -type f -exec sed -i 's/\r$//' {} \;"
wsl bash -c "chmod +x ./scripts/shell/*.sh"
```
**Isolated Scan Architecture:**
All scan results are stored in `scans/{scan_id}/` where `scan_id` format is:
```
{target_name}_{username}_{timestamp}
Example: comet_rnelson_2025-11-25_09-40-22
```
**Complete Scan Isolation:**
- Each scan is self-contained in its own directory
- No centralized reports/ directory - full isolation for audit trails
- Tool-specific subdirectories: `trufflehog/`, `clamav/`, `sonar/`, etc.
- Consolidated reports: `consolidated-reports/dashboards/security-dashboard.html`
- Historical scans preserved indefinitely for compliance and trending
**Quick Dashboard Access:**
```bash
# Simplest way - opens latest scan dashboard automatically
./scripts/shell/open-latest-dashboard.sh
# Or manually open latest
LATEST_SCAN=$(ls -t scans/ | head -1)
open scans/$LATEST_SCAN/consolidated-reports/dashboards/security-dashboard.html
# Regenerate dashboard for latest scan (if needed)
./scripts/shell/consolidate-security-reports.sh # Auto-detects latest scan
```
### Cross-Platform Script Execution
**Unix/Linux/macOS (Shell):**
```bash
cd /path/to/epyon
# Full scan - all 15 layers (recommended)
./epyon.sh "/path/to/project" full
# Individual Layer Execution using TARGET_DIR method:
# Layer 1: SBOM Generation (Syft - CycloneDX + Syft JSON)
TARGET_DIR="/path/to/project" ./scripts/shell/run-sbom-scan.sh
# Layer 2: Secret Detection (TruffleHog)
TARGET_DIR="/path/to/project" ./scripts/shell/run-trufflehog-scan.sh filesystem
# Layer 3: Code Quality Analysis (SonarQube)
TARGET_DIR="/path/to/project" ./scripts/shell/run-sonar-analysis.sh
# Layer 4: Malware Detection (ClamAV)
TARGET_DIR="/path/to/project" ./scripts/shell/run-clamav-scan.sh
# Layer 5: Helm Chart Building - Interactive ECR authentication
TARGET_DIR="/path/to/project" ./scripts/shell/run-helm-build.sh
# Layer 6: IaC Security (Checkov)
TARGET_DIR="/path/to/project" ./scripts/shell/run-checkov-scan.sh filesystem
# Layer 7: Container Security (Trivy)
TARGET_DIR="/path/to/project" ./scripts/shell/run-trivy-scan.sh filesystem
# Layer 8: Vulnerability Scanning (Grype)
TARGET_DIR="/path/to/project" ./scripts/shell/run-grype-scan.sh filesystem
# Layer 9: EOL Detection (Xeol)
TARGET_DIR="/path/to/project" ./scripts/shell/run-xeol-scan.sh filesystem
# Layer 10: Container Analysis (Anchore)
TARGET_DIR="/path/to/project" ./scripts/shell/run-anchore-scan.sh
# Layer 12: LLM Security Probing (Garak — opt-in via RUN_GARAK=true)
TARGET_DIR="/path/to/project" ./scripts/shell/run-garak-scan.sh
# Layer 14: Pickle/Serialization Safety
TARGET_DIR="/path/to/model-repo" ./scripts/shell/run-picklescan.sh
# Layer 15: Model Card Compliance
TARGET_DIR="/path/to/model-repo" ./scripts/shell/run-modelcard-check.sh
# Report Consolidation (integrated into complete scan)
./scripts/shell/consolidate-security-reports.sh
```
> **Windows Users**: Use WSL (Windows Subsystem for Linux) with the bash commands above. See the WSL prerequisites section for setup instructions. Native PowerShell is not supported — all Epyon scripts are Bash-based.
### Baseline Scanning for Scanner Drift Detection
Epyon currently supports local baseline scanning for scanner drift validation.
GitHub Actions scan modes are `quick`, `full`, and `stig`.
#### Local Baseline Scanning (Recommended for Scanner Validation)
**For validating scanner consistency and detecting tool drift:**
```bash
# Run initial baseline scan (clones comet-starter if needed)
./scripts/shell/run-baseline-scan.sh
# Update repository and run new baseline scan
./scripts/shell/run-baseline-scan.sh --update-repo
# Mark the most recent scan as official baseline (with SHA256 hash)
./scripts/shell/run-baseline-scan.sh --set-baseline
# Mark a specific scan as official baseline
./scripts/shell/run-baseline-scan.sh --set-baseline comet-starter_rnelson_2026-01-22_08-41-30
# Compare latest scan with official baseline
./scripts/shell/run-baseline-scan.sh --compare
# List all baseline scans (★ marks official baseline)
./scripts/shell/run-baseline-scan.sh --list
```
**Local Baseline Features:**
- 🎯 **Consistent Reference**: Uses MetroStar/comet-starter as standard baseline application
- 🔐 **SHA256 Hashing**: Cryptographic hash of security findings for integrity verification
- 📌 **Official Baseline**: Mark and track a specific scan as the authoritative reference
- 📊 **Drift Detection**: Compare scans over time to detect tool inconsistencies
- ✅ **0% Error Margin**: Validate identical results when scanning the same codebase
- 📈 **Historical Tracking**: All baseline scans preserved with timestamps and commit info
- 🔍 **Visual Comparison**: Automatically opens dashboards side-by-side for analysis
- 🔒 **Integrity Verification**: Baseline reference file with hash prevents tampering
**Baseline Reference File** (`baseline/.baseline-reference`):
```bash
BASELINE_SCAN_ID="comet-starter_rnelson_2026-01-22_08-41-30"
BASELINE_SCAN_PATH="scans/comet-starter_rnelson_2026-01-22_08-41-30"
BASELINE_HASH="c5096e8ed66e4b612c4b5629ac9e6fec1a1db679f184d2d515a0240189b34629"
BASELINE_HASH_ALGORITHM="SHA256"
BASELINE_REPO_COMMIT="a46f32b"
BASELINE_SET_DATE="2026-01-22T14:47:55Z"
BASELINE_SET_BY="rnelson"
```
**Use Cases:**
- **GitHub Actions**: Compare security posture between releases, track vulnerability trends, establish benchmarks
- **Local Scanning**: Validate scanner updates, ensure tool signatures are current, detect configuration drift