Skip to content

Commit 47d135e

Browse files
authored
fix: Optimize database password verification and password change (#8294)
1 parent d96fe49 commit 47d135e

File tree

17 files changed

+150
-130
lines changed

17 files changed

+150
-130
lines changed

backend/app/service/app_install.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,9 @@ func updateInstallInfoInDB(appKey, appName, param string, value interface{}) err
839839
"param": strings.ReplaceAll(appInstall.Param, oldVal, newVal),
840840
"env": strings.ReplaceAll(appInstall.Env, oldVal, newVal),
841841
}, commonRepo.WithByID(appInstall.ID))
842+
if appKey == "mysql" || appKey == "postgresql" {
843+
return nil
844+
}
842845
}
843846
if param == "user-password" {
844847
oldVal = fmt.Sprintf("\"PANEL_DB_USER_PASSWORD\":\"%v\"", appInstall.UserPassword)

frontend/src/global/form-rules.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ const checkIllegal = (rule: any, value: any, callback: any) => {
121121
value.indexOf('`') !== -1 ||
122122
value.indexOf('(') !== -1 ||
123123
value.indexOf(')') !== -1 ||
124-
value.indexOf("'") !== -1
124+
value.indexOf('>') !== -1 ||
125+
value.indexOf('<') !== -1
125126
) {
126127
callback(new Error(i18n.global.t('commons.rule.illegalInput')));
127128
} else {

frontend/src/lang/modules/en.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ const message = {
191191
rePassword: 'Confirm password is inconsistent with the password.',
192192
requiredInput: 'This field is required.',
193193
requiredSelect: 'Select an item in the list',
194+
illegalChar: 'Injection of characters & ; $ \' ` ( ) " > < | is currently not supported',
194195
illegalInput: `This field mustn't contains illegal characters.`,
195196
commonName:
196197
'This field must start with non-special characters and must consist of English, Chinese, numbers, ".", "-", and "_" characters with a length of 1-128.',
@@ -427,6 +428,8 @@ const message = {
427428
permission: 'Permissions',
428429
permissionForIP: 'IP',
429430
permissionAll: 'All of them(%)',
431+
localhostHelper:
432+
'Configuring database permissions as "localhost" for container deployment will prevent external access to the container. Please choose carefully!',
430433
databaseConnInfo: 'Connection info',
431434
rootPassword: 'Root password',
432435
serviceName: 'Service Name',
@@ -438,6 +441,7 @@ const message = {
438441
remoteConnHelper:
439442
'Remote connection to MySQL as user root may have security risks. Therefore, perform this operation with caution.',
440443
changePassword: 'Password',
444+
changeConnHelper: 'This operation will modify the current database {0}. Do you want to continue?',
441445
changePasswordHelper:
442446
'The database has been associated with an application. Changing the password will change the database password of the application at the same time. The change takes effect after the application restarts.',
443447

frontend/src/lang/modules/ja.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ const message = {
190190
rePassword: 'パスワードがパスワードと矛盾することを確認してください。',
191191
requiredInput: 'この項目は必須です。',
192192
requiredSelect: 'リスト内のアイテムを選択します',
193+
illegalChar: '現在、文字 & ; $ \' ` ( ) " > < | の注入はサポートされていません',
193194
illegalInput: `このフィールドには違法なキャラクターが含まれてはなりません。`,
194195
commonName:
195196
'このフィールドは、特別なキャラクターではなく、英語、中国語、数字で構成されている必要があります。「。」、「」、および「_」文字が1〜128の文字で構成されている必要があります。',
@@ -427,6 +428,8 @@ const message = {
427428
permission: '権限',
428429
permissionForIP: 'ip',
429430
permissionAll: 'それらすべて(%)',
431+
localhostHelper:
432+
'コンテナ展開でデータベース権限を"localhost"に設定すると、コンテナ外部からのアクセスができなくなります。慎重に選択してください!',
430433
databaseConnInfo: '接続情報',
431434
rootPassword: 'ルートパスワード',
432435
serviceName: 'サービス名',
@@ -438,6 +441,7 @@ const message = {
438441
remoteConnHelper:
439442
'ユーザールートとしてのMySQLへのリモート接続には、セキュリティリスクがある場合があります。したがって、この操作を慎重に実行します。',
440443
changePassword: 'パスワード',
444+
changeConnHelper: 'この操作は現在のデータベース {0} を変更します。続行しますか?',
441445
changePasswordHelper:
442446
'データベースはアプリケーションに関連付けられています。パスワードを変更すると、アプリケーションのデータベースパスワードが同時に変更されます。アプリケーションが再起動した後、変更は有効になります。',
443447

frontend/src/lang/modules/ko.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ const message = {
190190
rePassword: '확인 비밀번호가 비밀번호와 일치하지 않습니다.',
191191
requiredInput: '이 필드는 필수 항목입니다.',
192192
requiredSelect: '목록에서 항목을 선택하세요',
193+
illegalChar: '현재 & ; $ \' ` ( ) " > < | 문자 주입은 지원되지 않습니다',
193194
illegalInput: '이 필드에는 유효하지 않은 문자가 포함될 수 없습니다.',
194195
commonName:
195196
'이 필드는 특수 문자로 시작할 수 없으며, 영어, 한자, 숫자, ".", "-", "_" 문자로 구성되어야 하며 길이는 1-128자여야 합니다.',
@@ -429,6 +430,8 @@ const message = {
429430
permission: '권한',
430431
permissionForIP: 'IP',
431432
permissionAll: '모두(%)',
433+
localhostHelper:
434+
'컨테이너 배포 시 데이터베이스 권한을 "localhost"로 설정하면 컨테이너 외부에서 접근할 수 없게 됩니다. 신중하게 선택하세요!',
432435
databaseConnInfo: '연결 정보',
433436
rootPassword: '루트 비밀번호',
434437
serviceName: '서비스 이름',
@@ -440,6 +443,7 @@ const message = {
440443
remoteConnHelper:
441444
'MySQL 의 root 사용자로 원격 접속은 보안 위험을 초래할 수 있습니다. 따라서 이 작업은 신중히 수행해야 합니다.',
442445
changePassword: '비밀번호',
446+
changeConnHelper: '이 작업은 현재 데이터베이스 {0}을(를) 수정합니다. 계속하시겠습니까?',
443447
changePasswordHelper:
444448
'데이터베이스가 애플리케이션과 연결되어 있습니다. 비밀번호를 변경하면 애플리케이션의 데이터베이스 비밀번호도 변경됩니다. 변경 사항은 애플리케이션이 재시작된 후에 적용됩니다.',
445449
confChange: '설정',

frontend/src/lang/modules/ms.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ const message = {
193193
rePassword: 'Pengesahan kata laluan tidak sepadan dengan kata laluan.',
194194
requiredInput: 'Ruangan ini wajib diisi.',
195195
requiredSelect: 'Pilih satu item dalam senarai',
196+
illegalChar: 'Suntikan aksara & ; $ \' ` ( ) " > < | tidak disokong buat masa ini',
196197
illegalInput: 'Ruangan ini tidak boleh mengandungi aksara tidak sah.',
197198
commonName:
198199
'Ruangan ini mesti bermula dengan aksara bukan khas dan mesti terdiri daripada aksara rumi, Cina, nombor, ".", "-", dan "_" dengan panjang 1-128 aksara.',
@@ -435,6 +436,8 @@ const message = {
435436
permission: 'Kebenaran',
436437
permissionForIP: 'IP',
437438
permissionAll: 'Kesemuanya(%)',
439+
localhostHelper:
440+
'Mengkonfigurasi kebenaran pangkalan data sebagai "localhost" untuk penyebaran kontena akan menghalang akses luar ke kontena. Sila pilih dengan teliti!',
438441
databaseConnInfo: 'Maklumat sambungan',
439442
rootPassword: 'Kata laluan root',
440443
serviceName: 'Nama Perkhidmatan',
@@ -446,6 +449,7 @@ const message = {
446449
remoteConnHelper:
447450
'Sambungan jauh ke MySQL sebagai pengguna root mungkin mempunyai risiko keselamatan. Oleh itu, lakukan operasi ini dengan berhati-hati.',
448451
changePassword: 'Kata laluan',
452+
changeConnHelper: 'Operasi ini akan mengubah pangkalan data semasa {0}. Adakah anda ingin meneruskan?',
449453
changePasswordHelper:
450454
'Pangkalan data telah dikaitkan dengan aplikasi. Menukar kata laluan akan menukar kata laluan pangkalan data aplikasi pada masa yang sama. Perubahan ini akan berkuat kuasa selepas aplikasi dimulakan semula.',
451455

frontend/src/lang/modules/pt-br.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ const message = {
192192
rePassword: 'A confirmação da senha não corresponde à senha.',
193193
requiredInput: 'Este campo é obrigatório.',
194194
requiredSelect: 'Selecione um item na lista',
195+
illegalChar: 'Atualmente não há suporte para injeção dos caracteres & ; $ \' ` ( ) " > < |',
195196
illegalInput: 'Este campo não deve conter caracteres ilegais.',
196197
commonName:
197198
'Este campo deve começar com caracteres não especiais e consistir em letras, números, ".", "-", e "_" com comprimento de 1-128.',
@@ -433,6 +434,8 @@ const message = {
433434
permission: 'Permissões',
434435
permissionForIP: 'IP',
435436
permissionAll: 'Todos (% de)',
437+
localhostHelper:
438+
'Configurar permissões de banco de dados como "localhost" para implantação em contêiner impedirá o acesso externo ao contêiner. Por favor, escolha com cuidado!',
436439
databaseConnInfo: 'Informações de conexão',
437440
rootPassword: 'Senha root',
438441
serviceName: 'Nome do serviço',
@@ -444,6 +447,7 @@ const message = {
444447
remoteConnHelper:
445448
'Conectar-se ao MySQL como usuário root pode representar riscos de segurança. Realize esta operação com cautela.',
446449
changePassword: 'Senha',
450+
changeConnHelper: 'Esta operação modificará o banco de dados atual {0}. Deseja continuar?',
447451
changePasswordHelper:
448452
'O banco de dados está associado a um aplicativo. Alterar a senha alterará a senha do banco de dados do aplicativo ao mesmo tempo. A mudança surtirá efeito após a reinicialização do aplicativo.',
449453

frontend/src/lang/modules/ru.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ const message = {
191191
rePassword: 'Подтверждение пароля не совпадает с паролем.',
192192
requiredInput: 'Это поле обязательно для заполнения.',
193193
requiredSelect: 'Выберите элемент из списка',
194+
illegalChar: 'В настоящее время не поддерживается вставка символов & ; $ \' ` ( ) " > < |',
194195
illegalInput: 'Это поле не должно содержать недопустимых символов.',
195196
commonName:
196197
'Это поле должно начинаться с неспециальных символов и должно состоять из английских букв, китайских иероглифов, цифр, ".", "-" и "_" длиной 1-128.',
@@ -429,6 +430,8 @@ const message = {
429430
permission: 'Разрешения',
430431
permissionForIP: 'IP',
431432
permissionAll: 'Все (%)',
433+
localhostHelper:
434+
'Настройка разрешений базы данных как "localhost" для развертывания контейнера предотвратит внешний доступ к контейнеру. Пожалуйста, выбирайте внимательно!',
432435
databaseConnInfo: 'Информация о подключении',
433436
rootPassword: 'Пароль root',
434437
serviceName: 'Имя сервиса',
@@ -440,6 +443,7 @@ const message = {
440443
remoteConnHelper:
441444
'Удаленное подключение к MySQL как пользователь root может иметь риски безопасности. Поэтому выполняйте эту операцию с осторожностью.',
442445
changePassword: 'Пароль',
446+
changeConnHelper: 'Эта операция изменит текущую базу данных {0}. Продолжить?',
443447
changePasswordHelper:
444448
'База данных была связана с приложением. Изменение пароля изменит пароль базы данных приложения одновременно. Изменение вступит в силу после перезапуска приложения.',
445449

frontend/src/lang/modules/tw.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ const message = {
192192
rePassword: '密碼不一致,請檢查後重新輸入',
193193
requiredInput: '請填寫必填項',
194194
requiredSelect: '請選擇必選項',
195+
illegalChar: '暫不支援注入字元 & ; $ \' ` ( ) " > < |',
195196
illegalInput: '輸入框中存在不合法字元',
196197
commonName: '支援非特殊字元開頭,英文、中文、數字、.-和_,長度1-128',
197198
userName: '支援英文、中文、數字和_,長度3-30',
@@ -418,6 +419,7 @@ const message = {
418419
permission: '權限',
419420
permissionForIP: '指定 IP',
420421
permissionAll: '所有人(%)',
422+
localhostHelper: '將容器部署的資料庫權限配置為"localhost"會導致容器外部無法存取,請謹慎選擇!',
421423
databaseConnInfo: '連接資訊',
422424
rootPassword: 'root 密碼',
423425
serviceName: '服務名稱',
@@ -428,6 +430,7 @@ const message = {
428430
remoteHelper: '多個 ip 以逗號分隔,例:172.16.10.111,172.16.10.112',
429431
remoteConnHelper: 'root 帳號遠端連接 MySQL 有安全風險,開啟需謹慎!',
430432
changePassword: '改密',
433+
changeConnHelper: '此操作將修改當前資料庫 {0},是否繼續?',
431434
changePasswordHelper: '目前資料庫已經關聯應用,修改密碼將同步修改應用中資料庫密碼,修改後重啟生效。',
432435

433436
portHelper: '該埠為容器對外暴露埠,修改需要單獨儲存並且重啟容器!',

frontend/src/lang/modules/zh.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ const message = {
191191
rePassword: '密码不一致,请检查后重新输入',
192192
requiredInput: '请填写必填项',
193193
requiredSelect: '请选择必选项',
194+
illegalChar: '暂不支持注入字符 & ; $ \' ` ( ) " > < |',
194195
illegalInput: '输入框中存在不合法字符',
195196
commonName: '支持非特殊字符开头,英文、中文、数字、.-和_,长度1-128',
196197
userName: '支持英文、中文、数字和_,长度3-30',
@@ -419,6 +420,7 @@ const message = {
419420
permission: '权限',
420421
permissionForIP: '指定 IP',
421422
permissionAll: '所有人(%)',
423+
localhostHelper: '将容器部署的数据库权限配置为 localhost 会导致容器外部无法访问,请谨慎选择!',
422424
databaseConnInfo: '连接信息',
423425
rootPassword: 'root 密码',
424426
serviceName: '服务名称',
@@ -429,6 +431,7 @@ const message = {
429431
remoteHelper: '多个 ip 以逗号分隔,例:172.16.10.111,172.16.10.112',
430432
remoteConnHelper: 'root 帐号远程连接 MySQL 有安全风险,开启需谨慎!',
431433
changePassword: '改密',
434+
changeConnHelper: '此操作将修改当前数据库 {0},是否继续?',
432435
changePasswordHelper: '当前数据库已经关联应用,修改密码将同步修改应用中数据库密码,修改后重启生效。',
433436

434437
portHelper: '该端口为容器对外暴露端口,修改需要单独保存并且重启容器!',

0 commit comments

Comments
 (0)