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

Add gitignores for rails credentials #23263

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
BUILD
ca/root
certs/v2_key
config/secrets.yml*
coverage/
Gemfile.lock*
!Gemfile.lock.release
Expand All @@ -46,6 +45,23 @@ config/database.yml*
config/messaging.yml
config/vmdb.yml.db

# See: EDITOR=vi be rails credentials:edit --help for more information
# Rails credentials follow the following pattern:
# If ENV['RAILS_MASTER_KEY'] isn't specified:
# Global is used:
# * config/master.key (plain text encryption key)
# * config/credentials.yml.enc (encrypted credentials file)
# If --environment test, the overrides for that environment is used:
# * config/credentials/test.key
# * test.yml.enc
# If we want to commit and share encrypted credentials, we can change the two lines below to:
# config/*.key
# config/credentials/*.key
config/credentials*
Comment on lines +48 to +60
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the Rails boilerplate or is this something you wrote up? I'll merge regardless, I'm just curious.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the comments.

Rails assumes you'll want to commit the yml.enc encrypted files and share your .key file so only the .key is .gitignored. When you do rails credentials:edit with environment or without, it only adds the .gitignore for that particular .key file. I think it's safer to ignore both key and encrypted file for now and if we ever want to use a shared encrypted credentials file by sharing the key, we can remove the encrypted credentials file from the .gitignore.

config/master.key

# For legacy rails secrets
config/secrets.yml*
config/initializers/*.local.rb

config/settings.local.yml
Expand Down