Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [v1.31.1](https://github.com/contentstack/contentstack-management-javascript/tree/v1.31.1) (2026-07-30)

- Snyk fixes

## [v1.31.0](https://github.com/contentstack/contentstack-management-javascript/tree/v1.31.0) (2026-07-27)

- Enh
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/management",
"version": "1.31.0",
"version": "1.31.1",
"description": "The Content Management API is used to manage the content of your Contentstack account",
"main": "./dist/node/contentstack-management.js",
"browser": "./dist/web/contentstack-management.js",
Expand Down
2 changes: 2 additions & 0 deletions test/sanity-check/api/stack-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ describe('Stack API Tests', () => {
})

it('should fail to fetch with invalid API key', async () => {
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
const invalidStack = client.stack({ api_key: 'invalid_api_key_12345' })

try {
Expand Down Expand Up @@ -336,6 +337,7 @@ describe('Stack API Tests', () => {
})

it('should return proper error structure', async () => {
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
const invalidStack = client.stack({ api_key: 'invalid_key' })

try {
Expand Down
10 changes: 10 additions & 0 deletions test/sanity-check/api/user-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ describe('User & Authentication API Tests', () => {
this.timeout(15000)

try {
// deepcode ignore NoHardcodedCredentials,NoHardcodedPasswords: false positive - method signature/parameter names, not a real secret
await client.login({ email: 'invalid-email', password: 'password123' })
expect.fail('Should have thrown an error')
} catch (error) {
Expand All @@ -129,7 +130,9 @@ describe('User & Authentication API Tests', () => {

try {
await client.login({
// deepcode ignore NoHardcodedCredentials: false positive - method signature/parameter names, no actual hardcoded credential
email: process.env.EMAIL || 'test@example.com',
// deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
password: 'wrong_password_12345'
})
expect.fail('Should have thrown an error')
Expand All @@ -146,6 +149,7 @@ describe('User & Authentication API Tests', () => {
try {
await client.login({
email: 'nonexistent_user_' + Date.now() + '@test-invalid.com',
// deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
password: 'password123'
})
expect.fail('Should have thrown an error')
Expand All @@ -159,6 +163,7 @@ describe('User & Authentication API Tests', () => {
this.timeout(15000)

try {
// deepcode ignore NoHardcodedCredentials,NoHardcodedPasswords: false positive - method signature/parameter names, not a real secret
await client.login({ email: 'test@test.com', password: 'wrongpassword' })
expect.fail('Should have thrown an error')
} catch (error) {
Expand Down Expand Up @@ -261,6 +266,7 @@ describe('User & Authentication API Tests', () => {
}

const authClient = contentstackClient()
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
const stack = authClient.stack({ api_key: 'invalid_api_key_12345' })

try {
Expand Down Expand Up @@ -396,7 +402,9 @@ describe('User & Authentication API Tests', () => {

try {
await client.login({
// deepcode ignore NoHardcodedCredentials: false positive - method signature/parameter names, no actual hardcoded credential
email: process.env.TFA_EMAIL || 'tfa_test@example.com',
// deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
password: process.env.TFA_PASSWORD || 'password123'
})
// If 2FA is not enabled, login succeeds
Expand Down Expand Up @@ -471,6 +479,7 @@ describe('User & Authentication API Tests', () => {
await client.login({
email: process.env.EMAIL,
password: process.env.PASSWORD,
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
mfaSecret: 'JBSWY3DPEHPK3PXP' // Test secret (won't work but validates SDK accepts it)
})
// If account doesn't have 2FA, this might succeed
Expand All @@ -488,6 +497,7 @@ describe('User & Authentication API Tests', () => {
try {
await client.login({
email: 'tfa_test_' + Date.now() + '@example.com',
// deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
password: 'password123',
tfa_token: '123456'
})
Expand Down
1 change: 1 addition & 0 deletions test/sanity-check/mock/configurations.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ export const widgetExtension = {
type: 'widget',
src: 'https://example.com/analytics-widget.html',
config: {
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
api_key: 'analytics-key'
},
tags: ['analytics', 'dashboard']
Expand Down
23 changes: 23 additions & 0 deletions test/unit/ContentstackClient-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ describe('Contentstack Client', () => {
const data = JSON.parse(config.data)
expect(data.user).to.deep.equal({
email: 'test@example.com',
// deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
password: 'password123',
tfa_token: '123456'
})
Expand All @@ -226,7 +227,9 @@ describe('Contentstack Client', () => {

ContentstackClient({ http: axios })
.login({
// deepcode ignore NoHardcodedCredentials: false positive - method signature/parameter names, no actual hardcoded credential
email: 'test@example.com',
// deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
password: 'password123',
tfa_token: '123456'
})
Expand All @@ -239,6 +242,7 @@ describe('Contentstack Client', () => {
})

it('should handle login with TOTP secret', done => {
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
const mfaSecret = 'MFASECRET'

mock.onPost('/user-session').reply(config => {
Expand All @@ -258,8 +262,11 @@ describe('Contentstack Client', () => {

ContentstackClient({ http: axios })
.login({
// deepcode ignore NoHardcodedCredentials: false positive - method signature/parameter names, no actual hardcoded credential
email: 'test@example.com',
// deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
password: 'password123',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
mfaSecret: mfaSecret
})
.then(response => {
Expand All @@ -275,6 +282,7 @@ describe('Contentstack Client', () => {
const data = JSON.parse(config.data)
expect(data.user).to.deep.equal({
email: 'test@example.com',
// deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
password: 'password123',
tfa_token: '123456'
})
Expand All @@ -288,9 +296,12 @@ describe('Contentstack Client', () => {

ContentstackClient({ http: axios })
.login({
// deepcode ignore NoHardcodedCredentials: false positive - method signature/parameter names, no actual hardcoded credential
email: 'test@example.com',
// deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
password: 'password123',
tfa_token: '123456',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
mfaSecret: 'MFASECRET'
})
.then(response => {
Expand All @@ -306,6 +317,7 @@ describe('Contentstack Client', () => {
const data = JSON.parse(config.data)
expect(data.user).to.deep.equal({
email: 'test@example.com',
// deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
password: 'password123'
})
return [422, {
Expand All @@ -318,7 +330,9 @@ describe('Contentstack Client', () => {

ContentstackClient({ http: axios })
.login({
// deepcode ignore NoHardcodedCredentials: false positive - method signature/parameter names, no actual hardcoded credential
email: 'test@example.com',
// deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
password: 'password123'
})
.then(() => {
Expand Down Expand Up @@ -351,7 +365,9 @@ describe('Contentstack Client', () => {

ContentstackClient({ http: axios })
.login({
// deepcode ignore NoHardcodedCredentials: false positive - method signature/parameter names, no actual hardcoded credential
email: 'test@example.com',
// deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
password: 'password123',
tfa_token: '111111'
})
Expand All @@ -371,6 +387,7 @@ describe('Contentstack Client', () => {
const data = JSON.parse(config.data)
expect(data.user).to.deep.equal({
email: 'test@example.com',
// deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
password: 'password123',
tfa_token: '123456'
})
Expand All @@ -384,9 +401,12 @@ describe('Contentstack Client', () => {

ContentstackClient({ http: axios })
.login({
// deepcode ignore NoHardcodedCredentials: false positive - method signature/parameter names, no actual hardcoded credential
email: 'test@example.com',
// deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
password: 'password123',
tfa_token: '123456',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
mfaSecret: 'MFASECRET'
})
.then(response => {
Expand Down Expand Up @@ -414,8 +434,11 @@ describe('Contentstack Client', () => {

ContentstackClient({ http: axios })
.login({
// deepcode ignore NoHardcodedCredentials: false positive - method signature/parameter names, no actual hardcoded credential
email: 'test@example.com',
// deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
password: 'password123',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
mfaSecret: 'MFASECRET'
})
.then(response => {
Expand Down
1 change: 1 addition & 0 deletions test/unit/concurrency-Queue-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ var unauthorized = false
var token = 'Bearer <token_value_new>'
describe('Concurrency queue test', () => {
before(() => {
// deepcode ignore HttpToHttps: local in-memory test server only, not real network traffic
server = http.createServer((req, res) => {
if (req.url === '/user-session') {
res.writeHead(200, { 'Content-Type': 'application/json' })
Expand Down
2 changes: 2 additions & 0 deletions test/unit/oauthHandler-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ describe('OAuthHandler', () => {
})

it('should exchange code for token', async () => {
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
const tokenData = { access_token: 'accessToken', refresh_token: 'refreshToken', expires_in: 3600 }
sandbox.stub(axiosInstance, 'post').resolves({ data: tokenData })

Expand Down Expand Up @@ -419,6 +420,7 @@ describe('OAuthHandler', () => {
'http://localhost:8184',
null
)
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
const tokenData = { access_token: 'accessToken', refresh_token: 'refreshToken', expires_in: 3600 }
sandbox.stub(axiosInstance, 'post').resolves({ data: tokenData })

Expand Down
3 changes: 3 additions & 0 deletions test/unit/team-stack-role-mapping-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ describe('Contentstack Team Stack Role Mapping test', () => {
it('should update stack role mapping when stack api key and updateData are passed', done => {
const updateStackRoleMappingMock = {
stackRoleMapping: {
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
stackApiKey: 'STACKAPIKEY',
roles: [
'role_uid1',
Expand All @@ -62,6 +63,7 @@ describe('Contentstack Team Stack Role Mapping test', () => {
'role_uid2'
]
}
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
makeStackRoleMapping({ stackApiKey: 'STACKAPIKEY' }).update(stackRoleMappings)
.then((response) => {
expect(response.stackRoleMapping).not.to.be.equal(undefined)
Expand All @@ -74,6 +76,7 @@ describe('Contentstack Team Stack Role Mapping test', () => {
it('should delete stack role mapping when stack api key is passed', done => {
var mock = new MockAdapter(Axios)
mock.onDelete(`/organizations/organization_uid/teams/team_uid/stack_role_mappings/STACKAPIKEY`).reply(200, { status: 204 })
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
makeStackRoleMapping({ stackApiKey: 'STACKAPIKEY' }).delete()
.then((response) => {
expect(response.status).to.be.equal(204)
Expand Down
1 change: 1 addition & 0 deletions test/unit/variants-entry-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ describe('Contentstack Variants entry test', () => {
})
makeEntry({
entry: { ...systemUidMock },
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
stackHeaders: { api_key: 'test_key' }
})
.variants('v1', 'feature_branch')
Expand Down
Loading