Skip to content

Commit 25c9fcc

Browse files
committed
fix(security): validate demo user password against project policy
CREATE DEMO USER now checks the password against the project's PasswordPolicy before writing to MPR. Previously, non-compliant passwords were accepted silently but the Mendix runtime would skip creating the user, leading to confusing "unknown user" login errors. Closes #137
1 parent f575240 commit 25c9fcc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mdl/executor/cmd_security_write.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,11 @@ func (e *Executor) execCreateDemoUser(s *ast.CreateDemoUserStmt) error {
947947
return fmt.Errorf("failed to read project security: %w", err)
948948
}
949949

950+
// Validate password against project password policy
951+
if err := ps.PasswordPolicy.ValidatePassword(s.Password); err != nil {
952+
return fmt.Errorf("password policy violation for demo user '%s': %w\nhint: check your project's password policy with SHOW PROJECT SECURITY", s.UserName, err)
953+
}
954+
950955
// Check if user already exists
951956
for _, du := range ps.DemoUsers {
952957
if du.UserName == s.UserName {

0 commit comments

Comments
 (0)