ЛР7 на 4: HTTPS, mTLS, OpenBao AppRole и ротация leaf.
Skeleton contracts / contracts (pull_request) Blocked by required conditions

Smoke/security/grade4/persistence/failover пройдены; REPORT и DEFENSE.
This commit is contained in:
2026-12-02 23:08:27 +03:00
parent 20afc2c790
commit 2f2047909f
182 changed files with 15169 additions and 90 deletions
+44
View File
@@ -0,0 +1,44 @@
package dto
import (
"regexp"
"strings"
"time"
"unicode/utf8"
"github.com/google/uuid"
)
var usernamePattern = regexp.MustCompile(`^[a-z0-9_]{3,32}$`)
type CreateUserRequest struct {
Username string `json:"username"`
DisplayName string `json:"display_name"`
Password string `json:"password"`
}
type UserResponse struct {
ID uuid.UUID `json:"id"`
Username string `json:"username"`
DisplayName string `json:"display_name"`
CreatedAt time.Time `json:"created_at"`
}
func (r CreateUserRequest) Validate() bool {
if !usernamePattern.MatchString(r.Username) {
return false
}
displayNameLength := utf8.RuneCountInString(r.DisplayName)
if strings.TrimSpace(r.DisplayName) == "" ||
displayNameLength > 100 ||
strings.ContainsRune(r.DisplayName, 0) {
return false
}
if n := utf8.RuneCountInString(r.Password); n < 12 || n > 128 {
return false
}
return true
}