-
Notifications
You must be signed in to change notification settings - Fork 25
fix: Session dump inconsistent schema after sman flush #59
Conversation
chore: session Database init small generalization
Realised this should be done a couple of days ago. Glad you did it for me :-) |
But you should fix the tests. |
@rohe I fixed the tests ... rather I fixed the pointers in the session database. |
We (I) probably should document the three methods dump/flush/load better. The bases for these three methods are the
This means that after a Having something like salt being randomly defined means that all entities that needs to have the same salt must be loaded with the same state. This means that having anything that should be known to more than one worker being assigned randomly is probably a bad idea. You can make it work by initialising one worker, dump its initial state and then have all the subsequent initialised workers being loaded with the first ones state. |
We (I) should improve this commit making load_key and load_salt aware of the random value, stored elsewhere in two private attributes of sman objects, this Will prevent a random value Will be generated After any flush. But multiple workers Will Always have their own randomic, that's why I put the static password and salt parameters in the global configuration. These will prevent any randomness. So, what to do now with this PR? |
salt value in parameters dict Is "". The static password/Key configurations fixed this behaviour by-default and an additional commit can make a immutabile random salt and Key value instead of calling eberytime the rnd() finction |
You should NEVER do a flush without a load. That an invitation to disaster ! |
If you don't want random values per worker, then the value MUST be defined in the configuration (basically being static) or in a file referenced by the configuration (a la session_key). |
It could happen due to unhandled exceptions. This PR also enable static password and salt. I'llonly do a another commit to improve the init_db method as we shared in the previous posts. Can I intend that we agree and then go ahead? |
Once this PR Will be merged then se could see this session_key, sub_funcs, password and salts MAY be under a session manager umbrella, as a opconfiguration root mode and not sparse as they are. Hope to meet your agreement, this Will make Easier to read/understand the configuration and obviously make a Better documentation 💪 |
I think we must be clear about what is under the dump/flush/load umbrella and what isn't. |
They all are related to session manager, Just this. All this parameters belongs to session manager. But this aspect Is out of scope in this PR, i talked too much on things not related to the scope of this PR. It Just fix few small bugs and now my implementation of storage, in django-oidc-op develop branch, works great. This afternoon I'll add another commit to follow what shared here between US but feel free to suggest, tell, do what you intende to be Better for the roadmap. I accept task 😊 |
Ok, made it, unit tests works great and also added another test to deal with the issues it fixes and the feature I want to push with this contribution:
@rohe my feature make a db consistent after a flush and a way to have always the original key/salt in case of disaster.
a wonderful day, anyway |
Last commit improves Documentation and definitively closes #50 |
tests/test_23_oidc_registration_endpoint.py::TestEndpoint::test_register_alg_keys /home/wert/DEV3/OIDC-Project/env/lib/python3.7/site-packages/cryptojwt/utils.py:257: DeprecationWarning: owner is deprecated; use issuer_id
I think that conf dict should be readonly. Once it's created a lock state should prevent any other changes in the future |
Agree that it should be read only. Not sure how you would enforce a lock. If someone wanted to get around it, it would be hard to stop. |
Included in #65 |
and also