1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

18 commits

Author SHA1 Message Date
Kasper Timm Hansen
bb30f05f38
Deprecate encrypted secrets in favor of credentials.
Allow edits of existing encrypted secrets generated on Rails 5.1,
but refer to credentials when attempting to setup.

This also removes the need for any of the setup code, so the
generator can be ripped out altogether.
2017-11-12 17:50:09 +01:00
Yoshiyuki Hirano
ac345f5dad Fix indentation in the template for secrets 2017-08-23 06:48:13 +09:00
Pat Allan
acea68de02 Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
yuuji.yaginuma
1677c64ee0 Allow to edit secrets in mutiple apps at the same time
In encrypted secrets, the tmp file is used as a fixed file
(`secrets.yml.enc` under the tmp directory).
And that tmp file will be removed after process.

Therefore, if edit secrets at the same time with multiple applications,
the tmp file was conflicting.

In order to avoid the above issue, added pid to tmp file.
2017-07-13 08:06:32 +09:00
yuuji.yaginuma
be4ebc4780 Treat secrets as binary
Until Rails 5.1.1 secrets was treated as binary inside Rails.
https://github.com/rails/rails/blob/v5.1.1/railties/lib/rails/secrets.rb#L59
https://github.com/rails/rails/blob/v5.1.1/railties/lib/rails/secrets.rb#L63

However, it is treated as String in Rails 5.1.2(changed by 157db87210).
https://github.com/rails/rails/blob/v5.1.2/railties/lib/rails/secrets.rb#L104
https://github.com/rails/rails/blob/v5.1.2/railties/lib/rails/secrets.rb#L108

As a result, when upgrading from Rails 5.1.1 to 5.1.2, to write the value
treated as binary using `File.write`, causing an error.

In order to avoid `UndefinedConversionError`, fixed it to treat it as
binary like 5.1.1.
Fixes #29696
2017-07-09 09:25:45 +09:00
yuuji.yaginuma
32327eb123 Do not update secrets.yml.enc when secretes do not change
Currently, if open a file with `secrets:edit` command, `secrets.yml.enc`
will be changed even if its contents do not change.

Therefore, even if only want to check secrets, the difference will come
out. This is a little inconvenient.

As a fix to the above problem, when content does not change,
`secrets.yml.ecn` is fixed so that it is not changed.
2017-07-07 12:16:53 +09:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590, reversing
changes made to afb66a5a59.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Pavel Valena
edbe7c417a Do not use UTF8 in test SecretsCommandTest#test_edit_secrets 2017-05-30 01:53:31 +02:00
Kasper Timm Hansen
0338c81dc2 Reorder first secrets edit flow.
Setup config/secrets.yml.enc with template contents for people to edit.

Then generate encryption key and encrypt the initial secrets.
2017-05-25 15:56:55 +02:00
yuuji.yaginuma
827bfe4f41 Use the config value directly when call secrets
Currently, `read_encrypted_secrets` is set with initializer.
Therefore if refer to `secrets` in config, `read_encrypted_secrets` is false,
so can not get the value of `secrets.yml.enc`.

In order to be able to refer to secrets in config, modified to refer to
`config.read_encrypted_secrets` when calling `secrets`.

Fixes #28618.
2017-04-16 09:35:45 +09:00
Kasper Timm Hansen
d22f879691 Inline CIPHER constant. 2017-03-02 19:38:42 +01:00
Kasper Timm Hansen
e3b4554f23 Move key packing into encryptor. 2017-03-02 19:38:01 +01:00
Kasper Timm Hansen
f2eb3417f2 Add back yaml require. 2017-03-02 19:28:54 +01:00
Stephen Touset
6aa6f9ae44 Default Secrets to AES-128-GCM, using ActiveSupport::MessageEncryptor
Fixes #28135.
2017-03-01 14:54:34 -08:00
Kasper Timm Hansen
fbee4e3ce3 Revert "Revert "Add encrypted secrets"" 2017-02-23 18:15:28 +01:00
David Heinemeier Hansson
039380e3ee Revert "Add encrypted secrets" (#28127) 2017-02-23 15:55:15 +01:00
Kasper Timm Hansen
1166094569 Add encrypted secrets (#28038) 2017-02-23 15:01:02 +01:00