REST API for uploading SBOMs to Dependency-Track with hierarchical project management.
District (SuperParent) → Business Line (Parent) → Project (Child)
Upload SBOM with metadata for GitLab pipeline integration.
district - District name (SuperParent)business_line - Business line name (Parent)project_name - Project name (Child)version - Project versionsbom - SBOM file (multipart/form-data)gitlab_project_id - GitLab project IDgitlab_pipeline_id - GitLab pipeline IDcommit_sha - Git commit SHAbranch - Git branch (default: main)tags - Comma-separated custom tagscurl -X POST http://localhost:8888/api/v1/sbom/upload \ -F "district=North America" \ -F "business_line=Financial Services" \ -F "project_name=payment-api" \ -F "version=1.2.3" \ -F "gitlab_project_id=123" \ -F "commit_sha=abc123def456" \ -F "branch=main" \ -F "tags=production,api" \ -F "sbom=@/path/to/sbom.json"
Get project hierarchy for a district/business line.
district (required) - District namebusiness_line (optional) - Filter by business lineGET /api/v1/projects/hierarchy?district=North%20America&business_line=Financial%20Services
Get all versions for a specific project.
district (required) - District namebusiness_line (required) - Business line nameGET /api/v1/projects/payment-api/versions?district=North%20America&business_line=Financial%20Services
Health check endpoint for load balancers.
{"status": "healthy", "service": "sbom-upload-validator"}
Environment variables:
DT_URL - Dependency-Track server URLDT_API_KEY - Dependency-Track API keyPORT - Server port (default: 8888)FLASK_ENV - Set to 'development' for debug modeExample GitLab CI job for SBOM upload:
sbom_upload:
stage: security
script:
- |
curl -X POST $SBOM_VALIDATOR_URL/api/v1/sbom/upload \
-F "district=$DISTRICT" \
-F "business_line=$BUSINESS_LINE" \
-F "project_name=$CI_PROJECT_NAME" \
-F "version=$CI_COMMIT_TAG" \
-F "gitlab_project_id=$CI_PROJECT_ID" \
-F "gitlab_pipeline_id=$CI_PIPELINE_ID" \
-F "commit_sha=$CI_COMMIT_SHA" \
-F "branch=$CI_COMMIT_REF_NAME" \
-F "sbom=@sbom.json"
only:
- tags