
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
sbom-upload-validator
Advanced tools
Production-ready API for GitLab SBOM uploads to Dependency-Track with hierarchical management
An API service for GitLab pipeline SBOM uploads to OWASP Dependency-Track with hierarchical project management, comprehensive CI/CD automation, and federal network support.
The system implements a three-tier hierarchy in Dependency-Track:
# Install from PyPI (latest stable release)
pip install sbom-upload-validator==1.1.0
# Set environment variables
export DT_URL=http://your-dependency-track-api-url
export DT_API_KEY=your-api-key
export API_KEY_GITLAB=your-sbom-upload-api-key
# Run the service
sbom-validator --host 0.0.0.0 --port 8888
# Pull from Docker Hub (multi-platform: AMD64/ARM64)
docker pull stljim/sbom-upload-validator:1.1.0
# Run container
docker run -p 8888:8888 \
-e DT_URL=http://your-dependency-track-url \
-e DT_API_KEY=your-api-key \
-e API_KEY_GITLAB=your-sbom-upload-api-key \
stljim/sbom-upload-validator:1.1.0
# Or use latest tag (always points to latest stable release)
docker pull stljim/sbom-upload-validator:latest
# Clone the repository
git clone https://github.com/StL-Jim/sbom-upload-validator.git
cd sbom-upload-validator
# Install dependencies
pip install -r requirements.txt
# Set environment variables
export DT_URL=http://your-dependency-track-api-url
export DT_API_KEY=your-api-key
export API_KEY_GITLAB=your-sbom-upload-api-key
# Run the service
python app.py
# Start complete development stack
docker compose up -d
# This includes:
# - PostgreSQL database
# - Dependency-Track API server
# - Dependency-Track frontend
# - SBOM Upload Validator API
The PyPI package includes command-line tools for management:
# Start the API server
sbom-validator --host 0.0.0.0 --port 8888
# Initialize hierarchy from YAML config
dt-hierarchy-init --config dt_hierarchy_config.yaml --dry-run
# Validate configuration
dt-config-validate
The system implements a comprehensive organizational hierarchy with team-based access control:
Organization: STLS
βββ Technology Operations (District)
β βββ Software Development
β β βββ ci-cd-pipeline
β β βββ code-repository
β β βββ testing-framework
β βββ Infrastructure Services
β β βββ backup-system
β β βββ network-analyzer
β β βββ server-monitor
β βββ Cybersecurity
β βββ access-control
β βββ threat-detection
β βββ vulnerability-scanner
βββ Mission Operations (District)
β βββ Intelligence
β βββ analysis-workbench
β βββ collection-management
β βββ data-fusion
β βββ decision-support
β βββ radio-gateway
β βββ satellite-comms
β βββ secure-messaging
β βββ situation-awareness
βββ Support Services (District)
βββ Human Resources
β βββ personnel-system
β βββ security-clearance
β βββ training-tracker
βββ Finance and Acquisition
β βββ budget-system
β βββ expense-tracker
β βββ procurement-portal
βββ Facilities
βββ access-badge
βββ asset-tracker
βββ building-automation
Top level Organization Roll-up View β All projectsSTLS SuperParent Roll-up View β District-specific projects*-Write): SBOM upload and portfolio management*Roll-up view): Read-only access for reporting*-Analysis): Vulnerability and policy analysis# Initialize complete organizational structure
python simple_hierarchy_init.py
# Assign teams to projects based on organizational rules
python assign_teams_to_projects.py
# Create teams from organizational structure
python create_dt_teams.py
# Update team permissions
python fix_team_permissions.py
POST /api/v1/sbom/upload
Upload SBOM with metadata for GitLab pipeline integration.
Required Fields:
district - District name (SuperParent)business_line - Business line name (Parent)project_name - Project name (Child)version - Project versionsbom - SBOM file (multipart/form-data)Optional Fields:
gitlab_project_id - GitLab project IDgitlab_pipeline_id - GitLab pipeline IDcommit_sha - Git commit SHAbranch - Git branch (default: main)tags - Comma-separated custom tagsExample:
curl -X POST http://localhost:8888/api/v1/sbom/upload \
-H "X-API-Key: your-api-key" \
-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 "sbom=@/path/to/sbom.json"
Note: All API endpoints (except /health) require authentication via the X-API-Key header.
GET /api/v1/projects/hierarchy?district=<name>&business_line=<name>
GET /api/v1/projects/<project_name>/versions?district=<name>&business_line=<name>
GET /health
Add this to your .gitlab-ci.yml for automated SBOM uploads:
sbom_upload:
stage: security
script:
- |
curl -X POST $SBOM_VALIDATOR_URL/api/v1/sbom/upload \
-H "X-API-Key: $SBOM_VALIDATOR_API_KEY" \
-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
| Variable | Description | Default | Required |
|---|---|---|---|
DT_URL | Dependency-Track server URL | http://127.0.0.1:8080 | Yes |
DT_API_KEY | Dependency-Track API key | - | Yes |
API_KEY_GITLAB | GitLab pipeline API key | - | Yes |
API_KEY_ADMIN | Admin API key for management | - | No |
PORT | Server port | 8888 | No |
FLASK_ENV | Flask environment | production | No |
Create a .env file in the project root:
DT_URL=http://your-dependency-track-url
DT_API_KEY=your-api-key
API_KEY_GITLAB=your-gitlab-pipeline-key
API_KEY_ADMIN=your-admin-key
PORT=8888
FLASK_ENV=development
The SBOM upload validator uses Dependency-Track API keys directly for authentication - no additional API key management required!
X-API-Key header/api/v1/project)# Use your DT API key directly
curl -X POST $SBOM_VALIDATOR_URL/api/v1/sbom/upload \
-H "X-API-Key: odt_YourDependencyTrackAPIKey_Here" \
-F "district=North America" \
-F "business_line=Financial Services" \
-F "project_name=payment-api" \
-F "version=1.2.3" \
-F "sbom=@sbom.json"
GET /api/v1/keys/validateValidate your current Dependency-Track API key:
curl -X GET http://localhost:8888/api/v1/keys/validate \
-H "X-API-Key: odt_YourDTAPIKey"
# Response
{
"valid": true,
"key_name": "dt-user",
"key_type": "dependency-track",
"message": "API key is valid"
}
GET /api/v1/keys/listList recently used API keys (admin access only):
curl -X GET http://localhost:8888/api/v1/keys/list \
-H "X-API-Key: odt_YourAdminDTAPIKey"
# Response showing cached keys
{
"total_keys": 2,
"dt_keys": 2,
"keys": [
{"name": "dt-user", "type": "dependency-track", "key_prefix": "odt_NEvK..."},
{"name": "dt-admin", "type": "dependency-track", "key_prefix": "odt_XyZ1..."}
]
}
The system supports bulk initialization of organizational hierarchies using YAML configuration files, designed for federal network deployments.
# 1. Copy the example configuration
cp dt_hierarchy_config.example.yaml dt_hierarchy_config.yaml
# 2. Customize with your team UUIDs and organizational structure
# Edit dt_hierarchy_config.yaml
# 3. Preview what will be created (dry run)
python initialize_dt_hierarchy.py --dry-run
# 4. Initialize the complete hierarchy
python initialize_dt_hierarchy.py
Each district includes appropriate security and compliance tags:
clearance:secret, clearance:top-secret)compliance:fisma-high)data:pii, data:classified)criticality:critical, criticality:high)# Show configuration summary
python initialize_dt_hierarchy.py --summary
# Initialize specific district only
python initialize_dt_hierarchy.py --district "Technology Operations"
# Validate existing hierarchy against config
python initialize_dt_hierarchy.py --validate
# Test configuration loading
python dt_config_loader.py
hierarchy:
"Your District Name":
description: "District description"
tags: ["clearance:secret", "category:technology"]
teams: ["team-uuid-1", "team-uuid-2"]
business_lines:
"Your Business Line":
description: "Business line description"
tags: ["function:development"]
teams: ["bl-team-uuid"]
projects:
- name: "your-project"
description: "Project description"
tags: ["type:application", "criticality:high"]
See dt_hierarchy_config.example.yaml for a complete federal network template.
pip install sbom-upload-validator==1.1.2
Features:
docker pull stljim/sbom-upload-validator:latest
Available Tags:
latest - Latest stable release (currently v1.0.1)1.0.1 - Latest stable release1.0.0 - Previous stable releasefederal - Federal network optimizeddevelop - Development buildsMulti-Architecture Support:
linux/amd64 (Intel/AMD 64-bit)linux/arm64 (ARM 64-bit)# Test API connectivity
python dt_api_utils.py
# Health check
curl http://localhost:8888/health
# View API documentation
open http://localhost:8888
For comprehensive testing scenarios, example SBOMs, and bulk upload utilities, see the companion repository:
SBOM Upload Validator Examples
# Clone examples repository
git clone https://github.com/StL-Jim/sbom-upload-validator-examples.git
cd sbom-upload-validator-examples
# Upload test data
python upload_test_sboms.py --directory test_sboms
The project includes comprehensive GitHub Actions workflows for:
Continuous Integration (ci.yml):
Package Publishing (python-publish.yml):
Docker Builds (docker-build.yml):
βββ app.py # Main Flask API application
βββ dt_api_utils.py # Dependency-Track API client and hierarchy manager
βββ dt_config_loader.py # YAML configuration loader and validator
βββ initialize_dt_hierarchy.py # Bulk hierarchy initialization script
βββ dt_hierarchy_config.yaml # Main hierarchy configuration file
βββ dt_hierarchy_config.example.yaml # Federal network configuration template
βββ templates/
β βββ api_docs.html # API documentation page
βββ requirements.txt # Python dependencies
βββ Dockerfile # Container configuration
βββ docker-compose.yml # Complete development stack
βββ README.md # This file
FLASK_ENV=development python app.py
For manual package publishing (when automated workflows fail or for testing):
pyproject.toml and sbom_upload_validator/__init__.py# Run the provided batch script
manual_pypi_publish.bat
# Make script executable and run
chmod +x manual_pypi_publish.sh
./manual_pypi_publish.sh
# 1. Install/upgrade build tools
python -m pip install --upgrade pip build twine
# 2. Clean previous builds
rm -rf dist/ build/ *.egg-info/
# 3. Build the package
python -m build
# 4. Check package integrity
python -m twine check dist/*
# 5. Upload to PyPI
python -m twine upload dist/*
Authentication:
__token__pypi-)Files Created:
manual_pypi_publish.bat - Windows publishing scriptmanual_pypi_publish.sh - Unix/Linux publishing script/ endpoint for interactive documentationopenapi.yamlgit checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
FAQs
Production-ready API for GitLab SBOM uploads to Dependency-Track with hierarchical management
We found that sbom-upload-validator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.