A community-driven test harness for validating OSCAL (Open Security Controls Assessment Language) content. This project provides automated testing and validation of OSCAL models against their corresponding metaschemas, along with style checking capabilities.
The OSCAL Test Harness helps ensure OSCAL content adheres to:
- XML Schema validation rules
- OSCAL metaschema specifications
- Community-defined style guidelines
- Integration testing requirements
- Node.js (Latest LTS version recommended)
- npm or yarn package manager
- OSCAL CLI tool
- Java 11 or higher
- Clone the repository:
git clone https://github.com/your-org/oscal-test-harness.git
cd oscal-test-harness
- Clone the OSCAL repository (required for metaschemas):
git clone https://github.com/usnistgov/OSCAL.git
cd OSCAL
git checkout main
cd ..
- Install dependencies:
npm install
- Configure the environment:
make configure
The test harness provides several npm scripts for different testing scenarios:
npm test
npm run test:failed
npm run test:style
npm run test:integration
The project includes a manual workflow for running integration tests with custom OSCAL configurations:
- Go to the "Actions" tab in your GitHub repository
- Select "OSCAL Validations: Integration tests" workflow
- Click "Run workflow"
- Configure the test parameters:
- CLI Version: Version of the OSCAL CLI to use (default: 2.4.0)
- Repository: GitHub repository in format 'owner/repo' (default: usnistgov/OSCAL)
- Branch: Branch to test against (default: main)
Example workflow parameters:
- CLI Version:
2.5.0.SNAPSHOT
- Repository:
usnistgov/OSCAL
- Branch:
main
This will test using the specified repository and branch with CLI version 2.5.0.SNAPSHOT
.
5. Click "Run workflow" to start the tests
This allows testing against different OSCAL CLI versions and repository branches without modifying the code.
- Validates OSCAL XML content against official metaschemas
- Supports various OSCAL model types:
- System Security Plans (SSP)
- Plans of Action and Milestones (POA&M)
- Component Definitions
- Assessment Plans
- Assessment Results
- Enforces community-defined style guidelines
- Validates XML formatting and structure
- Ensures consistent documentation practices
- Generates standardized Static Analysis Results Interchange Format (SARIF) output
- Provides detailed validation results and error reporting
- Enables integration with various development tools and CI/CD pipelines
oscal-test-harness/
├── features/ # Cucumber feature files
│ ├── oscal.feature # OSCAL validation tests
│ ├── style.feature # Style validation tests
│ └── sarif.feature # SARIF output tests
├── style/ # Style guidelines
└── valid-content/ # Test data directory
This is a community-run project and contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Please ensure your contributions:
- Include appropriate test coverage
- Follow the existing code style
- Update documentation as needed
- Pass all existing tests
[Add appropriate license information]
- OSCAL - Official NIST OSCAL Documentation
- OSCAL Content - Official OSCAL Content Repository