我应该在GitHub Action工作流程结束时删除机密文件吗?

发布于 2025-01-29 23:31:12 字数 480 浏览 2 评论 0原文

我有一些操作,需要将秘密存储到文件中。稍后另一个作业使用此秘密,例如:

env:
  FIREBASE_DISTRIBUTION_KEY: ${{ secrets.GCP_SA_FIREBASE_DISTRIBUTION_PROD_KEY }}
run: |
  echo $FIREBASE_DISTRIBUTION_KEY > key.json
  export GOOGLE_APPLICATION_CREDENTIALS=key.json

从安全角度来看,我应该在工作流程末尾删除key.json吗?像:

- name: Remove credentials
  if: always()
  run: |
    rm key.json

我正在考虑一种场景,其中GitHub操作容器被妥协并且有人可以访问文件。或不相信Github会完全删除GitHub Action容器。

I have some actions where I need to store a secret into a file. This secret is used by another job later, like:

env:
  FIREBASE_DISTRIBUTION_KEY: ${{ secrets.GCP_SA_FIREBASE_DISTRIBUTION_PROD_KEY }}
run: |
  echo $FIREBASE_DISTRIBUTION_KEY > key.json
  export GOOGLE_APPLICATION_CREDENTIALS=key.json

From a security perspective, should I remove at the end of the workflow the key.json? Like:

- name: Remove credentials
  if: always()
  run: |
    rm key.json

I'm thinking about a scenario where the GitHub Actions containers are compromised and someone has access to the files. Or not trusting GitHub that they are deleting the GitHub Action container completely.

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

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

发布评论

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

评论(1

小耗子 2025-02-05 23:31:12

这不是必需的。

首先,github动作跑步者不是容器,而是虚拟机。没有机会逃脱,也没有“清理”容器的想法。

虚拟机被完全处理。运行您的工作的虚拟机 - 或任何磁盘图像都不会被重复使用。

This is not necessary.

First, GitHub Actions runners are not containers, they're virtual machines. There's no opportunity for container escape, and there's no notion of "cleaning up" the containers.

The virtual machine is disposed of completely. Neither the virtual machine that ran your job - nor any of its disk images - will be re-used.

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