You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
session: update un-set MacaroonRecipe field in kvdb
The KVDB implementation could previously create sessions with a non‐nil
`MacaroonRecipe` whose `Permissions` and `Caveats` fields were both nil.
However, the SQL session store cannot represent a `MacaroonRecipe` if
both `Permissions` and `Caveats` are missing—because in SQL they are
stored in separate tables, and without any entries in those tables we
can't represent a `MacaroonRecipe` record at all.
This commit therefore changes the implementation for the KVDB session
store, so that such sessions will have a nil value set for the
`MacaroonRecipe` field, if no `Permissions` and `Caveats` are set.
Additionally, when a session has a `MacaroonRecipe` set but one of the
`Permissions` or `Caveats` fields is unset, the KVDB session store would
represent that field as `nil`, whereas the SQL store would represent it
as an empty array.
Therefore, we update the KVDB session store implementation so that in
this scenario, those fields are also set to an empty array instead of
`nil`, matching the SQL store’s behavior.
This change is important because the KVDB→SQL migration code expects
sessions in both stores to be equivalent. Without it, comparing sessions
would fail, since the `MacaroonRecipe` field would be represented
differently in each store.
0 commit comments