Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(security): prevent secrets from leaking to source control #59

Merged
merged 5 commits into from
Jul 25, 2019

Conversation

lirantal
Copy link
Contributor

@lirantal lirantal commented Jul 7, 2019

What:

Detect secrets when files are committed so we can prevent from these leaking into source contorl.

Why:

Adds support through detect-secrets which wraps Yelp's generic detect-secrets tool, to test for secrets being committed to source control using the pre-commit framework the project already has, and as a result prevent secrets like passwords, tokens and others to leak into source control.

How:

Introduce husky, lint-staged and detect-secrets tool to create pre-commit hooks which will run the detect-secrets-launcher tool to detect detects for files being committed.

The detect-secrets npm package will try different methods of invoking the detect-secrets-hook tool to run the secrets test for each file, and if it isn't able to find it will silently fail to not interrupt developer workflow. In a future re-visit of this capability we can update this to be a breaking change and fail the commit (or perhaps fail the CI, which might be a bit late, but better than never).

Checklist:

  • Tests
  • Ready to be merged

@lirantal lirantal closed this Jul 12, 2019
@lirantal lirantal reopened this Jul 12, 2019
@lirantal
Copy link
Contributor Author

@boyney123 I updated this PR to include the newest version of detect-secrets and the secrets baseline

@boyney123
Copy link
Owner

Looks great @lirantal , sorry its taken so long to look at!

Just reviewing now, how can I run this locally to verify it?

@lirantal
Copy link
Contributor Author

@boyney123 fetch this branch locally, run an install to pull the required libraries introduced here so you have them installed and then try to change a JS file in the project, add to it something suspecious like const password = '1234567890, try to commit and you shouldn't be able to. It will tell you it detected that. So remove this, and commit and it should work just fine.

The secrets detection will only kick-in if you have that python lib installed, or docker so it can pull an image for it. Otherwise it's going to silently fail to not disturb developers/contributors on this project.

@boyney123
Copy link
Owner

Awesome, looking good! Love this.

I think it only works in the server directory atm, if I make changes in client I still can commit.

What do you think? Should we add it to all three projects inside?

image

@lirantal
Copy link
Contributor Author

Yay 🎉

Indeed I only added it specifically to the server project as an early PR. How about we merge so we can push this in without being too far from master's tip and then I'll send another PR to include the client/ project as well?

What is the 3rd project? :-)

@boyney123
Copy link
Owner

Yeah that sounds great. There is:

  1. `mockit-routes
  2. server
  3. client

I will merge this in soon (il get a minor release out and document the change :) )

@lirantal
Copy link
Contributor Author

Sounds good @boyney123
I'll then follow it up with a PR to include the other projects as well.

@boyney123 boyney123 changed the base branch from master to 1.2.0 July 25, 2019 09:32
@boyney123 boyney123 merged commit cd28ce6 into boyney123:1.2.0 Jul 25, 2019
boyney123 added a commit that referenced this pull request Jul 25, 2019
* Update changelog for 1.2.0

* feat(security): prevent secrets from leaking to source control (#59)

* feat(security): prevent secrets from leaking to source control

* chore: update lint-staged pacakgeto use v9

* fix: update versions

* fix(security): add secrets baseline
boyney123 pushed a commit that referenced this pull request Aug 13, 2019
* 1.2.0 (#62)

* Update changelog for 1.2.0

* feat(security): prevent secrets from leaking to source control (#59)

* feat(security): prevent secrets from leaking to source control

* chore: update lint-staged pacakgeto use v9

* fix: update versions

* fix(security): add secrets baseline

* 🚧 Added two extra status codes

* ✅ Unit checks now validates options groups

* 🚧 Label is only visible as a label attribute
boyney123 added a commit that referenced this pull request Aug 13, 2019
* Update changelog for 1.2.0

* Fix/#2 status codes (#65)

* 1.2.0 (#62)

* Update changelog for 1.2.0

* feat(security): prevent secrets from leaking to source control (#59)

* feat(security): prevent secrets from leaking to source control

* chore: update lint-staged pacakgeto use v9

* fix: update versions

* fix(security): add secrets baseline

* 🚧 Added two extra status codes

* ✅ Unit checks now validates options groups

* 🚧 Label is only visible as a label attribute

* Update changelog for 1.2.1

* fix(security): clean up markdown (#64)

* Update changelog for 1.2.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants