mitre / mitre/ts-inspec-objects
XCCDF -> Inspec is not processing text with \) correctly
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4
- Forks
- 2
- Avg merge
- 3m
- Merged PRs (30d)
- 21
Description
When running saf generate xccdf_benchmark2inspec_stub from saf cli we are seeing some issues with some content that contains parenthesis that are inside the %q() syntax.
For example given this original check text:
At the command prompt, run the following command:
# /opt/vmware/sbin/vami-lighttpd -p -f /opt/vmware/etc/lighttpd/lighttpd.conf 2>/dev/null|awk '/server\.modules/,/\)/'|grep mod_accesslog
Expected result:
"mod_accesslog",
If the output does not match the expected result, this is a finding.
Note: The command must be run from a bash shell and not from a shell generated by the "appliance shell". Use the "chsh" command to change the shell for the account to "/bin/bash". Refer to KB Article 2100508 for more details:
https://kb.vmware.com/s/article/2100508
The conversion is adding an additional \ before the ) in the command which is causing the quoting to break and produce invalid content like in this screenshot.
If i remove the added \ it is fine or if i change the delimeter from () to {} or [] it works but that still leaves the undesirable added \ which changes the command in the text and causes it to break if people try to copy it out of the InSpec text and run it.
I attached the source XCCDF for this to reproduce it if you take the U_VMware_vSphere_8_vCenter_Appliance_VAMI_STIG_Readiness_Guide_V1R2-xccdf.xml file from the zip.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue by running saf generate xccdf_benchmark2inspec_stub with the attached U_VMware_vSphere_8_vCenter_Appliance_VAMI_STIG_Readiness_Guide_V1R2-xccdf.xml file. Trace the XCCDF-to-InSpec conversion and compare the generated text around the command containing \). Done means the generated InSpec content remains valid and preserves the command text without an extra backslash.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100