diff --git a/src/ApiService/ApiService/onefuzzlib/notifications/NotificationsBase.cs b/src/ApiService/ApiService/onefuzzlib/notifications/NotificationsBase.cs index fdcb88d84b..ccd5cfe946 100644 --- a/src/ApiService/ApiService/onefuzzlib/notifications/NotificationsBase.cs +++ b/src/ApiService/ApiService/onefuzzlib/notifications/NotificationsBase.cs @@ -138,7 +138,7 @@ public async Async.Task Render(string templateString, Uri instanceUrl, b true => new TemplateContext { EnableRelaxedFunctionAccess = false, EnableRelaxedIndexerAccess = false, - EnableRelaxedMemberAccess = false, + EnableRelaxedMemberAccess = true, EnableRelaxedTargetAccess = false }, _ => new TemplateContext() diff --git a/src/ApiService/IntegrationTests/JinjaToScribanMigrationTests.cs b/src/ApiService/IntegrationTests/JinjaToScribanMigrationTests.cs index f4a9acfa40..90607f35db 100644 --- a/src/ApiService/IntegrationTests/JinjaToScribanMigrationTests.cs +++ b/src/ApiService/IntegrationTests/JinjaToScribanMigrationTests.cs @@ -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 @@ -412,4 +418,19 @@ private static GithubIssuesTemplate MigratableGithubTemplate() { private static TeamsTemplate GetTeamsTemplate() { return new TeamsTemplate(new SecretData(new SecretValue("https://example.com"))); } + + private static AdoTemplate ValidScribanAdoTemplate() { + return new AdoTemplate( + new Uri("http://example.com"), + new SecretData(new SecretValue("some secret")), + "{{ if task.tags.project }} blah {{ end }}", + string.Empty, + Array.Empty().ToList(), + new Dictionary(), + new ADODuplicateTemplate( + Array.Empty().ToList(), + new Dictionary(), + new Dictionary() + )); + } }