#9519 session cookie can't be read
Closed: fixed a year ago by frenaud. Opened a year ago 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

a year ago

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

a year ago

Metadata Update from @slev:
- Issue assigned to slev

a year ago

master:

  • d002a4d ipapython: Clean up krb5_error
  • 6cd0487 ipapython: Correct return type of krb5_free_cred_contents
  • 9802e85 ipapython: Propagate KRB5Error exceptions on iterating ccache

ipa-4-11:

  • 33638de ipapython: Clean up krb5_error
  • f8a616d ipapython: Correct return type of krb5_free_cred_contents
  • 59b8a9f ipapython: Propagate KRB5Error exceptions on iterating ccache

ipa-4-10:

  • 2e649b2 ipapython: Clean up krb5_error
  • 59f0107 ipapython: Correct return type of krb5_free_cred_contents
  • e69d98a ipapython: Propagate KRB5Error exceptions on iterating ccache

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

a year ago

ipa-4-9:

  • 381af47 ipapython: Clean up krb5_error
  • 2a4bad8 ipapython: Correct return type of krb5_free_cred_contents
  • beb402a ipapython: Propagate KRB5Error exceptions on iterating ccache
a year ago

Log in to comment on this ticket.

Metadata