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
Commit 2d5daee
Browse filesBrowse the repository at this point in the historyBrowse files
fix(stack-encrypt)!: a target field's label is refused when it is not table and column
Review of #1095: a target field whose label had three or more segments
passed se_plan_check and then failed on every value with TargetError::Column
from the resolver. A Go struct with context=app/users and
email,encrypt_into=TextEq lowers to the label app/users/email; stashgen asks
the engine for its rules, so it wrote the code, and Encrypt, Decrypt and
Fields.Email.Query all failed afterwards.
Plan::new_with now refuses it beside the Extended check, naming the field
(TargetError::Column), so the refusal reaches se_plan_check and the
generator before any code is written. FieldPlan::with_target keeps its
constructor bound of two or more segments, like every field constructor,
and the module docs now say where each rule lives. Go's record.Plan.Validate
refuses an encrypt_into field whose context has more than one segment or
any extension, and stashgen's lowerDeclaration names the field for the
same, so the host says it first.
Tests: the three-segment plan refused with the field and label named and
nothing minted, the same label accepted for a sealed field; Go Validate
refusals and the plain-field acceptance; the stashgen command refusing
context=app/users by field with nothing written.
Claude-Session: https://claude.ai/code/session_01V3WFXwax4J3uecpFEJ6yHc
returnfmt.Errorf("record: field %q names the EQL type %s and outputs; a field has one or the other", f.Name, f.Target)
229
229
}
230
+
// An EQL value is stored under a table and a column: the
231
+
// context is the table, the identity the column. The engine
232
+
// refuses anything else when the plan is built; saying it here
233
+
// names the field before the guest is asked.
234
+
iflen(p.Context) !=1 {
235
+
returnfmt.Errorf("record: field %q names the EQL type %s, and an EQL column is a table and a column: the context %q has %d segments, not one", f.Name, f.Target, strings.Join(p.Context, "/"), len(p.Context))
236
+
}
237
+
iflen(p.Extension) !=0 {
238
+
returnfmt.Errorf("record: field %q names the EQL type %s, and an EQL column is a table and a column: an extended context has no column", f.Name, f.Target)
returnnil, &FieldError{Type: d.Type, Field: f.GoName, Reason: fmt.Sprintf("%s seals a %s, and %s is %s", f.EQLType, eqlType.Plaintext, f.GoType, f.GoType.Kind)}
160
160
}
161
+
// An EQL value is stored under a table and a column: the struct's
162
+
// context is the table and the field's name the column, so a
163
+
// context of two or more segments leaves the field no column.
164
+
// The engine refuses it too (se_plan_check); naming it here
165
+
// names the field.
166
+
iflen(segments) !=1 {
167
+
returnnil, &FieldError{Type: d.Type, Field: f.GoName, Reason: fmt.Sprintf("%s is stored under a table and a column, and the context %q has %d segments, not one", f.EQLType, d.Context, len(segments))}
0 commit comments