-
Notifications
You must be signed in to change notification settings - Fork 2
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
extend create_project to include .secrets, optional pre-commit to detect secrets #83
Comments
Like this suggestion - think there's a really easy win here by giving a standard file users can have that is in the .gitignore by default. I think I'd leave the commit hooks out of it for now, just as they can be more effort and also start to add more dependencies too, but definitely something that could be an extension afterwards. Also worth noting that GitHub has some inbuilt secret scanning too, which we recommend having on for all repos, this can be pretty neat and requires little effort - I think it's worth us adding some notes on anything we add here, as well as the GitHub / DevOps specific approaches to think about how to make use of this too, nto the project vignette in #76. Main question for this issue is then probably what to call the file?
Interested in any other views on this! Also, any suggestions of good real world examples to use in the documentation / as a test case? |
I think you're right From what I can tell there is a profile version and a .Rproj specific version. I'd assume we'd want to create a .Renviron file, have guidance on how users should use this (maybe pre-populate this with some examples), and how to call this from their code. Example:
One thing to note is as far as I can tell, RStudios checks for .Renvirons only once on start up of the project and i'm unsure if there's a way to force this to happen once an .Renviron file is updated. Not ideal if users have to reopen a project after putting in their key but something to include in guidance if there's no fix. |
Nice - that all sounds good to me, happy to go with |
I like this, and it pushed people towards that best practice of sharing as much as possible but doing so in a safe manner. For reference, this is how I have used
And then as a little bonus, this function I use to connect to SQL using the config.yml:
May be useful in providing a use case for the |
Is your feature request related to a problem? Please describe.
For some workstreams a key or token may be needed and there is always a risk of individuals pushing keys/tokens to repo's.
Describe the solution you'd like
Include under create_project a .secrets file (or .env) which is untracked by git / included in the .gitignore as either standard or by optional toggle. Optionally, this could be extended to include a pre-commit hook which searches a repo for token/keys before a commit.
Describe alternatives you've considered
Users should use environment variables and not push secrets, guidance should assist with this but having it as part of the default project template with a back-up pre-commit hook can help limit this risk.
Additional context
Similar functionality is provided in the govcookie cutter repo but the pre-commits and structure are a bit buggy for R as this was mainly python focused originally: https://github.com/best-practice-and-impact/govcookiecutter
The text was updated successfully, but these errors were encountered: