mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-08 22:46:51 +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()
|
validator.Init()
|
||||||
gin.SetMode("debug")
|
gin.SetMode("debug")
|
||||||
cron.Run()
|
cron.Run()
|
||||||
InitOthers()
|
|
||||||
hook.Init()
|
hook.Init()
|
||||||
|
InitOthers()
|
||||||
|
|
||||||
rootRouter := router.Routers()
|
rootRouter := router.Routers()
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,13 @@ func StringEncryptWithKey(text, key string) (string, error) {
|
||||||
if len(text) == 0 {
|
if len(text) == 0 {
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
if len(key) < 16 {
|
||||||
|
for len(key) < 16 {
|
||||||
|
key += "u"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
key = key[:16]
|
||||||
|
}
|
||||||
pass := []byte(text)
|
pass := []byte(text)
|
||||||
xpass, err := aesEncryptWithSalt([]byte(key), pass)
|
xpass, err := aesEncryptWithSalt([]byte(key), pass)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -65,6 +72,13 @@ func StringDecryptWithKey(text, key string) (string, error) {
|
||||||
if len(text) == 0 {
|
if len(text) == 0 {
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
if len(key) < 16 {
|
||||||
|
for len(key) < 16 {
|
||||||
|
key += "u"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
key = key[:16]
|
||||||
|
}
|
||||||
bytesPass, err := base64.StdEncoding.DecodeString(text)
|
bytesPass, err := base64.StdEncoding.DecodeString(text)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|
|
@ -69,6 +69,9 @@ interface DialogProps {
|
||||||
containerName: string;
|
containerName: string;
|
||||||
}
|
}
|
||||||
const acceptParams = (props: DialogProps): void => {
|
const acceptParams = (props: DialogProps): void => {
|
||||||
|
form.newImageName = '';
|
||||||
|
form.comment = '';
|
||||||
|
form.author = '';
|
||||||
form.containerID = props.containerID;
|
form.containerID = props.containerID;
|
||||||
form.containerName = props.containerName;
|
form.containerName = props.containerName;
|
||||||
drawerVisible.value = true;
|
drawerVisible.value = true;
|
||||||
|
|
|
@ -540,7 +540,7 @@ const search = async () => {
|
||||||
form.labels = res.data.labels || [];
|
form.labels = res.data.labels || [];
|
||||||
form.env = res.data.env || [];
|
form.env = res.data.env || [];
|
||||||
form.exposedPorts = res.data.exposedPorts || [];
|
form.exposedPorts = res.data.exposedPorts || [];
|
||||||
for (const item of res.data.exposedPorts) {
|
for (const item of form.exposedPorts) {
|
||||||
if (item.hostIP) {
|
if (item.hostIP) {
|
||||||
item.host = item.hostIP + ':' + item.hostPort;
|
item.host = item.hostIP + ':' + item.hostPort;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<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 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-form-item :label="$t('container.tag')" :rules="Rules.requiredSelect" prop="tagName">
|
||||||
<el-select filterable v-model="form.tagName">
|
<el-select filterable v-model="form.tagName">
|
||||||
|
|
Loading…
Add table
Reference in a new issue