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
@@ -189,6 +200,30 @@ One of `Message` and `UnderlyingException` is required on creation.
189
200
190
201
---
191
202
203
+
# 🔒 Security
204
+
205
+
The validator provides built-in security through tag-based field filtering. **Only fields with the specified validation tag will be updated**, protecting sensitive fields from unauthorized modification. This tag filtering also works recursively for nested structs and arrays of structs.
206
+
207
+
## Tag Behavior
208
+
209
+
When using `ValidateAndUpdate` or similar functions with a custom tag (e.g., `"upd"`), fields are handled as follows:
210
+
211
+
```go
212
+
typeUserstruct {
213
+
IDint`json:"id"`// No tag: NEVER updated
214
+
Passwordstring`json:"password"`// No tag: NEVER updated
215
+
Namestring`json:"name" upd:"-"`// Ignore tag: Updated WITHOUT validation
216
+
Emailstring`json:"email" upd:"rex^[^@]+@[^@]+\\.[^@]+$"`// Full tag: Validated AND updated
0 commit comments