Open kmcphillips opened 2 years ago
I'm getting encryptor.rb:81:in `[]=': no implicit conversion of String into Integer (TypeError); potentially a similar root cause.
The yml file contains some unorthodox keys such as:
foo:
- "123123"
- "4345354"
Likely this is rather an abuse of Rails credentials, would still be nice if I could add diffcrypt though :)
Full stack trace:
34: from bin/rails:4:in `<main>'
33: from 2.7.7/gems/activesupport-6.0.6.1/lib/active_support/dependencies.rb:324:in `require'
32: from 2.7.7/gems/activesupport-6.0.6.1/lib/active_support/dependencies.rb:291:in `load_dependency'
31: from 2.7.7/gems/activesupport-6.0.6.1/lib/active_support/dependencies.rb:324:in `block in require'
30: from 2.7.7/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
29: from 2.7.7/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
28: from 2.7.7/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
27: from 2.7.7/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
26: from 2.7.7/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
25: from 2.7.7/gems/railties-6.0.6.1/lib/rails/commands.rb:18:in `<main>'
24: from 2.7.7/gems/railties-6.0.6.1/lib/rails/command.rb:46:in `invoke'
23: from 2.7.7/gems/railties-6.0.6.1/lib/rails/command/base.rb:69:in `perform'
22: from 2.7.7/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
21: from 2.7.7/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
20: from 2.7.7/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
19: from 2.7.7/gems/railties-6.0.6.1/lib/rails/commands/credentials/credentials_command.rb:32:in `edit'
18: from 2.7.7/gems/railties-6.0.6.1/lib/rails/command/helpers/editor.rb:26:in `catch_editing_exceptions'
17: from 2.7.7/gems/railties-6.0.6.1/lib/rails/commands/credentials/credentials_command.rb:33:in `block in edit'
16: from 2.7.7/gems/railties-6.0.6.1/lib/rails/commands/credentials/credentials_command.rb:67:in `change_credentials_in_system_editor'
15: from 2.7.7/gems/diffcrypt-0.6.1/lib/diffcrypt/rails/encrypted_configuration.rb:72:in `change'
14: from 2.7.7/gems/diffcrypt-0.6.1/lib/diffcrypt/rails/encrypted_configuration.rb:87:in `writing'
13: from 2.7.7/gems/diffcrypt-0.6.1/lib/diffcrypt/rails/encrypted_configuration.rb:57:in `write'
12: from 2.7.7/gems/diffcrypt-0.6.1/lib/diffcrypt/rails/encrypted_configuration.rb:104:in `encrypt'
11: from 2.7.7/gems/diffcrypt-0.6.1/lib/diffcrypt/encryptor.rb:51:in `encrypt'
10: from 2.7.7/gems/diffcrypt-0.6.1/lib/diffcrypt/encryptor.rb:65:in `encrypt_data'
9: from 2.7.7/gems/diffcrypt-0.6.1/lib/diffcrypt/encryptor.rb:79:in `encrypt_values'
8: from 2.7.7/gems/diffcrypt-0.6.1/lib/diffcrypt/encryptor.rb:79:in `each'
7: from 2.7.7/gems/diffcrypt-0.6.1/lib/diffcrypt/encryptor.rb:82:in `block in encrypt_values'
6: from 2.7.7/gems/diffcrypt-0.6.1/lib/diffcrypt/encryptor.rb:79:in `encrypt_values'
5: from 2.7.7/gems/diffcrypt-0.6.1/lib/diffcrypt/encryptor.rb:79:in `each'
4: from 2.7.7/gems/diffcrypt-0.6.1/lib/diffcrypt/encryptor.rb:82:in `block in encrypt_values'
3: from 2.7.7/gems/diffcrypt-0.6.1/lib/diffcrypt/encryptor.rb:79:in `encrypt_values'
2: from 2.7.7/gems/diffcrypt-0.6.1/lib/diffcrypt/encryptor.rb:79:in `each'
1: from 2.7.7/gems/diffcrypt-0.6.1/lib/diffcrypt/encryptor.rb:81:in `block in encrypt_values'
2.7.7/gems/diffcrypt-0.6.1/lib/diffcrypt/encryptor.rb:81:in `[]=': no implicit conversion of String into Integer (TypeError)
Will investigate @kmcphillips + @swiknaba. Better error handling for unsupported YAML should help here and ideally figure out why these specific scenarios don't work, both look as if they should.
Problem
When calling
encrypt
with some YAML it raises. This means only a subset of YAML is supported, but the file I am trying to encrypt has a structure like this:The exception raised is:
With this debug call stack information:
Reproduction