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
We could add some kind of opt-in strict mode to this function (for use in v6 rooms and up). But whatever we do, we'd need to be careful to maintain backwards compatibility because existing Synapse releases will install canonicaljson willy-nilly without any upper bound.
But whatever we do, we'd need to be careful to maintain backwards compatibility because existing Synapse releases will install canonicaljson willy-nilly without any upper bound.
I wonder if we should just plan to break such old Synapse releases. We could deprecate the encode_canonical_json name in favour of some other name, and (eventually) drop encode_canonical_json altogether (with a major semver bump). That would leave old Synapses obviously rather than subtly broken, and will leave python-canonicaljson without the footgun of a function called encode_canonical_json which doesn't encode canonical json.
Activity
richvdh commentedon Jun 5, 2019
looks like #17 fixes this
clokep commentedon Jul 23, 2020
Seems like this would be nice, but I don't think we can do it -- see matrix-org/synapse#7381 and related issues.
richvdh commentedon Jul 23, 2020
I think we should make it turn-on-and-off-able: add an option to reject floats.
ShadowJonathan commentedon Jan 31, 2022
This is still an issue, I was looking for a method by which synapse ensures that ints do not exceed their maximum value, and i found none.
#17 is closed, I'll look into making a new PR.
DMRobertson commentedon Jun 6, 2022
Note that the spec says:
and the grammar for only permits integer literals in number.
DMRobertson commentedon Jun 6, 2022
Additionally: it's not just that the tests fail, but we don't reject floats whatsoever:
DMRobertson commentedon Jun 6, 2022
We could add some kind of opt-in
strictmode to this function (for use in v6 rooms and up). But whatever we do, we'd need to be careful to maintain backwards compatibility because existing Synapse releases will install canonicaljson willy-nilly without any upper bound.richvdh commentedon Jun 7, 2022
I wonder if we should just plan to break such old Synapse releases. We could deprecate the
encode_canonical_jsonname in favour of some other name, and (eventually) dropencode_canonical_jsonaltogether (with a major semver bump). That would leave old Synapses obviously rather than subtly broken, and will leavepython-canonicaljsonwithout the footgun of a function calledencode_canonical_jsonwhich doesn't encode canonical json.