|
| 1 | +# **OWASP Dependency Check Evidence Example** |
| 2 | + |
| 3 | +This repository provides a working example of a GitHub Actions workflow that automates Java Maven project security scanning using **OWASP Dependency Check**. It then attaches the resulting vulnerability report as signed, verifiable evidence to the package in **JFrog Artifactory**. |
| 4 | + |
| 5 | +This workflow is an essential pattern for DevSecOps, creating a traceable, compliant, and secure software supply chain with comprehensive security vulnerability assessment. |
| 6 | + |
| 7 | +### **Key Features** |
| 8 | + |
| 9 | +* **Automated Build & Deploy**: Builds a Java Maven project and deploys it to Artifactory. |
| 10 | +* **OWASP Dependency Check**: Runs comprehensive security vulnerability scanning using OWASP Dependency Check. |
| 11 | +* **Vulnerability Report Generation**: Generates detailed JSON vulnerability reports with CVSS scoring. |
| 12 | +* **Optional Markdown Report**: Includes a helper script to generate a human-readable Markdown summary from the Dependency Check JSON results. |
| 13 | +* **Signed Evidence Attachment**: Attaches the vulnerability scan results to the corresponding package version in Artifactory using jf evd create, cryptographically signing it for integrity. |
| 14 | +* **OWASP Dependency Check**: [OWASP Dependency Check](https://owasp.org/www-project-dependency-check/) security vulnerability scanner |
| 15 | + |
| 16 | +### **Workflow** |
| 17 | + |
| 18 | +The following diagram illustrates the sequence of operations performed by the GitHub Actions workflow. |
| 19 | + |
| 20 | +```mermaid |
| 21 | +graph TD |
| 22 | + A[Workflow Dispatch Trigger] --> B[Setup JFrog CLI] |
| 23 | + B --> C[Checkout Repository] |
| 24 | + C --> D[Setup JDK 21] |
| 25 | + D --> E[Build and Publish Java Package to Artifactory] |
| 26 | + E --> F[Run OWASP Dependency Check Scan] |
| 27 | + F --> G[Generate Vulnerability Report] |
| 28 | + G --> H{Attach Optional Custom Markdown Report?} |
| 29 | + H -->|Yes| I[Generate Custom Markdown Report] |
| 30 | + H -->|No| J[Skip Markdown Report] |
| 31 | + I --> K[Attach Evidence to Package] |
| 32 | + J --> K[Attach Evidence to Package] |
| 33 | +``` |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +### **1. Prerequisites** |
| 38 | + |
| 39 | +Before running this workflow, you must have: |
| 40 | + |
| 41 | +* JFrog CLI 2.65.0 or above (installed automatically in the workflow) |
| 42 | +* An Artifactory repository of type maven (e.g., maven-depcheck-local). |
| 43 | +* A private key and a corresponding key alias configured in your JFrog Platform for signing evidence. |
| 44 | +* The following GitHub repository variables: |
| 45 | + * `JF_URL` (Artifactory base URL, e.g. `https://mycompany.jfrog.io`) |
| 46 | + * `EVIDENCE_KEY_ALIAS` (Key alias for signing evidence) |
| 47 | +* The following GitHub repository secrets: |
| 48 | + * `ARTIFACTORY_ACCESS_TOKEN` (Artifactory access token) |
| 49 | + * `PRIVATE_KEY` (Private key for signing evidence) |
| 50 | + |
| 51 | +### Environment Variables Used |
| 52 | + |
| 53 | +* `REGISTRY_DOMAIN` - Maven registry domain |
| 54 | +* `REPO_NAME` - Maven repository name |
| 55 | +* `PACKAGE_NAME` - Maven artifact name |
| 56 | +* `VERSION` - Build version (uses GitHub run number) |
| 57 | +* `BUILD_NAME` - Build information name in Artifactory |
| 58 | +* `ATTACH_OPTIONAL_CUSTOM_MARKDOWN_TO_EVIDENCE` - Controls markdown report generation |
| 59 | + |
| 60 | +### **2. Configuration** |
| 61 | + |
| 62 | +To use this workflow, you must configure the following GitHub Repository Secrets and Variables. |
| 63 | + |
| 64 | +#### **GitHub Secrets** |
| 65 | + |
| 66 | +Navigate to Settings > Secrets and variables > Actions and create the following secrets: |
| 67 | + |
| 68 | +| Secret Name | Description | |
| 69 | +| :---- | :---- | |
| 70 | +| ARTIFACTORY_ACCESS_TOKEN | A valid JFrog Access Token with permissions to read, write, and annotate in your target repository. | |
| 71 | +| PRIVATE_KEY | The private key used to sign the evidence. This key corresponds to the alias configured in JFrog Platform. | |
| 72 | + |
| 73 | +#### **GitHub Variables** |
| 74 | + |
| 75 | +Navigate to Settings > Secrets and variables > Actions and create the following variables: |
| 76 | + |
| 77 | +| Variable Name | Description | Example Value | |
| 78 | +| :---- | :---- | :---- | |
| 79 | +| JF_URL | The base URL of your JFrog Platform instance. | https://mycompany.jfrog.io | |
| 80 | +| EVIDENCE_KEY_ALIAS | The alias for the public key in JFrog Platform used to verify the evidence signature. | my-signing-key-alias | |
| 81 | + |
| 82 | +#### **Workflow Environment Variables** |
| 83 | + |
| 84 | +You can also customize the workflow's behavior by modifying the env block in the .github/workflows/owasp-depcheck-evidence-example.yml file: |
| 85 | + |
| 86 | +| Variable Name | Description | Default Value | |
| 87 | +| :---- | :---- | :---- | |
| 88 | +| REPO_NAME | The name of the target Maven repository in Artifactory. | maven-depcheck-local | |
| 89 | +| PACKAGE_NAME | The name of the Maven artifact to be built and deployed. | simple-java-depcheck | |
| 90 | +| BUILD_NAME | The name assigned to the build information in Artifactory. | depcheck-maven-build | |
| 91 | +| ATTACH_OPTIONAL_CUSTOM_MARKDOWN_TO_EVIDENCE | Set to true to generate and attach a Markdown report alongside the JSON evidence. Set to false to skip this step. | true | |
| 92 | + |
| 93 | +--- |
| 94 | + |
| 95 | +### **3. Usage** |
| 96 | + |
| 97 | +This workflow is triggered manually. |
| 98 | + |
| 99 | +1. Navigate to the **Actions** tab of your forked repository. |
| 100 | +2. In the left sidebar, click on the **Dependency Check with Evidence Integration** workflow. |
| 101 | +3. Click the **Run workflow** dropdown button. You can leave the default branch selected. |
| 102 | +4. Click the green **Run workflow** button. |
| 103 | + |
| 104 | +## Repository Structure |
| 105 | + |
| 106 | +``` |
| 107 | +examples/depcheck/ |
| 108 | +├── .github/workflows/ |
| 109 | +│ └── owasp-depcheck-evidence-example.yml # Main workflow with evidence integration |
| 110 | +├── examples/depcheck/ |
| 111 | +│ ├── src/ # Java Maven project |
| 112 | +│ │ ├── main/java/com/example/ # Source code |
| 113 | +│ │ └── pom.xml # Maven configuration |
| 114 | +│ └── scripts/ |
| 115 | +│ └── markdown-converter.py # Evidence report converter |
| 116 | +└── README.md # This file |
| 117 | +``` |
| 118 | + |
| 119 | +## Workflow Overview |
| 120 | + |
| 121 | +The GitHub Actions workflow (`owasp-depcheck-evidence-example.yml`) performs the following steps: |
| 122 | + |
| 123 | +### 1. **Build and Package** |
| 124 | +- Sets up Java 21 environment |
| 125 | +- Builds the Maven project |
| 126 | +- Deploys artifacts to JFrog Artifactory |
| 127 | + |
| 128 | +### 2. **Security Scanning** |
| 129 | +- Runs OWASP Dependency Check on built artifacts |
| 130 | +- Scans for known vulnerabilities in dependencies |
| 131 | +- Generates JSON vulnerability reports |
| 132 | + |
| 133 | +### 3. **Evidence Generation** |
| 134 | +- Converts JSON reports to readable markdown format (optional) |
| 135 | +- Creates evidence reports suitable for attachment to packages |
| 136 | +- Provides comprehensive vulnerability analysis |
| 137 | + |
| 138 | +### 4. **Evidence Attachment** |
| 139 | +- Publishes build information to JFrog Artifactory |
| 140 | +- Attaches signed evidence to builds in JFrog Artifactory |
| 141 | +- Uses cryptographic signing for evidence integrity |
| 142 | +- Creates verifiable security attestation |
| 143 | + |
| 144 | +## Evidence Integration |
| 145 | + |
| 146 | +This project follows the evidence management pattern from [JFrog Evidence Examples](https://github.com/jfrog/Evidence-Examples), where: |
| 147 | + |
| 148 | +- **Security scan results** become verifiable evidence |
| 149 | +- **Markdown reports** provide human-readable evidence |
| 150 | +- **Evidence is attached** to packages for security attestation |
| 151 | +- **Signed evidence** ensures integrity and authenticity |
| 152 | + |
| 153 | +## Local Development |
| 154 | + |
| 155 | +For local development and testing: |
| 156 | + |
| 157 | +```bash |
| 158 | +# Build the project locally |
| 159 | +cd examples/depcheck/src |
| 160 | +mvn clean compile package |
| 161 | + |
| 162 | +# Run dependency check (requires OWASP Dependency Check CLI) |
| 163 | +dependency-check --scan target/ --format JSON --out reports/ |
| 164 | + |
| 165 | +# Convert to markdown evidence |
| 166 | +python ../scripts/markdown-converter.py reports/dependency-check-report.json |
| 167 | +``` |
| 168 | + |
| 169 | +## Dependency Check Configuration |
| 170 | + |
| 171 | +The workflow configures OWASP Dependency Check with: |
| 172 | + |
| 173 | +- **Project Name**: Uses the package name for consistency |
| 174 | +- **Output Format**: JSON for processing, optional Markdown for evidence |
| 175 | +- **Scan Path**: Maven target directory (`examples/depcheck/src/target`) |
| 176 | +- **No Updates**: Uses cached vulnerability database (`--noupdate`) |
| 177 | +- **Evidence Type**: `https://owasp.org/dependency-check` predicate type |
| 178 | +- **Evidence Attachment**: Attaches evidence to build information in Artifactory |
| 179 | + |
| 180 | +## Evidence Management |
| 181 | + |
| 182 | +### Attaching Evidence to Builds |
| 183 | + |
| 184 | +This workflow follows the JFrog Evidence Examples pattern by attaching evidence to builds: |
| 185 | + |
| 186 | +1. **Build Evidence** - Security scan results attached to build information in Artifactory |
| 187 | +2. **Build Publishing** - Build information is published to Artifactory for evidence attachment |
| 188 | +3. **Signed Evidence** - Cryptographically signed vulnerability reports |
| 189 | +4. **Verifiable Evidence** - Evidence that can be verified using the configured key alias |
| 190 | + |
| 191 | +### Evidence Types Generated |
| 192 | + |
| 193 | +- **Dependency Check JSON Report** - Raw vulnerability data in JSON format |
| 194 | +- **Markdown Evidence Report** - Human-readable security summary (optional) |
| 195 | +- **Build Evidence** - Evidence attached to build information in Artifactory |
| 196 | +- **Signed Evidence** - Cryptographically signed evidence for integrity verification |
| 197 | + |
| 198 | +## Security Considerations |
| 199 | + |
| 200 | +- **CVSS Scoring**: Uses industry-standard Common Vulnerability Scoring System |
| 201 | +- **Vulnerability Assessment**: Comprehensive scanning of dependencies for known vulnerabilities |
| 202 | +- **Evidence Integrity**: Generated evidence is cryptographically signed for authenticity |
| 203 | +- **Audit Trail**: Complete record of security assessments with verifiable evidence |
| 204 | +- **CVE References**: Direct links to vulnerability databases for detailed information |
| 205 | + |
| 206 | +## Contributing |
| 207 | + |
| 208 | +This project follows the evidence management patterns established by JFrog Evidence Examples. Contributions should: |
| 209 | + |
| 210 | +1. Maintain evidence integrity and verifiability |
| 211 | +2. Follow the established workflow patterns for security scanning |
| 212 | +3. Ensure vulnerability scan results are properly formatted |
| 213 | +4. Include appropriate documentation for evidence types |
| 214 | +5. Maintain consistency with the OWASP Dependency Check integration |
| 215 | + |
| 216 | +## References |
| 217 | + |
| 218 | +- [JFrog Evidence Examples](https://github.com/jfrog/Evidence-Examples) - Original inspiration and patterns |
| 219 | +- [OWASP Dependency Check](https://owasp.org/www-project-dependency-check/) - Vulnerability scanning tool |
| 220 | +- [JFrog Evidence Management](https://jfrog.com/help/r/jfrog-artifactory-documentation/evidence-management-overview) - Evidence management documentation |
| 221 | +- [CVSS Scoring System](https://www.first.org/cvss/) - Vulnerability severity scoring |
0 commit comments