Contributor Guide
Thank you for contributing to COPS! Whether you are fixing a bug, improving documentation, adding an agent skill, or creating an entirely new security plugin, this guide provides the setup and standards you need.
Code & Evidence Standards
All contributions adhere to the canonical Repository Contract (AGENTS.md):
- Offline-First & Deterministic: Offload data parsing, schema checks, and evidence evaluations to standard-library Python scripts. Reserve LLM context for reasoning and synthesis.
- Standard-Library Core: The core runner, CLI, scanner, and plugin validator must use only the Python standard library. External dependencies are strictly reserved for testing (
requirements.txt). - Dedicated Branches: Always implement changes on a dedicated task branch based on a fresh fetch of
origin/main. - Honest Evidence Reporting: Never claim a check passed unless it ran in the local checkout. Clearly distinguish between offline validated tests, unverified cloud claims, and live-tested results.
- No Secrets or Private Paths: Never commit API keys, personal credentials, private tenant data, or machine-specific home paths.
Environment Setup
1. Create a Dedicated Virtual Environment
COPS requires Python 3.11 or newer:
# Clone the repository
git clone https://github.com/sodejm/copilot-operation-plugin-for-security.git
cd copilot-operation-plugin-for-security
# Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate
(On Windows PowerShell, run .\.venv\Scripts\Activate.ps1 to activate).
2. Install Development & Test Dependencies
Install the test runners and schema validators:
python -m pip install -r requirements.txt
Verify that all test prerequisites are satisfied:
make check-prerequisites
3. Install Local Push Protections
Install local Git hooks to protect against accidental direct pushes to main, credential leakage, and missing issue coverage:
make setup-hooks
Running Tests and Checks
Before pushing or opening a pull request, run the complete validation gate and verify that your changes satisfy documentation and test coverage for the active issue:
# Run full repository checks
make check PYTHON=.venv/bin/python
# Verify issue documentation & test coverage
make check-issue-coverage
Python changes must also pass ruff check .; YAML changes must pass yamllint -s ., matching the hosted quality gate. Install these tools in the development environment before running them. After changing canonical skills or portable evidence sources, regenerate adapters with make sync-agent-adapters and the evidence bundle with python scripts/agent/bundle_evidence.py, then rerun validation.
Security lint exceptions must describe the concrete reason at the narrowest applicable scope. Offline tests use synthetic credentials and noncryptographic seeded fuzzing; standalone scripts may set up the repository import path before imports. Public string-enum behavior is preserved rather than migrated solely to satisfy a style rule. Production authorization storage errors must propagate, and XML imports must reject entity declarations before parsing imported data.
Issue Documentation & Test Coverage Requirements
Every branch addressing an issue or feature must include:
- Documentation: Updated or newly created markdown files in
docs/,specs/, or root guides. - Behavioral Test Cases: Automated tests in
tests/or Gherkin BDD scenarios inspecs/features/.
If an administrative change, refactor, or typo fix requires an exemption, provide a rationale in the commit message using:
[skip-docs: <rationale>][skip-tests: <rationale>]
What make check executes:
- Python Source AST Parsing: Validates that all Python files parse cleanly without syntax errors.
- Contract Validation (
scripts/agent/validate_contract.py): Checks skill frontmatter, ensures no machine-specific paths exist, and verifies that all relative Markdown links resolve on disk. - Agent Adapter Synchronization (
scripts/agent/sync_adapters.py --check): Ensures that.claude/and other host adapters are perfectly synchronized with.agents/. - Marketplace Index Integrity (
scripts/agent/validate_marketplace.py): Checks that plugin manifests conform to the Agent Plugins v1.0.0 specification. - Prerequisite Verification (
scripts/agent/install_prerequisites.py --validate): Ensures system and library prerequisites are correctly met. - Portable Export Validation (
scripts/agent/export_portable.py --check): Verifies standard packaging boundaries. - Evidence Bundle Validation (
scripts/agent/bundle_evidence.py --check): Ensures evidence receipts adhere to schema constraints. - Host Marketplace Synchronization (
python3 -m cops generate --check): Verifies that.github/,.claude-plugin/, and.agents/marketplace files matchcatalog/plugins.json. - ATT&CK Coverage Check (
python3 -m cops coverage --check): Validates MITRE ATT&CK matrix mappings. - Plugin Test Suites (
python3 -m cops check): Runs declared offline verification suites across all 13 plugins. - Pytest & Unittest Suites: Executes all acceptance scenarios (
pytest tests) and skill unittests. - Git Diff Check: Confirms no trailing whitespace or corrupt line endings exist.
Adding a Plugin
To contribute a new cybersecurity capability to COPS:
- Choose Exactly One Primary Category:
logging-telemetrydetection-huntingidentity-accessvulnerability-managementoffensive-securityincident-response
-
Register the Package in
catalog/plugins.json: Add the plugin definition including its ID, name, version, category, maturity (experimental,beta,stable), and operational mode (planned,import,laboratory,live-validated). - Create the Package Directory Structure:
Place the package at
plugins/<category>/<plugin-id>/with:plugin.json: Core Agent Plugins v1.0.0 manifest.README.md: Overview, target practitioners, and prerequisites.docs/PLAYBOOK.md: Step-by-step practitioner playbook.scripts/: Standard-library Python validation and demo scripts.tests/: Offline synthetic test data and unit tests.skills/: Reusable agent skills conforming toagentskills.io.
- Regenerate Host Marketplaces:
python3 -m cops generateThis updates
.github/plugin/marketplace.json,.claude-plugin/marketplace.json, and.agents/plugins/marketplace.jsonautomatically. - Verify the New Package:
python3 -m cops validate <plugin-id> python3 -m cops demo <plugin-id> python3 -m cops check <plugin-id> make check PYTHON=.venv/bin/python
For complete authoring details, review Adding a Plugin (docs/ADDING_A_PLUGIN.md).
Offline Dependency Setup
For air-gapped or restricted network development environments:
- On a connected machine (matching OS, architecture, and Python version):
python -m pip download --dest wheelhouse -r requirements.txt -
Transfer
wheelhouseandrequirements.txtto the offline machine. - Install from local wheelhouse:
python -m pip install --no-index --find-links wheelhouse -r requirements.txt make check-prerequisites make check PYTHON=.venv/bin/python
Workflow maintenance keeps checkout actions aligned with the current hosted runner runtime. The dependency pull requests update the remaining Python, CodeQL, and Pages actions; shell values used by issue summaries are quoted before passing them to the GitHub CLI.