是否应该忽略.NPMRC?

发布于 2025-01-20 07:09:13 字数 225 浏览 3 评论 0原文

Fontawesome Pro 说明 描述了将密钥放在 .npmrc 文件中,但尚不清楚应如何管理该文件。具体来说,这个文件应该被 Git 忽略吗?

The Fontawesome Pro instructions describe placing a secret key in a .npmrc file but it is unclear how this file should be managed. Specifically, should this file be ignored by Git?

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

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

发布评论

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

评论(3

攒一口袋星星 2025-01-27 07:09:13

是正确的示例,是在.nmprc文件中管理敏感信息的一般方法:

  • 所有敏感值应由环境变量替换,然后
  • 应将这些变量定义为托管秘密在任何环境下,仓库都将被推向。

The Fontawesome Pro instructions are correct as an example of the general approach to managing sensitive information in a .nmprc file :

  • all sensitive values there should be replaced by environment variables, and
  • those variables should then be defined as managed secrets in whatever environment the repo will be pushed to.
旧竹 2025-01-27 07:09:13

我的答案说,最好忽略它而不是努力回购。好像您有多个工程师对生成的软件包进行贡献更改,以将每个开发人员都必须具有自己的.NPMRC文件推向注册表,并且“您不太可能希望将其推入repo,因为每次尝试都会覆盖/冲突。

我可以想象一个方案,您想通过为所有开发人员使用一个凭据,因此想自动化一个全局.npmrc文件,但这是我认为的显而易见的安全性人造PA。

My answer would say it's best to ignore it and not push to repo. as if you have multiple Engineers contributing changes to a generated package for push to the registry each developer will have to have their own .npmrc file and it' unlikely that you'd ever want that pushed to the repo as each attempt would overwrite/conflict.

I could imagine a scenario where you'd like to automate by using a single credential for all devs and thus one global .npmrc file but that is an obvious security faux pas in my view.

絕版丫頭 2025-01-27 07:09:13

您可以

  • .npmrc 文件复制到 .npmrc_local
  • 忽略文件 .npmrc_local (通过 .gitignore)
  • .npmrc 中删除敏感数据代码> 文件。
  • npm install 之前将更改推送到存储库,
  • 只是将 .npmrc_local 临时编译到 .npmrc 中。

这样 git repo 中就没有敏感日期了。这种方法可以用在可以轻松管理安全文件的地方(例如azure)

You can

  • copy .npmrc file into .npmrc_local
  • ignore file .npmrc_local (by .gitignore)
  • remove sensitive data from .npmrc file.
  • push changes to repo
  • before npm install just temporary compy .npmrc_local into .npmrc.

In this way sensitive date are no in git repo. This approach can be used in places where you can easy manage security files (e.g. azure)

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