fix: fix Security vulnerability

Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
Xinwei Xiong (cubxxw) 2023-12-15 21:09:41 +08:00
parent 10646f26c0
commit 080dfb222a
4 changed files with 25 additions and 13 deletions

View File

@ -10,7 +10,7 @@ ENV GOPROXY=$GOPROXY
# Set up the working directory # Set up the working directory
WORKDIR /openim/openim-server WORKDIR /openim/openim-server
COPY go.mod go.sum ./dd COPY go.mod go.sum ./
RUN go mod download RUN go mod download
# Copy all files to the container # Copy all files to the container

View File

@ -122,14 +122,14 @@ api:
# minio.signEndpoint is minio public network address # minio.signEndpoint is minio public network address
object: object:
enable: "minio" enable: "minio"
apiURL: "http://14.155.64.202:10002" apiURL: "http://172.28.0.1:10002"
minio: minio:
bucket: "openim" bucket: "openim"
endpoint: "http://172.28.0.1:10005" endpoint: "http://172.28.0.1:10005"
accessKeyID: "root" accessKeyID: "root"
secretAccessKey: "openIM123" secretAccessKey: "openIM123"
sessionToken: '' sessionToken: ''
signEndpoint: "http://14.155.64.202:10005" signEndpoint: "http://172.28.0.1:10005"
publicRead: false publicRead: false
cos: cos:
bucketURL: https://temp-1252357374.cos.ap-chengdu.myqcloud.com bucketURL: https://temp-1252357374.cos.ap-chengdu.myqcloud.com
@ -193,7 +193,7 @@ rpcRegisterName:
# Whether to output in json format # Whether to output in json format
# Whether to include stack trace in logs # Whether to include stack trace in logs
log: log:
storageLocation: /data/workspaces/open-im-server/logs/ storageLocation: ../logs/
rotationTime: 24 rotationTime: 24
remainRotationCount: 2 remainRotationCount: 2
remainLogLevel: 6 remainLogLevel: 6

View File

@ -26,11 +26,11 @@ PASSWORD=openIM123
# Base URL for the application programming interface (API). # Base URL for the application programming interface (API).
# Default: API_URL=http://172.28.0.1:10002 # Default: API_URL=http://172.28.0.1:10002
API_URL=http://14.155.64.202:10002 API_URL=http://172.28.0.1:10002
# Directory path for storing data files or related information. # Directory path for storing data files or related information.
# Default: DATA_DIR=./ # Default: DATA_DIR=./
DATA_DIR=/data/workspaces/open-im-server DATA_DIR=./
# Choose the appropriate image address, the default is GITHUB image, # Choose the appropriate image address, the default is GITHUB image,
# you can choose docker hub, for Chinese users can choose Ali Cloud # you can choose docker hub, for Chinese users can choose Ali Cloud

View File

@ -111,6 +111,7 @@ generate_example_files() {
local example_file="${COPY_EXAMPLES[$template]}" local example_file="${COPY_EXAMPLES[$template]}"
process_file "$template" "$example_file" false process_file "$template" "$example_file" false
done done
} }
# Function to process a single file, either by generating or copying # Function to process a single file, either by generating or copying
@ -146,10 +147,17 @@ process_file() {
openim::log::error "genconfig.sh script not found" openim::log::error "genconfig.sh script not found"
exit 1 exit 1
fi fi
"${OPENIM_ROOT}/scripts/genconfig.sh" "${ENV_FILE}" "${template}" > "${output_file}" || { if [[ -n "${env_cmd}" ]]; then
openim::log::error "Error processing template file ${template}" eval "$env_cmd ${OPENIM_ROOT}/scripts/genconfig.sh '${ENV_FILE}' '${template}' > '${output_file}'" || {
exit 1 openim::log::error "Error processing template file ${template}"
} exit 1
}
else
"${OPENIM_ROOT}/scripts/genconfig.sh" "${ENV_FILE}" "${template}" > "${output_file}" || {
openim::log::error "Error processing template file ${template}"
exit 1
}
fi
else else
openim::log::info "📋 Copying ${template} to ${output_file}..." openim::log::info "📋 Copying ${template} to ${output_file}..."
cp "${template}" "${output_file}" || { cp "${template}" "${output_file}" || {
@ -167,9 +175,10 @@ declare -A env_vars=(
["LOG_STORAGE_LOCATION"]="../logs/" ["LOG_STORAGE_LOCATION"]="../logs/"
) )
# Function to clean configuration files
clean_config_files() { clean_config_files() {
for output_file in "${TEMPLATES[@]}"; do local all_templates=("${TEMPLATES[@]}" "${COPY_TEMPLATES[@]}")
for output_file in "${all_templates[@]}"; do
if [[ -f "${output_file}" ]]; then if [[ -f "${output_file}" ]]; then
rm -f "${output_file}" rm -f "${output_file}"
openim::log::info "Removed configuration file: ${output_file}" openim::log::info "Removed configuration file: ${output_file}"
@ -179,7 +188,10 @@ clean_config_files() {
# Function to clean example files # Function to clean example files
clean_example_files() { clean_example_files() {
for example_file in "${EXAMPLES[@]}"; do # 合并 EXAMPLES 和 COPY_EXAMPLES 数组
local all_examples=("${EXAMPLES[@]}" "${COPY_EXAMPLES[@]}")
for example_file in "${all_examples[@]}"; do
if [[ -f "${example_file}" ]]; then if [[ -f "${example_file}" ]]; then
rm -f "${example_file}" rm -f "${example_file}"
openim::log::info "Removed example file: ${example_file}" openim::log::info "Removed example file: ${example_file}"