-
Notifications
You must be signed in to change notification settings - Fork 157
Test fips for Ruby #592
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
Test fips for Ruby #592
Conversation
Pull Request validationFailed🔴 Failed or pending statuses:
🔴 Review - Missing review from a member (1 required) |
|
[test] |
|
[test] |
Testing Farm results
|
|
[test] |
|
[test] |
|
[test] |
|
[test] |
|
[test] |
3 similar comments
|
[test] |
|
[test] |
|
[test] |
|
[test] |
1 similar comment
|
[test] |
Testing Farm results
|
|
[test] |
Pull Request validationFailed🔴 Review - Missing review from a member (1 required) Success🟢 CI - All checks have passed |
|
[test] |
|
[test] |
|
[test] |
|
[test] |
Add FIPS test and example application with HTTP. The check is simply executing OpenSSL.fips_mode which returns bool. Based on exit status we can then know whether it failed/succeeded as we expect it to. The app has 4 GET endpoints that executes some OpenSSL capability. 2 of those test symmetric ciphers: * '/symmetric/aes-256-cbc' -- succeeds under FIPS * '/symmetric/des-ede-cbc' -- fails under FIPS 2 of those test digests: * '/hash/sha256' -- succeeds under FIPS * '/hash/md5' -- fails under FIPS The app is prepared so that it tests assumptions of when should what fail, under both FIPS and non-fips environment. These endpoints either return 200 if the case for them succeeded or 5xx for FIPS related failures and 4xx for general failures not accounted for. When a failure happens when it shouldn't, the app also returns backtrace in the response body. A few examples: MD5 succeeds and FIPS is enabled, that's unexpected, returns 500 SHA256 fails in any case, 409 is returned because that shouldn't happen with both FIPS disabled and enabled, something else went wrong. MD5 fails with FIPS enabled, that's desired and expected, returns 200. Since more information is passed within body on response, `curl --fail-with-body` is recommended. 409 is chosen to differentiate 500 returned in cases we might expect. It was chosen firstly as it is "user error", either the code is wrong, or the setup is wrong. For the purpose of building and running the app, an adjustment was made to run_test_application to be able to run a custom named container. Otherwise there is only testapp to be ran and we can have better names.
|
@phracek finally got through to something I'd call functioning tests... Ready for review. |
|
[test] |
phracek
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.
I don't understand test_ruby_fips_s2i_app function.
| ct_wait_for_cid "${cid_file}" | ||
| ct_test_response "http://$(container_ip):8080/symmetric/aes-256-cbc" 200 "" | ||
| ct_check_testcase_result $? | ||
| ct_test_response "http://$(container_ip):8080/symmetric/des-ede-cbc" 200 "" |
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.
Based on your description in pull request:
- '/symmetric/aes-256-cbc' -- succeeds under FIPS
- '/symmetric/des-ede-cbc' -- fails under FIPS - This should fail.
2 of those test digests: - '/hash/sha256' -- succeeds under FIPS
- '/hash/md5' -- fails under FIPS
test_ruby_fips_s2i_app where is enabled FIPS mode This works the same as for FIPs mode and for None FIPs mode? Like this https://github.com/sclorg/s2i-nodejs-container/blob/master/test/test-lib-nodejs.sh#L587
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.
It is checked in code that it fails under FIPS, an exception is rescued. If an exception does NOT occur under FIPS, then the test fails.
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.
I noted it down with those comments that there are ciphers/hashes which are expected to fail and which are expected to pass. If those that should pass raise an exception, that is not expected and the test will fail.
phracek
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.
LGTM. Thanks for adding FIPS enabled Ruby container. It brings to customers, that we have a container FIPS compliance.
Worked on mimicking the nodejs approach: sclorg/s2i-nodejs-container#498
The check is simply executing OpenSSL.fips_mode which returns bool.
Based on exit status we can then know whether it failed/succeeded against our expectation.
The app has 4 GET endpoints that executes some OpenSSL capability.
2 of those test symmetric ciphers:
2 of those test digests:
The app is prepared so that it tests assumptions of when should what
fail, under both FIPS and non-fips environment.
These endpoints either return 200 if the case for them succeeded
or 5xx for FIPS related failures and 4xx for general failures not
accounted for. When a failure happens when it shouldn't, the app also
returns backtrace in the response body.
A few examples:
MD5 succeeds and FIPS is enabled, that's unexpected, returns 500
SHA256 fails in any case, 409 is returned because that shouldn't happen
with both FIPS disabled and enabled, something else went wrong.
MD5 fails with FIPS enabled, that's desired and expected, returns 200.
Since more information is passed within body on response,
curl --fail-with-bodyis recommended.409 is chosen to differentiate 500 returned in cases we
might expect. It was chosen firstly as it is "user error", either the code is
wrong, or the setup is wrong.
For the purpose of building and running the app,
and adjustment was made to run_test_application to be able to run a custom
named container.
Otherwise there is only testapp to be ran and we can have better names.