#9519 session cookie can't be read
Closed: fixed by frenaud. Opened by slev.

Session cookie related tests fail with:

FAILED test_ipalib/test_rpc.py::test_rpcclient_context::test_context_request_url - AssertionError: 'https://master1.ipa.test/ipa/json' != 'https://master1.ipa...
FAILED test_ipalib/test_rpc.py::test_rpcclient_context::test_context_session_cookie - TypeError: argument of type 'NoneType' is not iterable
FAILED test_ipapython/test_session_storage.py::test_session_storage::test_02 - AssertionError: assert None == b'Test Data'
_________________________ test_session_storage.test_02 _________________________ 
self = <ipatests.test_ipapython.test_session_storage.test_session_storage object at 0x7fcbd4dab4d0>
    def test_02(self):                                                           
        data = session_storage.get_data(self.principal, self.key)                
>       assert(data == self.data)                                                
E       AssertionError: assert None == b'Test Data'                              
E        +  where b'Test Data' = <ipatests.test_ipapython.test_session_storage.test_session_storage object at 0x7fcbd4dab4d0>.data                                    
test_ipapython/test_session_storage.py:34: AssertionError

The following code can reproduce the problem:

from ipapython import session_storage
CCACHE_COOKIE_KEY = "X-IPA-Session-Cookie"
principal = "admin@IPA.TEST"
data = "test"
session_storage.remove_data(principal, CCACHE_COOKIE_KEY)
session_storage.store_data(principal, CCACHE_COOKIE_KEY, data)
print(session_storage.get_data(principal, CCACHE_COOKIE_KEY))

output:

[user@host /dir# KRB5_TRACE=/dev/stdout python3 test.py
[22297] 1706109672.564323: Storing config in FILE:/tmp/krb5cc_0 for admin@IPA.TEST: X-IPA-Session-Cookie: (null)
[22297] 1706109672.564324: Removing admin@IPA.TEST -> krb5_ccache_conf_data/X-IPA-Session-Cookie/admin\@IPA.TEST@X-CACHECONF: from FILE:/tmp/krb5cc_0
2 krb5_free_cred_contents (<ipapython.session_storage.LP__krb5_context object at 0x7f535553cb90>, <cparam 'P' (0x7f53553d43b0)>)
[22297] 1706109672.564325: Storing config in FILE:/tmp/krb5cc_0 for admin@IPA.TEST: X-IPA-Session-Cookie: test\x00
[22297] 1706109672.564326: Storing admin@IPA.TEST -> krb5_ccache_conf_data/X-IPA-Session-Cookie/admin\@IPA.TEST@X-CACHECONF: in FILE:/tmp/krb5cc_0
2 krb5_free_cred_contents (<ipapython.session_storage.LP__krb5_context object at 0x7f535553ccb0>, <cparam 'P' (0x7f53553d4430)>)
None
[root@master1 /]# ipa --version
VERSION: 4.11.1, API_VERSION: 2.253

Metadata Update from @slev:
- Issue assigned to slev

Metadata Update from @slev:
- Assignee reset
- Custom field on_review adjusted to https://github.com/freeipa/freeipa/pull/7186

Metadata Update from @slev:
- Issue assigned to slev

master:

  • d002a4d7c991966ccb73e4ab34d0288b90f033ab ipapython: Clean up krb5_error
  • 6cd04875dea09c83e01261a805aa27360768d46f ipapython: Correct return type of krb5_free_cred_contents
  • 9802e852cb29fdbc43b056816ade27f453001706 ipapython: Propagate KRB5Error exceptions on iterating ccache

ipa-4-11:

  • 33638de180a8157e369ad6c61f9e3406d9e85404 ipapython: Clean up krb5_error
  • f8a616dc6196324145372713da772fe9b2352e53 ipapython: Correct return type of krb5_free_cred_contents
  • 59b8a9fb7169561c7ba9168fe84f47ae94e5ce23 ipapython: Propagate KRB5Error exceptions on iterating ccache

ipa-4-10:

  • 2e649b26d1d8ec988ec64477af73cd1f033731fd ipapython: Clean up krb5_error
  • 59f010774d13ea6a0148235db2ff05a3f3c93c7b ipapython: Correct return type of krb5_free_cred_contents
  • e69d98add55f25641459fc1dfb973260e85f9b95 ipapython: Propagate KRB5Error exceptions on iterating ccache

Metadata Update from @frenaud:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

ipa-4-9:

  • 381af470779ea87335f57038dcbe72cd042ae6bb ipapython: Clean up krb5_error
  • 2a4bad8bb3295c5c0f5a760ecd41871c4c5a0c56 ipapython: Correct return type of krb5_free_cred_contents
  • beb402afdbf32c01eed860e9416356f7b492ad74 ipapython: Propagate KRB5Error exceptions on iterating ccache

Metadata Update from @frenaud:
- Custom field rhbz adjusted to https://issues.redhat.com/browse/RHEL-23621, https://issues.redhat.com/browse/RHEL-23622

Metadata