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
2 changes: 2 additions & 0 deletions Scripts/generate_test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def __init__(self, trx_file, coverage_file=None):
self.coverage = None

def parse_trx(self):
# deepcode ignore InsecureXmlParser: test-report generation script, trusted local XML input
tree = ET.parse(self.trx_file)
root = tree.getroot()

Expand Down Expand Up @@ -117,6 +118,7 @@ def parse_coverage(self):
if not self.coverage_file or not os.path.exists(self.coverage_file):
return

# deepcode ignore InsecureXmlParser: test-report generation script, trusted local XML input
tree = ET.parse(self.coverage_file)
root = tree.getroot()

Expand Down
1 change: 1 addition & 0 deletions contentstack.model.generator.tests/ConfigTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public void ApiKey_AppUid_AuthToken_CanBeSetAndRetrieved()
{
var config = new Config
{
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
ApiKey = "test_api_key",
AppUid = "test_app_uid",
AuthToken = "test_auth_token"
Expand Down
12 changes: 12 additions & 0 deletions contentstack.model.generator.tests/ContentstackClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public void Constructor_ShouldInitializeWithOAuthOptions()

var options = new ContentstackOptions
{
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
ApiKey = "test_api_key",
Host = "api.contentstack.io",
IsOAuth = true,
Expand All @@ -36,6 +37,7 @@ public void Constructor_ShouldInitializeWithTraditionalAuth()

var options = new ContentstackOptions
{
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
ApiKey = "test_api_key",
Host = "api.contentstack.io",
IsOAuth = false,
Expand Down Expand Up @@ -64,6 +66,7 @@ public void Constructor_ShouldSetSerializerOptions()

var options = new ContentstackOptions
{
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
ApiKey = "test_api_key",
Host = "api.contentstack.io"
};
Expand All @@ -84,6 +87,7 @@ public void Constructor_ShouldPreserveHostFormat(string inputHost)

var options = new ContentstackOptions
{
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
ApiKey = "test_api_key",
Host = inputHost
};
Expand All @@ -101,6 +105,7 @@ public void GetHeader_ShouldReturnLocalHeadersWhenMainHeadersIsNull()

var options = new ContentstackOptions
{
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
ApiKey = "test_api_key",
Host = "api.contentstack.io"
};
Expand All @@ -127,6 +132,7 @@ public void GetHeader_ShouldReturnMainHeadersWhenLocalHeadersIsNull()

var options = new ContentstackOptions
{
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
ApiKey = "test_api_key",
Host = "api.contentstack.io"
};
Expand All @@ -146,6 +152,7 @@ public void GetHeader_ShouldMergeLocalAndMainHeaders()

var options = new ContentstackOptions
{
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
ApiKey = "test_api_key",
Host = "api.contentstack.io"
};
Expand All @@ -171,6 +178,7 @@ public void GetHeader_ShouldPrioritizeLocalHeadersOverMainHeaders()

var options = new ContentstackOptions
{
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
ApiKey = "test_api_key",
Host = "api.contentstack.io"
};
Expand All @@ -194,6 +202,7 @@ public void GetHeader_ShouldHandleEmptyLocalHeaders()

var options = new ContentstackOptions
{
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
ApiKey = "test_api_key",
Host = "api.contentstack.io"
};
Expand All @@ -214,6 +223,7 @@ public void GetHeader_ShouldHandleNullValues()

var options = new ContentstackOptions
{
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
ApiKey = "test_api_key",
Host = "api.contentstack.io"
};
Expand All @@ -239,6 +249,7 @@ public void GetHeader_ShouldHandleSpecialCharacters()

var options = new ContentstackOptions
{
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
ApiKey = "test_api_key",
Host = "api.contentstack.io"
};
Expand Down Expand Up @@ -267,6 +278,7 @@ public void GetHeader_ShouldHandleCaseSensitiveKeys()

var options = new ContentstackOptions
{
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
ApiKey = "test_api_key",
Host = "api.contentstack.io"
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public void Properties_ShouldBeSettableAndGettable()
var options = new ContentstackOptions();
var testDate = DateTime.UtcNow.AddHours(1);
var testScopes = new[] { "read", "write" };
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
options.ApiKey = "test_api_key";
options.Authtoken = "test_authtoken";
options.Host = "api.contentstack.io";
Expand All @@ -43,6 +44,7 @@ public void Properties_ShouldBeSettableAndGettable()
options.IsOAuth = true;
options.Authorization = "Bearer test_token";
options.OAuthClientId = "test_client_id";
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
options.OAuthClientSecret = "test_client_secret";
options.OAuthRedirectUri = "http://localhost:8080";
options.OAuthAppId = "test_app_id";
Expand Down
7 changes: 7 additions & 0 deletions contentstack.model.generator.tests/ModelGeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public void OAuthScopesParsing_ShouldParseCorrectly(string input, string[]? expe
public void CreateContentstackOptions_WithTraditionalAuth_ShouldSetCorrectProperties()
{

// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
_modelGenerator.ApiKey = "test_api_key";
_modelGenerator.Authtoken = "test_authtoken";
_modelGenerator.Host = "api.contentstack.io";
Expand All @@ -166,11 +167,13 @@ public void CreateContentstackOptions_WithTraditionalAuth_ShouldSetCorrectProper
public void CreateContentstackOptions_WithOAuth_ShouldSetCorrectProperties()
{

// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
_modelGenerator.ApiKey = "test_api_key";
_modelGenerator.Host = "api.contentstack.io";
_modelGenerator.Branch = "main";
_modelGenerator.UseOAuth = true;
_modelGenerator.OAuthClientId = "test_client_id";
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
_modelGenerator.OAuthClientSecret = "test_client_secret";
_modelGenerator.OAuthRedirectUri = "http://localhost:8080";
_modelGenerator.OAuthAppId = "test_app_id";
Expand All @@ -195,6 +198,7 @@ public void CreateContentstackOptions_WithOAuth_ShouldSetCorrectProperties()
public void CreateContentstackOptions_WithOAuthAndNoScopes_ShouldSetScopesToNull()
{

// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
_modelGenerator.ApiKey = "test_api_key";
_modelGenerator.Host = "api.contentstack.io";
_modelGenerator.UseOAuth = true;
Expand Down Expand Up @@ -283,6 +287,7 @@ public void HandleOAuthFlow_WithValidOAuthOptions_ShouldNotThrow()
{

_modelGenerator.UseOAuth = true;
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
_modelGenerator.ApiKey = "test_api_key";
_modelGenerator.Host = "api.contentstack.io";
_modelGenerator.OAuthClientId = "test_client_id";
Expand Down Expand Up @@ -310,12 +315,14 @@ private ContentstackOptions CreateContentstackOptionsFromModelGenerator()

return new ContentstackOptions
{
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
ApiKey = _modelGenerator.ApiKey,
Authtoken = _modelGenerator.Authtoken,
Host = _modelGenerator.Host,
Branch = _modelGenerator.Branch,
IsOAuth = _modelGenerator.UseOAuth,
OAuthClientId = _modelGenerator.OAuthClientId,
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
OAuthClientSecret = _modelGenerator.OAuthClientSecret,
OAuthRedirectUri = _modelGenerator.OAuthRedirectUri,
OAuthAppId = _modelGenerator.OAuthAppId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public void CompleteOAuthFlow_ShouldHandleTraditionalOAuthFlow()
{
Host = "api.contentstack.io",
OAuthClientId = "test_client_id",
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
OAuthClientSecret = "test_client_secret",
OAuthRedirectUri = "http://localhost:8080",
OAuthAppId = "test_app_id"
Expand Down
1 change: 1 addition & 0 deletions contentstack.model.generator.tests/OAuthModelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public void IsValid_NonPkceWithWhitespaceOnlyClientSecret_ReturnsFalseWithMessag
[Fact]
public void IsValid_NonPkceWithClientSecret_ReturnsTrue()
{
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
var options = new OAuthOptions { ClientSecret = "a-real-secret" };

Assert.True(options.IsValid());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public void Properties_CanBeSetAndRetrieved()
{
var stack = new StackResponse
{
// deepcode ignore NoHardcodedCredentials: test fixture value, not a real secret
APIKey = "test_api_key",
Name = "My Stack",
MasterLocale = "en-us",
Expand Down
1 change: 1 addition & 0 deletions contentstack.model.generator/CMA/ContentstackClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ private string _GlobalFieldsUrl
}
private readonly Dictionary<string, object> _StackHeaders = new Dictionary<string, object>();

// deepcode ignore NoHardcodedCredentials: false positive - method signature/parameter names, no actual hardcoded credential
public void SetHeader(string key, string value)
{
if (key != null && value != null)
Expand Down
Loading