From 4da2e33c65fd1a816492d4b346007b18475aafba Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Mon, 8 Sep 2025 17:09:22 +0530 Subject: [PATCH 1/3] Delete secrets-scan.yml --- .github/workflows/secrets-scan.yml | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 .github/workflows/secrets-scan.yml diff --git a/.github/workflows/secrets-scan.yml b/.github/workflows/secrets-scan.yml deleted file mode 100644 index 049c02f..00000000 --- a/.github/workflows/secrets-scan.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Secrets Scan -on: - pull_request: - types: [opened, synchronize, reopened] -jobs: - security-secrets: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '2' - ref: '${{ github.event.pull_request.head.ref }}' - - run: | - git reset --soft HEAD~1 - - name: Install Talisman - run: | - # Download Talisman - wget https://github.com/thoughtworks/talisman/releases/download/v1.37.0/talisman_linux_amd64 -O talisman - - # Checksum verification - checksum=$(sha256sum ./talisman | awk '{print $1}') - if [ "$checksum" != "8e0ae8bb7b160bf10c4fa1448beb04a32a35e63505b3dddff74a092bccaaa7e4" ]; then exit 1; fi - - # Make it executable - chmod +x talisman - - name: Run talisman - run: | - # Run Talisman with the pre-commit hook - ./talisman --githook pre-commit \ No newline at end of file From 1f3dc69fc0227abb40265adb699ff585c8c763db Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Mon, 8 Sep 2025 17:09:26 +0530 Subject: [PATCH 2/3] Updated codeowners --- .github/CODEOWNERS | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1be7e0d..9e5a180 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,9 @@ -* @contentstack/security-admin +* @contentstack/launch-pr-reviewers + +.github/workflows/sca-scan.yml @contentstack/security-admin + +**/.snyk @contentstack/security-admin + +.github/workflows/policy-scan.yml @contentstack/security-admin + +.github/workflows/issues-jira.yml @contentstack/security-admin From ce89e3f69717a60afa5ddbdce20f558660d69792 Mon Sep 17 00:00:00 2001 From: SakshiKoli-CS Date: Fri, 31 Oct 2025 15:51:07 +0530 Subject: [PATCH 3/3] CL-2062 | +Harshi | Fix skip environment variables option with --variable-type flag --- src/adapters/base-class.test.ts | 95 ++++++++++++++++++++++++++++++++- src/adapters/base-class.ts | 6 ++- 2 files changed, 99 insertions(+), 2 deletions(-) diff --git a/src/adapters/base-class.test.ts b/src/adapters/base-class.test.ts index c036a89..cb02aa1 100644 --- a/src/adapters/base-class.test.ts +++ b/src/adapters/base-class.test.ts @@ -32,6 +32,99 @@ describe('BaseClass', () => { config: config.variablePreparationTypeOptions, } as any); }); + + it('should handle string variableType by converting to array - Import variables from a stack', async () => { + baseClass = new BaseClass({ + log: logMock, + exit: exitMock, + config: { + variableType: 'Import variables from a stack', + variablePreparationTypeOptions: config.variablePreparationTypeOptions, + }, + } as any); + + const importEnvFromStackMock = jest.spyOn(baseClass, 'importEnvFromStack').mockResolvedValueOnce(); + + await baseClass.handleEnvImportFlow(); + + expect(importEnvFromStackMock).toHaveBeenCalled(); + expect(exitMock).not.toHaveBeenCalled(); + }); + + it('should handle string variableType by converting to array - Manually add custom variables to the list', async () => { + baseClass = new BaseClass({ + log: logMock, + exit: exitMock, + config: { + variableType: 'Manually add custom variables to the list', + variablePreparationTypeOptions: config.variablePreparationTypeOptions, + }, + } as any); + + const promptForEnvValuesMock = jest.spyOn(baseClass, 'promptForEnvValues').mockResolvedValueOnce(); + + await baseClass.handleEnvImportFlow(); + + expect(promptForEnvValuesMock).toHaveBeenCalled(); + expect(exitMock).not.toHaveBeenCalled(); + }); + + it('should handle string variableType by converting to array - Import variables from the .env.local file', async () => { + baseClass = new BaseClass({ + log: logMock, + exit: exitMock, + config: { + variableType: 'Import variables from the .env.local file', + variablePreparationTypeOptions: config.variablePreparationTypeOptions, + }, + } as any); + + const importVariableFromLocalConfigMock = jest + .spyOn(baseClass, 'importVariableFromLocalConfig') + .mockResolvedValueOnce(); + + await baseClass.handleEnvImportFlow(); + + expect(importVariableFromLocalConfigMock).toHaveBeenCalled(); + expect(exitMock).not.toHaveBeenCalled(); + }); + + it('should handle string variableType by converting to array - Skip adding environment variables', async () => { + baseClass = new BaseClass({ + log: logMock, + exit: exitMock, + config: { + variableType: 'Skip adding environment variables', + variablePreparationTypeOptions: config.variablePreparationTypeOptions, + }, + } as any); + + await baseClass.handleEnvImportFlow(); + + expect(baseClass.envVariables).toEqual([]); + expect(logMock).toHaveBeenCalledWith('Skipped adding environment variables.', 'info'); + expect(exitMock).not.toHaveBeenCalled(); + }); + + it('should fail if string to array conversion is removed', async () => { + baseClass = new BaseClass({ + log: logMock, + exit: exitMock, + config: { + variableType: 'Skip adding environment variables', + variablePreparationTypeOptions: config.variablePreparationTypeOptions, + }, + } as any); + + await baseClass.handleEnvImportFlow(); + + expect(exitMock).not.toHaveBeenCalled(); + expect(logMock).not.toHaveBeenCalledWith( + "The 'Skip adding environment variables' option cannot be combined with other environment variable options. Please choose either 'Skip adding environment variables' or one or more of the other available options.", + 'error', + ); + }); + it('should exit if no options are selected', async () => { (ux.inquire as jest.Mock).mockResolvedValueOnce([]); @@ -162,7 +255,7 @@ describe('BaseClass', () => { 'Import variables from the .env.local file', ]); - await baseClass.handleEnvImportFlow(); + await baseClass.handleEnvImportFlow(); expect(importEnvFromStackMock).toHaveBeenCalled(); expect(promptForEnvValuesMock).toHaveBeenCalled(); diff --git a/src/adapters/base-class.ts b/src/adapters/base-class.ts index 96f93d7..24576ee 100755 --- a/src/adapters/base-class.ts +++ b/src/adapters/base-class.ts @@ -504,7 +504,7 @@ export default class BaseClass { * @memberof BaseClass */ async handleEnvImportFlow(): Promise { - const variablePreparationType = + let variablePreparationType: string | string[] = this.config.variableType || (await ux.inquire({ type: 'checkbox', @@ -514,6 +514,10 @@ export default class BaseClass { message: 'Import variables from a stack and/or manually add custom variables to the list', })); + if (typeof variablePreparationType === 'string') { + variablePreparationType = [variablePreparationType]; + } + if (variablePreparationType.length === 0) { this.log('Please select at least one option by pressing , then press to proceed.', 'error'); this.exit(1);