Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.
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
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public async Async.Task<string> Render(string templateString, Uri instanceUrl, b
true => new TemplateContext {
EnableRelaxedFunctionAccess = false,
EnableRelaxedIndexerAccess = false,
EnableRelaxedMemberAccess = false,
EnableRelaxedMemberAccess = true,
EnableRelaxedTargetAccess = false
},
_ => new TemplateContext()
Expand Down
21 changes: 21 additions & 0 deletions src/ApiService/IntegrationTests/JinjaToScribanMigrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,12 @@ public async Async.Task Access_WithoutAuthorization_IsRejected() {
result.StatusCode.Should().Be(System.Net.HttpStatusCode.BadRequest);
}

[Fact]
public async Async.Task Do_Not_Enforce_Key_Exists_In_Strict_Validation() {
(await JinjaTemplateAdapter.IsValidScribanNotificationTemplate(Context, Logger, ValidScribanAdoTemplate()))
.Should().BeTrue();
}

private async Async.Task ConfigureAuth() {
await Context.InsertAll(
new InstanceConfig(Context.ServiceConfiguration.OneFuzzInstanceName!) { Admins = new[] { _userObjectId } } // needed for admin check
Expand Down Expand Up @@ -412,4 +418,19 @@ private static GithubIssuesTemplate MigratableGithubTemplate() {
private static TeamsTemplate GetTeamsTemplate() {
return new TeamsTemplate(new SecretData<string>(new SecretValue<string>("https://example.com")));
}

private static AdoTemplate ValidScribanAdoTemplate() {
return new AdoTemplate(
new Uri("http://example.com"),
new SecretData<string>(new SecretValue<string>("some secret")),
"{{ if task.tags.project }} blah {{ end }}",
string.Empty,
Array.Empty<string>().ToList(),
new Dictionary<string, string>(),
new ADODuplicateTemplate(
Array.Empty<string>().ToList(),
new Dictionary<string, string>(),
new Dictionary<string, string>()
));
}
}