Date: January 28, 2026 Audit Scope: Verify MCP server implementation follows ComplianceAsCode/content project rules
The MCP server implementation has been audited against the guidelines in COMPLIANCEASCODE_REFERENCE.md. The implementation is largely compliant with some areas for improvement identified.
Finding: The implementation correctly recognizes and handles ComplianceAsCode's custom Jinja2 delimiters.
Evidence:
src/content_agent/core/discovery/rules.pyhas proper documentation about{{{ }}},{{% %}},{{# #}}syntax- Module docstring explains the custom delimiters
- Reference to COMPLIANCEASCODE_REFERENCE.md is present
Compliance with Reference: ✅ Fully aligned
Finding: Rule files (rule.yml) are loaded with the correct YAML loader to handle Jinja2 templates.
Evidence:
src/content_agent/core/discovery/rules.py:116- Usesyaml.load(content, Loader=yaml.FullLoader)src/content_agent/core/discovery/rules.py:218- Usesyaml.load(content, Loader=yaml.FullLoader)
Compliance with Reference:
"Use yaml.load(..., Loader=yaml.FullLoader) to handle Jinja2 templates in YAML files"
✅ Fully compliant
Finding: Products are correctly extracted from identifiers and references using @ notation, not from a direct products: field.
Evidence:
src/content_agent/core/discovery/rules.py:209-233-_extract_products_from_identifiers()method- Correctly parses
cce@rhel8,stigid@rhel9, etc. - Extracts from both
identifiersandreferencessections
Compliance with Reference:
"No Direct Products Field: Rules don't have a
products:field - infer from identifiers and profile inclusion"
✅ Fully compliant
Test Results: Product filtering verified working for rhel9, rhel8, ol8, sle15
Finding: Product YAML files (product.yml) use yaml.safe_load().
Evidence:
src/content_agent/core/discovery/products.py:82- Usesyaml.safe_load(f)src/content_agent/core/discovery/products.py:127- Usesyaml.safe_load(f)
Analysis:
- Verified that product.yml files in ComplianceAsCode/content do NOT contain Jinja2 templates
- Checked all products:
find /path/to/content/products -name "product.yml" -exec grep -l "{{{" {} \;returned 0 results - According to ADR-0002, profiles should NOT use Jinja2 macros
Compliance with Reference:
"Macro Usage Guidelines (ADR-0002): Do NOT use Jinja2 macros in: ... profile files"
✅ Acceptable - safe_load is correct for files without Jinja2
Finding: The rule validator uses yaml.safe_load() which could be problematic if used on existing rules with Jinja2 templates.
Evidence:
src/content_agent/core/scaffolding/validators.py:52- Usesyaml.safe_load(yaml_content)
Analysis:
- Current use case: Validating NEW rules during scaffolding (no Jinja2 templates expected)
- Unit tests only test simple YAML without Jinja2
- Potential issue: If someone tries to validate an EXISTING rule.yml from the repository, it could fail
Recommendation:
- Low Priority: Current usage is for scaffolding, so safe_load is acceptable
- Future Enhancement: Consider adding a parameter to switch to FullLoader if validating existing content
- Documentation: Add a note that this validator is for new rules, not existing repository content
Compliance with Reference:
Finding: The implementation correctly handles platform field as either string or list.
Evidence:
# src/content_agent/core/discovery/rules.py:144-146
platforms = data.get("platform", data.get("platforms", []))
if isinstance(platforms, str):
platforms = [platforms]Compliance with Reference:
"platform: Defines where the rule applies (machine, container, etc.)"
✅ Fully compliant - handles both singular and plural, string and list
Finding: Profile files use custom parsing, not YAML loading.
Evidence:
src/content_agent/core/discovery/profiles.py:100- Uses custom_parse_profile()method- Profile files (.profile) have a custom format, not pure YAML
Analysis:
- Verified that .profile files in ComplianceAsCode/content do NOT contain Jinja2 templates
- Custom parsing is appropriate for the .profile format
Compliance with Reference: ✅ Appropriate implementation for profile format
Finding: Template field correctly uses Dict[str, Any] to handle nested dictionaries.
Evidence:
src/content_agent/models/rule.py:104-template: Optional[Dict[str, Any]]- Previously was
Dict[str, str]which caused validation errors
Compliance with Reference: ✅ Fixed to handle actual template data structure
Finding: Comprehensive documentation has been created.
Evidence:
docs/COMPLIANCEASCODE_REFERENCE.md- Comprehensive reference guide- Module docstrings in rules.py explain Jinja2 custom delimiters
- README.md links to the reference documentation
Compliance with Reference: ✅ Exceeds requirements - excellent documentation
None - all critical functionality is compliant
None - acceptable compromises documented
-
Validator Documentation (validators.py:52)
- Add docstring note that validator is for NEW rules during scaffolding
- Clarify that it's not meant for validating existing repository content with Jinja2
- Consider adding a
strictparameter for future use with FullLoader
-
Code Comments (products.py:82, 127)
- Add comment explaining why safe_load is safe here (product.yml has no Jinja2 per ADR-0002)
- Validation Mode: Add optional
existing_content=Trueparameter to validator to use FullLoader for validating existing rules - Test Coverage: Add tests that verify behavior with Jinja2 templates in YAML
- Error Messages: Improve error messages when YAML parsing fails to mention Jinja2 templates as potential cause
| Requirement | Status | Evidence |
|---|---|---|
| Recognize {{{ }}} syntax | ✅ Yes | Module docstring, code comments |
| Use FullLoader for rules | ✅ Yes | rules.py:116, 218 |
| Extract products from @ notation | ✅ Yes | _extract_products_from_identifiers() |
| Handle platform as string/list | ✅ Yes | Platform normalization code |
| No direct products field assumption | ✅ Yes | Product extraction from identifiers |
| Document Jinja2 custom delimiters | ✅ Yes | COMPLIANCEASCODE_REFERENCE.md |
| safe_load for non-Jinja2 files | ✅ Yes | products.py, validators.py |
| Appropriate YAML loader per file type | ✅ Yes | Different loaders for different files |
The MCP server implementation demonstrates strong compliance with ComplianceAsCode/content project conventions and best practices. All critical requirements are met, with only minor documentation enhancements recommended for clarity.
The implementation correctly:
- Handles Jinja2 custom delimiters
- Extracts product information from identifiers
- Uses appropriate YAML loaders for different file types
- Documents the ComplianceAsCode conventions
Final Assessment: ✅ COMPLIANT - Ready for production use with minor documentation enhancements recommended.
- Reviewed all YAML loading locations in codebase
- Verified YAML loader types against file types
- Checked product.yml and .profile files for Jinja2 templates
- Cross-referenced implementation against COMPLIANCEASCODE_REFERENCE.md
- Validated with actual ComplianceAsCode/content repository
- Tested rule search and product filtering functionality
docs/COMPLIANCEASCODE_REFERENCE.md- ComplianceAsCode project reference- ComplianceAsCode ADR-0002: Jinja2 Boundaries
- ComplianceAsCode Developer Documentation:
/docs/manual/developer/