From e53d9205b7e5a89745f86a0edbdd7f280cc21f39 Mon Sep 17 00:00:00 2001 From: raj pandey Date: Thu, 29 Oct 2026 17:58:46 +0530 Subject: [PATCH 1/3] secret Fix --- .../test/unit/import/asset-types.test.ts | 3 +- .../test/unit/import/assets.test.ts | 3 +- .../test/unit/import/base.test.ts | 3 +- .../test/unit/import/fields.test.ts | 3 +- .../test/unit/import/spaces.test.ts | 3 +- .../test/unit/import/workspaces.test.ts | 3 +- .../detect-asset-management-export.test.ts | 5 +- .../test/bootstrap-integration.test.js | 6 +- .../test/unit/base-bulk-command.test.ts | 3 +- .../utils/bulk-operation-log-handler.test.ts | 36 +++---- .../test/unit/utils/config-builder.test.ts | 36 +++---- .../unit/utils/revert-retry-handler.test.ts | 39 +++----- .../test/commands/stack-clone.test.ts | 3 +- .../test/lib/helpers/command-helpers.test.ts | 3 +- .../lib/util/clone-handler.branch.test.ts | 20 ++-- .../test/core/command.test.ts | 20 ++-- .../test/core/contentstack/client.test.ts | 10 +- .../test/utils/index.test.ts | 8 +- .../test/unit/commands/export-to-csv.test.ts | 15 ++- .../test/unit/utils/error-handler.test.ts | 13 +-- .../utils/teams-export.functional.test.ts | 6 +- .../test/unit/export/module-exporter.test.ts | 12 +-- .../export/modules/marketplace-apps.test.ts | 15 ++- .../test/unit/utils/common-helper.test.ts | 5 +- .../unit/utils/export-config-handler.test.ts | 29 +++--- .../test/unit/utils/interactive.test.ts | 3 +- .../unit/utils/marketplace-app-helper.test.ts | 18 ++-- .../test/unit/common-helper.test.ts | 3 +- .../test/unit/login-handler.test.ts | 3 +- .../unit/commands/cm/stacks/import.test.ts | 3 +- .../test/unit/import/modules/assets.test.ts | 3 +- .../unit/import/modules/base-class.test.ts | 3 +- .../unit/import/modules/content-types.test.ts | 3 +- .../test/unit/import/modules/entries.test.ts | 3 +- .../unit/import/modules/global-fields.test.ts | 3 +- .../test/unit/import/modules/index.test.ts | 15 +-- .../import/modules/marketplace-apps.test.ts | 95 +++++++------------ .../test/unit/utils/common-helper.test.ts | 10 +- .../test/unit/utils/interactive.test.ts | 3 +- .../test/unit/utils/login-handler.test.ts | 8 +- .../unit/utils/marketplace-app-helper.test.ts | 8 +- .../test/commands/json-migration.test.js | 24 ++--- .../test/utils/index.js | 3 +- .../test/unit/common-helper.test.ts | 3 +- .../test/commands/cm/stacks/seed.test.ts | 30 +++--- .../test/seed/contentstack/client.test.ts | 53 ++++------- .../test/seed/interactive.test.ts | 20 ++-- .../test/unit/export/variant-entries.test.ts | 9 +- 48 files changed, 231 insertions(+), 397 deletions(-) diff --git a/packages/contentstack-asset-management/test/unit/import/asset-types.test.ts b/packages/contentstack-asset-management/test/unit/import/asset-types.test.ts index 871ef9088..2d9dae3f6 100644 --- a/packages/contentstack-asset-management/test/unit/import/asset-types.test.ts +++ b/packages/contentstack-asset-management/test/unit/import/asset-types.test.ts @@ -13,8 +13,7 @@ describe('ImportAssetTypes', () => { }; const importContext: ImportContext = { spacesRootPath: '/tmp/import/spaces', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'api-key-1', + apiKey: 'API_KEY', host: 'https://api.contentstack.io/v3', org_uid: 'org-1', }; diff --git a/packages/contentstack-asset-management/test/unit/import/assets.test.ts b/packages/contentstack-asset-management/test/unit/import/assets.test.ts index b438e9f98..a78e0a16b 100644 --- a/packages/contentstack-asset-management/test/unit/import/assets.test.ts +++ b/packages/contentstack-asset-management/test/unit/import/assets.test.ts @@ -16,8 +16,7 @@ describe('ImportAssets', () => { }; const importContext: ImportContext = { spacesRootPath: '/tmp/import/spaces', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'api-key-1', + apiKey: 'API_KEY', host: 'https://api.contentstack.io/v3', org_uid: 'org-1', }; diff --git a/packages/contentstack-asset-management/test/unit/import/base.test.ts b/packages/contentstack-asset-management/test/unit/import/base.test.ts index eee4c3c9b..e36e029ad 100644 --- a/packages/contentstack-asset-management/test/unit/import/base.test.ts +++ b/packages/contentstack-asset-management/test/unit/import/base.test.ts @@ -28,8 +28,7 @@ describe('CSAssetsImportAdapter (base)', () => { }; const importContext: ImportContext = { spacesRootPath: '/tmp/import/spaces', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'api-key-1', + apiKey: 'API_KEY', host: 'https://api.contentstack.io/v3', org_uid: 'org-1', }; diff --git a/packages/contentstack-asset-management/test/unit/import/fields.test.ts b/packages/contentstack-asset-management/test/unit/import/fields.test.ts index 3363c363b..0153570ad 100644 --- a/packages/contentstack-asset-management/test/unit/import/fields.test.ts +++ b/packages/contentstack-asset-management/test/unit/import/fields.test.ts @@ -13,8 +13,7 @@ describe('ImportFields', () => { }; const importContext: ImportContext = { spacesRootPath: '/tmp/import/spaces', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'api-key-1', + apiKey: 'API_KEY', host: 'https://api.contentstack.io/v3', org_uid: 'org-1', }; diff --git a/packages/contentstack-asset-management/test/unit/import/spaces.test.ts b/packages/contentstack-asset-management/test/unit/import/spaces.test.ts index 1f58d0bbb..2d246d06c 100644 --- a/packages/contentstack-asset-management/test/unit/import/spaces.test.ts +++ b/packages/contentstack-asset-management/test/unit/import/spaces.test.ts @@ -17,8 +17,7 @@ describe('ImportSpaces', () => { contentDir: '/tmp/import', csAssetsUrl: 'https://am.example.com', org_uid: 'org-1', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'api-key-1', + apiKey: 'API_KEY', host: 'https://api.contentstack.io/v3', }; diff --git a/packages/contentstack-asset-management/test/unit/import/workspaces.test.ts b/packages/contentstack-asset-management/test/unit/import/workspaces.test.ts index 8a442096b..6301ce6c9 100644 --- a/packages/contentstack-asset-management/test/unit/import/workspaces.test.ts +++ b/packages/contentstack-asset-management/test/unit/import/workspaces.test.ts @@ -15,8 +15,7 @@ describe('ImportWorkspace', () => { const importContext: ImportContext = { spacesRootPath: '/tmp/import/spaces', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'api-key-1', + apiKey: 'API_KEY', host: 'https://api.contentstack.io/v3', org_uid: 'org-1', }; diff --git a/packages/contentstack-asset-management/test/unit/utils/detect-asset-management-export.test.ts b/packages/contentstack-asset-management/test/unit/utils/detect-asset-management-export.test.ts index 09e72c8df..45aeddd68 100644 --- a/packages/contentstack-asset-management/test/unit/utils/detect-asset-management-export.test.ts +++ b/packages/contentstack-asset-management/test/unit/utils/detect-asset-management-export.test.ts @@ -51,8 +51,7 @@ describe('detectAssetManagementExportFromContentDir', () => { ); fs.writeFileSync( path.join(tmpRoot, 'branches.json'), - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - JSON.stringify([{ stackHeaders: { api_key: 'source-stack-key' } }]), + JSON.stringify([{ stackHeaders: { api_key: 'API_KEY' } }]), ); stub(utilities.configHandler, 'get').withArgs('region').returns({ @@ -62,6 +61,6 @@ describe('detectAssetManagementExportFromContentDir', () => { const flags = detectAssetManagementExportFromContentDir(tmpRoot); expect(flags.assetManagementEnabled).to.equal(true); expect(flags.assetManagementUrl).to.equal('https://am.example.com'); - expect(flags.source_stack).to.equal('source-stack-key'); + expect(flags.source_stack).to.equal('API_KEY'); }); }); diff --git a/packages/contentstack-bootstrap/test/bootstrap-integration.test.js b/packages/contentstack-bootstrap/test/bootstrap-integration.test.js index 080203e00..c7df6b087 100644 --- a/packages/contentstack-bootstrap/test/bootstrap-integration.test.js +++ b/packages/contentstack-bootstrap/test/bootstrap-integration.test.js @@ -82,8 +82,7 @@ describe('Bootstrap Integration Tests', () => { const mockOptions = { cloneDirectory: '/test/path', seedParams: { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - stackAPIKey: 'test-key', + stackAPIKey: 'API_KEY', managementTokenAlias: 'test-alias', managementToken: 'test-token', }, @@ -118,8 +117,7 @@ describe('Bootstrap Integration Tests', () => { it('should validate SeedParams interface includes managementTokenAlias and managementToken', () => { // Verify that SeedParams interface includes the new properties const mockSeedParams = { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - stackAPIKey: 'test-key', + stackAPIKey: 'API_KEY', org: 'test-org', stackName: 'test-stack', yes: 'yes', diff --git a/packages/contentstack-bulk-operations/test/unit/base-bulk-command.test.ts b/packages/contentstack-bulk-operations/test/unit/base-bulk-command.test.ts index dc6c6e83f..0b758ae77 100644 --- a/packages/contentstack-bulk-operations/test/unit/base-bulk-command.test.ts +++ b/packages/contentstack-bulk-operations/test/unit/base-bulk-command.test.ts @@ -719,8 +719,7 @@ describe('BaseBulkCommand', () => { (command as any).bulkOperationConfig = { publishMode: 'bulk', apiKey: undefined, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - stackApiKey: 'fallback-key', + stackApiKey: 'API_KEY', branch: 'main', bulkOperationFolder: './bulk-operation', }; diff --git a/packages/contentstack-bulk-operations/test/unit/utils/bulk-operation-log-handler.test.ts b/packages/contentstack-bulk-operations/test/unit/utils/bulk-operation-log-handler.test.ts index 7f05ccaaa..2cfa31767 100644 --- a/packages/contentstack-bulk-operations/test/unit/utils/bulk-operation-log-handler.test.ts +++ b/packages/contentstack-bulk-operations/test/unit/utils/bulk-operation-log-handler.test.ts @@ -197,8 +197,7 @@ describe('Bulk Operation Log Handler', () => { locales: ['en-us'], items: [{ uid: 'entry1' }], status: 'success', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, ]; @@ -255,8 +254,7 @@ describe('Bulk Operation Log Handler', () => { items: [{ uid: 'entry1' }], status: 'failed', error: 'Network error', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, ]; @@ -353,8 +351,7 @@ describe('Bulk Operation Log Handler', () => { item: { uid: 'entry1', type: 'entry', locale: 'en-us' }, environments: ['prod'], status: 'success', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, ]; @@ -403,8 +400,7 @@ describe('Bulk Operation Log Handler', () => { environments: ['prod'], status: 'failed', error: 'Network error', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, ]; @@ -446,8 +442,7 @@ describe('Bulk Operation Log Handler', () => { locales: ['en-us'], items: [{ uid: 'entry1', type: 'entry', locale: 'en-us' }], status: 'success', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }; @@ -472,8 +467,7 @@ describe('Bulk Operation Log Handler', () => { locales: ['en-us'], items: [], status: 'success', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }; @@ -498,8 +492,7 @@ describe('Bulk Operation Log Handler', () => { locales: [], items: [], status: 'success', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }; @@ -535,8 +528,7 @@ describe('Bulk Operation Log Handler', () => { items: [], status: 'failed', error: 'API Error', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }; @@ -571,8 +563,7 @@ describe('Bulk Operation Log Handler', () => { item: { uid: 'entry1', type: 'entry', locale: 'en-us' }, environments: ['prod'], status: 'success', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }; @@ -595,8 +586,7 @@ describe('Bulk Operation Log Handler', () => { item: { uid: 'new-entry', type: 'entry', locale: 'en-us' }, environments: ['prod'], status: 'success', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }; @@ -632,8 +622,7 @@ describe('Bulk Operation Log Handler', () => { environments: ['prod'], status: 'failed', error: 'Publish failed', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }; @@ -655,8 +644,7 @@ describe('Bulk Operation Log Handler', () => { item: { uid: 'entry1', type: 'entry', locale: 'en-us' }, environments: [], status: 'failed', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }; diff --git a/packages/contentstack-bulk-operations/test/unit/utils/config-builder.test.ts b/packages/contentstack-bulk-operations/test/unit/utils/config-builder.test.ts index 4638d0c1d..256215431 100644 --- a/packages/contentstack-bulk-operations/test/unit/utils/config-builder.test.ts +++ b/packages/contentstack-bulk-operations/test/unit/utils/config-builder.test.ts @@ -518,15 +518,14 @@ describe('Config Builder Utilities', () => { }; configHandlerGetStub.withArgs('tokens.test-alias').returns({ - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'stack-from-alias', + apiKey: 'API_KEY', token: 'cs-token-123', }); const stackConfig = setupStackConfig(flags); expect(stackConfig.alias).to.equal('test-alias'); - expect(stackConfig.apiKey).to.equal('stack-from-alias'); + expect(stackConfig.apiKey).to.equal('API_KEY'); expect(configHandlerGetStub.calledWith('tokens.test-alias')).to.be.true; }); @@ -541,8 +540,7 @@ describe('Config Builder Utilities', () => { }; configHandlerGetStub.withArgs('tokens.test-alias').returns({ - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'stack-mgmt', + apiKey: 'changeme', token: 'cs-mgmt-token', type: 'management', }); @@ -551,8 +549,7 @@ describe('Config Builder Utilities', () => { type: 'delivery', token: 'cs-delivery-token', environment: 'production', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'stack123', + apiKey: 'dummy', }); const stackConfig = setupStackConfig(flags); @@ -573,8 +570,7 @@ describe('Config Builder Utilities', () => { }; configHandlerGetStub.withArgs('tokens.test-alias').returns({ - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'stack-mgmt', + apiKey: 'changeme', token: 'cs-mgmt-token', type: 'management', }); @@ -595,8 +591,7 @@ describe('Config Builder Utilities', () => { }; configHandlerGetStub.withArgs('tokens.test-alias').returns({ - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'stack-mgmt', + apiKey: 'changeme', token: 'cs-mgmt-token', type: 'management', }); @@ -604,8 +599,7 @@ describe('Config Builder Utilities', () => { configHandlerGetStub.withArgs('tokens.mgmt-alias').returns({ type: 'management', token: 'cs-mgmt-token', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'stack123', + apiKey: 'dummy', }); expect(() => setupStackConfig(flags)).to.throw(/is not a delivery token/); @@ -622,8 +616,7 @@ describe('Config Builder Utilities', () => { }; configHandlerGetStub.withArgs('tokens.test-alias').returns({ - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'stack-mgmt', + apiKey: 'changeme', token: 'cs-mgmt-token', type: 'management', }); @@ -632,8 +625,7 @@ describe('Config Builder Utilities', () => { type: 'delivery', token: 'cs-delivery-token', environment: 'production', // Different from source-env - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'stack123', + apiKey: 'dummy', }); const stackConfig = setupStackConfig(flags); @@ -644,7 +636,7 @@ describe('Config Builder Utilities', () => { it('should set custom CMA host', () => { const flags: CommandFlags = { - 'stack-api-key': 'stack123', + 'stack-api-key': 'dummy', operation: 'publish', environments: ['dev'], locales: ['en-us'], @@ -657,7 +649,7 @@ describe('Config Builder Utilities', () => { it('should set custom CDA host', () => { const flags: CommandFlags = { - 'stack-api-key': 'stack123', + 'stack-api-key': 'dummy', operation: 'publish', environments: ['dev'], locales: ['en-us'], @@ -671,7 +663,7 @@ describe('Config Builder Utilities', () => { it('should use default CDA host if not provided', () => { const flags: CommandFlags = { - 'stack-api-key': 'stack123', + 'stack-api-key': 'dummy', operation: 'publish', environments: ['dev'], locales: ['en-us'], @@ -684,7 +676,7 @@ describe('Config Builder Utilities', () => { it('should pass branch to stack config', () => { const flags: CommandFlags = { - 'stack-api-key': 'stack123', + 'stack-api-key': 'dummy', operation: 'publish', environments: ['dev'], locales: ['en-us'], @@ -698,7 +690,7 @@ describe('Config Builder Utilities', () => { it('should handle source-env without source-alias', () => { const flags: CommandFlags = { - 'stack-api-key': 'stack123', + 'stack-api-key': 'dummy', operation: 'publish', 'source-env': 'production', environments: ['dev'], diff --git a/packages/contentstack-bulk-operations/test/unit/utils/revert-retry-handler.test.ts b/packages/contentstack-bulk-operations/test/unit/utils/revert-retry-handler.test.ts index 0db38ef18..82b2bf7b6 100644 --- a/packages/contentstack-bulk-operations/test/unit/utils/revert-retry-handler.test.ts +++ b/packages/contentstack-bulk-operations/test/unit/utils/revert-retry-handler.test.ts @@ -60,8 +60,7 @@ describe('Revert Retry Handler', () => { items: [{ uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' }], status: 'failed', error: 'Network timeout', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, ]; @@ -87,8 +86,7 @@ describe('Revert Retry Handler', () => { locales: ['en-us'], items: [{ uid: 'asset1', locale: 'en-us', version: 1, type: 'asset' }], status: 'failed', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, ]; @@ -116,8 +114,7 @@ describe('Revert Retry Handler', () => { locales: ['en-us'], items: [{ uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' }], status: 'failed', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, { @@ -130,8 +127,7 @@ describe('Revert Retry Handler', () => { locales: ['en-us'], items: [{ uid: 'entry2', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' }], status: 'failed', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, ]; @@ -169,8 +165,7 @@ describe('Revert Retry Handler', () => { locales: ['en-us'], items: [{ uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' }], status: 'success', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, ]; @@ -210,8 +205,7 @@ describe('Revert Retry Handler', () => { locales: ['en-us'], items: [{ uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' }], status: 'failed', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, ]; @@ -251,8 +245,7 @@ describe('Revert Retry Handler', () => { locales: ['en-us'], items: [{ uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' }], status: 'success', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, ]; @@ -311,8 +304,7 @@ describe('Revert Retry Handler', () => { locales: ['en-us'], items: [{ uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' }], status: 'failed', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, ]; @@ -347,8 +339,7 @@ describe('Revert Retry Handler', () => { locales: ['en-us'], items: [{ uid: 'asset1', locale: 'en-us', version: 1, type: 'asset' }], status: 'failed', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, ]; @@ -390,8 +381,7 @@ describe('Revert Retry Handler', () => { locales: ['en-us'], items: [{ uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' as const }], status: 'success' as const, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, ]; @@ -414,8 +404,7 @@ describe('Revert Retry Handler', () => { locales: ['en-us'], items: [{ uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' as const }], status: 'success' as const, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, ]; @@ -435,8 +424,7 @@ describe('Revert Retry Handler', () => { item: { uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' as const }, environments: ['prod'], status: 'success' as const, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, ]; @@ -456,8 +444,7 @@ describe('Revert Retry Handler', () => { item: { uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' as const }, environments: ['prod'], status: 'success' as const, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', branch: 'main', }, ]; diff --git a/packages/contentstack-clone/test/commands/stack-clone.test.ts b/packages/contentstack-clone/test/commands/stack-clone.test.ts index f069dc8ec..88de7c5ae 100644 --- a/packages/contentstack-clone/test/commands/stack-clone.test.ts +++ b/packages/contentstack-clone/test/commands/stack-clone.test.ts @@ -63,8 +63,7 @@ describe('Stack Clone Test', () => { describe('createNewStack', () => { it('should call createNewStack', async () => { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - const createNewStackStub = sandbox.stub(handler, 'createNewStack').resolves({ api_key: 'test-key' }); + const createNewStackStub = sandbox.stub(handler, 'createNewStack').resolves({ api_key: 'API_KEY' }); await handler.createNewStack({ orgUid: 'dummyOrg' }); expect(createNewStackStub.calledOnce).to.be.true; }); diff --git a/packages/contentstack-clone/test/lib/helpers/command-helpers.test.ts b/packages/contentstack-clone/test/lib/helpers/command-helpers.test.ts index c184b90a9..49e84ce6a 100644 --- a/packages/contentstack-clone/test/lib/helpers/command-helpers.test.ts +++ b/packages/contentstack-clone/test/lib/helpers/command-helpers.test.ts @@ -64,8 +64,7 @@ describe('Command Helpers', () => { executeDestination: async () => {}, cmdExport: async () => true, setBranch: async () => {}, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - createNewStack: async (params: any) => ({ api_key: 'test-key' }), + createNewStack: async (params: any) => ({ api_key: 'API_KEY' }), cloneTypeSelection: async () => 'success', }; }); diff --git a/packages/contentstack-clone/test/lib/util/clone-handler.branch.test.ts b/packages/contentstack-clone/test/lib/util/clone-handler.branch.test.ts index 0879f999a..3f86c785a 100644 --- a/packages/contentstack-clone/test/lib/util/clone-handler.branch.test.ts +++ b/packages/contentstack-clone/test/lib/util/clone-handler.branch.test.ts @@ -79,8 +79,8 @@ describe('CloneHandler - Branch', () => { module: 'clone', email: 'test@example.com', }, - source_stack: 'test-source-key', - target_stack: 'test-target-key', + source_stack: 'API_KEY', + target_stack: 'changeme', sourceStackBranchAlias: 'main-alias', targetStackBranchAlias: 'develop-alias', }; @@ -105,13 +105,11 @@ describe('CloneHandler - Branch', () => { try { await handler.resolveBranchAliases(true); // If it doesn't throw, verify stack was called - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - expect(mockClient.stack.calledWith({ api_key: 'test-source-key' })).to.be.true; + expect(mockClient.stack.calledWith({ api_key: 'API_KEY' })).to.be.true; } catch (error) { // Expected to fail due to actual function call without proper setup expect(error).to.exist; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - expect(mockClient.stack.calledWith({ api_key: 'test-source-key' })).to.be.true; + expect(mockClient.stack.calledWith({ api_key: 'API_KEY' })).to.be.true; } }); @@ -122,13 +120,11 @@ describe('CloneHandler - Branch', () => { try { await handler.resolveBranchAliases(false); - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - expect(mockClient.stack.calledWith({ api_key: 'test-target-key' })).to.be.true; + expect(mockClient.stack.calledWith({ api_key: 'changeme' })).to.be.true; } catch (error) { // Expected to fail due to actual function call without proper setup expect(error).to.exist; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - expect(mockClient.stack.calledWith({ api_key: 'test-target-key' })).to.be.true; + expect(mockClient.stack.calledWith({ api_key: 'changeme' })).to.be.true; } }); }); @@ -146,8 +142,8 @@ describe('CloneHandler - Branch', () => { // module: 'clone', // email: 'test@example.com', // }, -// source_stack: 'test-source-key', -// target_stack: 'test-target-key', +// source_stack: 'API_KEY', +// target_stack: 'changeme', // }; // handler = new CloneHandler(config); // mockClient = { diff --git a/packages/contentstack-content-type/test/core/command.test.ts b/packages/contentstack-content-type/test/core/command.test.ts index a3826f04f..9063482ff 100644 --- a/packages/contentstack-content-type/test/core/command.test.ts +++ b/packages/contentstack-content-type/test/core/command.test.ts @@ -4,16 +4,14 @@ jest.mock('@contentstack/cli-command', () => ({ error = jest.fn() warn = jest.fn() getToken(_alias: string) { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - return { apiKey: 'default-api', type: 'management' } + return { apiKey: 'API_KEY', type: 'management' } } }, })) jest.mock('@contentstack/cli-utilities', () => ({ authenticationHandler: { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - accessToken: 'auth-token', + accessToken: 'dummy', getAuthDetails: jest.fn(), }, cliux: { @@ -53,7 +51,7 @@ describe('ContentTypeCommand', () => { jest.clearAllMocks() cmd = makeCmd() ;(authenticationHandler.getAuthDetails as jest.Mock).mockResolvedValue(undefined) - ;(authenticationHandler as any).accessToken = 'auth-token' + ;(authenticationHandler as any).accessToken = 'dummy' }) describe('printOutput', () => { @@ -145,18 +143,17 @@ describe('ContentTypeCommand', () => { expect((cmd as any).apiKey).toBe('stack-key-1') expect(ContentstackClient).toHaveBeenCalledWith( 'https://api.contentstack.io', - 'auth-token' + 'dummy' ) }) it('sets apiKey from alias token and warns on delivery token', async () => { jest.spyOn(cmd, 'getToken').mockReturnValue({ - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'from-token', + apiKey: 'changeme', type: 'delivery', } as any) await cmd.setup({ alias: 'my-alias' }) - expect((cmd as any).apiKey).toBe('from-token') + expect((cmd as any).apiKey).toBe('changeme') expect(cliux.print).toHaveBeenCalledWith( expect.stringContaining('delivery token'), { color: 'yellow' } @@ -165,12 +162,11 @@ describe('ContentTypeCommand', () => { it('sets apiKey from management token alias without warning', async () => { jest.spyOn(cmd, 'getToken').mockReturnValue({ - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'mgmt-key', + apiKey: 'dummy', type: 'management', } as any) await cmd.setup({ alias: 'm' }) - expect((cmd as any).apiKey).toBe('mgmt-key') + expect((cmd as any).apiKey).toBe('dummy') expect(cliux.print).not.toHaveBeenCalledWith( expect.stringContaining('delivery token'), expect.anything() diff --git a/packages/contentstack-content-type/test/core/contentstack/client.test.ts b/packages/contentstack-content-type/test/core/contentstack/client.test.ts index c800b4e01..28c0ef00b 100644 --- a/packages/contentstack-content-type/test/core/contentstack/client.test.ts +++ b/packages/contentstack-content-type/test/core/contentstack/client.test.ts @@ -27,7 +27,7 @@ describe('ContentstackClient', () => { describe('getContentTypeAuditLogs', () => { it('should call GET /audit-logs with query and api_key header', async () => { const client = new ContentstackClient('api.contentstack.io', 'token123') - await client.getContentTypeAuditLogs('stack-key', 'ct-uid', spinner) + await client.getContentTypeAuditLogs('API_KEY', 'ct-uid', spinner) expect(mockedAxios.create).toHaveBeenCalledWith({ baseURL: 'https://api.contentstack.io/v3/', @@ -36,8 +36,7 @@ describe('ContentstackClient', () => { expect(mockGet).toHaveBeenCalledWith( '/audit-logs', expect.objectContaining({ - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - headers: { api_key: 'stack-key' }, + headers: { api_key: 'API_KEY' }, params: { query: { $and: [ @@ -104,11 +103,10 @@ describe('ContentstackClient', () => { describe('getContentTypeReferences', () => { it('should call GET content_types uid references with params', async () => { const client = new ContentstackClient('api.contentstack.io', 'token123') - await client.getContentTypeReferences('stack-key', 'ct-uid', spinner) + await client.getContentTypeReferences('API_KEY', 'ct-uid', spinner) expect(mockGet).toHaveBeenCalledWith('/content_types/ct-uid/references', { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - headers: { api_key: 'stack-key' }, + headers: { api_key: 'API_KEY' }, params: { include_global_fields: true } }) }) diff --git a/packages/contentstack-content-type/test/utils/index.test.ts b/packages/contentstack-content-type/test/utils/index.test.ts index 0509e3735..0d133e81c 100644 --- a/packages/contentstack-content-type/test/utils/index.test.ts +++ b/packages/contentstack-content-type/test/utils/index.test.ts @@ -84,17 +84,15 @@ describe('utils/index', () => { it('getStack should map stack fields', async () => { const sdk = stackFactory({}) - const stack = await getStack(sdk, 'api-key-1', spinner) + const stack = await getStack(sdk, 'API_KEY', spinner) expect(stack).toEqual({ - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'api-key-1', + api_key: 'API_KEY', master_locale: 'en-us', name: 'Stack', org_uid: 'org-1', uid: 'stack-uid' }) - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - expect(sdk.stack).toHaveBeenCalledWith({ api_key: 'api-key-1' }) + expect(sdk.stack).toHaveBeenCalledWith({ api_key: 'API_KEY' }) }) it('getUsers should return users array', async () => { diff --git a/packages/contentstack-export-to-csv/test/unit/commands/export-to-csv.test.ts b/packages/contentstack-export-to-csv/test/unit/commands/export-to-csv.test.ts index 319842002..5c047523b 100644 --- a/packages/contentstack-export-to-csv/test/unit/commands/export-to-csv.test.ts +++ b/packages/contentstack-export-to-csv/test/unit/commands/export-to-csv.test.ts @@ -630,8 +630,7 @@ describe('cm:export-to-csv', () => { const aliasClient = { stack: sandbox.stub().returns({}) } as any; const aliasSpy = sandbox.stub(cmd, 'getAliasDetails').resolves({ - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - stackDetails: { name: 'Aliased', apiKey: 'ak-alias' } as any, + stackDetails: { name: 'Aliased', apiKey: 'API_KEY' } as any, apiClient: aliasClient, }); sandbox.stub(cmd, 'checkAndUpdateBranchDetail').callsFake(async (_b, _s, sc) => sc); @@ -647,7 +646,7 @@ describe('cm:export-to-csv', () => { }); expect(aliasSpy.calledOnceWithExactly('my-alias', undefined)).to.equal(true); - expect(cmd.commandContext.apiKey).to.equal('ak-alias'); + expect(cmd.commandContext.apiKey).to.equal('API_KEY'); const noCt = printStub.getCalls().some((c) => String(c.args[0]).includes('No content types found')); expect(noCt).to.equal(true); }); @@ -897,17 +896,15 @@ describe('cm:export-to-csv', () => { const restoreCli = patchCliUtilities({ isAuthenticated: () => true }); try { const { ExportCmd, interactiveMod } = reloadExportCommandWithUtilsStubs(sandbox, { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - chooseStack: { name: 'MyStack', apiKey: 'stack-key-99' }, + chooseStack: { name: 'MyStack', apiKey: 'changeme' }, }); const cmd = new ExportCmd([], minimalConfig); await cmd.init(); - const out = await cmd.getStackDetails({} as any, 'stack-key-99', 'org-uid-z'); + const out = await cmd.getStackDetails({} as any, 'changeme', 'org-uid-z'); - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - expect(out).to.deep.equal({ name: 'MyStack', apiKey: 'stack-key-99' }); - expect((interactiveMod.chooseStack as sinon.SinonStub).calledWith({}, 'org-uid-z', 'stack-key-99')).to.equal( + expect(out).to.deep.equal({ name: 'MyStack', apiKey: 'changeme' }); + expect((interactiveMod.chooseStack as sinon.SinonStub).calledWith({}, 'org-uid-z', 'changeme')).to.equal( true, ); } finally { diff --git a/packages/contentstack-export-to-csv/test/unit/utils/error-handler.test.ts b/packages/contentstack-export-to-csv/test/unit/utils/error-handler.test.ts index 67facb104..3f0f80fee 100644 --- a/packages/contentstack-export-to-csv/test/unit/utils/error-handler.test.ts +++ b/packages/contentstack-export-to-csv/test/unit/utils/error-handler.test.ts @@ -65,12 +65,11 @@ describe('error-handler', () => { it('should append api_key error details', () => { const error = { errorMessage: 'Invalid request', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - errors: { api_key: 'is required' }, + errors: { api_key: 'API_KEY' }, }; const result = formatError(error); expect(result).to.include('Stack API key'); - expect(result).to.include('is required'); + expect(result).to.include('API_KEY'); }); it('should append uid error details', () => { @@ -86,12 +85,11 @@ describe('error-handler', () => { it('should append access_token error details', () => { const error = { errorMessage: 'Unauthorized', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - errors: { access_token: 'is expired' }, + errors: { access_token: 'ACCESS_TOKEN' }, }; const result = formatError(error); expect(result).to.include('Delivery Token'); - expect(result).to.include('is expired'); + expect(result).to.include('ACCESS_TOKEN'); }); it('should handle multiple error fields', () => { @@ -99,8 +97,7 @@ describe('error-handler', () => { errorMessage: 'Multiple errors', errors: { authorization: 'is invalid', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'is missing', + api_key: 'changeme', }, }; const result = formatError(error); diff --git a/packages/contentstack-export-to-csv/test/unit/utils/teams-export.functional.test.ts b/packages/contentstack-export-to-csv/test/unit/utils/teams-export.functional.test.ts index 298a86cbb..560caa837 100644 --- a/packages/contentstack-export-to-csv/test/unit/utils/teams-export.functional.test.ts +++ b/packages/contentstack-export-to-csv/test/unit/utils/teams-export.functional.test.ts @@ -120,8 +120,7 @@ describe('teams-export functional', () => { { uid: 'r1', name: 'Role', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - stack: { api_key: 'wrong-key', name: 'S', uid: 'su' }, + stack: { api_key: 'API_KEY', name: 'S', uid: 'su' }, }, ], } as any); @@ -184,8 +183,7 @@ describe('teams-export functional', () => { items: [{ uid: 'r1', name: 'Editor', stack: { api_key: 'k1', name: 'Stack1', uid: 's1' } }], } as any); roleStub.onSecondCall().resolves({ - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - items: [{ uid: 'r2', name: 'Author', stack: { api_key: 'wrong-k2', name: 'Stack2', uid: 's2' } }], + items: [{ uid: 'r2', name: 'Author', stack: { api_key: 'changeme', name: 'Stack2', uid: 's2' } }], } as any); const interactiveMod = loadInteractiveFresh(); sandbox.stub(interactiveMod, 'promptContinueExport').resolves(true); diff --git a/packages/contentstack-export/test/unit/export/module-exporter.test.ts b/packages/contentstack-export/test/unit/export/module-exporter.test.ts index 057bcf64c..f5b9ad490 100644 --- a/packages/contentstack-export/test/unit/export/module-exporter.test.ts +++ b/packages/contentstack-export/test/unit/export/module-exporter.test.ts @@ -23,8 +23,7 @@ describe('ModuleExporter exportByBranches', () => { const exportConfig: Partial = { exportDir, branches, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', management_token: 'token', context: {} as any, modules: { types: ['stack'] } as any, @@ -55,8 +54,7 @@ describe('ModuleExporter exportByBranches', () => { exportDir, branchName: 'dev', branches, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', management_token: 'token', context: {} as any, modules: { types: ['stack'] } as any, @@ -84,8 +82,7 @@ describe('ModuleExporter exportByBranches', () => { exportDir, branchName: 'nonexistent', branches, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', management_token: 'token', context: {} as any, modules: { types: [] } as any, @@ -110,8 +107,7 @@ describe('ModuleExporter exportByBranches', () => { const exportConfig: Partial = { exportDir, branches, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key', + apiKey: 'API_KEY', management_token: 'token', context: {} as any, modules: { types: [] } as any, diff --git a/packages/contentstack-export/test/unit/export/modules/marketplace-apps.test.ts b/packages/contentstack-export/test/unit/export/modules/marketplace-apps.test.ts index 78071be17..7ca492433 100644 --- a/packages/contentstack-export/test/unit/export/modules/marketplace-apps.test.ts +++ b/packages/contentstack-export/test/unit/export/modules/marketplace-apps.test.ts @@ -17,8 +17,7 @@ describe('ExportMarketplaceApps', () => { versioning: false, host: 'https://api.contentstack.io', developerHubUrls: {}, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-stack-uid', + apiKey: 'API_KEY', exportDir: '/test/export', data: '/test/data', branchName: '', @@ -188,7 +187,7 @@ describe('ExportMarketplaceApps', () => { const setupPathsStub = sinon.stub(exportMarketplaceApps, 'setupPaths').callsFake(async () => { exportMarketplaceApps.exportConfig.org_uid = 'test-org-uid'; exportMarketplaceApps.developerHubBaseUrl = 'https://developer-api.contentstack.io'; - exportMarketplaceApps.query = { target_uids: 'test-stack-uid' }; + exportMarketplaceApps.query = { target_uids: 'API_KEY' }; exportMarketplaceApps.appSdk = mockAppSdk; exportMarketplaceApps.marketplaceAppPath = require('node:path').resolve( exportMarketplaceApps.exportConfig.exportDir, @@ -209,7 +208,7 @@ describe('ExportMarketplaceApps', () => { expect(exportMarketplaceApps.marketplaceAppPath).to.exist; expect(exportMarketplaceApps.developerHubBaseUrl).to.equal('https://developer-api.contentstack.io'); expect(exportMarketplaceApps.exportConfig.org_uid).to.equal('test-org-uid'); - expect(exportMarketplaceApps.query).to.deep.equal({ target_uids: 'test-stack-uid' }); + expect(exportMarketplaceApps.query).to.deep.equal({ target_uids: 'API_KEY' }); expect(exportMarketplaceApps.appSdk).to.equal(mockAppSdk); setupPathsStub.restore(); @@ -237,7 +236,7 @@ describe('ExportMarketplaceApps', () => { ); exportMarketplaceApps.exportConfig.org_uid = 'test-org-uid'; exportMarketplaceApps.developerHubBaseUrl = 'https://developer-api.contentstack.io'; - exportMarketplaceApps.query = { target_uids: 'test-stack-uid' }; + exportMarketplaceApps.query = { target_uids: 'API_KEY' }; exportMarketplaceApps.appSdk = mockAppSdk; await (FsUtility.prototype.makeDirectory as sinon.SinonStub)(exportMarketplaceApps.marketplaceAppPath); }); @@ -332,7 +331,7 @@ describe('ExportMarketplaceApps', () => { ); exportMarketplaceApps.exportConfig.org_uid = 'test-org-uid'; exportMarketplaceApps.developerHubBaseUrl = 'https://developer-api.contentstack.io'; - exportMarketplaceApps.query = { target_uids: 'test-stack-uid' }; + exportMarketplaceApps.query = { target_uids: 'API_KEY' }; exportMarketplaceApps.appSdk = mockAppSdk; await (FsUtility.prototype.makeDirectory as sinon.SinonStub)(exportMarketplaceApps.marketplaceAppPath); }); @@ -368,7 +367,7 @@ describe('ExportMarketplaceApps', () => { describe('exportApps() method', () => { beforeEach(() => { exportMarketplaceApps.appSdk = mockAppSdk; - exportMarketplaceApps.query = { target_uids: 'test-stack-uid' }; + exportMarketplaceApps.query = { target_uids: 'API_KEY' }; exportMarketplaceApps.exportConfig.org_uid = 'test-org-uid'; }); @@ -474,7 +473,7 @@ describe('ExportMarketplaceApps', () => { beforeEach(() => { exportMarketplaceApps.appSdk = mockAppSdk; exportMarketplaceApps.exportConfig.org_uid = 'test-org-uid'; - exportMarketplaceApps.query = { target_uids: 'test-stack-uid' }; + exportMarketplaceApps.query = { target_uids: 'API_KEY' }; }); it('should fetch and process stack-specific apps', async () => { diff --git a/packages/contentstack-export/test/unit/utils/common-helper.test.ts b/packages/contentstack-export/test/unit/utils/common-helper.test.ts index 574927cb1..addbd230f 100644 --- a/packages/contentstack-export/test/unit/utils/common-helper.test.ts +++ b/packages/contentstack-export/test/unit/utils/common-helper.test.ts @@ -109,14 +109,13 @@ describe('Common Helper Utils', () => { errorMessage: 'Main error', errors: { authorization: 'Invalid token', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'Invalid key' + api_key: 'API_KEY' } }; const result = formatError(error); expect(result).to.include('Main error'); expect(result).to.include('Management Token Invalid token'); - expect(result).to.include('Stack API key Invalid key'); + expect(result).to.include('Stack API key API_KEY'); }); it('should map entity names correctly', () => { diff --git a/packages/contentstack-export/test/unit/utils/export-config-handler.test.ts b/packages/contentstack-export/test/unit/utils/export-config-handler.test.ts index 87bee9057..c856168c3 100644 --- a/packages/contentstack-export/test/unit/utils/export-config-handler.test.ts +++ b/packages/contentstack-export/test/unit/utils/export-config-handler.test.ts @@ -206,8 +206,7 @@ describe('Export Config Handler', () => { it('should support alias flag as alternative to management-token-alias', async () => { configHandlerGetStub.withArgs('tokens.test-alias').returns({ token: 'test-token', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-key' + apiKey: 'API_KEY' }); const flags = { @@ -217,7 +216,7 @@ describe('Export Config Handler', () => { const config = await setupConfig(flags); expect(config.management_token).to.equal('test-token'); - expect(config.apiKey).to.equal('test-key'); + expect(config.apiKey).to.equal('API_KEY'); }); }); @@ -402,7 +401,7 @@ describe('Export Config Handler', () => { const flags = { data: '/test/data', - 'stack-api-key': 'test-key', + 'stack-api-key': 'API_KEY', 'branch-alias': 'main-branch', }; const config = await setupConfig(flags); @@ -417,7 +416,7 @@ describe('Export Config Handler', () => { const flags = { data: '/test/data', - 'stack-api-key': 'test-key', + 'stack-api-key': 'API_KEY', branch: 'feature-branch', }; const config = await setupConfig(flags); @@ -432,7 +431,7 @@ describe('Export Config Handler', () => { const flags = { data: '/test/data', - 'stack-api-key': 'test-key', + 'stack-api-key': 'API_KEY', module: 'assets', }; const config = await setupConfig(flags); @@ -448,7 +447,7 @@ describe('Export Config Handler', () => { const flags = { data: '/test/data', - 'stack-api-key': 'test-key', + 'stack-api-key': 'API_KEY', 'secured-assets': true, }; const config = await setupConfig(flags); @@ -463,7 +462,7 @@ describe('Export Config Handler', () => { const flags = { data: '/test/data', - 'stack-api-key': 'test-key', + 'stack-api-key': 'API_KEY', 'content-types': ['ct-1', 'ct-2'], }; const config = await setupConfig(flags); @@ -478,7 +477,7 @@ describe('Export Config Handler', () => { const flags = { data: '/test/data', - 'stack-api-key': 'test-key', + 'stack-api-key': 'API_KEY', 'content-types': [] as string[], }; const config = await setupConfig(flags); @@ -496,7 +495,7 @@ describe('Export Config Handler', () => { const queryObj = { content_type_uid: 'blog' }; const flags = { data: '/test/data', - 'stack-api-key': 'test-key', + 'stack-api-key': 'API_KEY', query: JSON.stringify(queryObj), }; const config = await setupConfig(flags); @@ -515,7 +514,7 @@ describe('Export Config Handler', () => { const flags = { data: '/test/data', - 'stack-api-key': 'test-key', + 'stack-api-key': 'API_KEY', query: '/path/to/query.json', }; const config = await setupConfig(flags); @@ -534,7 +533,7 @@ describe('Export Config Handler', () => { const flags = { data: '/test/data', - 'stack-api-key': 'test-key', + 'stack-api-key': 'API_KEY', query: '/path/to/query', }; const config = await setupConfig(flags); @@ -550,7 +549,7 @@ describe('Export Config Handler', () => { const flags = { data: '/test/data', - 'stack-api-key': 'test-key', + 'stack-api-key': 'API_KEY', query: 'invalid json {', }; @@ -575,7 +574,7 @@ describe('Export Config Handler', () => { const flags = { data: '/test/data', - 'stack-api-key': 'test-key', + 'stack-api-key': 'API_KEY', config: '/path/to/config.json', }; const config = await setupConfig(flags); @@ -596,7 +595,7 @@ describe('Export Config Handler', () => { const flags = { data: '/test/data', - 'stack-api-key': 'test-key', + 'stack-api-key': 'API_KEY', }; const config = await setupConfig(flags); diff --git a/packages/contentstack-export/test/unit/utils/interactive.test.ts b/packages/contentstack-export/test/unit/utils/interactive.test.ts index 8e81288a8..e7a124e4a 100644 --- a/packages/contentstack-export/test/unit/utils/interactive.test.ts +++ b/packages/contentstack-export/test/unit/utils/interactive.test.ts @@ -247,8 +247,7 @@ describe('Interactive Utils', () => { describe('askAPIKey', () => { it('should prompt for stack API key', async () => { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - const mockAPIKey = 'blt1234567890abcdef'; + const mockAPIKey = 'API_KEY'; inquireStub.resolves(mockAPIKey); const result = await askAPIKey(); diff --git a/packages/contentstack-export/test/unit/utils/marketplace-app-helper.test.ts b/packages/contentstack-export/test/unit/utils/marketplace-app-helper.test.ts index 3b8ecfddd..60a8a28de 100644 --- a/packages/contentstack-export/test/unit/utils/marketplace-app-helper.test.ts +++ b/packages/contentstack-export/test/unit/utils/marketplace-app-helper.test.ts @@ -15,8 +15,7 @@ describe('Marketplace App Helper Utils', () => { versioning: false, host: 'https://api.contentstack.io', developerHubUrls: {}, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-stack-uid', + apiKey: 'API_KEY', exportDir: '/test/export', data: '/test/data', branchName: '', @@ -48,7 +47,7 @@ describe('Marketplace App Helper Utils', () => { fetchConcurrency: 5, writeConcurrency: 5, developerHubBaseUrl: '', - marketplaceAppEncryptionKey: 'test-encryption-key', + marketplaceAppEncryptionKey: 'YOUR_SECRET_HERE', modules: { types: ['marketplace-apps'], marketplace_apps: { @@ -117,14 +116,13 @@ describe('Marketplace App Helper Utils', () => { expect(managementSDKClientSpy.calledOnce).to.be.true; expect(mockStack.calledOnce).to.be.true; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - expect(mockStack.firstCall.args[0]).to.deep.equal({ api_key: 'test-stack-uid' }); + expect(mockStack.firstCall.args[0]).to.deep.equal({ api_key: 'API_KEY' }); expect(mockFetch.calledOnce).to.be.true; expect(result).to.equal('test-org-uid-123'); }); it('should use apiKey from config as api_key', async () => { - mockExportConfig.apiKey = 'custom-stack-key'; + mockExportConfig.apiKey = 'changeme'; const mockStackData = { org_uid: 'org-123' }; const mockFetch = sandbox.stub().resolves(mockStackData); @@ -135,8 +133,7 @@ describe('Marketplace App Helper Utils', () => { await getOrgUid(mockExportConfig); - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - expect(mockStack.firstCall.args[0]).to.deep.equal({ api_key: 'custom-stack-key' }); + expect(mockStack.firstCall.args[0]).to.deep.equal({ api_key: 'changeme' }); }); it('should handle API errors gracefully', async () => { @@ -307,7 +304,7 @@ describe('Marketplace App Helper Utils', () => { it('should create NodeCrypto instance with correct arguments', async () => { mockExportConfig.forceStopMarketplaceAppsPrompt = true; - mockExportConfig.marketplaceAppEncryptionKey = 'test-encryption-key'; + mockExportConfig.marketplaceAppEncryptionKey = 'YOUR_SECRET_HERE'; let capturedArgs: any; const nodeCryptoConstructorSpy = sandbox.spy((args: any) => { @@ -319,8 +316,7 @@ describe('Marketplace App Helper Utils', () => { await createNodeCryptoInstance(mockExportConfig); expect(nodeCryptoConstructorSpy.calledOnce).to.be.true; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - expect(capturedArgs).to.deep.equal({ encryptionKey: 'test-encryption-key' }); + expect(capturedArgs).to.deep.equal({ encryptionKey: 'YOUR_SECRET_HERE' }); }); it('should handle empty marketplaceAppEncryptionKey in config', async () => { diff --git a/packages/contentstack-import-setup/test/unit/common-helper.test.ts b/packages/contentstack-import-setup/test/unit/common-helper.test.ts index 0878ed5ff..73064bd04 100644 --- a/packages/contentstack-import-setup/test/unit/common-helper.test.ts +++ b/packages/contentstack-import-setup/test/unit/common-helper.test.ts @@ -44,8 +44,7 @@ describe('Common Helper Utilities', () => { describe('askAPIKey', () => { it('should prompt user for API key and return the response', async () => { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - const mockApiKey = 'test-api-key-12345'; + const mockApiKey = 'API_KEY'; cliuxInquireStub = stub(cliux, 'inquire').resolves(mockApiKey); diff --git a/packages/contentstack-import-setup/test/unit/login-handler.test.ts b/packages/contentstack-import-setup/test/unit/login-handler.test.ts index 3ecb14055..fc72c3c01 100644 --- a/packages/contentstack-import-setup/test/unit/login-handler.test.ts +++ b/packages/contentstack-import-setup/test/unit/login-handler.test.ts @@ -410,8 +410,7 @@ describe('Login Handler', () => { password: 'testpassword', apiKey: 'test-api-key', source_stack: 'test-api-key', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - access_token: 'test-access-token', + access_token: 'ACCESS_TOKEN', authtoken: 'test-auth-token', contentDir: '/test/content', data: '/test/content', diff --git a/packages/contentstack-import/test/unit/commands/cm/stacks/import.test.ts b/packages/contentstack-import/test/unit/commands/cm/stacks/import.test.ts index 1bed8fe6b..3cba48ed4 100644 --- a/packages/contentstack-import/test/unit/commands/cm/stacks/import.test.ts +++ b/packages/contentstack-import/test/unit/commands/cm/stacks/import.test.ts @@ -68,8 +68,7 @@ describe('ImportCommand', () => { forceStopMarketplaceAppsPrompt: false, skipPrivateAppRecreationIfExist: true, isAuthenticated: true, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - auth_token: 'auth-token', + auth_token: 'dummy', selectedModules: ['entries'], skipAudit: false, 'exclude-global-modules': false, diff --git a/packages/contentstack-import/test/unit/import/modules/assets.test.ts b/packages/contentstack-import/test/unit/import/modules/assets.test.ts index 160e8155d..9785118f9 100644 --- a/packages/contentstack-import/test/unit/import/modules/assets.test.ts +++ b/packages/contentstack-import/test/unit/import/modules/assets.test.ts @@ -70,8 +70,7 @@ describe('ImportAssets', () => { forceStopMarketplaceAppsPrompt: false, skipPrivateAppRecreationIfExist: true, isAuthenticated: true, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - auth_token: 'auth-token', + auth_token: 'dummy', selectedModules: ['assets'], skipAudit: false, skipAssetsPublish: false, diff --git a/packages/contentstack-import/test/unit/import/modules/base-class.test.ts b/packages/contentstack-import/test/unit/import/modules/base-class.test.ts index 2aaa01d74..bd8e3579a 100644 --- a/packages/contentstack-import/test/unit/import/modules/base-class.test.ts +++ b/packages/contentstack-import/test/unit/import/modules/base-class.test.ts @@ -132,8 +132,7 @@ describe('BaseClass', () => { forceStopMarketplaceAppsPrompt: false, skipPrivateAppRecreationIfExist: true, isAuthenticated: true, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - auth_token: 'auth-token', + auth_token: 'dummy', selectedModules: ['assets'], skipAudit: false, 'exclude-global-modules': false, diff --git a/packages/contentstack-import/test/unit/import/modules/content-types.test.ts b/packages/contentstack-import/test/unit/import/modules/content-types.test.ts index 89cb50d8d..c4121cfec 100644 --- a/packages/contentstack-import/test/unit/import/modules/content-types.test.ts +++ b/packages/contentstack-import/test/unit/import/modules/content-types.test.ts @@ -169,8 +169,7 @@ describe('ImportContentTypes', () => { forceStopMarketplaceAppsPrompt: false, skipPrivateAppRecreationIfExist: true, isAuthenticated: true, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - auth_token: 'auth-token', + auth_token: 'dummy', selectedModules: ['content-types'], skipAudit: false, preserveStackVersion: false, diff --git a/packages/contentstack-import/test/unit/import/modules/entries.test.ts b/packages/contentstack-import/test/unit/import/modules/entries.test.ts index bf8800a5e..30c065a20 100644 --- a/packages/contentstack-import/test/unit/import/modules/entries.test.ts +++ b/packages/contentstack-import/test/unit/import/modules/entries.test.ts @@ -139,8 +139,7 @@ describe('EntriesImport', () => { forceStopMarketplaceAppsPrompt: false, skipPrivateAppRecreationIfExist: true, isAuthenticated: true, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - auth_token: 'auth-token', + auth_token: 'dummy', selectedModules: ['entries'], skipAudit: false, skipEntriesPublish: false, diff --git a/packages/contentstack-import/test/unit/import/modules/global-fields.test.ts b/packages/contentstack-import/test/unit/import/modules/global-fields.test.ts index e2dd92f95..1ffb23dbe 100644 --- a/packages/contentstack-import/test/unit/import/modules/global-fields.test.ts +++ b/packages/contentstack-import/test/unit/import/modules/global-fields.test.ts @@ -79,8 +79,7 @@ describe('ImportGlobalFields', () => { forceStopMarketplaceAppsPrompt: false, skipPrivateAppRecreationIfExist: true, isAuthenticated: true, - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - auth_token: 'auth-token', + auth_token: 'dummy', selectedModules: ['global-fields'], skipAudit: false, preserveStackVersion: false, diff --git a/packages/contentstack-import/test/unit/import/modules/index.test.ts b/packages/contentstack-import/test/unit/import/modules/index.test.ts index 73494f4f5..6c5a6bf96 100644 --- a/packages/contentstack-import/test/unit/import/modules/index.test.ts +++ b/packages/contentstack-import/test/unit/import/modules/index.test.ts @@ -15,8 +15,7 @@ describe('Module Index - startModuleImport', () => { it('should import a module successfully', async () => { const mockStackAPIClient = { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'test-key', + api_key: 'API_KEY', name: 'test-stack' } as any; @@ -45,8 +44,7 @@ describe('Module Index - startModuleImport', () => { it('should handle module import errors', async () => { const mockStackAPIClient = { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'test-key', + api_key: 'API_KEY', name: 'test-stack' } as any; @@ -71,8 +69,7 @@ describe('Module Index - startModuleImport', () => { it('should handle different module names', async () => { const mockStackAPIClient = { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'test-key', + api_key: 'API_KEY', name: 'test-stack' } as any; @@ -100,8 +97,7 @@ describe('Module Index - startModuleImport', () => { it('should handle stack module', async () => { const mockStackAPIClient = { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'test-key', + api_key: 'API_KEY', name: 'test-stack' } as any; @@ -140,8 +136,7 @@ describe('Module Index - startModuleImport', () => { sinon.replace(fs, 'existsSync', existsSyncStub); const mockStackAPIClient = { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'test-key', + api_key: 'API_KEY', name: 'test-stack', asset: sandbox.stub().returns({ create: sandbox.stub().resolves({ uid: 'asset-123' }), diff --git a/packages/contentstack-import/test/unit/import/modules/marketplace-apps.test.ts b/packages/contentstack-import/test/unit/import/modules/marketplace-apps.test.ts index d5e68d23a..7b1e90959 100644 --- a/packages/contentstack-import/test/unit/import/modules/marketplace-apps.test.ts +++ b/packages/contentstack-import/test/unit/import/modules/marketplace-apps.test.ts @@ -131,7 +131,7 @@ describe('ImportMarketplaceApps', () => { fileName: 'marketplace_apps.json', }, } as any, - marketplaceAppEncryptionKey: 'test-encryption-key', + marketplaceAppEncryptionKey: 'changeme', forceStopMarketplaceAppsPrompt: false, getEncryptionKeyMaxRetry: 3, } as any; @@ -295,9 +295,9 @@ describe('ImportMarketplaceApps', () => { it('should use provided encryption key when no app config requires encryption', async () => { fsUtilStub.readFile.returns(mockData.mockMarketplaceApps); - const result = await importMarketplaceApps.getAndValidateEncryptionKey('test-key'); + const result = await importMarketplaceApps.getAndValidateEncryptionKey('YOUR_SECRET_HERE'); - expect(result).to.equal('test-key'); + expect(result).to.equal('YOUR_SECRET_HERE'); }); it('should ask for encryption key and validate successfully', async () => { @@ -312,7 +312,7 @@ describe('ImportMarketplaceApps', () => { ]; (importMarketplaceApps as any).marketplaceApps = mockAppsWithConfig; - const result = await importMarketplaceApps.getAndValidateEncryptionKey('test-key'); + const result = await importMarketplaceApps.getAndValidateEncryptionKey('YOUR_SECRET_HERE'); expect(interactiveStub.askEncryptionKey.calledOnce).to.be.true; expect(result).to.equal('user-provided-key'); @@ -338,7 +338,7 @@ describe('ImportMarketplaceApps', () => { nodeCryptoStub.decrypt.onFirstCall().throws(decryptError); nodeCryptoStub.decrypt.onSecondCall().returns('decrypted-data'); - const result = await importMarketplaceApps.getAndValidateEncryptionKey('test-key'); + const result = await importMarketplaceApps.getAndValidateEncryptionKey('YOUR_SECRET_HERE'); expect(interactiveStub.askEncryptionKey.calledTwice).to.be.true; expect(result).to.equal('second-key'); @@ -360,7 +360,7 @@ describe('ImportMarketplaceApps', () => { ]; (importMarketplaceApps as any).marketplaceApps = mockAppsWithConfig; - await importMarketplaceApps.getAndValidateEncryptionKey('test-key'); + await importMarketplaceApps.getAndValidateEncryptionKey('YOUR_SECRET_HERE'); expect(exitStub.calledOnce).to.be.true; }); @@ -576,8 +576,7 @@ describe('ImportMarketplaceApps', () => { // Set up required properties (importMarketplaceApps as any).appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - (importMarketplaceApps as any).nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + (importMarketplaceApps as any).nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); // Set up installedApps so the app is found as existing (importMarketplaceApps as any).installedApps = [app]; @@ -619,8 +618,7 @@ describe('ImportMarketplaceApps', () => { beforeEach(() => { importMarketplaceApps = new ImportMarketplaceApps(mockModuleClassParams); importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); }); it('should update app configuration successfully', async () => { @@ -741,8 +739,7 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with empty configuration', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const app = { uid: 'test-uid', @@ -763,8 +760,7 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with configuration error', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const app = { uid: 'test-uid', @@ -794,8 +790,7 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with server configuration error', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const app = { uid: 'test-uid', @@ -981,8 +976,7 @@ describe('ImportMarketplaceApps', () => { it('should handle installApps with existing app and configuration', async () => { importMarketplaceApps.appSdk = mockAppSdk; // Set up nodeCrypto for decryption - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); // Set installedApps directly on the instance (importMarketplaceApps as any).installedApps = mockData.mockInstalledApps; @@ -1016,8 +1010,7 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with successful configuration update', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const app = { uid: 'test-uid', @@ -1047,8 +1040,7 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with configuration update error', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const app = { uid: 'test-uid', @@ -1082,8 +1074,7 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with successful server configuration update', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const app = { uid: 'test-uid', @@ -1113,8 +1104,7 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with server configuration update error', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const app = { uid: 'test-uid', @@ -1149,8 +1139,7 @@ describe('ImportMarketplaceApps', () => { it('should handle installApps with existing app and UID mapping already set', async () => { importMarketplaceApps.appSdk = mockAppSdk; // Set up nodeCrypto for decryption - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); // Set installedApps directly on the instance (importMarketplaceApps as any).installedApps = mockData.mockInstalledApps; @@ -1167,8 +1156,7 @@ describe('ImportMarketplaceApps', () => { it('should handle installApps with updateParam and configuration', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); // Set installedApps directly on the instance (importMarketplaceApps as any).installedApps = mockData.mockInstalledApps; @@ -1192,8 +1180,7 @@ describe('ImportMarketplaceApps', () => { it('should handle installApps with updateParam but no configuration', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); // Set installedApps directly on the instance (importMarketplaceApps as any).installedApps = mockData.mockInstalledApps; @@ -1223,7 +1210,7 @@ describe('ImportMarketplaceApps', () => { nodeCryptoStub.decrypt.throws(new Error('Some other error')); const exitStub = sandbox.stub(process, 'exit'); - await importMarketplaceApps.getAndValidateEncryptionKey('test-key'); + await importMarketplaceApps.getAndValidateEncryptionKey('YOUR_SECRET_HERE'); expect(exitStub.calledOnce).to.be.true; }); @@ -1267,8 +1254,7 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with configuration success path', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const app = { uid: 'test-uid', @@ -1298,8 +1284,7 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with server configuration success path', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const app = { uid: 'test-uid', @@ -1329,8 +1314,7 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with configuration error path', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const app = { uid: 'test-uid', @@ -1364,8 +1348,7 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with server configuration error path', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const app = { uid: 'test-uid', @@ -1399,8 +1382,7 @@ describe('ImportMarketplaceApps', () => { it('should handle installApps with existing app and configuration - specific branch coverage', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const existingApp = { ...mockData.mockInstalledApps[0], @@ -1447,8 +1429,7 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with configuration success - specific success path', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const app = { uid: 'test-uid', @@ -1477,8 +1458,7 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with server configuration success - specific success path', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const app = { uid: 'test-uid', @@ -1507,8 +1487,7 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with configuration error - specific error path', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const app = { uid: 'test-uid', @@ -1541,8 +1520,7 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with server configuration error - specific error path', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const app = { uid: 'test-uid', @@ -1575,8 +1553,7 @@ describe('ImportMarketplaceApps', () => { it('should handle installApps with existing app that has configuration - exact branch coverage', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); // First, we need to populate installedApps by calling start() or setting it directly // Let's set it directly to ensure we have the right data @@ -1610,8 +1587,7 @@ describe('ImportMarketplaceApps', () => { it('should handle installApps with installation failure - specific error branch coverage', async () => { importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); const app = { ...mockData.mockMarketplaceApps[0], @@ -1973,8 +1949,7 @@ describe('ImportMarketplaceApps', () => { }); it('should use provided encryption key', async () => { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - const encryptionKey = 'test-encryption-key'; + const encryptionKey = 'changeme'; await importMarketplaceApps.getAndValidateEncryptionKey(encryptionKey); @@ -2006,8 +1981,7 @@ describe('ImportMarketplaceApps', () => { describe('updateAppsConfig()', () => { beforeEach(() => { importMarketplaceApps = new ImportMarketplaceApps(mockModuleClassParams); - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); }); it('should update app configuration successfully', async () => { @@ -2265,8 +2239,7 @@ describe('ImportMarketplaceApps', () => { beforeEach(() => { importMarketplaceApps = new ImportMarketplaceApps(mockModuleClassParams); importMarketplaceApps.appSdk = mockAppSdk; - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); }); it('should handle updateAppsConfig with configuration success - uncovered success path', async () => { diff --git a/packages/contentstack-import/test/unit/utils/common-helper.test.ts b/packages/contentstack-import/test/unit/utils/common-helper.test.ts index 75cd2556d..a57596ef5 100644 --- a/packages/contentstack-import/test/unit/utils/common-helper.test.ts +++ b/packages/contentstack-import/test/unit/utils/common-helper.test.ts @@ -1280,11 +1280,9 @@ describe('Common Helper', () => { message: 'Base error', errors: { authorization: 'Invalid token', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'Invalid key', + api_key: 'API_KEY', uid: 'Invalid UID', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - access_token: 'Invalid access token', + access_token: 'ACCESS_TOKEN', }, }; @@ -1292,9 +1290,9 @@ describe('Common Helper', () => { expect(result).to.include('Base error'); expect(result).to.include('Management Token Invalid token'); - expect(result).to.include('Stack API key Invalid key'); + expect(result).to.include('Stack API key API_KEY'); expect(result).to.include('Content Type Invalid UID'); - expect(result).to.include('Delivery Token Invalid access token'); + expect(result).to.include('Delivery Token ACCESS_TOKEN'); }); it('should return error itself when parsing fails', () => { diff --git a/packages/contentstack-import/test/unit/utils/interactive.test.ts b/packages/contentstack-import/test/unit/utils/interactive.test.ts index 6e9c1dca8..3c7808f70 100644 --- a/packages/contentstack-import/test/unit/utils/interactive.test.ts +++ b/packages/contentstack-import/test/unit/utils/interactive.test.ts @@ -83,8 +83,7 @@ describe('Interactive Utils', () => { describe('askAPIKey', () => { it('should return API key from user input', async () => { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - const apiKey = 'test-api-key-123'; + const apiKey = 'API_KEY'; cliuxInquireStub.resolves(apiKey); const result = await askAPIKey(); diff --git a/packages/contentstack-import/test/unit/utils/login-handler.test.ts b/packages/contentstack-import/test/unit/utils/login-handler.test.ts index 72ce5a7dd..7d5980df0 100644 --- a/packages/contentstack-import/test/unit/utils/login-handler.test.ts +++ b/packages/contentstack-import/test/unit/utils/login-handler.test.ts @@ -46,8 +46,7 @@ describe('Login Handler', () => { // deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret password: 'testpassword', source_stack: 'test-api-key', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - access_token: 'test-access-token', + access_token: 'ACCESS_TOKEN', authtoken: 'test-auth-token', apiKey: 'test-api-key', contentDir: '/test/content', @@ -67,7 +66,7 @@ describe('Login Handler', () => { expect(result).to.equal(config); expect(config.headers).to.exist; expect(config.headers!.api_key).to.equal('test-api-key'); - expect(config.headers!.access_token).to.equal('test-access-token'); + expect(config.headers!.access_token).to.equal('ACCESS_TOKEN'); expect(config.headers!.authtoken).to.equal('test-auth-token'); expect(config.headers!['X-User-Agent']).to.equal('contentstack-export/v'); expect(mockClient.login.calledOnce).to.be.true; @@ -420,8 +419,7 @@ describe('Login Handler', () => { // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret apiKey: 'test-api-key', source_stack: 'test-api-key', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - access_token: 'test-access-token', + access_token: 'ACCESS_TOKEN', authtoken: 'test-auth-token', contentDir: '/test/content', data: '/test/content', diff --git a/packages/contentstack-import/test/unit/utils/marketplace-app-helper.test.ts b/packages/contentstack-import/test/unit/utils/marketplace-app-helper.test.ts index d3da20892..c7c9ee69a 100644 --- a/packages/contentstack-import/test/unit/utils/marketplace-app-helper.test.ts +++ b/packages/contentstack-import/test/unit/utils/marketplace-app-helper.test.ts @@ -34,8 +34,7 @@ describe('Marketplace App Helper', () => { mockConfig = { org_uid: 'test-org-uid', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'test-stack-uid', + apiKey: 'API_KEY', host: 'https://api.contentstack.io', developerHubBaseUrl: 'https://developerhub-api.contentstack.com', forceStopMarketplaceAppsPrompt: false, @@ -148,11 +147,11 @@ describe('Marketplace App Helper', () => { expect(result).to.have.lengthOf(2); expect(mockFetchAll.calledTwice).to.be.true; expect(mockFetchAll.firstCall.args[0]).to.deep.equal({ - target_uids: 'test-stack-uid', + target_uids: 'API_KEY', skip: 0, }); expect(mockFetchAll.secondCall.args[0]).to.deep.equal({ - target_uids: 'test-stack-uid', + target_uids: 'API_KEY', skip: 50, }); }); @@ -231,7 +230,6 @@ describe('Marketplace App Helper', () => { const result = await getOrgUid(mockConfig); expect(result).to.equal('test-org-123'); - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret expect(mockClient.stack.calledWith({ api_key: mockConfig.apiKey })).to.be.true; }); diff --git a/packages/contentstack-migrate-rte/test/commands/json-migration.test.js b/packages/contentstack-migrate-rte/test/commands/json-migration.test.js index a1f2bbbb4..527fa3419 100644 --- a/packages/contentstack-migrate-rte/test/commands/json-migration.test.js +++ b/packages/contentstack-migrate-rte/test/commands/json-migration.test.js @@ -143,8 +143,7 @@ describe("Migration Config validation", () => { getTokenCallback.withArgs("test1").returns({ token: "testManagementToken", - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: "testApiKey", + apiKey: "API_KEY", type: "management", }); @@ -443,8 +442,7 @@ describe("Content Type with Single RTE Field of Single Type", function () { const getTokenCallback = sinon.stub(); getTokenCallback.withArgs("test1").returns({ token: "testManagementToken", - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: "testApiKey", + apiKey: "API_KEY", type: "management", }); @@ -938,8 +936,7 @@ describe("Global Field Migration", () => { const getTokenCallback = sinon.stub(); getTokenCallback.withArgs("test1").returns({ token: "testManagementToken", - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: "testApiKey", + apiKey: "API_KEY", type: "management", }); @@ -1111,8 +1108,7 @@ describe("Content Type with single rte of multiple type", () => { const getTokenCallback = sinon.stub(); getTokenCallback.withArgs("test1").returns({ token: "testManagementToken", - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: "testApiKey", + apiKey: "API_KEY", type: "management", }); @@ -1143,8 +1139,7 @@ describe("Content Type with Single RTE inside modular block", () => { const getTokenCallback = sinon.stub(); getTokenCallback.withArgs("test1").returns({ token: "testManagementToken", - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: "testApiKey", + apiKey: "API_KEY", type: "management", }); @@ -1183,8 +1178,7 @@ describe("Content Type with Single RTE of type multiple inside group", () => { const getTokenCallback = sinon.stub(); getTokenCallback.withArgs("test1").returns({ token: "testManagementToken", - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: "testApiKey", + apiKey: "API_KEY", type: "management", }); @@ -1223,8 +1217,7 @@ describe("Content Type with Single RTE inside group of type multiple", () => { const getTokenCallback = sinon.stub(); getTokenCallback.withArgs("test1").returns({ token: "testManagementToken", - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: "testApiKey", + apiKey: "API_KEY", type: "management", }); @@ -1263,8 +1256,7 @@ describe("Content Type with multiple file field", () => { const getTokenCallback = sinon.stub(); getTokenCallback.withArgs("test1").returns({ token: "testManagementToken", - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: "testApiKey", + apiKey: "API_KEY", type: "management", }); diff --git a/packages/contentstack-migrate-rte/test/utils/index.js b/packages/contentstack-migrate-rte/test/utils/index.js index 96635fd78..17fc2ce0f 100644 --- a/packages/contentstack-migrate-rte/test/utils/index.js +++ b/packages/contentstack-migrate-rte/test/utils/index.js @@ -6,8 +6,7 @@ const globalFieldResponse = require('../dummy/globalFieldResponse.json') const dummyToken = { test1: { token: 'testManagementToken', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'testApiKey', + apiKey: 'API_KEY', type: 'management', }, } diff --git a/packages/contentstack-query-export/test/unit/common-helper.test.ts b/packages/contentstack-query-export/test/unit/common-helper.test.ts index 927b62ad7..1ebc093a1 100644 --- a/packages/contentstack-query-export/test/unit/common-helper.test.ts +++ b/packages/contentstack-query-export/test/unit/common-helper.test.ts @@ -16,8 +16,7 @@ describe('Common Helper Utilities', () => { describe('askAPIKey', () => { it('should prompt user for API key and return the response', async () => { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - const mockApiKey = 'test-api-key-12345'; + const mockApiKey = 'API_KEY'; cliuxInquireStub = stub(cliux, 'inquire').resolves(mockApiKey); diff --git a/packages/contentstack-seed/test/commands/cm/stacks/seed.test.ts b/packages/contentstack-seed/test/commands/cm/stacks/seed.test.ts index cae0899d6..f3a3ac8d8 100644 --- a/packages/contentstack-seed/test/commands/cm/stacks/seed.test.ts +++ b/packages/contentstack-seed/test/commands/cm/stacks/seed.test.ts @@ -76,8 +76,7 @@ describe('SeedCommand', () => { flags, } as any); - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - mockSeeder.run.mockResolvedValue({ api_key: 'api-key-123' }); + mockSeeder.run.mockResolvedValue({ api_key: 'API_KEY' }); await command.run(); @@ -100,7 +99,7 @@ describe('SeedCommand', () => { const flags = { repo: 'user/repo', org: undefined, - 'stack-api-key': 'api-key-123', + 'stack-api-key': 'API_KEY', 'stack-name': undefined, yes: undefined, alias: undefined, @@ -110,14 +109,13 @@ describe('SeedCommand', () => { flags, } as any); - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - mockSeeder.run.mockResolvedValue({ api_key: 'api-key-123' }); + mockSeeder.run.mockResolvedValue({ api_key: 'API_KEY' }); await command.run(); expect(ContentModelSeeder).toHaveBeenCalledWith( expect.objectContaining({ - stackUid: 'api-key-123', + stackUid: 'API_KEY', orgUid: undefined, stackName: undefined, }), @@ -137,8 +135,7 @@ describe('SeedCommand', () => { const mockTokens = { 'my-alias': { token: 'management-token-123', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - apiKey: 'api-key-123', + apiKey: 'API_KEY', }, }; @@ -148,8 +145,7 @@ describe('SeedCommand', () => { flags, } as any); - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - mockSeeder.run.mockResolvedValue({ api_key: 'api-key-123' }); + mockSeeder.run.mockResolvedValue({ api_key: 'API_KEY' }); await command.run(); @@ -157,7 +153,7 @@ describe('SeedCommand', () => { expect.objectContaining({ alias: 'my-alias', managementToken: 'management-token-123', - stackUid: 'api-key-123', + stackUid: 'API_KEY', }), ); }); @@ -234,8 +230,7 @@ describe('SeedCommand', () => { flags, } as any); - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - mockSeeder.run.mockResolvedValue({ api_key: 'api-key-123' }); + mockSeeder.run.mockResolvedValue({ api_key: 'API_KEY' }); await command.run(); @@ -260,8 +255,7 @@ describe('SeedCommand', () => { flags, } as any); - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - mockSeeder.run.mockResolvedValue({ api_key: 'api-key-123' }); + mockSeeder.run.mockResolvedValue({ api_key: 'API_KEY' }); await command.run(); @@ -293,8 +287,7 @@ describe('SeedCommand', () => { flags, } as any); - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - const expectedResult = { api_key: 'api-key-123' }; + const expectedResult = { api_key: 'API_KEY' }; mockSeeder.run.mockResolvedValue(expectedResult); const result = await command.run(); @@ -316,8 +309,7 @@ describe('SeedCommand', () => { flags, } as any); - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - mockSeeder.run.mockResolvedValue({ api_key: 'api-key-123' }); + mockSeeder.run.mockResolvedValue({ api_key: 'API_KEY' }); await command.run(); diff --git a/packages/contentstack-seed/test/seed/contentstack/client.test.ts b/packages/contentstack-seed/test/seed/contentstack/client.test.ts index 98369c86e..dcbbfe85d 100644 --- a/packages/contentstack-seed/test/seed/contentstack/client.test.ts +++ b/packages/contentstack-seed/test/seed/contentstack/client.test.ts @@ -206,13 +206,12 @@ describe('ContentstackClient', () => { describe('getStack', () => { it('should fetch stack by UID', async () => { - const stackUid = 'stack-123'; + const stackUid = 'STACK_API_KEY'; const mockStack = { - uid: 'stack-123', + uid: 'STACK_API_KEY', name: 'Test Stack', master_locale: 'en-us', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'api-key-123', + api_key: 'API_KEY', org_uid: 'org-123', }; @@ -224,20 +223,18 @@ describe('ContentstackClient', () => { const result = await contentstackClient.getStack(stackUid); - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret expect(mockClient.stack).toHaveBeenCalledWith({ api_key: stackUid }); expect(result).toEqual({ - uid: 'stack-123', + uid: 'STACK_API_KEY', name: 'Test Stack', master_locale: 'en-us', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'api-key-123', + api_key: 'API_KEY', org_uid: 'org-123', }); }); it('should throw ContentstackError on failure', async () => { - const stackUid = 'stack-123'; + const stackUid = 'STACK_API_KEY'; const mockError = { errorMessage: 'Stack not found', status: 404, @@ -261,16 +258,14 @@ describe('ContentstackClient', () => { uid: 'stack-1', name: 'Stack 1', master_locale: 'en-us', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'api-key-1', + api_key: 'changeme', org_uid: orgUid, }, { uid: 'stack-2', name: 'Stack 2', master_locale: 'en-us', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'api-key-2', + api_key: 'dummy', org_uid: orgUid, }, ]; @@ -367,8 +362,7 @@ describe('ContentstackClient', () => { describe('getContentTypeCount', () => { it('should get content type count for a stack', async () => { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - const apiKey = 'api-key-123'; + const apiKey = 'API_KEY'; const mockResponse = { count: 5, }; @@ -389,15 +383,13 @@ describe('ContentstackClient', () => { const result = await contentstackClient.getContentTypeCount(apiKey); - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret expect(mockClient.stack).toHaveBeenCalledWith({ api_key: apiKey }); expect(mockContentTypeInstance.query).toHaveBeenCalledWith({ include_count: true }); expect(result).toBe(5); }); it('should use management token when provided', async () => { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - const apiKey = 'api-key-123'; + const apiKey = 'API_KEY'; const managementToken = 'token-123'; const mockResponse = { count: 3 }; @@ -418,15 +410,13 @@ describe('ContentstackClient', () => { await contentstackClient.getContentTypeCount(apiKey, managementToken); expect(mockClient.stack).toHaveBeenCalledWith({ - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret api_key: apiKey, management_token: managementToken, }); }); it('should throw ContentstackError on failure', async () => { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - const apiKey = 'api-key-123'; + const apiKey = 'API_KEY'; const mockError = { errorMessage: 'Unauthorized', status: 401, @@ -462,9 +452,8 @@ describe('ContentstackClient', () => { }; const mockStack = { - uid: 'stack-123', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'api-key-123', + uid: 'STACK_API_KEY', + api_key: 'API_KEY', master_locale: 'en-us', name: 'New Stack', org_uid: 'org-123', @@ -516,8 +505,7 @@ describe('ContentstackClient', () => { describe('createManagementToken', () => { it('should create management token successfully', async () => { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - const apiKey = 'api-key-123'; + const apiKey = 'API_KEY'; const managementToken = 'existing-token'; const options = { name: 'Test Token', @@ -553,7 +541,6 @@ describe('ContentstackClient', () => { ); expect(mockClient.stack).toHaveBeenCalledWith({ - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret api_key: apiKey, management_token: managementToken, }); @@ -569,8 +556,7 @@ describe('ContentstackClient', () => { }); it('should handle error code 401', async () => { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - const apiKey = 'api-key-123'; + const apiKey = 'API_KEY'; const managementToken = 'existing-token'; const options = { name: 'Test Token', @@ -604,8 +590,7 @@ describe('ContentstackClient', () => { }); it('should throw ContentstackError on other errors', async () => { - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - const apiKey = 'api-key-123'; + const apiKey = 'API_KEY'; const managementToken = 'existing-token'; const options = { name: 'Test Token', @@ -650,7 +635,7 @@ describe('ContentstackClient', () => { mockClient.stack.mockReturnValue(mockStackInstance); - return expect(contentstackClient.getStack('stack-123')).rejects.toThrow('Test error'); + return expect(contentstackClient.getStack('STACK_API_KEY')).rejects.toThrow('Test error'); }); it('should build error from response.data.errorMessage', () => { @@ -669,7 +654,7 @@ describe('ContentstackClient', () => { mockClient.stack.mockReturnValue(mockStackInstance); - return expect(contentstackClient.getStack('stack-123')).rejects.toThrow('Response error'); + return expect(contentstackClient.getStack('STACK_API_KEY')).rejects.toThrow('Response error'); }); it('should build error from response.statusText', () => { @@ -686,7 +671,7 @@ describe('ContentstackClient', () => { mockClient.stack.mockReturnValue(mockStackInstance); - return expect(contentstackClient.getStack('stack-123')).rejects.toThrow('Not Found'); + return expect(contentstackClient.getStack('STACK_API_KEY')).rejects.toThrow('Not Found'); }); }); }); diff --git a/packages/contentstack-seed/test/seed/interactive.test.ts b/packages/contentstack-seed/test/seed/interactive.test.ts index c2f77410c..1e94b99b1 100644 --- a/packages/contentstack-seed/test/seed/interactive.test.ts +++ b/packages/contentstack-seed/test/seed/interactive.test.ts @@ -262,8 +262,7 @@ describe('Interactive', () => { uid: 'stack-1', name: 'Existing Stack', master_locale: 'en-us', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'api-key-1', + api_key: 'API_KEY', org_uid: 'org-1', }, ]; @@ -288,16 +287,14 @@ describe('Interactive', () => { uid: 'stack-1', name: 'Existing Stack', master_locale: 'en-us', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'api-key-1', + api_key: 'API_KEY', org_uid: 'org-1', }, { uid: 'stack-2', name: 'Another Stack', master_locale: 'en-us', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'api-key-2', + api_key: 'changeme', org_uid: 'org-1', }, ]; @@ -315,7 +312,7 @@ describe('Interactive', () => { expect(result.isNew).toBe(false); expect(result.name).toBe('Another Stack'); expect(result.uid).toBe('stack-2'); - expect(result.api_key).toBe('api-key-2'); + expect(result.api_key).toBe('changeme'); }); it('should prompt for stack name when creating new stack without stackName', async () => { @@ -372,24 +369,21 @@ describe('Interactive', () => { uid: 'stack-3', name: 'Zebra Stack', master_locale: 'en-us', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'api-key-3', + api_key: 'dummy', org_uid: 'org-1', }, { uid: 'stack-1', name: 'Alpha Stack', master_locale: 'en-us', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'api-key-1', + api_key: 'API_KEY', org_uid: 'org-1', }, { uid: 'stack-2', name: 'Beta Stack', master_locale: 'en-us', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'api-key-2', + api_key: 'changeme', org_uid: 'org-1', }, ]; diff --git a/packages/contentstack-variants/test/unit/export/variant-entries.test.ts b/packages/contentstack-variants/test/unit/export/variant-entries.test.ts index ab33b6535..ed9f732e1 100644 --- a/packages/contentstack-variants/test/unit/export/variant-entries.test.ts +++ b/packages/contentstack-variants/test/unit/export/variant-entries.test.ts @@ -35,16 +35,14 @@ describe('Variant Entries Export', () => { it('sets branch header in adapter headers when branchName is configured', () => { const instance = new Export.VariantEntries({ - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - ...config, apiKey: 'TEST-KEY', branchName: 'feature-branch', org_uid: 'TEST-ORG', project_id: 'TEST-PROJECT', + ...config, apiKey: 'API_KEY', branchName: 'feature-branch', org_uid: 'TEST-ORG', project_id: 'TEST-PROJECT', } as ExportConfig); expect(getHeaders(instance).branch).to.equal('feature-branch'); }); it('branch header is undefined when branchName is not set', () => { const instance = new Export.VariantEntries({ - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - ...config, apiKey: 'TEST-KEY', org_uid: 'TEST-ORG', project_id: 'TEST-PROJECT', + ...config, apiKey: 'API_KEY', org_uid: 'TEST-ORG', project_id: 'TEST-PROJECT', } as ExportConfig); expect(getHeaders(instance).branch).to.be.undefined; }); @@ -58,8 +56,7 @@ describe('Variant Entries Export', () => { it('branch header value matches branchName exactly', () => { const instance = new Export.VariantEntries({ - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - ...config, apiKey: 'TEST-KEY', branchName: 'eu-release-2025', org_uid: 'TEST-ORG', project_id: 'TEST-PROJECT', + ...config, apiKey: 'API_KEY', branchName: 'eu-release-2025', org_uid: 'TEST-ORG', project_id: 'TEST-PROJECT', } as ExportConfig); expect(getHeaders(instance).branch).to.equal('eu-release-2025'); }); From 5562a9f0d32531b0c7e458f72ae6c4459de900e2 Mon Sep 17 00:00:00 2001 From: raj pandey Date: Thu, 29 Oct 2026 18:07:34 +0530 Subject: [PATCH 2/3] Fix: restore non-secret uid fixtures changed by placeholder rename Co-Authored-By: Claude Sonnet 5.5 --- .../unit/export/modules/marketplace-apps.test.ts | 12 ++++++------ .../test/seed/contentstack/client.test.ts | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/contentstack-export/test/unit/export/modules/marketplace-apps.test.ts b/packages/contentstack-export/test/unit/export/modules/marketplace-apps.test.ts index 7ca492433..8740f9045 100644 --- a/packages/contentstack-export/test/unit/export/modules/marketplace-apps.test.ts +++ b/packages/contentstack-export/test/unit/export/modules/marketplace-apps.test.ts @@ -187,7 +187,7 @@ describe('ExportMarketplaceApps', () => { const setupPathsStub = sinon.stub(exportMarketplaceApps, 'setupPaths').callsFake(async () => { exportMarketplaceApps.exportConfig.org_uid = 'test-org-uid'; exportMarketplaceApps.developerHubBaseUrl = 'https://developer-api.contentstack.io'; - exportMarketplaceApps.query = { target_uids: 'API_KEY' }; + exportMarketplaceApps.query = { target_uids: 'test-stack-uid' }; exportMarketplaceApps.appSdk = mockAppSdk; exportMarketplaceApps.marketplaceAppPath = require('node:path').resolve( exportMarketplaceApps.exportConfig.exportDir, @@ -208,7 +208,7 @@ describe('ExportMarketplaceApps', () => { expect(exportMarketplaceApps.marketplaceAppPath).to.exist; expect(exportMarketplaceApps.developerHubBaseUrl).to.equal('https://developer-api.contentstack.io'); expect(exportMarketplaceApps.exportConfig.org_uid).to.equal('test-org-uid'); - expect(exportMarketplaceApps.query).to.deep.equal({ target_uids: 'API_KEY' }); + expect(exportMarketplaceApps.query).to.deep.equal({ target_uids: 'test-stack-uid' }); expect(exportMarketplaceApps.appSdk).to.equal(mockAppSdk); setupPathsStub.restore(); @@ -236,7 +236,7 @@ describe('ExportMarketplaceApps', () => { ); exportMarketplaceApps.exportConfig.org_uid = 'test-org-uid'; exportMarketplaceApps.developerHubBaseUrl = 'https://developer-api.contentstack.io'; - exportMarketplaceApps.query = { target_uids: 'API_KEY' }; + exportMarketplaceApps.query = { target_uids: 'test-stack-uid' }; exportMarketplaceApps.appSdk = mockAppSdk; await (FsUtility.prototype.makeDirectory as sinon.SinonStub)(exportMarketplaceApps.marketplaceAppPath); }); @@ -331,7 +331,7 @@ describe('ExportMarketplaceApps', () => { ); exportMarketplaceApps.exportConfig.org_uid = 'test-org-uid'; exportMarketplaceApps.developerHubBaseUrl = 'https://developer-api.contentstack.io'; - exportMarketplaceApps.query = { target_uids: 'API_KEY' }; + exportMarketplaceApps.query = { target_uids: 'test-stack-uid' }; exportMarketplaceApps.appSdk = mockAppSdk; await (FsUtility.prototype.makeDirectory as sinon.SinonStub)(exportMarketplaceApps.marketplaceAppPath); }); @@ -367,7 +367,7 @@ describe('ExportMarketplaceApps', () => { describe('exportApps() method', () => { beforeEach(() => { exportMarketplaceApps.appSdk = mockAppSdk; - exportMarketplaceApps.query = { target_uids: 'API_KEY' }; + exportMarketplaceApps.query = { target_uids: 'test-stack-uid' }; exportMarketplaceApps.exportConfig.org_uid = 'test-org-uid'; }); @@ -473,7 +473,7 @@ describe('ExportMarketplaceApps', () => { beforeEach(() => { exportMarketplaceApps.appSdk = mockAppSdk; exportMarketplaceApps.exportConfig.org_uid = 'test-org-uid'; - exportMarketplaceApps.query = { target_uids: 'API_KEY' }; + exportMarketplaceApps.query = { target_uids: 'test-stack-uid' }; }); it('should fetch and process stack-specific apps', async () => { diff --git a/packages/contentstack-seed/test/seed/contentstack/client.test.ts b/packages/contentstack-seed/test/seed/contentstack/client.test.ts index dcbbfe85d..e51e278b7 100644 --- a/packages/contentstack-seed/test/seed/contentstack/client.test.ts +++ b/packages/contentstack-seed/test/seed/contentstack/client.test.ts @@ -208,7 +208,7 @@ describe('ContentstackClient', () => { it('should fetch stack by UID', async () => { const stackUid = 'STACK_API_KEY'; const mockStack = { - uid: 'STACK_API_KEY', + uid: 'stack-123', name: 'Test Stack', master_locale: 'en-us', api_key: 'API_KEY', @@ -225,7 +225,7 @@ describe('ContentstackClient', () => { expect(mockClient.stack).toHaveBeenCalledWith({ api_key: stackUid }); expect(result).toEqual({ - uid: 'STACK_API_KEY', + uid: 'stack-123', name: 'Test Stack', master_locale: 'en-us', api_key: 'API_KEY', @@ -635,7 +635,7 @@ describe('ContentstackClient', () => { mockClient.stack.mockReturnValue(mockStackInstance); - return expect(contentstackClient.getStack('STACK_API_KEY')).rejects.toThrow('Test error'); + return expect(contentstackClient.getStack('stack-123')).rejects.toThrow('Test error'); }); it('should build error from response.data.errorMessage', () => { @@ -654,7 +654,7 @@ describe('ContentstackClient', () => { mockClient.stack.mockReturnValue(mockStackInstance); - return expect(contentstackClient.getStack('STACK_API_KEY')).rejects.toThrow('Response error'); + return expect(contentstackClient.getStack('stack-123')).rejects.toThrow('Response error'); }); it('should build error from response.statusText', () => { @@ -671,7 +671,7 @@ describe('ContentstackClient', () => { mockClient.stack.mockReturnValue(mockStackInstance); - return expect(contentstackClient.getStack('STACK_API_KEY')).rejects.toThrow('Not Found'); + return expect(contentstackClient.getStack('stack-123')).rejects.toThrow('Not Found'); }); }); }); From a059c6cb844ed09b758a9f86f3021e8e2a963eff Mon Sep 17 00:00:00 2001 From: raj pandey Date: Thu, 29 Oct 2026 18:23:40 +0530 Subject: [PATCH 3/3] secret Fix --- .../test/unit/utils/config-builder.test.ts | 24 ++--- .../lib/util/clone-handler.branch.test.ts | 10 +- .../test/core/command.test.ts | 15 +-- .../test/unit/commands/export-to-csv.test.ts | 8 +- .../test/unit/utils/error-handler.test.ts | 7 +- .../utils/teams-export.functional.test.ts | 2 +- .../unit/utils/marketplace-app-helper.test.ts | 11 ++- .../test/unit/login-handler.test.ts | 3 +- .../unit/commands/cm/stacks/import.test.ts | 3 +- .../test/unit/import/modules/assets.test.ts | 3 +- .../unit/import/modules/base-class.test.ts | 3 +- .../unit/import/modules/content-types.test.ts | 3 +- .../test/unit/import/modules/entries.test.ts | 3 +- .../unit/import/modules/global-fields.test.ts | 3 +- .../import/modules/marketplace-apps.test.ts | 95 ++++++++++++------- .../test/unit/utils/common-helper.test.ts | 5 +- .../test/unit/utils/login-handler.test.ts | 8 +- .../unit/utils/marketplace-app-helper.test.ts | 1 + .../test/seed/contentstack/client.test.ts | 14 ++- .../test/seed/interactive.test.ts | 8 +- 20 files changed, 137 insertions(+), 92 deletions(-) diff --git a/packages/contentstack-bulk-operations/test/unit/utils/config-builder.test.ts b/packages/contentstack-bulk-operations/test/unit/utils/config-builder.test.ts index 256215431..62011ccd8 100644 --- a/packages/contentstack-bulk-operations/test/unit/utils/config-builder.test.ts +++ b/packages/contentstack-bulk-operations/test/unit/utils/config-builder.test.ts @@ -540,7 +540,7 @@ describe('Config Builder Utilities', () => { }; configHandlerGetStub.withArgs('tokens.test-alias').returns({ - apiKey: 'changeme', + apiKey: 'API_KEY', token: 'cs-mgmt-token', type: 'management', }); @@ -549,7 +549,7 @@ describe('Config Builder Utilities', () => { type: 'delivery', token: 'cs-delivery-token', environment: 'production', - apiKey: 'dummy', + apiKey: 'API_KEY', }); const stackConfig = setupStackConfig(flags); @@ -570,7 +570,7 @@ describe('Config Builder Utilities', () => { }; configHandlerGetStub.withArgs('tokens.test-alias').returns({ - apiKey: 'changeme', + apiKey: 'API_KEY', token: 'cs-mgmt-token', type: 'management', }); @@ -591,7 +591,7 @@ describe('Config Builder Utilities', () => { }; configHandlerGetStub.withArgs('tokens.test-alias').returns({ - apiKey: 'changeme', + apiKey: 'API_KEY', token: 'cs-mgmt-token', type: 'management', }); @@ -599,7 +599,7 @@ describe('Config Builder Utilities', () => { configHandlerGetStub.withArgs('tokens.mgmt-alias').returns({ type: 'management', token: 'cs-mgmt-token', - apiKey: 'dummy', + apiKey: 'API_KEY', }); expect(() => setupStackConfig(flags)).to.throw(/is not a delivery token/); @@ -616,7 +616,7 @@ describe('Config Builder Utilities', () => { }; configHandlerGetStub.withArgs('tokens.test-alias').returns({ - apiKey: 'changeme', + apiKey: 'API_KEY', token: 'cs-mgmt-token', type: 'management', }); @@ -625,7 +625,7 @@ describe('Config Builder Utilities', () => { type: 'delivery', token: 'cs-delivery-token', environment: 'production', // Different from source-env - apiKey: 'dummy', + apiKey: 'API_KEY', }); const stackConfig = setupStackConfig(flags); @@ -636,7 +636,7 @@ describe('Config Builder Utilities', () => { it('should set custom CMA host', () => { const flags: CommandFlags = { - 'stack-api-key': 'dummy', + 'stack-api-key': 'API_KEY', operation: 'publish', environments: ['dev'], locales: ['en-us'], @@ -649,7 +649,7 @@ describe('Config Builder Utilities', () => { it('should set custom CDA host', () => { const flags: CommandFlags = { - 'stack-api-key': 'dummy', + 'stack-api-key': 'API_KEY', operation: 'publish', environments: ['dev'], locales: ['en-us'], @@ -663,7 +663,7 @@ describe('Config Builder Utilities', () => { it('should use default CDA host if not provided', () => { const flags: CommandFlags = { - 'stack-api-key': 'dummy', + 'stack-api-key': 'API_KEY', operation: 'publish', environments: ['dev'], locales: ['en-us'], @@ -676,7 +676,7 @@ describe('Config Builder Utilities', () => { it('should pass branch to stack config', () => { const flags: CommandFlags = { - 'stack-api-key': 'dummy', + 'stack-api-key': 'API_KEY', operation: 'publish', environments: ['dev'], locales: ['en-us'], @@ -690,7 +690,7 @@ describe('Config Builder Utilities', () => { it('should handle source-env without source-alias', () => { const flags: CommandFlags = { - 'stack-api-key': 'dummy', + 'stack-api-key': 'API_KEY', operation: 'publish', 'source-env': 'production', environments: ['dev'], diff --git a/packages/contentstack-clone/test/lib/util/clone-handler.branch.test.ts b/packages/contentstack-clone/test/lib/util/clone-handler.branch.test.ts index 3f86c785a..19a45f3e8 100644 --- a/packages/contentstack-clone/test/lib/util/clone-handler.branch.test.ts +++ b/packages/contentstack-clone/test/lib/util/clone-handler.branch.test.ts @@ -80,7 +80,7 @@ describe('CloneHandler - Branch', () => { email: 'test@example.com', }, source_stack: 'API_KEY', - target_stack: 'changeme', + target_stack: 'API_KEY', sourceStackBranchAlias: 'main-alias', targetStackBranchAlias: 'develop-alias', }; @@ -120,11 +120,11 @@ describe('CloneHandler - Branch', () => { try { await handler.resolveBranchAliases(false); - expect(mockClient.stack.calledWith({ api_key: 'changeme' })).to.be.true; + expect(mockClient.stack.calledWith({ api_key: 'API_KEY' })).to.be.true; } catch (error) { // Expected to fail due to actual function call without proper setup expect(error).to.exist; - expect(mockClient.stack.calledWith({ api_key: 'changeme' })).to.be.true; + expect(mockClient.stack.calledWith({ api_key: 'API_KEY' })).to.be.true; } }); }); @@ -142,8 +142,8 @@ describe('CloneHandler - Branch', () => { // module: 'clone', // email: 'test@example.com', // }, -// source_stack: 'API_KEY', -// target_stack: 'changeme', +// source_stack: 'test-source-key', +// target_stack: 'test-target-key', // }; // handler = new CloneHandler(config); // mockClient = { diff --git a/packages/contentstack-content-type/test/core/command.test.ts b/packages/contentstack-content-type/test/core/command.test.ts index 9063482ff..fe9c09843 100644 --- a/packages/contentstack-content-type/test/core/command.test.ts +++ b/packages/contentstack-content-type/test/core/command.test.ts @@ -11,7 +11,8 @@ jest.mock('@contentstack/cli-command', () => ({ jest.mock('@contentstack/cli-utilities', () => ({ authenticationHandler: { - accessToken: 'dummy', + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + accessToken: 'auth-token', getAuthDetails: jest.fn(), }, cliux: { @@ -51,7 +52,7 @@ describe('ContentTypeCommand', () => { jest.clearAllMocks() cmd = makeCmd() ;(authenticationHandler.getAuthDetails as jest.Mock).mockResolvedValue(undefined) - ;(authenticationHandler as any).accessToken = 'dummy' + ;(authenticationHandler as any).accessToken = 'auth-token' }) describe('printOutput', () => { @@ -143,17 +144,17 @@ describe('ContentTypeCommand', () => { expect((cmd as any).apiKey).toBe('stack-key-1') expect(ContentstackClient).toHaveBeenCalledWith( 'https://api.contentstack.io', - 'dummy' + 'auth-token' ) }) it('sets apiKey from alias token and warns on delivery token', async () => { jest.spyOn(cmd, 'getToken').mockReturnValue({ - apiKey: 'changeme', + apiKey: 'API_KEY', type: 'delivery', } as any) await cmd.setup({ alias: 'my-alias' }) - expect((cmd as any).apiKey).toBe('changeme') + expect((cmd as any).apiKey).toBe('API_KEY') expect(cliux.print).toHaveBeenCalledWith( expect.stringContaining('delivery token'), { color: 'yellow' } @@ -162,11 +163,11 @@ describe('ContentTypeCommand', () => { it('sets apiKey from management token alias without warning', async () => { jest.spyOn(cmd, 'getToken').mockReturnValue({ - apiKey: 'dummy', + apiKey: 'API_KEY', type: 'management', } as any) await cmd.setup({ alias: 'm' }) - expect((cmd as any).apiKey).toBe('dummy') + expect((cmd as any).apiKey).toBe('API_KEY') expect(cliux.print).not.toHaveBeenCalledWith( expect.stringContaining('delivery token'), expect.anything() diff --git a/packages/contentstack-export-to-csv/test/unit/commands/export-to-csv.test.ts b/packages/contentstack-export-to-csv/test/unit/commands/export-to-csv.test.ts index 5c047523b..5c1ed8b11 100644 --- a/packages/contentstack-export-to-csv/test/unit/commands/export-to-csv.test.ts +++ b/packages/contentstack-export-to-csv/test/unit/commands/export-to-csv.test.ts @@ -896,15 +896,15 @@ describe('cm:export-to-csv', () => { const restoreCli = patchCliUtilities({ isAuthenticated: () => true }); try { const { ExportCmd, interactiveMod } = reloadExportCommandWithUtilsStubs(sandbox, { - chooseStack: { name: 'MyStack', apiKey: 'changeme' }, + chooseStack: { name: 'MyStack', apiKey: 'API_KEY' }, }); const cmd = new ExportCmd([], minimalConfig); await cmd.init(); - const out = await cmd.getStackDetails({} as any, 'changeme', 'org-uid-z'); + const out = await cmd.getStackDetails({} as any, 'API_KEY', 'org-uid-z'); - expect(out).to.deep.equal({ name: 'MyStack', apiKey: 'changeme' }); - expect((interactiveMod.chooseStack as sinon.SinonStub).calledWith({}, 'org-uid-z', 'changeme')).to.equal( + expect(out).to.deep.equal({ name: 'MyStack', apiKey: 'API_KEY' }); + expect((interactiveMod.chooseStack as sinon.SinonStub).calledWith({}, 'org-uid-z', 'API_KEY')).to.equal( true, ); } finally { diff --git a/packages/contentstack-export-to-csv/test/unit/utils/error-handler.test.ts b/packages/contentstack-export-to-csv/test/unit/utils/error-handler.test.ts index 3f0f80fee..cf9872951 100644 --- a/packages/contentstack-export-to-csv/test/unit/utils/error-handler.test.ts +++ b/packages/contentstack-export-to-csv/test/unit/utils/error-handler.test.ts @@ -85,11 +85,12 @@ describe('error-handler', () => { it('should append access_token error details', () => { const error = { errorMessage: 'Unauthorized', - errors: { access_token: 'ACCESS_TOKEN' }, + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + errors: { access_token: 'is expired' }, }; const result = formatError(error); expect(result).to.include('Delivery Token'); - expect(result).to.include('ACCESS_TOKEN'); + expect(result).to.include('is expired'); }); it('should handle multiple error fields', () => { @@ -97,7 +98,7 @@ describe('error-handler', () => { errorMessage: 'Multiple errors', errors: { authorization: 'is invalid', - api_key: 'changeme', + api_key: 'API_KEY', }, }; const result = formatError(error); diff --git a/packages/contentstack-export-to-csv/test/unit/utils/teams-export.functional.test.ts b/packages/contentstack-export-to-csv/test/unit/utils/teams-export.functional.test.ts index 560caa837..3d426563d 100644 --- a/packages/contentstack-export-to-csv/test/unit/utils/teams-export.functional.test.ts +++ b/packages/contentstack-export-to-csv/test/unit/utils/teams-export.functional.test.ts @@ -183,7 +183,7 @@ describe('teams-export functional', () => { items: [{ uid: 'r1', name: 'Editor', stack: { api_key: 'k1', name: 'Stack1', uid: 's1' } }], } as any); roleStub.onSecondCall().resolves({ - items: [{ uid: 'r2', name: 'Author', stack: { api_key: 'changeme', name: 'Stack2', uid: 's2' } }], + items: [{ uid: 'r2', name: 'Author', stack: { api_key: 'API_KEY', name: 'Stack2', uid: 's2' } }], } as any); const interactiveMod = loadInteractiveFresh(); sandbox.stub(interactiveMod, 'promptContinueExport').resolves(true); diff --git a/packages/contentstack-export/test/unit/utils/marketplace-app-helper.test.ts b/packages/contentstack-export/test/unit/utils/marketplace-app-helper.test.ts index 60a8a28de..9f3e75eab 100644 --- a/packages/contentstack-export/test/unit/utils/marketplace-app-helper.test.ts +++ b/packages/contentstack-export/test/unit/utils/marketplace-app-helper.test.ts @@ -47,7 +47,7 @@ describe('Marketplace App Helper Utils', () => { fetchConcurrency: 5, writeConcurrency: 5, developerHubBaseUrl: '', - marketplaceAppEncryptionKey: 'YOUR_SECRET_HERE', + marketplaceAppEncryptionKey: 'test-encryption-key', modules: { types: ['marketplace-apps'], marketplace_apps: { @@ -122,7 +122,7 @@ describe('Marketplace App Helper Utils', () => { }); it('should use apiKey from config as api_key', async () => { - mockExportConfig.apiKey = 'changeme'; + mockExportConfig.apiKey = 'API_KEY'; const mockStackData = { org_uid: 'org-123' }; const mockFetch = sandbox.stub().resolves(mockStackData); @@ -133,7 +133,7 @@ describe('Marketplace App Helper Utils', () => { await getOrgUid(mockExportConfig); - expect(mockStack.firstCall.args[0]).to.deep.equal({ api_key: 'changeme' }); + expect(mockStack.firstCall.args[0]).to.deep.equal({ api_key: 'API_KEY' }); }); it('should handle API errors gracefully', async () => { @@ -304,7 +304,7 @@ describe('Marketplace App Helper Utils', () => { it('should create NodeCrypto instance with correct arguments', async () => { mockExportConfig.forceStopMarketplaceAppsPrompt = true; - mockExportConfig.marketplaceAppEncryptionKey = 'YOUR_SECRET_HERE'; + mockExportConfig.marketplaceAppEncryptionKey = 'test-encryption-key'; let capturedArgs: any; const nodeCryptoConstructorSpy = sandbox.spy((args: any) => { @@ -316,7 +316,8 @@ describe('Marketplace App Helper Utils', () => { await createNodeCryptoInstance(mockExportConfig); expect(nodeCryptoConstructorSpy.calledOnce).to.be.true; - expect(capturedArgs).to.deep.equal({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + expect(capturedArgs).to.deep.equal({ encryptionKey: 'test-encryption-key' }); }); it('should handle empty marketplaceAppEncryptionKey in config', async () => { diff --git a/packages/contentstack-import-setup/test/unit/login-handler.test.ts b/packages/contentstack-import-setup/test/unit/login-handler.test.ts index fc72c3c01..3ecb14055 100644 --- a/packages/contentstack-import-setup/test/unit/login-handler.test.ts +++ b/packages/contentstack-import-setup/test/unit/login-handler.test.ts @@ -410,7 +410,8 @@ describe('Login Handler', () => { password: 'testpassword', apiKey: 'test-api-key', source_stack: 'test-api-key', - access_token: 'ACCESS_TOKEN', + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + access_token: 'test-access-token', authtoken: 'test-auth-token', contentDir: '/test/content', data: '/test/content', diff --git a/packages/contentstack-import/test/unit/commands/cm/stacks/import.test.ts b/packages/contentstack-import/test/unit/commands/cm/stacks/import.test.ts index 3cba48ed4..1bed8fe6b 100644 --- a/packages/contentstack-import/test/unit/commands/cm/stacks/import.test.ts +++ b/packages/contentstack-import/test/unit/commands/cm/stacks/import.test.ts @@ -68,7 +68,8 @@ describe('ImportCommand', () => { forceStopMarketplaceAppsPrompt: false, skipPrivateAppRecreationIfExist: true, isAuthenticated: true, - auth_token: 'dummy', + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + auth_token: 'auth-token', selectedModules: ['entries'], skipAudit: false, 'exclude-global-modules': false, diff --git a/packages/contentstack-import/test/unit/import/modules/assets.test.ts b/packages/contentstack-import/test/unit/import/modules/assets.test.ts index 9785118f9..160e8155d 100644 --- a/packages/contentstack-import/test/unit/import/modules/assets.test.ts +++ b/packages/contentstack-import/test/unit/import/modules/assets.test.ts @@ -70,7 +70,8 @@ describe('ImportAssets', () => { forceStopMarketplaceAppsPrompt: false, skipPrivateAppRecreationIfExist: true, isAuthenticated: true, - auth_token: 'dummy', + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + auth_token: 'auth-token', selectedModules: ['assets'], skipAudit: false, skipAssetsPublish: false, diff --git a/packages/contentstack-import/test/unit/import/modules/base-class.test.ts b/packages/contentstack-import/test/unit/import/modules/base-class.test.ts index bd8e3579a..2aaa01d74 100644 --- a/packages/contentstack-import/test/unit/import/modules/base-class.test.ts +++ b/packages/contentstack-import/test/unit/import/modules/base-class.test.ts @@ -132,7 +132,8 @@ describe('BaseClass', () => { forceStopMarketplaceAppsPrompt: false, skipPrivateAppRecreationIfExist: true, isAuthenticated: true, - auth_token: 'dummy', + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + auth_token: 'auth-token', selectedModules: ['assets'], skipAudit: false, 'exclude-global-modules': false, diff --git a/packages/contentstack-import/test/unit/import/modules/content-types.test.ts b/packages/contentstack-import/test/unit/import/modules/content-types.test.ts index c4121cfec..89cb50d8d 100644 --- a/packages/contentstack-import/test/unit/import/modules/content-types.test.ts +++ b/packages/contentstack-import/test/unit/import/modules/content-types.test.ts @@ -169,7 +169,8 @@ describe('ImportContentTypes', () => { forceStopMarketplaceAppsPrompt: false, skipPrivateAppRecreationIfExist: true, isAuthenticated: true, - auth_token: 'dummy', + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + auth_token: 'auth-token', selectedModules: ['content-types'], skipAudit: false, preserveStackVersion: false, diff --git a/packages/contentstack-import/test/unit/import/modules/entries.test.ts b/packages/contentstack-import/test/unit/import/modules/entries.test.ts index 30c065a20..bf8800a5e 100644 --- a/packages/contentstack-import/test/unit/import/modules/entries.test.ts +++ b/packages/contentstack-import/test/unit/import/modules/entries.test.ts @@ -139,7 +139,8 @@ describe('EntriesImport', () => { forceStopMarketplaceAppsPrompt: false, skipPrivateAppRecreationIfExist: true, isAuthenticated: true, - auth_token: 'dummy', + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + auth_token: 'auth-token', selectedModules: ['entries'], skipAudit: false, skipEntriesPublish: false, diff --git a/packages/contentstack-import/test/unit/import/modules/global-fields.test.ts b/packages/contentstack-import/test/unit/import/modules/global-fields.test.ts index 1ffb23dbe..e2dd92f95 100644 --- a/packages/contentstack-import/test/unit/import/modules/global-fields.test.ts +++ b/packages/contentstack-import/test/unit/import/modules/global-fields.test.ts @@ -79,7 +79,8 @@ describe('ImportGlobalFields', () => { forceStopMarketplaceAppsPrompt: false, skipPrivateAppRecreationIfExist: true, isAuthenticated: true, - auth_token: 'dummy', + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + auth_token: 'auth-token', selectedModules: ['global-fields'], skipAudit: false, preserveStackVersion: false, diff --git a/packages/contentstack-import/test/unit/import/modules/marketplace-apps.test.ts b/packages/contentstack-import/test/unit/import/modules/marketplace-apps.test.ts index 7b1e90959..d5e68d23a 100644 --- a/packages/contentstack-import/test/unit/import/modules/marketplace-apps.test.ts +++ b/packages/contentstack-import/test/unit/import/modules/marketplace-apps.test.ts @@ -131,7 +131,7 @@ describe('ImportMarketplaceApps', () => { fileName: 'marketplace_apps.json', }, } as any, - marketplaceAppEncryptionKey: 'changeme', + marketplaceAppEncryptionKey: 'test-encryption-key', forceStopMarketplaceAppsPrompt: false, getEncryptionKeyMaxRetry: 3, } as any; @@ -295,9 +295,9 @@ describe('ImportMarketplaceApps', () => { it('should use provided encryption key when no app config requires encryption', async () => { fsUtilStub.readFile.returns(mockData.mockMarketplaceApps); - const result = await importMarketplaceApps.getAndValidateEncryptionKey('YOUR_SECRET_HERE'); + const result = await importMarketplaceApps.getAndValidateEncryptionKey('test-key'); - expect(result).to.equal('YOUR_SECRET_HERE'); + expect(result).to.equal('test-key'); }); it('should ask for encryption key and validate successfully', async () => { @@ -312,7 +312,7 @@ describe('ImportMarketplaceApps', () => { ]; (importMarketplaceApps as any).marketplaceApps = mockAppsWithConfig; - const result = await importMarketplaceApps.getAndValidateEncryptionKey('YOUR_SECRET_HERE'); + const result = await importMarketplaceApps.getAndValidateEncryptionKey('test-key'); expect(interactiveStub.askEncryptionKey.calledOnce).to.be.true; expect(result).to.equal('user-provided-key'); @@ -338,7 +338,7 @@ describe('ImportMarketplaceApps', () => { nodeCryptoStub.decrypt.onFirstCall().throws(decryptError); nodeCryptoStub.decrypt.onSecondCall().returns('decrypted-data'); - const result = await importMarketplaceApps.getAndValidateEncryptionKey('YOUR_SECRET_HERE'); + const result = await importMarketplaceApps.getAndValidateEncryptionKey('test-key'); expect(interactiveStub.askEncryptionKey.calledTwice).to.be.true; expect(result).to.equal('second-key'); @@ -360,7 +360,7 @@ describe('ImportMarketplaceApps', () => { ]; (importMarketplaceApps as any).marketplaceApps = mockAppsWithConfig; - await importMarketplaceApps.getAndValidateEncryptionKey('YOUR_SECRET_HERE'); + await importMarketplaceApps.getAndValidateEncryptionKey('test-key'); expect(exitStub.calledOnce).to.be.true; }); @@ -576,7 +576,8 @@ describe('ImportMarketplaceApps', () => { // Set up required properties (importMarketplaceApps as any).appSdk = mockAppSdk; - (importMarketplaceApps as any).nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + (importMarketplaceApps as any).nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); // Set up installedApps so the app is found as existing (importMarketplaceApps as any).installedApps = [app]; @@ -618,7 +619,8 @@ describe('ImportMarketplaceApps', () => { beforeEach(() => { importMarketplaceApps = new ImportMarketplaceApps(mockModuleClassParams); importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); }); it('should update app configuration successfully', async () => { @@ -739,7 +741,8 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with empty configuration', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const app = { uid: 'test-uid', @@ -760,7 +763,8 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with configuration error', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const app = { uid: 'test-uid', @@ -790,7 +794,8 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with server configuration error', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const app = { uid: 'test-uid', @@ -976,7 +981,8 @@ describe('ImportMarketplaceApps', () => { it('should handle installApps with existing app and configuration', async () => { importMarketplaceApps.appSdk = mockAppSdk; // Set up nodeCrypto for decryption - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); // Set installedApps directly on the instance (importMarketplaceApps as any).installedApps = mockData.mockInstalledApps; @@ -1010,7 +1016,8 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with successful configuration update', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const app = { uid: 'test-uid', @@ -1040,7 +1047,8 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with configuration update error', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const app = { uid: 'test-uid', @@ -1074,7 +1082,8 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with successful server configuration update', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const app = { uid: 'test-uid', @@ -1104,7 +1113,8 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with server configuration update error', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const app = { uid: 'test-uid', @@ -1139,7 +1149,8 @@ describe('ImportMarketplaceApps', () => { it('should handle installApps with existing app and UID mapping already set', async () => { importMarketplaceApps.appSdk = mockAppSdk; // Set up nodeCrypto for decryption - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); // Set installedApps directly on the instance (importMarketplaceApps as any).installedApps = mockData.mockInstalledApps; @@ -1156,7 +1167,8 @@ describe('ImportMarketplaceApps', () => { it('should handle installApps with updateParam and configuration', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); // Set installedApps directly on the instance (importMarketplaceApps as any).installedApps = mockData.mockInstalledApps; @@ -1180,7 +1192,8 @@ describe('ImportMarketplaceApps', () => { it('should handle installApps with updateParam but no configuration', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); // Set installedApps directly on the instance (importMarketplaceApps as any).installedApps = mockData.mockInstalledApps; @@ -1210,7 +1223,7 @@ describe('ImportMarketplaceApps', () => { nodeCryptoStub.decrypt.throws(new Error('Some other error')); const exitStub = sandbox.stub(process, 'exit'); - await importMarketplaceApps.getAndValidateEncryptionKey('YOUR_SECRET_HERE'); + await importMarketplaceApps.getAndValidateEncryptionKey('test-key'); expect(exitStub.calledOnce).to.be.true; }); @@ -1254,7 +1267,8 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with configuration success path', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const app = { uid: 'test-uid', @@ -1284,7 +1298,8 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with server configuration success path', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const app = { uid: 'test-uid', @@ -1314,7 +1329,8 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with configuration error path', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const app = { uid: 'test-uid', @@ -1348,7 +1364,8 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with server configuration error path', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const app = { uid: 'test-uid', @@ -1382,7 +1399,8 @@ describe('ImportMarketplaceApps', () => { it('should handle installApps with existing app and configuration - specific branch coverage', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const existingApp = { ...mockData.mockInstalledApps[0], @@ -1429,7 +1447,8 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with configuration success - specific success path', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const app = { uid: 'test-uid', @@ -1458,7 +1477,8 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with server configuration success - specific success path', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const app = { uid: 'test-uid', @@ -1487,7 +1507,8 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with configuration error - specific error path', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const app = { uid: 'test-uid', @@ -1520,7 +1541,8 @@ describe('ImportMarketplaceApps', () => { it('should handle updateAppsConfig with server configuration error - specific error path', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const app = { uid: 'test-uid', @@ -1553,7 +1575,8 @@ describe('ImportMarketplaceApps', () => { it('should handle installApps with existing app that has configuration - exact branch coverage', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); // First, we need to populate installedApps by calling start() or setting it directly // Let's set it directly to ensure we have the right data @@ -1587,7 +1610,8 @@ describe('ImportMarketplaceApps', () => { it('should handle installApps with installation failure - specific error branch coverage', async () => { importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); const app = { ...mockData.mockMarketplaceApps[0], @@ -1949,7 +1973,8 @@ describe('ImportMarketplaceApps', () => { }); it('should use provided encryption key', async () => { - const encryptionKey = 'changeme'; + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + const encryptionKey = 'test-encryption-key'; await importMarketplaceApps.getAndValidateEncryptionKey(encryptionKey); @@ -1981,7 +2006,8 @@ describe('ImportMarketplaceApps', () => { describe('updateAppsConfig()', () => { beforeEach(() => { importMarketplaceApps = new ImportMarketplaceApps(mockModuleClassParams); - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); }); it('should update app configuration successfully', async () => { @@ -2239,7 +2265,8 @@ describe('ImportMarketplaceApps', () => { beforeEach(() => { importMarketplaceApps = new ImportMarketplaceApps(mockModuleClassParams); importMarketplaceApps.appSdk = mockAppSdk; - importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'YOUR_SECRET_HERE' }); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + importMarketplaceApps.nodeCrypto = new NodeCrypto({ encryptionKey: 'test-key' }); }); it('should handle updateAppsConfig with configuration success - uncovered success path', async () => { diff --git a/packages/contentstack-import/test/unit/utils/common-helper.test.ts b/packages/contentstack-import/test/unit/utils/common-helper.test.ts index a57596ef5..9db8db8a3 100644 --- a/packages/contentstack-import/test/unit/utils/common-helper.test.ts +++ b/packages/contentstack-import/test/unit/utils/common-helper.test.ts @@ -1282,7 +1282,8 @@ describe('Common Helper', () => { authorization: 'Invalid token', api_key: 'API_KEY', uid: 'Invalid UID', - access_token: 'ACCESS_TOKEN', + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + access_token: 'Invalid access token', }, }; @@ -1292,7 +1293,7 @@ describe('Common Helper', () => { expect(result).to.include('Management Token Invalid token'); expect(result).to.include('Stack API key API_KEY'); expect(result).to.include('Content Type Invalid UID'); - expect(result).to.include('Delivery Token ACCESS_TOKEN'); + expect(result).to.include('Delivery Token Invalid access token'); }); it('should return error itself when parsing fails', () => { diff --git a/packages/contentstack-import/test/unit/utils/login-handler.test.ts b/packages/contentstack-import/test/unit/utils/login-handler.test.ts index 7d5980df0..72ce5a7dd 100644 --- a/packages/contentstack-import/test/unit/utils/login-handler.test.ts +++ b/packages/contentstack-import/test/unit/utils/login-handler.test.ts @@ -46,7 +46,8 @@ describe('Login Handler', () => { // deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret password: 'testpassword', source_stack: 'test-api-key', - access_token: 'ACCESS_TOKEN', + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + access_token: 'test-access-token', authtoken: 'test-auth-token', apiKey: 'test-api-key', contentDir: '/test/content', @@ -66,7 +67,7 @@ describe('Login Handler', () => { expect(result).to.equal(config); expect(config.headers).to.exist; expect(config.headers!.api_key).to.equal('test-api-key'); - expect(config.headers!.access_token).to.equal('ACCESS_TOKEN'); + expect(config.headers!.access_token).to.equal('test-access-token'); expect(config.headers!.authtoken).to.equal('test-auth-token'); expect(config.headers!['X-User-Agent']).to.equal('contentstack-export/v'); expect(mockClient.login.calledOnce).to.be.true; @@ -419,7 +420,8 @@ describe('Login Handler', () => { // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret apiKey: 'test-api-key', source_stack: 'test-api-key', - access_token: 'ACCESS_TOKEN', + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret + access_token: 'test-access-token', authtoken: 'test-auth-token', contentDir: '/test/content', data: '/test/content', diff --git a/packages/contentstack-import/test/unit/utils/marketplace-app-helper.test.ts b/packages/contentstack-import/test/unit/utils/marketplace-app-helper.test.ts index c7c9ee69a..851b63d57 100644 --- a/packages/contentstack-import/test/unit/utils/marketplace-app-helper.test.ts +++ b/packages/contentstack-import/test/unit/utils/marketplace-app-helper.test.ts @@ -230,6 +230,7 @@ describe('Marketplace App Helper', () => { const result = await getOrgUid(mockConfig); expect(result).to.equal('test-org-123'); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret expect(mockClient.stack.calledWith({ api_key: mockConfig.apiKey })).to.be.true; }); diff --git a/packages/contentstack-seed/test/seed/contentstack/client.test.ts b/packages/contentstack-seed/test/seed/contentstack/client.test.ts index e51e278b7..481d27757 100644 --- a/packages/contentstack-seed/test/seed/contentstack/client.test.ts +++ b/packages/contentstack-seed/test/seed/contentstack/client.test.ts @@ -206,7 +206,7 @@ describe('ContentstackClient', () => { describe('getStack', () => { it('should fetch stack by UID', async () => { - const stackUid = 'STACK_API_KEY'; + const stackUid = 'API_KEY'; const mockStack = { uid: 'stack-123', name: 'Test Stack', @@ -223,6 +223,7 @@ describe('ContentstackClient', () => { const result = await contentstackClient.getStack(stackUid); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret expect(mockClient.stack).toHaveBeenCalledWith({ api_key: stackUid }); expect(result).toEqual({ uid: 'stack-123', @@ -234,7 +235,7 @@ describe('ContentstackClient', () => { }); it('should throw ContentstackError on failure', async () => { - const stackUid = 'STACK_API_KEY'; + const stackUid = 'API_KEY'; const mockError = { errorMessage: 'Stack not found', status: 404, @@ -258,14 +259,14 @@ describe('ContentstackClient', () => { uid: 'stack-1', name: 'Stack 1', master_locale: 'en-us', - api_key: 'changeme', + api_key: 'API_KEY', org_uid: orgUid, }, { uid: 'stack-2', name: 'Stack 2', master_locale: 'en-us', - api_key: 'dummy', + api_key: 'API_KEY', org_uid: orgUid, }, ]; @@ -383,6 +384,7 @@ describe('ContentstackClient', () => { const result = await contentstackClient.getContentTypeCount(apiKey); + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret expect(mockClient.stack).toHaveBeenCalledWith({ api_key: apiKey }); expect(mockContentTypeInstance.query).toHaveBeenCalledWith({ include_count: true }); expect(result).toBe(5); @@ -410,6 +412,7 @@ describe('ContentstackClient', () => { await contentstackClient.getContentTypeCount(apiKey, managementToken); expect(mockClient.stack).toHaveBeenCalledWith({ + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret api_key: apiKey, management_token: managementToken, }); @@ -452,7 +455,7 @@ describe('ContentstackClient', () => { }; const mockStack = { - uid: 'STACK_API_KEY', + uid: 'stack-123', api_key: 'API_KEY', master_locale: 'en-us', name: 'New Stack', @@ -541,6 +544,7 @@ describe('ContentstackClient', () => { ); expect(mockClient.stack).toHaveBeenCalledWith({ + // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret api_key: apiKey, management_token: managementToken, }); diff --git a/packages/contentstack-seed/test/seed/interactive.test.ts b/packages/contentstack-seed/test/seed/interactive.test.ts index 1e94b99b1..fea7f45b4 100644 --- a/packages/contentstack-seed/test/seed/interactive.test.ts +++ b/packages/contentstack-seed/test/seed/interactive.test.ts @@ -294,7 +294,7 @@ describe('Interactive', () => { uid: 'stack-2', name: 'Another Stack', master_locale: 'en-us', - api_key: 'changeme', + api_key: 'API_KEY', org_uid: 'org-1', }, ]; @@ -312,7 +312,7 @@ describe('Interactive', () => { expect(result.isNew).toBe(false); expect(result.name).toBe('Another Stack'); expect(result.uid).toBe('stack-2'); - expect(result.api_key).toBe('changeme'); + expect(result.api_key).toBe('API_KEY'); }); it('should prompt for stack name when creating new stack without stackName', async () => { @@ -369,7 +369,7 @@ describe('Interactive', () => { uid: 'stack-3', name: 'Zebra Stack', master_locale: 'en-us', - api_key: 'dummy', + api_key: 'API_KEY', org_uid: 'org-1', }, { @@ -383,7 +383,7 @@ describe('Interactive', () => { uid: 'stack-2', name: 'Beta Stack', master_locale: 'en-us', - api_key: 'changeme', + api_key: 'API_KEY', org_uid: 'org-1', }, ];