
SEDATED® 项目(敏感企业数据分析器以消除泄露)专注于防止用户凭证和令牌等敏感数据被推送到 Git。
在当今的 CICD 环境中,需要进行大量的代码更改,开发人员不断推送可能无意中包含敏感信息的代码。这种潜在的敏感数据暴露给组织带来了巨大的风险(2017 OWASP Top Ten #3 - 敏感数据暴露)。SEDATED® 通过自动审查所有传入的代码更改并向开发人员提供即时反馈来解决此问题。如果识别出敏感数据,它将阻止提交被推送到 Git 服务器。
**注意:SEDATED® 仅扫描提交推送中新增或修改的行(在补丁文件中以 + 开头)。对于提交推送中被删除的行(在补丁文件中以 - 开头),SEDATED® 不会扫描。
git clone https://github.com/OWASP/SEDATED.git
cd SEDATED/
.example 文件cp /config/whitelists/commit_whitelist.txt.example /config/whitelists/commit_whitelist.txt
cp /config/whitelists/repo_whitelist.txt.example /config/whitelists/repo_whitelist.txt
cp /config/enforced_repos_list.txt.example /config/enforced_repos_list.txt
/config/custom_configs.sh 变量和函数将组织特定的 SEDATED® 实现推送到组织所需的 Git 仓库(GitHub、GitLab、Git 等)。
pre-receive.sh 文件在 GitHub Enterprise 实例上完成此操作的说明可在 GitHub_Enterprise_Setup.md 中找到。
pre-receive.sh 脚本替换 always_reject.sh。pre-receive.sh 脚本访问。pre-receive.sh/config/custom_configs.shpre-receive.sh 一起使用,允许组织自定义其 SEDATED® 实现,而无需修改 SEDATED® 的 pre-receive.sh 文件中的任何源代码,它提供了内置的可自定义变量和函数,这些变量和函数从 pre-receive.sh 中引用。/config/enforced_repos_list.txtconfig/custom_configs.sh 中的 use_enforced_repo_check_custom 标志设置为 "True" 时使用。/* 来对特定组织或用户名下的所有仓库进行强制启用。/config/enforced_repos_list.txt 文件中,则推送者(如果从命令行推送)将看到一条可自定义的消息(通过 /config/custom_configs.sh 文件自定义),并且 SEDATED® 不会扫描推送中包含的任何代码。/config/custom_configs.sh 中找到,并设置为 "True" 或 "False"。
/config/enforced_repos_list.txt 中的仓库才会“强制”启用 SEDATED®。所有其他“启用”了 SEDATED® 但未列在 /config/enforced_repos_list.txt 中的仓库只会看到一条自定义消息,不会对来自这些仓库的推送进行代码扫描。config/custom_configs.sh 中的 use_enforced_repo_check_custom 标志设置为 "True" 时才需要存在。/config/regexes.jsonpre-receive.sh 中)使用 -P 标志消费,使其成为 Perl 兼容的正则表达式(PCRE)。/testing/regex_testing/regex_test_script.sh 脚本,则需要通过添加或删除与更新后的正则表达式相关的测试用例来更新 /testing/regex_testing/test_cases.txt 文件,以便 /testing/regex_testing/regex_test_script.sh 的结果准确。\。/config/whitelists/commit_whitelist.txt/config/whitelists/commit_whitelist.txt.example 文件所示。commit_whitelist.txt)文件提交拉取请求,以便进行审查。/config/whitelists/repo_whitelist.txt/config/whitelists/repo_whitelist.txt.example 文件所示。/testing/regex_testing/regex_test_script.shtesting/regex_testing/test_cases.txt 一起使用,是一种简单、快速的离线方式,用于测试/验证 config/regexes.json 中的正则表达式是否有效并匹配所需的模式,以及是否按预期排除/不匹配。
/testing/regex_testing/test_cases.txt)测试正则表达式,以验证正则表达式是否按预期工作。/testing/regex_testing/test_cases.txt)的测试。-P 标志)。/testing/regex_testing/test_cases.txt 中获取。/testing/regex_testing/test_cases.txt/testing/regex_testing/regex_test_script.sh 中供其使用。>>pass 或 >>fail,告诉 /testing/regex_testing/regex_test_script.sh 脚本对正则表达式的期望。
>>pass 表示包含前面字符串的推送将被 SEDATED® 接受(即正则表达式不会标记前面的字符串)。>>fail 表示包含前面字符串的推送将被 SEDATED® 拒绝(即正则表达式会标记前面的字符串)。