fix: slsa L1-L4 level format, header, iec62443 stderr parity (v0.5.28)#38
Merged
Conversation
….5.28)
- cmd_slsa: accept --level L1/L2/L3/L4 prefix format (atoi("L1") was 0)
- cmd_slsa: update text header to "SLSA Supply-Chain Gap Report"
- cmd_slsa: print confirmation to stderr when --output is used
- cmd_iec62443: print "IEC 62443 gap report written to" to stderr on --output
- tests: add 8 new tests covering level format, bad level, output file,
bad output path for both slsa and iec62443
- .fusa-reqs.json: add REQ-SLSA-LEVEL001, REQ-SLSA-OUT001,
REQ-IEC62443-SL001, REQ-IEC62443-OUT001
Parity with go-FuSa TestRunSLSA_AllLevels, TestRunSLSA_BadLevel,
TestRunSLSA_OutputFile, TestRunSLSA_BadOutputPath,
TestRunIEC62443_AllSLs, TestRunIEC62443_BadSL,
TestRunIEC62443_OutputFile, TestRunIEC62443_BadOutputPath.
Signed-off-by: Matt Jones <matt@jellybaby.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
|
|
||
| if (output && out != stdout) fclose(out); | ||
| if (output && out != stdout) { | ||
| fclose(out); |
|
|
||
| if (output && out != stdout) fclose(out); | ||
| if (output && out != stdout) { | ||
| fclose(out); |
| //cfusa:test REQ-SLSA-LEVEL001 | ||
| void test_slsa_level_l1_accepted(void) | ||
| { | ||
| char *argv[] = {"cfusa", "--dir", CLI_TEST_DIR, "--level", "L1", NULL}; |
| //cfusa:test REQ-SLSA-LEVEL001 | ||
| void test_slsa_bad_level_returns_2(void) | ||
| { | ||
| char *argv[] = {"cfusa", "--dir", CLI_TEST_DIR, "--level", "L5", NULL}; |
| void test_slsa_output_writes_file(void) | ||
| { | ||
| remove(SLSA_OUT_TEST_FILE); | ||
| char *argv[] = {"cfusa", "--dir", CLI_TEST_DIR, "--format", "json", |
| //cfusa:test REQ-SLSA-OUT001 | ||
| void test_slsa_bad_output_returns_3(void) | ||
| { | ||
| char *argv[] = {"cfusa", "--dir", CLI_TEST_DIR, |
| //cfusa:test REQ-IEC62443-SL001 | ||
| void test_iec62443_sl_format_accepted(void) | ||
| { | ||
| char *argv[] = {"cfusa", "--dir", CLI_TEST_DIR, "--sl", "SL-1", NULL}; |
| //cfusa:test REQ-IEC62443-SL001 | ||
| void test_iec62443_bad_sl_returns_2(void) | ||
| { | ||
| char *argv[] = {"cfusa", "--dir", CLI_TEST_DIR, "--sl", "SL-5", NULL}; |
| void test_iec62443_output_writes_file(void) | ||
| { | ||
| remove(IEC62443_OUT_TEST_FILE); | ||
| char *argv[] = {"cfusa", "--dir", CLI_TEST_DIR, "--format", "json", |
| //cfusa:test REQ-IEC62443-OUT001 | ||
| void test_iec62443_bad_output_returns_3(void) | ||
| { | ||
| char *argv[] = {"cfusa", "--dir", CLI_TEST_DIR, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cfusa slsa --level L1/L2/L3/L4: acceptLxprefix format —atoi("L1")was returning 0, causing exit 2 even for valid levelscfusa slsatext output: header changed from "SLSA v1.0 Gap Report" → "SLSA Supply-Chain Gap Report"cfusa slsa --output <file>: print "SLSA gap report written to <file>" to stderr after writingcfusa iec62443 --output <file>: print "IEC 62443 gap report written to <file>" to stderr after writingParity
go-FuSa:
TestRunSLSA_AllLevels,TestRunSLSA_BadLevel,TestRunSLSA_OutputFile,TestRunSLSA_BadOutputPath,TestRunIEC62443_AllSLs,TestRunIEC62443_BadSL,TestRunIEC62443_OutputFile,TestRunIEC62443_BadOutputPathTest plan
cfusa slsa --level L1exits 0 or 1 (not 2)cfusa slsa --level L5exits 2cfusa slsa --output /tmp/s.jsoncreates file and prints to stderrcfusa slsa --output /no/such/dir/s.jsonexits 3cfusa iec62443 --sl SL-1exits 0 or 1cfusa iec62443 --sl SL-5exits 2cfusa iec62443 --output /tmp/i.jsoncreates file and prints to stderr