diff --git a/packages/contentstack-import/src/utils/entries-helper.ts b/packages/contentstack-import/src/utils/entries-helper.ts index f4c9d4ae19..ee57c94654 100644 --- a/packages/contentstack-import/src/utils/entries-helper.ts +++ b/packages/contentstack-import/src/utils/entries-helper.ts @@ -206,11 +206,10 @@ export const lookupEntries = function ( let entry = JSON.stringify(data.entry); uids?.forEach(function (uid: any) { if (mappedUids.hasOwnProperty(uid)) { - const sanitizedUid = escapeRegExp(uid); const escapedMappedUid = escapeRegExp(mappedUids[uid]); - const uidRegex = new RegExp(`\\b${sanitizedUid}\\b`, 'img'); - let { status } = validateRegex(uidRegex); - if (status === 'safe') { + // Use a static regex for alphanumeric only uids + const uidRegex = /^[a-zA-Z0-9]+$/; // Static regex that matches alphanumeric uids + if (uid.match(uidRegex)) { // Validate against the static regex entry = entry.replace(uidRegex, escapedMappedUid); mapped.push(uid); } else { diff --git a/packages/contentstack-utilities/src/auth-handler.ts b/packages/contentstack-utilities/src/auth-handler.ts index 8ca247621a..a00b81de89 100644 --- a/packages/contentstack-utilities/src/auth-handler.ts +++ b/packages/contentstack-utilities/src/auth-handler.ts @@ -4,7 +4,8 @@ import configHandler from './config-handler'; import dotenv from 'dotenv'; import * as ContentstackManagementSDK from '@contentstack/management'; import messageHandler from './message-handler'; -const http = require('http'); +// const http = require('http'); +import https from 'https'; const url = require('url'); import open from 'open'; import {LoggerService} from './logger'; @@ -119,7 +120,7 @@ class AuthHandler { async createHTTPServer(): Promise { return new Promise((resolve, reject) => { try { - const server = http.createServer((req, res) => { + const server = https.createServer((req, res) => { const reqURL = req.url; const queryObject = url.parse(reqURL, true).query; if (queryObject.code) {