Skip to content

Harden CLI input validation and file output#3347

Draft
nhatnghiho wants to merge 3 commits into
aws:mainfrom
nhatnghiho:cli-patches
Draft

Harden CLI input validation and file output#3347
nhatnghiho wants to merge 3 commits into
aws:mainfrom
nhatnghiho:cli-patches

Conversation

@nhatnghiho

Copy link
Copy Markdown
Contributor

Issues:

Resolves P469904855

Description of changes:

Fixes input validation gaps and tightens file permissions in the CLI tool:

  • Always fail on DNS resolution errors in s_client regardless of quiet mode
  • Reject unrecognized -v2 cipher names in pkcs8 -topk8 instead of falling through
  • Set restrictive permissions (0600) when writing private key files

Testing:

Tests added for each change.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 51.92308% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.16%. Comparing base (13fdb9e) to head (5799c10).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
tool/file.cc 0.00% 18 Missing ⚠️
tool/transport_common.cc 20.00% 2 Missing and 2 partials ⚠️
tool-openssl/ec_test.cc 75.00% 1 Missing ⚠️
tool-openssl/pkcs8_test.cc 88.88% 1 Missing ⚠️
tool-openssl/pkey_test.cc 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3347      +/-   ##
==========================================
- Coverage   78.18%   78.16%   -0.02%     
==========================================
  Files         693      693              
  Lines      123959   124004      +45     
  Branches    17213    17217       +4     
==========================================
+ Hits        96912    96929      +17     
- Misses      26129    26154      +25     
- Partials      918      921       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@justsmth

justsmth commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Build failure on some platforms:

/Users/runner/work/aws-lc/aws-lc/third_party/googletest/include/gtest/gtest.h:1545:11: error: comparison of integers of different signs: 'const int' and 'const unsigned int' 
...
/Users/runner/work/aws-lc/aws-lc/tool-openssl/ec_test.cc:238:3: note: in instantiation of function template specialization 'testing::internal::EqHelper::Compare<int, unsigned int, nullptr>' requested here
  EXPECT_EQ(perms & 0077, 0u)
  ^
...                                         ^
1 error generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants