butlergroup/env_encryption_tool_nodejs

GitHub: butlergroup/env_encryption_tool_nodejs

一款基于 Node.js 的 .env 文件加密与运行时解密工具,通过操作系统级环境变量管理解密密钥,实现应用敏感配置的安全存储与按需还原。

Stars: 1 | Forks: 1

[![CodeQL](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/d37f8a9641114201.svg)](https://github.com/butlergroup/env_encryption_tool_nodejs/actions/workflows/github-code-scanning/codeql) [![Node.js CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/62cb88a3e2114202.svg)](https://github.com/butlergroup/env_encryption_tool_nodejs/actions/workflows/node.js.yml) [![Dependabot Updates](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/638b5085c0114203.svg)](https://github.com/butlergroup/env_encryption_tool_nodejs/actions/workflows/dependabot/dependabot-updates) [![njsscan sarif](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/786d8d3e31114205.svg)](https://github.com/butlergroup/env_encryption_tool_nodejs/actions/workflows/njsscan.yml) [![Snyk Security-Monitored](https://img.shields.io/badge/Snyk%20Security-Monitored-purple)](https://app.snyk.io/share/784f6fef-6aaf-47ed-81ba-99e05b854665) [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/10677/badge)](https://www.bestpractices.dev/projects/10677) [![Scorecard supply-chain security](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/6efc94fd44114206.svg)](https://github.com/butlergroup/env_encryption_tool_nodejs/actions/workflows/scorecard.yml) [![Microsoft Defender For Devops](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/e7f4f7ecf2114208.svg)](https://github.com/butlergroup/env_encryption_tool_nodejs/actions/workflows/defender-for-devops.yml) [![Coverage Status](https://coveralls.io/repos/github/butlergroup/env_encryption_tool_nodejs/badge.svg?branch=main)](https://coveralls.io/github/butlergroup/env_encryption_tool_nodejs?branch=main) [![Feature Requests](https://img.shields.io/github/issues/butlergroup/env_encryption_tool_nodejs/feature-request.svg)](https://github.com/butlergroup/env_encryption_tool_nodejs/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement) [![Bugs](https://img.shields.io/github/issues/butlergroup/env_encryption_tool_nodejs/bug.svg)](https://github.com/butlergroup/env_encryption_tool_nodejs/issues?utf8=✓&q=is%3Aissue+is%3Aopen+label%3Abug) ## env_encryption_tool_nodejs :copyright: 项目目标与信息 **目的**:该项目的目标是为给定的 Node.js 应用程序加密 .env 文件,并将其以加密状态存储,然后在运行时使用基于操作系统的环境变量对其进行解密并传递给应用程序。这要求任何潜在/非法的攻击者必须先攻破操作系统的安全机制并访问其环境变量,才能入侵应用级别的环境变量。 *免责声明*:本项目已稳定并可用于生产环境,但在达到 v1.0 版本和/或获得赞助之前,我们不会提供基于 SLA 的支持。:bowtie: ## 安装说明 1. [安装 Node.js](https://nodejs.org/en) 或使用 nvm (Node version manager) 来 [在 Linux/MacOS 上](https://github.com/nvm-sh/nvm?tab=readme-ov-file#installing-and-updating) 或 [在 Windows 上](https://github.com/coreybutler/nvm-windows) 安装 Node.js :earth_americas: 2. 克隆/Fork env_encryption_tool_nodejs 仓库 :zap: 3. 修改 encryptConfig.js 中的加密密钥为您所需的内容 :lock: 4. 在与您的 .env 文件相同的文件夹中运行 "node encryptConfig.js" - 这将输出一个 env.enc 文件 :confetti_ball: 5. 将包含的 decryptConfig.js 文件及其包/导入集成到您的 Node.js 项目中 :star: 6. 设置一个名为 "DECRYPTION_KEY" 的操作系统级环境变量(:earth_americas: [适用于 Linux](https://stackoverflow.com/questions/45502996/how-to-set-environment-variable-in-linux-permanently),:earth_africa: [适用于 Windows](https://phoenixnap.com/kb/windows-set-environment-variable),:earth_asia: [适用于 MacOS](https://stackoverflow.com/questions/65597552/how-exactly-to-set-up-and-use-environment-variables-on-a-mac)),其值需与您在 encryptConfig.js 中设置的值相同。 7. 将 env.enc 文件复制到您的 Node.js 应用程序运行的同一文件夹中,大功告成!您的应用程序在运行时将获得加密的环境变量。:tada: 8. (可选)安装 pm2 来管理并启用 Node.js 应用程序的自启动:npm install pm2@latest -g(这是本项目中文件的配置方式)。然后运行 "pm2 start ecosystem.config.js" 启动应用程序。:sparkles: ## 许可证 env_encryption_tool_nodejs 采用 AGPL-3.0 许可证授权,只要源代码保持开源,即可免费使用、修改和分发。**在未公开源代码的情况下使用本软件的修改版本不符合 AGPL-3.0 许可证的规定。** ## 服务条款 在使用我们的软件之前,请阅读我们的[服务条款](https://github.com/butlergroup/env_encryption_tool_nodejs/blob/main/terms-of-service.md)。违反这些条款的用户将不会获得社区或贡献者的支持。 ## 隐私政策 请同时阅读我们的[隐私政策](https://github.com/butlergroup/env_encryption_tool_nodejs/blob/main/privacy-policy.md),以了解我们如何处理您的个人信息。 ## 联系方式 有任何问题或建议?请通过 welcome@butlergroup.net 联系我们。感谢您,祝您编程愉快! :) ## Star 历史 [![Star History Chart](https://api.star-history.com/svg?repos=butlergroup/env_encryption_tool_nodejs&type=Date)](https://www.star-history.com/#butlergroup/env_encryption_tool_nodejs&Date)
标签:API密钥保护, CI/CD安全, CodeQL, DevSecOps, dotenv加密, .env文件解密, GNU通用公共许可证, Llama, MITM代理, Node.js, Node.js安全, OpenSSF, Snyk, SOC Prime, StruQ, XML 请求, 上游代理, 代码安全扫描, 安全开发, 安全评估工具, 开发工具, 敏感数据保护, 数据加密工具, 数据存储安全, 环境变量加密, 自定义脚本