MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / validateColumn

Function validateColumn

pkg/jsonfilter/jsonfilter.go:129–135  ·  view source on GitHub ↗

validateColumn ensures the JSON column is a bare SQL identifier before it is emitted into the query by the ent sqljson helpers. Callers are expected to set it to a known column constant, but validating here keeps safety from depending on every caller remembering to do so.

(column string)

Source from the content-addressed store, hash-verified

127// it to a known column constant, but validating here keeps safety from depending
128// on every caller remembering to do so.
129func validateColumn(column string) error {
130 if !columnRegexp.MatchString(column) {
131 return fmt.Errorf("invalid column %q: must be a valid identifier", column)
132 }
133
134 return nil
135}
136
137// validateFieldPath ensures the JSON field path only contains safe characters
138// before it is concatenated into the SQL query by the ent sqljson helpers.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected