问题标签 [git-secret]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
513 浏览

git - 持续集成期间不能泄露秘密

使用 git-secret,我加密了我的应用程序所需的几个 API 密钥。现在,我正在尝试与 Travis CI 集成进行部署,我需要 Travis 能够解密这些文件并显示它们。

为此,我创建了一个新的密钥对,用它来加密我的所有文件,然后将公钥和私钥都添加到我的存储库中(私钥由 Travis CI 加密)。然后我可以使用以下命令将这两个键添加到 gpg 中:

但是,当我尝试使用 解密这些文件时git-secret reveal -p $SECRET_PASSWORD,出现以下错误:

git-secret: abort: no public keys for users found. run 'git secret tell email@address'.

看起来我添加的密钥没有被添加,或者它们添加到的密钥环没有被使用。我已经在自己的 docker 映像中尝试过这个,而且效果很好,所以我不明白为什么 Travis 会以不同的方式工作

用于以下测试的 Dockerfile:

构建后,我能够启动 docker 映像,从 bash 导入密钥,签出我的仓库,并按预期使用echo $SECRET_PASSWORD | gpg --batch --import travis.privatekey

0 投票
2 回答
471 浏览

javascript - 什么是用于识别 git-secret 存储库中 AWS 基本身份验证值的正则表达式?

我想从存储库中的文件中识别 AWS 基本身份验证。为此,我想为 git-secret 添加一个模式来扫描存储库中基本身份验证值的值。

我尝试过以下模式:

脚本如下:

我希望为 git-secret 添加模式以识别存储库中的 AWS 基本身份验证值。

以下是基本身份验证值的示例:

'Basic' + + <60 characters> 那么我们应该标记它。如果它少于 60 或多于 60,那么它不是一个有效的字符串。

0 投票
1 回答
381 浏览

git-secret - 使用 git-secret 和 git pre-commit 不起作用

当设置预提交挂钩以调用 git secret hide 以在运行提交时加密秘密文件以提交一个或多个更改的文件时,更改的文件按预期提交,但我留下了两个未暂存的新更改文件或提交 .gitsecret/paths/mapping.cfg 和 src/tokens.ts.secret ,令牌文件是我的秘密文件。秘密文件似乎是新的加密文件,但问题是它没有被暂存或提交。我不确定我的预提交文件应该是什么样子,是否应该手动添加/提交文件 - 我不这么认为。

我的预提交文件如下所示:

预期结果是这两个文件与我的提交一起暂存和提交。

0 投票
1 回答
440 浏览

regex - 将 RegEx 添加到 Git 机密

我正在尝试使用 --add 开关将一些 RegEx 密码模式添加到 git 机密中。

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[#$^+=!*()@%&]).{6,40}$ ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[0-9]).{6,40}$

当我只做一个基本的 git secrets --scan 命令时,我得到了fatal: command line,我也得到了Invalid preceding regular expression,所以我想也许我搞砸了 RegEx。

当我扫描特定文件时,我得到以下输出:

grep: repetition-operator operand invalid

不知道我在这里缺少什么。提前致谢!

我希望在运行 git secrets --scan 或 git secrets --scan somefile.whateverext 时不会出错

0 投票
0 回答
61 浏览

jenkins - 为 Jenkins ci 配置 ci_secrets

ci_secrets 是 ( https://github.com/pmarlow/ci_secrets ) 是一个 repo 秘密扫描工具,可以轻松地与 Travis 和 Gitlab ci 集成,而无需持久服务器。将其配置到 Jenkins 管道中有点棘手,因为 Jenkins 不支持像这样的环境变量

这是从范围内的第一个提交中确定最新扫描的提交所必需的。

有没有办法在 Jenkins 管道中实现这一点?

例如:

0 投票
1 回答
915 浏览

ubuntu-16.04 - 从 Ubuntu 中删除 git 机密

我已将 git 机密添加到 ubuntu(16.04 LTS) 并且在我执行这些命令之前它工作正常,

我已经删除了这些文件,

从我的环境来看,但它似乎仍然无法正常工作。

如何从我的 PC 中永久删除 git-secrets 并重新安装或解决此问题。

0 投票
0 回答
499 浏览

gnupg - 我应该在哪里为 GnuPG 2.0 及更高版本指定 pinentry 程序?

我将介绍 git-crypt 或 git-secret 来加密 git 存储库中描述的凭据信息。

这就需要 GnuPG(GPG) 提供一种加密方式。我已经用自制软件安装了以下程序:

  • gnupg
  • gnupg2
  • pinentry-mac

从 GnuPG 2.0 开始,无需单独安装 gpg-agent。

GnuPG 2.1 中的新功能

但是如何设置 pinentry-program 呢?我尝试在 gpg-agent.confg 中将 pinentry-mac 设置为 pinentry-program,就像我在以前的版本中所做的那样。它对我不起作用。

替换 gpg-agent.conf 的文件是什么文件,或者是否需要任何额外的过程,例如重新启动 gpg?

0 投票
1 回答
43 浏览

jenkins - Jenkins CI / CD on an Open Source Github project with confidential properties files

I'm struggling on doing Jenkins CI/CD pipelines for an Open Source project which has a set of confidential .properties files.

The .properties files are necessary for maintainability in a Spring boot project, and some of the .properties files are confidential, and so must not be disclosed in the open sourced code-base.

For each confidential .properties we provide an example .properties in the open source.

The question is, how do you smoothly (i.e. automize) incorporate the confidential .properties or files in the Jenkins CI/CD pipelines, and have a great version controllability using git over those files? So that those confidential .properties can effect durring every CI/CD phase and so in the production.

This seems to be a hard-to-automize challenge, any comments, suggestions or experiences are appreciated!


What I've tried

Git secret

This is a great solution but it doesn't support Windows, so I can't go with it. (Every alternative to git-secret I've found also doesn't support cross-platform.

0 投票
1 回答
227 浏览

git - git-secret 揭示导致 pubring.kbx 文件的更改 - 为什么?

我正在尝试了解 git-secret 工作流程。

这是场景:

  • 队友通过git-secret tell添加了我的 gpg 密钥并重新加密了秘密文件并推送了它们。
  • 我可以显示这些文件,通过git-secret hide重新加密它们,并看到在重新加密(隐藏)之后,其他队友应该能够访问这些文件,因为它们列在git-secret whoknows -> 工作得很好!

我注意到,在执行git-secret后,pubring.kbx发生了变化。我不明白为什么会这样。我不只是解密文件吗?

为什么泄露信息会导致密钥环发生变化?我需要提交这些更改吗?

0 投票
1 回答
946 浏览

yaml - git-secret-reveal 在 github 操作上失败

我正在尝试将 Github Actions 用于 CI。我在 GitHub 上的存储库中创建了一些秘密,并使用 git-secret 工具加密了源中的一些文件。最后,我为 github 写了 netx yml-script 作为 action

我想这描述了下一个管道:

  1. 结帐当前分支
  2. 使用 PK(gpg 密钥?)和 PWD 安装 gpg 所需的工具
  3. 将带有 PK 电子邮件的用户添加到白名单
  4. 解密 .secret 文件
  5. 最后构建 docker 镜像。

我对吗?

我的问题是步骤 3-4。我在日志中有错误

我已经在本地机器(linux)上检查了我的解决方案,它就像一个魅力。好吧,也许有人知道我在 yml-script 中的错误在哪里?