You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by cc...@apache.org on 2026/08/31 18:17:20 UTC

(allura) branch cc/8617-part2 updated (9e018da0b -> b022c9f7b)

This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a change to branch cc/8617-part2
in repository https://gitbox.apache.org/repos/asf/allura.git


    from 9e018da0b [#8617] Implement field level encryption for tool data fields
     add edf8a8c1b fixup! [#8617] Update User's set_tool_data to store encrypted tool data values
     new b022c9f7b [#8617] Update tool-data encryption flags and generic tests

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Allura/allura/model/auth.py                        | 13 +--
 Allura/allura/tests/model/test_auth.py             | 93 +++++++++++++++-------
 .../tests/scripts/test_convert_encrypted_field.py  | 22 ++---
 3 files changed, 82 insertions(+), 46 deletions(-)


(allura) 01/01: [#8617] Update tool-data encryption flags and generic tests

Posted by cc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch cc/8617-part2
in repository https://gitbox.apache.org/repos/asf/allura.git

commit b022c9f7bc25b3e65356394036d8d5e4bc375906
Merge: 9e018da0b edf8a8c1b
Author: Carlos Cruz <ca...@slashdotmedia.com>
AuthorDate: Mon Aug 31 11:37:00 2026 -0600

    [#8617] Update tool-data encryption flags and generic tests

 Allura/allura/model/auth.py                        | 13 +--
 Allura/allura/tests/model/test_auth.py             | 93 +++++++++++++++-------
 .../tests/scripts/test_convert_encrypted_field.py  | 22 ++---
 3 files changed, 82 insertions(+), 46 deletions(-)

diff --cc Allura/allura/tests/model/test_auth.py
index 6668811ec,e41e36c1c..c8beaab64
--- a/Allura/allura/tests/model/test_auth.py
+++ b/Allura/allura/tests/model/test_auth.py
@@@ -536,8 -552,10 +552,27 @@@ class TestAuth
              }},
          )
  
-         assert user.get_tool_data('sfx', 'registration_ip') == '198.51.100.12'
+         assert user.get_tool_data('test_tool', 'field') == 'old field'
+         assert user.get_tool_data(
+             'test_tool', 'field', decrypt=True) == 'new field'
+ 
++    def test_get_tool_data_decrypts_without_plaintext(self):
++        user = M.User(
++            username='tool-data-encrypted-only-getter-test',
++            tool_data={'test_tool': {'field_encrypted': M.User.encr('field value')}},
++        )
++
++        assert user.get_tool_data('test_tool', 'field', decrypt=True) == 'field value'
++
++    def test_get_tool_data_decrypt_falls_back_to_plaintext(self):
++        user = M.User(
++            username='tool-data-plaintext-getter-test',
++            tool_data={'test_tool': {'field': 'field value'}},
++        )
++
++        assert user.get_tool_data('test_tool', 'field', decrypt=True) == 'field value'
++        assert user.get_tool_data('test_tool', 'missing', 'default', decrypt=True) == 'default'
 +
      def test_personal_data_fields_are_stored_encrypted_on_creation(self):
          user = M.User(
              username='personal-data-encrypted-create-test',
diff --cc Allura/allura/tests/scripts/test_convert_encrypted_field.py
index f9811aca4,9ede77ad5..aac046f97
--- a/Allura/allura/tests/scripts/test_convert_encrypted_field.py
+++ b/Allura/allura/tests/scripts/test_convert_encrypted_field.py
@@@ -96,32 -92,6 +96,32 @@@ def test_encryption_schema_info_rejects
          )
  
  
 +def test_remove_unencrypted_dynamic_field_preserves_ciphertext():
 +    setup_basic_test()
 +    user = M.User(
 +        username='dynamic-field-conversion-test',
-         tool_data={'sfx': {
-             'registration_ip': '198.51.100.12',
-             'registration_ip_encrypted': M.User.encr('198.51.100.12'),
++        tool_data={'test_tool': {
++            'field': 'field value',
++            'field_encrypted': M.User.encr('field value'),
 +        }},
 +    )
 +    ThreadLocalODMSession.flush_all()
 +    user_id = user._id
 +
 +    main(
 +        'allura.model.auth.User',
-         'tool_data.sfx.registration_ip',
++        'tool_data.test_tool.field',
 +        remove_unencrypted=True,
 +        encrypt_dynamic_field=True,
 +    )
 +    ThreadLocalODMSession.close_all()
 +
 +    user = M.User.query.get(_id=user_id)
-     raw_sfx = user.tool_data.sfx
-     assert 'registration_ip' not in raw_sfx
-     assert raw_sfx.registration_ip_encrypted == M.User.encr('198.51.100.12')
++    raw_tool_data = user.tool_data.test_tool
++    assert 'field' not in raw_tool_data
++    assert raw_tool_data.field_encrypted == M.User.encr('field value')
 +
 +
  def test_encrypt_nested_array_value_updates_every_item():
      socialnetworks = [
          {'socialnetwork': 'Mastodon', 'accounturl': 'https://example.com/@user'},