A command-line tool for OpenSSF Baseline compliance checking and setup.
baseline-init helps repositories achieve and maintain OpenSSF Security Baseline compliance by:
- Checking repositories for missing compliance requirements
- Validating existing compliance files against schemas
- Auto-generating compliant default files (SECURITY-INSIGHTS.yml, SECURITY.md, etc.)
- Guiding users through interactive setup
git clone https://github.com/aguamala/baseline-init.git
cd baseline-init
go build -o baseline-initgo install github.com/aguamala/baseline-init@latestCheck if your repository meets OpenSSF baseline requirements:
baseline-init checkOutput formats:
baseline-init check --format json # JSON output
baseline-init check --format yaml # YAML output
baseline-init check --format text # Human-readable (default)Generate files with sensible defaults:
baseline-init setup --autoWalk through guided setup with prompts:
baseline-init setup --interactiveThe interactive mode will ask you for:
- Project URL
- Security contact email
- Project lifecycle stage
- Vulnerability reporting preferences
- Pull request policies
- Maintainer information
Overwrite existing files:
baseline-init setup --auto --forceValidate compliance files against their schemas:
baseline-init validate SECURITY-INSIGHTS.yml
baseline-init validate .github/SECURITY-INSIGHTS.ymlScan a repository for OpenSSF baseline compliance.
Flags:
-f, --format- Output format: text, json, yaml (default: text)-p, --path- Path to repository (default: current directory)
Example:
baseline-init check /path/to/repo --format jsonExit Codes:
0- Repository is compliant1- Repository is not compliant or error occurred
Generate OpenSSF baseline compliance files.
Flags:
--auto- Auto-generate with defaults--interactive- Interactive setup mode--force- Overwrite existing files-p, --path- Path to repository (default: current directory)
Example:
baseline-init setup --interactive
baseline-init setup /path/to/repo --autoValidate a compliance file against its schema.
Example:
baseline-init validate SECURITY-INSIGHTS.ymlDisplay version information.
The primary compliance file containing security metadata following the OpenSSF Security Insights specification.
Location: Repository root or .github/SECURITY-INSIGHTS.yml
Key sections:
header- Metadata and versioningproject-lifecycle- Project status and maintenancecontribution-policy- PR and contribution policiessecurity-contacts- Security team contact informationvulnerability-reporting- Vulnerability disclosure policiessecurity-testing- Security testing practicesdependencies- Dependency management
Security policy and vulnerability reporting instructions.
Location: Repository root, .github/SECURITY.md, or docs/SECURITY.md
The tool checks for the following OpenSSF baseline requirements:
- β SECURITY-INSIGHTS.yml - Security metadata (High Priority)
- β LICENSE - Open source license (High Priority)
- β SECURITY.md - Security policy (Medium Priority)
- π CODE_OF_CONDUCT.md - Code of conduct (Medium Priority)
- π CONTRIBUTING.md - Contribution guidelines (Low Priority)
Add compliance checking to your workflow:
name: OpenSSF Baseline Check
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
compliance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Install baseline-init
run: go install github.com/aguamala/baseline-init@latest
- name: Check compliance
run: baseline-init check --format text- Go 1.23 or later
- Git
go build -o baseline-initgo test ./...Run tests with coverage:
go test -cover ./...baseline-init/
βββ cmd/ # Command definitions (check, setup, validate)
βββ pkg/
β βββ checker/ # Compliance checking logic
β βββ generator/ # File generation logic
β βββ validator/ # YAML validation logic
β βββ interactive/ # Interactive prompts
β βββ report/ # Output formatting
βββ main.go # Entry point
βββ go.mod # Go module definition
βββ README.md # This file
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
go test ./... - Submit a pull request
Apache License 2.0 - see LICENSE for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Built with:
Based on the OpenSSF Security Baseline and Security Insights projects.