From a667d04e53b152bd4df6e6a61f50caca96234659 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 2 Feb 2024 15:24:17 +0800 Subject: [PATCH] fix: frontend security risk (#2355) --- web/app/(commonLayout)/apps/NewAppDialog.tsx | 2 +- web/app/(commonLayout)/apps/page.tsx | 4 ++-- .../(datasetDetailLayout)/[datasetId]/layout.tsx | 4 ++-- web/app/(commonLayout)/datasets/DatasetFooter.tsx | 4 ++-- .../conversation-histroy/history-panel.tsx | 2 +- .../dataset-config/settings-modal/index.tsx | 4 ++-- .../prompt-mode/advanced-mode-waring.tsx | 2 +- .../toolbox/moderation/moderation-setting-modal.tsx | 4 ++-- .../configuration/tools/external-data-tool-modal.tsx | 2 +- web/app/components/app/log/index.tsx | 2 +- .../app/overview/apikey-info-panel/index.tsx | 2 +- web/app/components/app/overview/customize/index.tsx | 11 +++++------ web/app/components/app/overview/settings/index.tsx | 2 +- web/app/components/billing/billing-page/index.tsx | 2 +- web/app/components/custom/custom-page/index.tsx | 2 +- .../components/custom/custom-web-app-brand/index.tsx | 4 ++-- web/app/components/datasets/create/step-two/index.tsx | 2 +- .../datasets/hit-testing/modify-retrieval-modal.tsx | 2 +- web/app/components/datasets/settings/form/index.tsx | 4 ++-- web/app/components/header/account-about/index.tsx | 10 +++++----- web/app/components/header/account-dropdown/index.tsx | 8 ++++---- .../api-based-extension-page/empty.tsx | 2 +- .../api-based-extension-page/modal.tsx | 4 ++-- .../model-provider-page/model-modal/index.tsx | 2 +- web/app/components/header/github-star/index.tsx | 2 +- web/app/components/share/chat/welcome/index.tsx | 2 +- web/app/components/share/chatbot/welcome/index.tsx | 2 +- web/app/components/share/text-generation/index.tsx | 2 +- web/app/components/tools/contribute.tsx | 2 +- .../tools/edit-custom-collection-modal/index.tsx | 2 +- web/app/signin/normalForm.tsx | 6 +++--- web/utils/index.ts | 7 +++++++ 32 files changed, 59 insertions(+), 53 deletions(-) diff --git a/web/app/(commonLayout)/apps/NewAppDialog.tsx b/web/app/(commonLayout)/apps/NewAppDialog.tsx index 6a07a4096b..ff5b3bdd61 100644 --- a/web/app/(commonLayout)/apps/NewAppDialog.tsx +++ b/web/app/(commonLayout)/apps/NewAppDialog.tsx @@ -157,7 +157,7 @@ const NewAppDialog = ({ show, onSuccess, onClose }: NewAppDialogProps) => {
{t('app.newApp.chatAppIntro')}
{/*
- {t('app.newApp.previewDemo')} + {t('app.newApp.previewDemo')}
*/}
  • {

    {t('join')}

    {t('communityIntro')}

    - - + +
    diff --git a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx index 89ff28e5ac..b280e73d74 100644 --- a/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx +++ b/web/app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/layout.tsx @@ -58,7 +58,7 @@ const LikedItem = ({ return (
    - + {type === 'app' && (
    @@ -154,7 +154,7 @@ const ExtraInfo = ({ isMobile, relatedApps }: IExtraInfoProps) => { ? 'https://docs.dify.ai/v/zh-hans/guides/application-design/prompt-engineering' : 'https://docs.dify.ai/user-guide/creating-dify-apps/prompt-engineering' } - target='_blank' + target='_blank' rel='noopener noreferrer' > {t('common.datasetMenus.viewDoc')} diff --git a/web/app/(commonLayout)/datasets/DatasetFooter.tsx b/web/app/(commonLayout)/datasets/DatasetFooter.tsx index 8d37afb88b..6eac815a1a 100644 --- a/web/app/(commonLayout)/datasets/DatasetFooter.tsx +++ b/web/app/(commonLayout)/datasets/DatasetFooter.tsx @@ -9,8 +9,8 @@ const DatasetFooter = () => { ) diff --git a/web/app/components/app/configuration/config-prompt/conversation-histroy/history-panel.tsx b/web/app/components/app/configuration/config-prompt/conversation-histroy/history-panel.tsx index 40ed1e2324..bf4b9c9f51 100644 --- a/web/app/components/app/configuration/config-prompt/conversation-histroy/history-panel.tsx +++ b/web/app/components/app/configuration/config-prompt/conversation-histroy/history-panel.tsx @@ -49,7 +49,7 @@ const HistoryPanel: FC = ({ {t('appDebug.feature.conversationHistory.learnMore')}
    diff --git a/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx b/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx index c9336b2386..c16605defa 100644 --- a/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx +++ b/web/app/components/app/configuration/dataset-config/settings-modal/index.tsx @@ -163,7 +163,7 @@ const SettingsModal: FC = ({ className='block px-3 py-2 w-full h-[88px] rounded-lg bg-gray-100 text-sm outline-none appearance-none resize-none' placeholder={t('datasetSettings.form.descPlaceholder') || ''} /> - + {t('datasetSettings.form.descWrite')} @@ -226,7 +226,7 @@ const SettingsModal: FC = ({
    {t('datasetSettings.form.retrievalSetting.title')}
    diff --git a/web/app/components/app/configuration/prompt-mode/advanced-mode-waring.tsx b/web/app/components/app/configuration/prompt-mode/advanced-mode-waring.tsx index 9f1a9eaabe..0011b7054a 100644 --- a/web/app/components/app/configuration/prompt-mode/advanced-mode-waring.tsx +++ b/web/app/components/app/configuration/prompt-mode/advanced-mode-waring.tsx @@ -28,7 +28,7 @@ const AdvancedModeWarning: FC = ({ {t('appDebug.promptMode.advancedWarning.learnMore')} diff --git a/web/app/components/app/configuration/toolbox/moderation/moderation-setting-modal.tsx b/web/app/components/app/configuration/toolbox/moderation/moderation-setting-modal.tsx index 38199379ed..a1b8d7deda 100644 --- a/web/app/components/app/configuration/toolbox/moderation/moderation-setting-modal.tsx +++ b/web/app/components/app/configuration/toolbox/moderation/moderation-setting-modal.tsx @@ -237,7 +237,7 @@ const ModerationSettingModal: FC = ({ return ( {}} + onClose={() => { }} className='!p-8 !pb-6 !mt-14 !max-w-none !w-[640px]' >
    @@ -311,7 +311,7 @@ const ModerationSettingModal: FC = ({
    {t('common.apiBasedExtension.selector.title')}
    diff --git a/web/app/components/app/configuration/tools/external-data-tool-modal.tsx b/web/app/components/app/configuration/tools/external-data-tool-modal.tsx index 1797b10a4f..8584c25e9e 100644 --- a/web/app/components/app/configuration/tools/external-data-tool-modal.tsx +++ b/web/app/components/app/configuration/tools/external-data-tool-modal.tsx @@ -245,7 +245,7 @@ const ExternalDataToolModal: FC = ({ {t('common.apiBasedExtension.selector.title')} diff --git a/web/app/components/app/log/index.tsx b/web/app/components/app/log/index.tsx index db853299fa..0df303a627 100644 --- a/web/app/components/app/log/index.tsx +++ b/web/app/components/app/log/index.tsx @@ -43,7 +43,7 @@ const EmptyElement: FC<{ appUrl: string }> = ({ appUrl }) => {
    , testLink: }} + components={{ shareLink: , testLink: }} />
    diff --git a/web/app/components/app/overview/apikey-info-panel/index.tsx b/web/app/components/app/overview/apikey-info-panel/index.tsx index 99155de4ff..555be997a1 100644 --- a/web/app/components/app/overview/apikey-info-panel/index.tsx +++ b/web/app/components/app/overview/apikey-info-panel/index.tsx @@ -55,7 +55,7 @@ const APIKeyInfoPanel: FC = () => {
    {t('appOverview.apiKeyInfo.tryCloud')}
    diff --git a/web/app/components/app/overview/customize/index.tsx b/web/app/components/app/overview/customize/index.tsx index bc3ef3f2ce..826a85aae5 100644 --- a/web/app/components/app/overview/customize/index.tsx +++ b/web/app/components/app/overview/customize/index.tsx @@ -63,7 +63,7 @@ const CustomizeModal: FC = ({
    @@ -73,7 +73,7 @@ const CustomizeModal: FC = ({
    {t(`${prefixCustomize}.way1.step3`)}
    {t(`${prefixCustomize}.way1.step2Tip`)}
    - +
    - +
    {t('tools.contribute.viewGuide')}
    diff --git a/web/app/components/tools/edit-custom-collection-modal/index.tsx b/web/app/components/tools/edit-custom-collection-modal/index.tsx index 3919dbf1d6..509b51d1c0 100644 --- a/web/app/components/tools/edit-custom-collection-modal/index.tsx +++ b/web/app/components/tools/edit-custom-collection-modal/index.tsx @@ -177,7 +177,7 @@ const EditCustomCollectionModal: FC = ({
    {t('tools.createTool.viewSchemaSpec')}
    diff --git a/web/app/signin/normalForm.tsx b/web/app/signin/normalForm.tsx index 4050b8b3a4..45b10191f3 100644 --- a/web/app/signin/normalForm.tsx +++ b/web/app/signin/normalForm.tsx @@ -13,7 +13,7 @@ import Button from '@/app/components/base/button' import { login, oauth } from '@/service/common' import I18n from '@/context/i18n' import { LanguagesSupportedUnderscore, getModelRuntimeSupported } from '@/utils/language' - +import { getPurifyHref } from '@/utils' const validEmailReg = /^[\w\.-]+@([\w-]+\.)+[\w-]{2,}$/ type IState = { @@ -150,7 +150,7 @@ const NormalForm = () => { {!IS_CE_EDITION && (
    - +
    - +