mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-06 13:27:43 +08:00
fix: Fix an exception caused by insufficient encryption string length (#8114)
This commit is contained in:
parent
1f842b49cc
commit
6c251e1a49
5 changed files with 20 additions and 3 deletions
|
@ -43,8 +43,8 @@ func Start() {
|
|||
validator.Init()
|
||||
gin.SetMode("debug")
|
||||
cron.Run()
|
||||
InitOthers()
|
||||
hook.Init()
|
||||
InitOthers()
|
||||
|
||||
rootRouter := router.Routers()
|
||||
|
||||
|
|
|
@ -29,6 +29,13 @@ func StringEncryptWithKey(text, key string) (string, error) {
|
|||
if len(text) == 0 {
|
||||
return "", nil
|
||||
}
|
||||
if len(key) < 16 {
|
||||
for len(key) < 16 {
|
||||
key += "u"
|
||||
}
|
||||
} else {
|
||||
key = key[:16]
|
||||
}
|
||||
pass := []byte(text)
|
||||
xpass, err := aesEncryptWithSalt([]byte(key), pass)
|
||||
if err == nil {
|
||||
|
@ -65,6 +72,13 @@ func StringDecryptWithKey(text, key string) (string, error) {
|
|||
if len(text) == 0 {
|
||||
return "", nil
|
||||
}
|
||||
if len(key) < 16 {
|
||||
for len(key) < 16 {
|
||||
key += "u"
|
||||
}
|
||||
} else {
|
||||
key = key[:16]
|
||||
}
|
||||
bytesPass, err := base64.StdEncoding.DecodeString(text)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
|
|
@ -69,6 +69,9 @@ interface DialogProps {
|
|||
containerName: string;
|
||||
}
|
||||
const acceptParams = (props: DialogProps): void => {
|
||||
form.newImageName = '';
|
||||
form.comment = '';
|
||||
form.author = '';
|
||||
form.containerID = props.containerID;
|
||||
form.containerName = props.containerName;
|
||||
drawerVisible.value = true;
|
||||
|
|
|
@ -540,7 +540,7 @@ const search = async () => {
|
|||
form.labels = res.data.labels || [];
|
||||
form.env = res.data.env || [];
|
||||
form.exposedPorts = res.data.exposedPorts || [];
|
||||
for (const item of res.data.exposedPorts) {
|
||||
for (const item of form.exposedPorts) {
|
||||
if (item.hostIP) {
|
||||
item.host = item.hostIP + ':' + item.hostPort;
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<DrawerPro v-model="drawerVisible" :header="$t('terminal.exportImage')" @close="handleClose" size="small">
|
||||
<DrawerPro v-model="drawerVisible" :header="$t('container.exportImage')" @close="handleClose" size="small">
|
||||
<el-form v-loading="loading" label-position="top" ref="formRef" :model="form" label-width="80px">
|
||||
<el-form-item :label="$t('container.tag')" :rules="Rules.requiredSelect" prop="tagName">
|
||||
<el-select filterable v-model="form.tagName">
|
||||
|
|
Loading…
Add table
Reference in a new issue