TFSEC摘要导出摘要

发布于 2025-02-02 11:39:38 字数 1859 浏览 4 评论 0原文

我正在管道中运行TFSEC。我执行以下命令运行TFSEC。

- tfsec -s --custom-check-dir ${CODEBUILD_SRC_DIR} > tfsec_static_code_analysis_summary_${PIPELINE_EXECUTION_ID}.txt

如您所见,我正在尝试从TFSEC导出结果。我已经知道TFSEC具有输出,我用它来获取CSV。 CSV的问题是,如果没有错误,则为空白。事实证明这是我组织的问题。妥协是他们愿意将摘要 + CSV作为证明它运行。上面的命令是我试图导出摘要产生此结果的尝试:

[0m  [1mtimings[0m
  ──────────────────────────────────────────
[0m[0m  [2mdisk i/o            [0m 221.427µs
[0m[0m  [2mparsing             [0m 3.293529ms
[0m[0m  [2madaptation          [0m 73.017µs
[0m[0m  [2mchecks              [0m 5.092385ms
[0m[0m  [2mtotal               [0m 8.680358ms
[0m
[0m  [1mcounts[0m
  ──────────────────────────────────────────
[0m[0m  [2mblocks              [0m 45
[0m[0m  [2mmodules             [0m 3
[0m[0m  [2mfiles               [0m 12
[0m
[0m  [1mresults[0m
  ──────────────────────────────────────────
[0m[0m  [2mignored             [0m 0
[0m[0m  [2mexcluded            [0m 0
[0m[0m  [2mcritical            [0m 0
[0m[0m  [2mhigh                [0m 0
[0m[0m  [2mmedium              [0m 0
[0m[0m  [2mlow                 [0m 0
[0m
[0m
[32m[1mNo problems detected!

[0m

根据我阅读的Linux将文本混合使用的常见内容。我正在尝试将导出从屏幕截图中输出到格式中。

不确定是否有人知道我可以使用的命令。我尝试了以下方面的尝试:

- tfsec -s --custom-check-dir ${CODEBUILD_SRC_DIR} >> tfsec_static_code_analysis_summary_${PIPELINE_EXECUTION_ID}.txt

- tfsec -s --custom-check-dir ${CODEBUILD_SRC_DIR} | sed 's/^[ ]*[0-9\:\/ ]\+[ ]*//' | unix2dos >> tfsec_static_code_analysis_summary_${PIPELINE_EXECUTION_ID}.txt

- tfsec -s --custom-check-dir ${CODEBUILD_SRC_DIR} | tee -a tfsec_static_code_analysis_summary_${PIPELINE_EXECUTION_ID}.txt

在这里寻求任何帮助。

I am running TFSEC inside a pipeline. I execute the following command to run TFSEC.

- tfsec -s --custom-check-dir ${CODEBUILD_SRC_DIR} > tfsec_static_code_analysis_summary_${PIPELINE_EXECUTION_ID}.txt

As you can see I am trying to export the results from TFSEC. I already know that TFSEC has an output and I use that to get the csv. The problem with the csv is if there is no errors it's blank. This proves to be a problem with my organization. The compromise is they are willing to take the Summary + the CSV as proof that it ran. The command above is my attempt to export the summary which yields this result:

[0m  [1mtimings[0m
  ──────────────────────────────────────────
[0m[0m  [2mdisk i/o            [0m 221.427µs
[0m[0m  [2mparsing             [0m 3.293529ms
[0m[0m  [2madaptation          [0m 73.017µs
[0m[0m  [2mchecks              [0m 5.092385ms
[0m[0m  [2mtotal               [0m 8.680358ms
[0m
[0m  [1mcounts[0m
  ──────────────────────────────────────────
[0m[0m  [2mblocks              [0m 45
[0m[0m  [2mmodules             [0m 3
[0m[0m  [2mfiles               [0m 12
[0m
[0m  [1mresults[0m
  ──────────────────────────────────────────
[0m[0m  [2mignored             [0m 0
[0m[0m  [2mexcluded            [0m 0
[0m[0m  [2mcritical            [0m 0
[0m[0m  [2mhigh                [0m 0
[0m[0m  [2mmedium              [0m 0
[0m[0m  [2mlow                 [0m 0
[0m
[0m
[32m[1mNo problems detected!

[0m

From what i have read its common for Linux to mix text up. I am trying to get my export to output into the format from the screenshot.

enter image description here

Not sure if anyone knows a command that i can use. I have tried the following with no success:

- tfsec -s --custom-check-dir ${CODEBUILD_SRC_DIR} >> tfsec_static_code_analysis_summary_${PIPELINE_EXECUTION_ID}.txt

- tfsec -s --custom-check-dir ${CODEBUILD_SRC_DIR} | sed 's/^[ ]*[0-9\:\/ ]\+[ ]*//' | unix2dos >> tfsec_static_code_analysis_summary_${PIPELINE_EXECUTION_ID}.txt

- tfsec -s --custom-check-dir ${CODEBUILD_SRC_DIR} | tee -a tfsec_static_code_analysis_summary_${PIPELINE_EXECUTION_ID}.txt

Looking for any help here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

落花浅忆 2025-02-09 11:39:38

特别感谢我的伙伴,他帮助了我。我们最终使用SED命令进行导出,这看起来像是这样的

 - tfsec -s --custom-check-dir ${CODEBUILD_SRC_DIR} | sed -e 's/\[[0-9;]*m//g' | sed -e 's/\x1b*//g' >> tfsec_static_code_analysis_summary_${PIPELINE_EXECUTION_ID}.txt

第一组SED REGEX使格式正确。第二个删除了出口中的逃生标记。

希望这对其他人有帮助!

Special thanks to my buddy who helped me out with this. We ended up using the sed command to do the export which looks like this

 - tfsec -s --custom-check-dir ${CODEBUILD_SRC_DIR} | sed -e 's/\[[0-9;]*m//g' | sed -e 's/\x1b*//g' >> tfsec_static_code_analysis_summary_${PIPELINE_EXECUTION_ID}.txt

The first set of sed regex gets the format correct. The second removes the escape markups in the export.

Hopefully this helps others out there!

执手闯天涯 2025-02-09 11:39:38

使用- 无色- 无色将删除颜色的编码。

另外,您可以使用-f文本吐出基本的文本格式。

看起来您最终找到了一种方法。

Using --no-color or --no-colour would have remove the encoding for colours.

Alternatively, you can use -f text to spit out basic text format.

Looks like you found a way in the end.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文