simp / simp/rubygem-simp-compliance_engine

sce-schema.json: controlsMap key pattern rejects all real control identifiers

Open Beginner friendly
#134 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2
Forks
1
Avg merge
5d 16h
Merged PRs (30d)
2

Description

$defs/controlsMap (lib/compliance_engine/sce-schema.json:52) combines a restrictive key pattern with additionalProperties: false:

"patternProperties": {
  "^\\w(?:[\\w.-]*[\\w-])?(?::\\w(?:[\\w.-]*[\\w-])?)*$": { "type": "boolean" }
},
"additionalProperties": false

The pattern allows only word characters, dots, dashes, and colons. Real control identifiers in shipped SCE data routinely contain parentheses, spaces, and pipes, so every one of them fails validation.

Impact

Validating the four Sicura enterprise modules against the shipped schema with json_schemer produces 18,543 violations, all from this one rule:

module violations
simp_enterprise_el_cis 11,804
simp_enterprise_windows_cis 4,174
simp_enterprise_el_disa 2,202
simp_enterprise_windows_disa 363

Representative failing keys:

AU-3(1)                                                   # NIST control enhancement
SC-28(1)
GRID: MS-00000001                                         # CIS
STIG ID: RHEL-08-040025 | RULE ID: SV-230498r1069314 | CAT III

Relaxing that single patternProperties entry and re-running gives zero violations in all four modules — the rest of the schema matches production data accurately. So this one pattern is the only thing standing between the schema and being usable as a validation gate.

Suggested fix

Widen the controlsMap key pattern to accept the identifier forms actually in use (at minimum parentheses, spaces, and pipes), or drop additionalProperties: false on this $def so unrecognized key shapes are permitted rather than rejected.

Whichever way it goes, it would be worth deciding explicitly whether keys like STIG ID: ... | RULE ID: ... | CAT III are intended control identifiers or a data-side smell — the schema is currently making that call implicitly, and making it in the direction that rejects everything.

Context

Found while evaluating whether scelint should consume ComplianceEngine.schema as an additional lint pass (simp/rubygem-simp-scelint#88 raised scelint's pin to compliance_engine ~> 1.0, which is what made the schema reachable). As it stands, adopting the schema at error level would bury every other finding.

Validated with json_schemer 2.5.0 against compliance_engine 1.1.0.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect $defs/controlsMap at lib/compliance_engine/sce-schema.json:52 and reproduce validation with json_schemer 2.5.0 against the four shipped Sicura modules. Decide how the schema should represent the documented control identifiers, then verify the chosen change produces zero violations without weakening unrelated validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
json, ruby
Domain
backend, testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.