Closed jordanpadams closed 11 months ago
Hi @jordanpadams, in between the time this issue was created (Jan 17) and the time it was put onto the backlog (Oct 17), a major thing has changed over at SLIM, that being: they no longer recommend git-secrets.
Instead, they've settled onto another tool, detect-secrets, which they've documented extensively. It looks like detect-secrets can do a whole lot more than git-secrets, which worked fine for AWS keys. Yet detect-secrets can also find absolute file paths (which you commented on), sensitive email addresses, hostnames—and even do entropy analysis (automatic detection of secrets based on their high degree of randomness).
We've already settled onto git-secrets for the template-repo-python and template-repo-java, and I can certainly spread git-secrets out to the rest of our repositories.
But, as the issue description says above ↑, do we want to follow the guidelines at NASA-AMMOS/slim#89—which would mean going to detect-secrets—or do what the issue title says—which would be propagating git-secrets?
@nutjob4life feel free to refactor all this towards the best solution you deem for our projects. in this case, let's role with detect-secrets.
To resolve this, I need to use the sandbox, however I have a prerequisite pull request that'll need to be merged so I can get the sandbox working again.
Notes to self.
All developers—whether they use Python or Java—will need Python. (Honestly, I'm not sure how I feel about this.)
One quickie idea:
$ cd $HOME
$ python3 -m venv bin
$ cat > bin/requirements.txt <<EOF
pre-commit ~= 3.5.0
detect-secrets @ git+https://github.com/NASA-AMMOS/slim-detect-secrets.git@exp
EOF
$ bin/pip3 install --requirement bin/requirements.txt
To generate the baseline of PDS repositories, we'll need to exclude far more than the SLIM folk think, as we don't commit generated files (I hope they aren't either).
detect-secrets scan . \
--all-files \
--disable-plugin AbsolutePathDetectorExperimental \
--exclude-files '\.secrets..*' \
--exclude-files '\.git.*' \
--exclude-files '\.mypy_cache' \
--exclude-files '\.pytest_cache' \
--exclude-files '\.tox' \
--exclude-files '\.venv' \
--exclude-files 'venv' \
--exclude-files 'dist' \
--exclude-files 'build' \
--exclude-files '.*\.egg-info' > .secrets.baseline
detect-secrets scan . \
--all-files \
--disable-plugin AbsolutePathDetectorExperimental \
--exclude-files '\.secrets..*' \
--exclude-files '\.git.*' \
--exclude-files 'target' > .secrets.baseline
Progress: this is now functioning in the sandbox's pds-template-repo-python
. Next step is to try it in the sandbox pds-template-repo-java
and then see if we want to roll it out everywhere, and update our various instructions.
(Still have an open question about whether we want to force Java developers to install Python.)
Progress: this is now functioning in the sandbox's pds-template-repo-java
.
I've also updated the READMEs for both Java and Python with instructions on how to use detect-secrets
. These instructions reference a wiki page that is yet to be written, so these are the next steps:
Suggested repositories:
@nutjob4life is investigating 4 repos which do not behave as expected. The others are good.
It turns out it was three repositories, not four, that had problems with server-side secrets-detection via GitHub Actions.
Only one of those repositories got merged into main
, so I've filed a fresh pull request to fix the problem with the server-side secrets detection.
The other two repositories, doi-ui
and registry
, had their pull requests remain open. So I've pushed additional commits to those branches to address the problems with server-side secrets detection.
The doi-ui
PR has already been merged, leaving (at the time of this writing), the PR for secrets on registry
open.
In addition, these PRs for secrets detection remain open at the time of this writing—but had no issues with their secrets-detection status checks in GitHub Actions:
@nutjob4life one more I found: https://github.com/NASA-PDS/wds-react-legacy/tree/main/.github/workflows
@jordanpadams pull request created
Closing this out since most repos have been retrofitted. Will add to additional repos as needed if any were missed.
đź’ˇ Description
https://nasa-ammos.github.io/slim/continuous-integration/starter-kits/#git-secrets
Probably need discussion with secrets/credentials provider: https://github.com/awslabs/git-secrets#id20
Should follow the guidelines and recommendations from here: https://github.com/NASA-AMMOS/slim/issues/89