-
Notifications
You must be signed in to change notification settings - Fork 765
Improve argument rules #6100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve argument rules #6100
Conversation
|
Skipping CI for Draft Pull Request. |
yuumasato
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the oval_argument_file macro very similar to line_in_file macro?
Yes, it is similar. But also it is different. The |
yuumasato
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is similar. But also it is different. The
line_in_fileis tailored for a single value per line.
Thanks for clarifying the differences.
But, if you can see a way to do the same using
line_in_file, please give me an example.
I think multi_value=true can help.
https://github.com/ComplianceAsCode/content/blob/master/shared/macros-oval.jinja#L17
It is used by oval_grub_config macro for example.
https://github.com/ComplianceAsCode/content/blob/master/shared/macros-oval.jinja#L327
And actually, all BLS related templates could leverage |
|
Changes identified: Recommended tests to execute: |
The only rule that use it does it like this The resulting OVAL is: <ind:textfilecontent54_object id="oval:ssg-obj_grub2_nousb_argument:obj:1" version="1">
<ind:filepath>/etc/default/grub</ind:filepath>
<ind:pattern operation="pattern match">^[ \t]*GRUB_CMDLINE_LINUX=([^#]*).*$</ind:pattern>
<ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
</ind:textfilecontent54_object>
<ind:textfilecontent54_state id="oval:ssg-state_grub2_nousb_argument:ste:1" version="1">
<ind:subexpression datatype="string" operation="pattern match">^.*\bnousb\b.*$</ind:subexpression>
</ind:textfilecontent54_state> |
BLS-compatible bootloader is not nesesary the GRUB, hence |
My point was to illustrate usage of macro |
My bad, you are correct in the BLS assessment. |
I got it. But still it is more tailored to check for rather than for While I actually was able to imagine some regexes for |
|
@matejak Here you are, |
|
@JAORMX Can you test it, please? |
|
Ah, dammit, conflicts |
and use it as custom Jinja filter and across the code for ID sanitizing and regular expression escaping unification. Also document custom filters in the Developer's Guide.
…est' and high-level 'oval_argument_in_file' macros And use them to re-factor 'zipl_bls_entries_option', 'bls_entries_option' and 'coreos_kernel_option' templates.
39e33d7 to
e81f130
Compare
|
/test e2e-aws-rhcos4-moderate |
|
@evgenyz this worked for me! /lgtm |
I guess that you meant whether it is OK that the OVAL title is determined by the rule's XCCDF title, as that's what |
|
@yuumasato How do you like it? Are the ZIPL changes OK from your point of view? |
yuumasato
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I actually was able to imagine some regexes for
oval_check_config_fileto use it for the later case, I strongly believe that it would be an abusive usage of that (already very complex) macro. Let's have a new oneoval_argument_in_fileand tailor it for the second case.
Alright.
Improvement of #6088.
More info pending.