ruby-on-railsruby-on-rails-5.2

Is it safe to commit Rails' credentials.yml.enc file?


I've just created a new Rails project, and it came with this credentials.yml.enc file.

Is it safe to commit it publicly?


Solution

  • What David Heinemeier Hansson said here:

    These secrets are not supposed to withstand any sort of attack in test or development.

    As far I understood you should not keep damn secret credentials here, and then it's good to publish in public.

    It's only in production (and derivative environments, like exposed betas) where the secret actually needs to be secret. So we can simply insert this secret into the new flat credentials.yml.enc file.

    And at the end he mentioned:

    Note: We should just keep Rails.secrets and friends around. The Rails.credentials setup would be a new, concurrent approach. All new apps would use it, but we wouldn't need to screw existing apps.

    Hope it would help. For more, follow this.