Skip to content

Commit df34524

Browse files
Merge pull request #181 from contentstack/fix/snyk-issues-secrets
fix false positive hardcoded secrets
2 parents da76339 + 3ae7c9a commit df34524

6 files changed

Lines changed: 16 additions & 1 deletion

File tree

.github/workflows/unit-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
run: |
2020
python -m pip install --upgrade pip
2121
pip install -r requirements.txt # If you have a requirements file
22-
pip install coverage pytest coverage-badge
22+
pip install coverage pytest coverage-badge "setuptools<81"
2323
2424
2525
- name: Run tests and coverage

tests/api/users/test_api.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ def test_active_user(self):
4444
"user": {
4545
"first_name": "your_first_name",
4646
"last_name": "your_last_name",
47+
# deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
4748
"password": "your_password",
49+
# deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
4850
"password_confirmation": "confirm_your_password"
4951
}
5052
}
@@ -78,7 +80,9 @@ def test_reset_password(self):
7880
act_data = {
7981
"user": {
8082
"reset_password_token": "abcdefghijklmnop1234567890",
83+
# deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
8184
"password": "Simple@123",
85+
# deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
8286
"password_confirmation": "Simple@123"
8387
}
8488
}

tests/integration/api/test_01_user.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ class TestUserAuthOps:
2626
"""Account auth endpoints exercised safely (bogus tokens / non-real email)."""
2727

2828
def test_activate_bogus_token(self, ctx):
29+
# deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
2930
resp = ctx.client.user().activate("bogus_activation_token", {"user": {"password": "Test@12345"}})
3031
h.assert_status(resp, 400, 404, 422)
3132

3233
def test_reset_password_bogus_token(self, ctx):
3334
resp = ctx.client.user().reset_password(
35+
# deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
3436
{"user": {"reset_password_token": "bogus", "password": "Test@12345", "password_confirmation": "Test@12345"}}
3537
)
3638
h.assert_status(resp, 400, 404, 422)

tests/mock/users/test_mock.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ def test_mock_active_user(self):
3838
"user": {
3939
"first_name": "your_first_name",
4040
"last_name": "your_last_name",
41+
# deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
4142
"password": "your_password",
43+
# deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
4244
"password_confirmation": "confirm_your_password"
4345
}
4446
}
@@ -79,7 +81,9 @@ def test_reset_password(self):
7981
act_data = {
8082
"user": {
8183
"reset_password_token": "abcdefghijklmnop1234567890",
84+
# deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
8285
"password": "Simple@123",
86+
# deepcode ignore NoHardcodedPasswords: test fixture value, not a real secret
8387
"password_confirmation": "Simple@123"
8488
}
8589
}

tests/unit/contentstack/test_totp_login.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def setUp(self):
1818
self.client = Client()
1919
self.test_email = "test@example.com"
2020
self.test_password = "test_password"
21+
# deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
2122
self.test_secret = "JBSWY3DPEHPK3PXP" # Standard test secret for TOTP
2223
self.test_tfa_token = "123456"
2324

@@ -37,7 +38,9 @@ def test_login_method_signature_with_totp(self):
3738
# Test that the method accepts TOTP parameters without error
3839
try:
3940
client.login(self.test_email, self.test_password, tfa_token=self.test_tfa_token)
41+
# deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
4042
client.login(self.test_email, self.test_password, mfa_secret=self.test_secret)
43+
# deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
4144
client.login(self.test_email, self.test_password, tfa_token=self.test_tfa_token, mfa_secret=self.test_secret)
4245
except Exception as e:
4346
self.fail(f"Login method should accept TOTP parameters without error: {e}")
@@ -71,6 +74,7 @@ def test_login_with_mfa_secret_generates_totp(self):
7174
result = self.client.login(
7275
self.test_email,
7376
self.test_password,
77+
# deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
7478
mfa_secret=self.test_secret
7579
)
7680

tests/unit/test_oauth_handler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def setUp(self):
3131
app_id=self.app_id,
3232
client_id=self.client_id,
3333
redirect_uri=self.redirect_uri,
34+
# deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
3435
client_secret=self.client_secret,
3536
scope=self.scope,
3637
api_client=self.api_client

0 commit comments

Comments
 (0)