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..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 @@ -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: 'API_KEY', 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: 'API_KEY', }); 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: 'API_KEY', 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: 'API_KEY', 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: 'API_KEY', }); 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: 'API_KEY', 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: 'API_KEY', }); 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': 'API_KEY', 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': 'API_KEY', 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': 'API_KEY', 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': 'API_KEY', 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': 'API_KEY', 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..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 @@ -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: 'API_KEY', 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: '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-target-key' })).to.be.true; + expect(mockClient.stack.calledWith({ api_key: 'API_KEY' })).to.be.true; } }); }); diff --git a/packages/contentstack-content-type/test/core/command.test.ts b/packages/contentstack-content-type/test/core/command.test.ts index a3826f04f..fe9c09843 100644 --- a/packages/contentstack-content-type/test/core/command.test.ts +++ b/packages/contentstack-content-type/test/core/command.test.ts @@ -4,8 +4,7 @@ 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' } } }, })) @@ -151,12 +150,11 @@ describe('ContentTypeCommand', () => { 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: 'API_KEY', type: 'delivery', } as any) await cmd.setup({ alias: 'my-alias' }) - expect((cmd as any).apiKey).toBe('from-token') + expect((cmd as any).apiKey).toBe('API_KEY') expect(cliux.print).toHaveBeenCalledWith( expect.stringContaining('delivery token'), { color: 'yellow' } @@ -165,12 +163,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: 'API_KEY', type: 'management', } as any) await cmd.setup({ alias: 'm' }) - expect((cmd as any).apiKey).toBe('mgmt-key') + expect((cmd as any).apiKey).toBe('API_KEY') 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..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 @@ -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: 'API_KEY' }, }); 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, 'API_KEY', '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: '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 67facb104..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 @@ -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', () => { @@ -99,8 +98,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: '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 298a86cbb..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 @@ -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: '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/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..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 @@ -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: '', 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..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 @@ -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: '', @@ -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 = 'API_KEY'; 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: 'API_KEY' }); }); it('should handle API errors gracefully', 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/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/utils/common-helper.test.ts b/packages/contentstack-import/test/unit/utils/common-helper.test.ts index 75cd2556d..9db8db8a3 100644 --- a/packages/contentstack-import/test/unit/utils/common-helper.test.ts +++ b/packages/contentstack-import/test/unit/utils/common-helper.test.ts @@ -1280,8 +1280,7 @@ 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', @@ -1292,7 +1291,7 @@ 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'); }); 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/marketplace-app-helper.test.ts b/packages/contentstack-import/test/unit/utils/marketplace-app-helper.test.ts index d3da20892..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 @@ -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, }); }); 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..481d27757 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 = 'API_KEY'; const mockStack = { uid: 'stack-123', 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', }; @@ -230,14 +229,13 @@ describe('ContentstackClient', () => { uid: 'stack-123', 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 = 'API_KEY'; const mockError = { errorMessage: 'Stack not found', status: 404, @@ -261,16 +259,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: 'API_KEY', 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: 'API_KEY', org_uid: orgUid, }, ]; @@ -367,8 +363,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, }; @@ -396,8 +391,7 @@ describe('ContentstackClient', () => { }); 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 }; @@ -425,8 +419,7 @@ describe('ContentstackClient', () => { }); 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, @@ -463,8 +456,7 @@ describe('ContentstackClient', () => { const mockStack = { uid: 'stack-123', - // deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret - api_key: 'api-key-123', + api_key: 'API_KEY', master_locale: 'en-us', name: 'New Stack', org_uid: 'org-123', @@ -516,8 +508,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', @@ -569,8 +560,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 +594,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', diff --git a/packages/contentstack-seed/test/seed/interactive.test.ts b/packages/contentstack-seed/test/seed/interactive.test.ts index c2f77410c..fea7f45b4 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: 'API_KEY', 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('API_KEY'); }); 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: 'API_KEY', 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: 'API_KEY', 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'); });