diff --git a/.talismanrc b/.talismanrc index 28aed1441..3440060ea 100644 --- a/.talismanrc +++ b/.talismanrc @@ -83,8 +83,10 @@ fileignoreconfig: checksum: 4abcc89c75b7ddca8128fd72faafbb9b159f02611d96325bcd355283074ce287 - filename: ui/src/components/ContentMapper/index.scss checksum: 46f8fde3b745feba40943f00d8d52714d0f320202c86b62f6c5ded73c2dbcf4c - - + - filename: ui/src/utilities/constants.ts + checksum: faac1367b4d80e022d4b7a165f9d2ac8bfd428f1a91af849064992ae2b3d6b1f + - filename: ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx + checksum: 988d93b93768ef0909305590ab0b89456333b9937ec12828edf23163f8640dfc fileignoreconfig: - filename: api/src/services/migration.service.ts checksum: abae249cacfab5c67e2d18a645c852649da2339954f26ae0f88c8698bdc016e6 diff --git a/api/src/services/globalField.service.ts b/api/src/services/globalField.service.ts index c96b70085..70611fc0d 100644 --- a/api/src/services/globalField.service.ts +++ b/api/src/services/globalField.service.ts @@ -46,7 +46,7 @@ const createGlobalField = async ({ const filePath = path.join(process.cwd(),globalSave, GLOBAL_FIELDS_FILE_NAME); const globalfields = res?.data?.global_fields || []; - let fileGlobalFields : any[]= [] + let fileGlobalFields = [] if (fs.existsSync(filePath)) { const globalFieldSchema = await fs.promises.readFile(filePath, 'utf8'); try { diff --git a/api/src/services/migration.service.ts b/api/src/services/migration.service.ts index 62618dd66..471c99ac6 100644 --- a/api/src/services/migration.service.ts +++ b/api/src/services/migration.service.ts @@ -732,10 +732,7 @@ const getAuditData = async (req: Request): Promise => { if (!safeEntriesSelectFieldPath.startsWith(auditLogPath)) { throw new BadRequestError('Access to this file is not allowed.'); } - // Additional path traversal prevention - if (!safeEntriesSelectFieldPath.startsWith(auditLogPath) || safeEntriesSelectFieldPath.includes('..')) { - throw new BadRequestError('Access to this file is not allowed.'); - } + const fileContent = await fsPromises?.readFile(safeEntriesSelectFieldPath, 'utf8'); try { if (typeof fileContent === 'string') { diff --git a/ui/src/components/AdvancePropertise/index.tsx b/ui/src/components/AdvancePropertise/index.tsx index 56b4b4d95..a33a25540 100644 --- a/ui/src/components/AdvancePropertise/index.tsx +++ b/ui/src/components/AdvancePropertise/index.tsx @@ -67,7 +67,7 @@ const AdvancePropertise = (props: SchemaProps) => { value: item })); - const referencedItems = props?.data?.refrenceTo?.map((item: string) => ({ + const referencedItems = props?.data?.referenceTo?.map((item: string) => ({ label: item, value: item })); diff --git a/ui/src/components/ContentMapper/contentMapper.interface.ts b/ui/src/components/ContentMapper/contentMapper.interface.ts index f4921af1f..0e239a38b 100644 --- a/ui/src/components/ContentMapper/contentMapper.interface.ts +++ b/ui/src/components/ContentMapper/contentMapper.interface.ts @@ -67,7 +67,7 @@ export interface FieldMapType { contentstackUid: string; _invalid?: boolean; backupFieldUid: string; - refrenceTo: string[]; + referenceTo: string[]; } export interface Advanced { diff --git a/ui/src/components/ContentMapper/index.tsx b/ui/src/components/ContentMapper/index.tsx index c02bda1e3..c85b9f9a8 100644 --- a/ui/src/components/ContentMapper/index.tsx +++ b/ui/src/components/ContentMapper/index.tsx @@ -325,7 +325,7 @@ const ContentMapper = forwardRef(({ handleStepChange }: contentMapperProps, ref: // Make title and url field non editable useEffect(() => { tableData?.forEach((field) => { - if(field?.backupFieldType === 'reference' && field?.refrenceTo?.length === 0) { + if(field?.backupFieldType === 'reference' && field?.referenceTo?.length === 0) { field._canSelect = false; } else if (field?.backupFieldType !== 'text' && field?.backupFieldType !== 'url') { @@ -850,8 +850,8 @@ const ContentMapper = forwardRef(({ handleStepChange }: contentMapperProps, ref: setIsDropDownChanged(checkBoxChanged); const newTableData = tableData?.map?.((row: any) => { if (row?.uid === rowId && row?.contentstackFieldUid === rowContentstackFieldUid) { - if (row?.refrenceTo) { - row.refrenceTo = updatedSettings?.referenedItems; + if (row?.referenceTo) { + row.referenceTo = updatedSettings?.referenedItems; } return { ...row, advanced: { ...row?.advanced, ...updatedSettings } }; } diff --git a/ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx b/ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx index 4ee0f03b1..04ad10a81 100644 --- a/ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx +++ b/ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx @@ -14,6 +14,7 @@ import { useDispatch, useSelector } from 'react-redux'; import { RootState } from '../../../store'; import { updateNewMigrationData } from '../../../store/slice/migrationDataSlice'; import { DEFAULT_DROPDOWN, IDropDown, INewMigration } from '../../../context/app/app.interface'; +import {CS_ENTRIES} from '../../../utilities/constants'; export type ExistingFieldType = { [key: string]: { label: string; value: string }; @@ -222,9 +223,9 @@ const Mapper = ({ } else if (type === 'csLocale' && selectedLocaleKey) { - if(updatedMappings?.['undefined'] === existingLocale?.[index]?.label){ + if(updatedMappings?.[CS_ENTRIES?.UNMAPPED_LOCALE_KEY] === existingLocale?.[index]?.label){ updatedMappings[selectedLocaleKey] = existingLocale?.[index]?.label; - delete updatedMappings?.['undefined']; + delete updatedMappings?.[CS_ENTRIES?.UNMAPPED_LOCALE_KEY]; }else{ updatedMappings[selectedLocaleKey] = existingLocale?.[index]?.label ? existingLocale?.[index]?.label diff --git a/ui/src/utilities/constants.ts b/ui/src/utilities/constants.ts index d93943c30..3083c77f3 100644 --- a/ui/src/utilities/constants.ts +++ b/ui/src/utilities/constants.ts @@ -65,7 +65,8 @@ export const CS_ENTRIES = { url: '500' }, ERROR_HANDLER: 'error_handler', - ADD_STACK: 'add_stack' + ADD_STACK: 'add_stack', + UNMAPPED_LOCALE_KEY: 'undefined' }; export const UPLOAD_FILE_RELATIVE_URL = process.env.REACT_APP_UPLOAD_SERVER;