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
{{ message }}
Repository navigation
Go SDK: int16 is widened to Int32, and there's no way to encrypt a date, timestamp, decimal or 128-bit integer #1144
The Go SDK (languages/golang) encrypts Go struct fields. stashgen
generates the code, and encrypt/gensupport converts Go values into
vitaminc value kinds.
Problem
int8 and int16 are widened to Int32, and the unsigned widths to UInt32 (encrypt/gensupport/declaration.go:22-23). That fixes the wrong
kind into every stored ciphertext and term.
time.Time could mean a date or a timestamp, and there is no date type.
There is no mapping for decimals or 128-bit integers.
The Go SDK hasn't been released, so changing the mapping now costs nothing.
After release it needs a data migration.
Proposal
Map each integer width to its own kind. Add Int128 and Uint128 value
types.
time.Time maps to Timestamp, and encrypt.Date{Year, Month, Day} is a
date. A field whose EQL target is a date family accepts time.Time,
truncated to its UTC calendar day.
Add a decimal mapping that refuses NaN and ±Infinity.
Update record.Kind, the gensupport conversions and stashgen's type
mapping. Regenerate eql_gen.go against v4. Change the eql_v3 strings to eql_v4 (about 245 lines).
Background
The Go SDK (
languages/golang) encrypts Go struct fields.stashgengenerates the code, and
encrypt/gensupportconverts Go values intovitaminc value kinds.
Problem
int8andint16are widened toInt32, and the unsigned widths toUInt32(encrypt/gensupport/declaration.go:22-23). That fixes the wrongkind into every stored ciphertext and term.
time.Timecould mean a date or a timestamp, and there is no date type.eql_gen.gorefuses every numeric and date EQL type (stashgen refuses every number, date and boolean EQL type — produce them in EQL v4 using ADR-0002's encodings #1130).The Go SDK hasn't been released, so changing the mapping now costs nothing.
After release it needs a data migration.
Proposal
Int128andUint128valuetypes.
time.Timemaps toTimestamp, andencrypt.Date{Year, Month, Day}is adate. A field whose EQL target is a date family accepts
time.Time,truncated to its UTC calendar day.
record.Kind, thegensupportconversions andstashgen's typemapping. Regenerate
eql_gen.goagainst v4. Change theeql_v3strings toeql_v4(about 245 lines).Must land before the Go SDK ships (#1046). Needs #1140 and #1142. Decided in
ADR-0002 (#1139).