3
0

Prevent exec of value vldt/san/fmt on val. expr fields

This commit is contained in:
Denis Arh 2020-11-27 18:37:54 +01:00
parent b739c5d01f
commit 8296e48f89
3 changed files with 15 additions and 0 deletions

View File

@ -38,6 +38,11 @@ func (f formatter) Run(m *types.Module, vv types.RecordValueSet) types.RecordVal
continue
}
if fld.Expressions.ValueExpr != "" {
// do not do any validation if field has value expression!
continue
}
if !(fld.Expressions.DisableDefaultFormatters && len(fld.Expressions.Formatters) > 0) {
// Per field type validators
switch strings.ToLower(fld.Kind) {

View File

@ -73,6 +73,11 @@ func (s sanitizer) Run(m *types.Module, vv types.RecordValueSet) (out types.Reco
continue
}
if f.Expressions.ValueExpr != "" {
// do not do any sanitization if field has value expression!
continue
}
if v.IsDeleted() || !v.Updated {
// Ignore unchanged and deleted
continue

View File

@ -145,6 +145,11 @@ fields:
continue
}
if f.Expressions.ValueExpr != "" {
// do not do any validation if field has value expression!
continue
}
if !(f.Expressions.DisableDefaultValidators && len(f.Expressions.Validators) > 0) {
if v.Value == "" {
// Nothing to do with empty value