Skip to content

Tags: lignumqt/doltgresql

Tags

0.56.2-rc1

Toggle 0.56.2-rc1's commit message
fix: correct deserialization order of sequence/routine/membership in …

…auth

The serialize() function wrote fields in this order:
  tablePrivileges → sequencePrivileges → routinePrivileges → roleMembership

But deserializeV1() read them in a different order:
  tablePrivileges → roleMembership → routinePrivileges → sequencePrivileges

This mismatch went unnoticed because all three sections (sequencePrivileges,
routinePrivileges, roleMembership) have the same zero-value byte representation
(count=0) when no privileges exist. Once GRANT ALL PRIVILEGES ON ALL ROUTINES
or GRANT ALL PRIVILEGES ON ALL FUNCTIONS is executed, routinePrivileges becomes
non-empty, the reader offset shifts, and doltgres panics with an index out of
range error on the next startup when attempting to read the persisted auth file.

Fix deserializeV1() to match the order used by serialize().

Fixes dolthub#2693

v0.56.2-rc1

Toggle v0.56.2-rc1's commit message
fix: correct deserialization order of sequence/routine/membership in …

…auth

The serialize() function wrote fields in this order:
  tablePrivileges → sequencePrivileges → routinePrivileges → roleMembership

But deserializeV1() read them in a different order:
  tablePrivileges → roleMembership → routinePrivileges → sequencePrivileges

This mismatch went unnoticed because all three sections (sequencePrivileges,
routinePrivileges, roleMembership) have the same zero-value byte representation
(count=0) when no privileges exist. Once GRANT ALL PRIVILEGES ON ALL ROUTINES
or GRANT ALL PRIVILEGES ON ALL FUNCTIONS is executed, routinePrivileges becomes
non-empty, the reader offset shifts, and doltgres panics with an index out of
range error on the next startup when attempting to read the persisted auth file.

Fix deserializeV1() to match the order used by serialize().

Fixes dolthub#2693