-
Notifications
You must be signed in to change notification settings - Fork 749
Fix(accounts_tmout): OVAL check incorrectly passes for TMOUT=0 #13564
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
Conversation
Hi @yu410621. Thanks for your PR. I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
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.
@yu410621 This is a great discovery! Thank you for your PR. Can you add a test scenario covering this situation?
Hi @jan-cerny , I've added the requested test cases and updated the rule documentation. Thanks for the feedback! |
Code Climate has analyzed commit a9d86f1 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 61.9% (0.0% change). View more on Code Climate. |
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.
jcerny@fedora:~/work/git/scap-security-guide (pr/13564)$ python3 tests/automatus.py rule --libvirt qemu:///system ssgts_rhel9 accounts_tmout
Setting console output to log level INFO
INFO - The base image option has not been specified, choosing libvirt-based test environment.
INFO - Logging into /home/jcerny/work/git/scap-security-guide/logs/rule-custom-2025-06-11-1522/test_suite.log
WARNING - Script 'multiline.pass.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_sle,multi_platform_ubuntu'
WARNING - Script 'multiline_profile.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_sle,multi_platform_ubuntu'
WARNING - Script 'multiline_profile_d.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_sle,multi_platform_ubuntu'
WARNING - Script 'multiline_profile_d.pass.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_sle,multi_platform_ubuntu'
INFO - xccdf_org.ssgproject.content_rule_accounts_tmout
INFO - Script comment_profile_d.fail.sh using profile (all) OK
INFO - Script line_not_there.fail.sh using profile (all) OK
INFO - Script wrong_value_profile.fail.sh using profile (all) OK
INFO - Script wrong_value_profile_d.fail.sh using profile (all) OK
INFO - Script comment_profile.fail.sh using profile (all) OK
INFO - Script conflicting_values_diff_file.fail.sh using profile (all) OK
INFO - Script conflicting_values_same_file.fail.sh using profile (all) OK
INFO - Script correct_value_profile.pass.sh using profile (all) OK
INFO - Script correct_value_profile_d.pass.sh using profile (all) OK
INFO - Script correct_value_profile_declare.pass.sh using profile (all) OK
INFO - Script duplicate_correct_value_diff_files.pass.sh using profile (all) OK
INFO - Script duplicate_correct_value_profile.pass.sh using profile (all) OK
INFO - Script duplicate_correct_value_profile_d.pass.sh using profile (all) OK
INFO - Script supercompliance_profile.pass.sh using profile (all) OK
INFO - Script supercompliance_profile_d.pass.sh using profile (all) OK
INFO - Script tmout_is_zero_profile.fail.sh using profile (all) OK
INFO - Script tmout_is_zero_profile_d.fail.sh using profile (all) OK
jcerny@fedora:~/work/git/scap-security-guide (pr/13564)$ python3 tests/automatus.py rule --libvirt qemu:///system ssgts_rhel9 --remediate-using ansible accounts_tmout
Setting console output to log level INFO
INFO - The base image option has not been specified, choosing libvirt-based test environment.
INFO - Logging into /home/jcerny/work/git/scap-security-guide/logs/rule-custom-2025-06-11-1529/test_suite.log
WARNING - Script 'multiline.pass.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_sle,multi_platform_ubuntu'
WARNING - Script 'multiline_profile.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_sle,multi_platform_ubuntu'
WARNING - Script 'multiline_profile_d.fail.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_sle,multi_platform_ubuntu'
WARNING - Script 'multiline_profile_d.pass.sh' is not applicable on 'rhel9' target because its platform is 'multi_platform_sle,multi_platform_ubuntu'
INFO - xccdf_org.ssgproject.content_rule_accounts_tmout
INFO - Script comment_profile_d.fail.sh using profile (all) OK
INFO - Script line_not_there.fail.sh using profile (all) OK
INFO - Script wrong_value_profile.fail.sh using profile (all) OK
INFO - Script wrong_value_profile_d.fail.sh using profile (all) OK
INFO - Script comment_profile.fail.sh using profile (all) OK
INFO - Script conflicting_values_diff_file.fail.sh using profile (all) OK
INFO - Script conflicting_values_same_file.fail.sh using profile (all) OK
INFO - Script correct_value_profile.pass.sh using profile (all) OK
INFO - Script correct_value_profile_d.pass.sh using profile (all) OK
INFO - Script correct_value_profile_declare.pass.sh using profile (all) OK
INFO - Script duplicate_correct_value_diff_files.pass.sh using profile (all) OK
INFO - Script duplicate_correct_value_profile.pass.sh using profile (all) OK
INFO - Script duplicate_correct_value_profile_d.pass.sh using profile (all) OK
INFO - Script supercompliance_profile.pass.sh using profile (all) OK
INFO - Script supercompliance_profile_d.pass.sh using profile (all) OK
INFO - Script tmout_is_zero_profile.fail.sh using profile (all) OK
INFO - Script tmout_is_zero_profile_d.fail.sh using profile (all) OK
Description:
The current accounts_tmout OVAL definition is flawed, as it incorrectly passes on systems where TMOUT is set to 0.
This occurs because the existing check only validates an upper bound (e.g., less than or equal to 600), a condition that TMOUT=0 satisfies. However, a value of 0 disables the timeout feature in most shells, which contradicts the rule's intent.
This PR corrects the logic by adding a lower-bound check to ensure the TMOUT value is greater than or equal to 1. The top-level now combines both the existing upper-bound and new lower-bound checks with AND logic, ensuring TMOUT=0 is correctly reported as non-compliant.
The definition's version has been incremented from 3 to 4 to reflect this logical change.