diff --git a/pkg/compute/regiondrivers/managedvirtual.go b/pkg/compute/regiondrivers/managedvirtual.go index cdc1864018..0688cff39d 100644 --- a/pkg/compute/regiondrivers/managedvirtual.go +++ b/pkg/compute/regiondrivers/managedvirtual.go @@ -2333,8 +2333,46 @@ func (self *SManagedVirtualizationRegionDriver) RequestElasticcacheUpdateBackupP } func (self *SManagedVirtualizationRegionDriver) ValidateCreateElasticcacheAccountData(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error) { - if name, _ := data.GetString("name"); name == "root" { - return nil, httperrors.NewConflictError("account name 'root' is not allowed") + reservedNames := []string{ + "add", "admin", "all", "alter", "analyze", "and", "as", "asc", + "asensitive", "aurora", "before", "between", "bigint", "binary", + "blob", "both", "by", "call", "cascade", "case", "change", + "char", "character", "check", "collate", "column", "condition", + "connection", "constraint", "continue", "convert", "create", + "cross", "current_date", "current_time", "current_timestamp", + "current_user", "cursor", " database", "databases", "day_hour", + "day_microsecond", "day_minute", "day_second", "dec", "decimal", + "declare", "default", "delayed", "delete", "desc", "describe", + "deterministic", "distinct", "distinctrow", "div", "double", + "drc_rds", "drop", "dual", "each", "eagleye", "else", "elseif", + "enclosed", "escaped", "exists", "exit", "explain", "false", + "fetch", "float", "float4", "float8", "for", "force", "foreign", + "from", "fulltext", " goto", "grant", "group", "guest", "having", + "high_priority", "hour_microsecond", "hour_minute", "hour_second", + "if", "ignore", "in", "index", "infile", "information_schema", "inner", + "inout", "insensitive", "insert", "int", "int1", "int2", "int3", "int4", + "int8", "integer", "interval", "into", "is", "iterate", "join", "key", "keys", + "kill", "label", "leading", "leave", "left", "like", "limit", "linear", "lines", + "load", "localtime", "localtimestamp", "lock", "long", "longblob", "longtext", + "loop", "low_priority", " match", "mediumblob", "mediumint", "mediumtext", + "middleint", "minute_microsecond", "minute_second", "mod", "modifies", + "mysql", "natural", "no_write_to_binlog", "not", "null", "numeric", + "on", "optimize", "option", "optionally", "or", "order", "out", "outer", + "outfile", "precision", "primary", "procedure", "purge", + "raid0", "range", "read", "reads", "real", + "references", "regexp", "release", "rename", "repeat", + "replace", "replicator", "require", "restrict", "return", "revoke", "right", + "rlike", "root", "schema", "schemas", "second_microsecond", "select", "sensitive", + "separator", "set", "show", "smallint", "spatial", "specific", "sql", "sql_big_result", + "sql_calc_found_rows", "sql_small_result", "sqlexception", "sqlstate", "sqlwarning", + "ssl", "starting", "straight_join", "table", "terminated", "test", "then", "tinyblob", + "tinyint", "tinytext", "to", "trailing", "trigger", "true", "undo", + "union", "unique", "unlock", "unsigned", "update", "usage", "use", "using", + "utc_date", "utc_time", "utc_timestamp", "values", "varbinary", "varchar", + "varcharacter", "varying", "when", "where", "while", "with", "write", "x509", + "xor", "xtrabak", "year_month", "zerofill"} + if name, _ := data.GetString("name"); utils.IsInStringArray(name, reservedNames) { + return nil, httperrors.NewConflictError("account name '%s' is not allowed", name) } return data, nil