プロジェクト

全般

プロフィール

Vote #79700

完了

Decrypting LDAP and SCM passwords fail if the plaintext password is longer than 31 bytes

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Database_21
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
21
version_id:
144
issue_org_id:
30171
author_id:
332
assigned_to_id:
332
comments:
9
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

This issue is originally reported to the community repository on GitHub by "Nik Il":https://github.com/mr-exz.

https://github.com/redmine/redmine/pull/112/files

encode64 adds \n every 60 symbols, switch to strict_encode64 method, because .strip not working


journals

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Confirmed the problem.

<pre><code class="diff">
Index: test/unit/lib/redmine/ciphering_test.rb
===================================================================
--- test/unit/lib/redmine/ciphering_test.rb (revision 17702)
+++ test/unit/lib/redmine/ciphering_test.rb (working copy)
@@ -92,15 +92,16 @@
end

def test_decrypt_all
+ long_password = SecureRandom.alphanumeric(32)
Repository.delete_all
Redmine::Configuration.with 'database_cipher_key' => 'secret' do
Repository::Subversion.create!(:password => 'foo', :url => 'file:///tmp', :identifier => 'foo')
- Repository::Subversion.create!(:password => 'bar', :url => 'file:///tmp', :identifier => 'bar')
+ Repository::Subversion.create!(:password => long_password, :url => 'file:///tmp', :identifier => 'bar')

assert Repository.decrypt_all(:password)
r = Repository.order('id DESC').first
- assert_equal 'bar', r.password
- assert_equal 'bar', r.read_attribute(:password)
+ assert_equal long_password, r.password
+ assert_equal long_password, r.read_attribute(:password)
end
end
end
</code></pre>

<pre>
laphroaig:redmine-trunk maeda$ ruby test/unit/lib/redmine/ciphering_test.rb
Run options: --seed 15544

# Running:

.F

Failure:
Redmine::CipheringTest#test_decrypt_all [test/unit/lib/redmine/ciphering_test.rb:103]:
--- expected
+++ actual
@@ -1,2 +1,2 @@
-# encoding: US-ASCII
-"YW1zLuz0jcoHerKvHsApD9GVCrRMKXc8"
+"aes-256-cbc:a99hBE62VjbiZNoexSoakctQIKCAO31BoSVOw5krfBF24VUoMBpzrsytazMl
+tP+j--+TqRamucQbcZfeaeGIBLxA=="

bin/rails test test/unit/lib/redmine/ciphering_test.rb:94

......

Finished in 0.354780s, 22.5492 runs/s, 42.2797 assertions/s.
8 runs, 15 assertions, 1 failures, 0 errors, 0 skips
</pre>
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
This issue also affected "Vault Plugin":http://www.redmine.org/plugins/vault and was fixed in "Issue 43":https://github.com/noshutdown-ru/vault/commit/4c03b8df04ab21619661b637b6f1c4a64b3ac162

Since Vault uses Redmine's encryption, perhaps it could help.

Regards
--------------------------------------------------------------------------------
Updated the test in order to catch the problem.
--------------------------------------------------------------------------------
Committed the patches.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

relates,Closed,7411,Option to cipher LDAP ans SCM passwords stored in the database

Admin Redmine さんが約4年前に更新

  • カテゴリDatabase_21 にセット
  • 対象バージョン3.4.8_144 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0