Repository navigation
Feature/ab#34582 tighten api security - #3102
Closed
JamesPasta wants to merge 26 commits into
Closed
JamesPasta wants to merge 26 commits into
JamesPasta wants to merge 26 commits into
Conversation
…hares consuming channel' Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
JamesPasta
marked this pull request as draft
October 15, 2026 21:44
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Build blockers, missing tenant migrations, and permission mismatches prevent safe deployment and disrupt existing notification workflows.
7 open findings
Remove duplicate RazorGenerate file inclusion · New Unsupported C# 14 collection-expression constructor syntax · New Upgrade DOMPurify in the web project's manifest and lockfile · New Add tenant migration and snapshot updates for model changes · New Align notification scheduler permissions with role grants · New Allow template editors to access required reference lookups · New Report clipboard failures instead of false success · New
What changed in this PR
This PR tightens security across Unity’s grant-management APIs and improves background processing, payment approvals, and notification consistency.
Changes:
- Adds authorization checks, safer UI handling, and dependency updates.
- Introduces shared worker auditing, message retries, and payment concurrency handling.
- Moves approval mutations into commands and adds template locking, tests, and documentation updates.
| File | Description |
|---|---|
| documentation/payments/payments-web-ui.md | Documents read-only approval preview. |
| documentation/payments/payments-roadmap.md | Removes the addressed GET-mutation issue. |
| documentation/payments/payments-overview.md | Updates approval-slot lifecycle documentation. |
| documentation/payments/payments-approval-workflow.md | Documents command-driven approval slots. |
| documentation/notifications/notifications-scheduled-notifications.md | Explains template locking. |
| applications/Unity.GrantManager/yarn.lock | Locks solution-level DOMPurify dependencies. |
| applications/Unity.GrantManager/test/Unity.GrantManager.Application.Tests/Notifications/ScheduledNotificationTemplateLockTests.cs | Tests template-reference protection. |
| applications/Unity.GrantManager/test/Unity.GrantManager.Application.Tests/GrantsPortal/ApplicantUpdateEmailRecoveryWorkerTests.cs | Supplies worker audit dependencies. |
| applications/Unity.GrantManager/test/Unity.GrantManager.Application.Tests/Applicants/BackgroundWorkers/FiscalYearEndRolloverWorkerTests.cs | Tests separate tenant audit logs. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ApplicantOrganizationInfo/ApplicantOrganizationInfoController.cs | Adds organization-info authorization. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ApplicantContacts/ApplicantContactsController.cs | Adds contacts authorization. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Web/Views/Shared/Components/ApplicantAddresses/ApplicantAddressesController.cs | Adds addresses authorization. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Web/Unity.GrantManager.Web.csproj | Adds XML cryptography dependency pin. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/ApplicationForms/TokenModal.js | Simplifies clipboard writes. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Web/GrantManagerWebModule.cs | Enables bundle minification. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Web/Controllers/FormNotificationsApiController.cs | Adds notification endpoint permissions. |
| applications/Unity.GrantManager/src/Unity.GrantManager.HttpApi/Unity.GrantManager.HttpApi.csproj | Adds XML cryptography dependency pin. |
| applications/Unity.GrantManager/src/Unity.GrantManager.HttpApi.Client/Unity.GrantManager.HttpApi.Client.csproj | Adds XML cryptography dependency pin. |
| applications/Unity.GrantManager/src/Unity.GrantManager.EntityFrameworkCore/Unity.GrantManager.EntityFrameworkCore.csproj | Adds XML cryptography dependency pin. |
| applications/Unity.GrantManager/src/Unity.GrantManager.EntityFrameworkCore/Migrations/HostMigrations/20261013120000_AddQuartzMisfireOriginalFireTime.cs | Adds Quartz misfire timestamp column. |
| applications/Unity.GrantManager/src/Unity.GrantManager.EntityFrameworkCore/EntityFrameworkCore/GrantTenantDbContext.cs | Configures schedule-template relationship. |
| applications/Unity.GrantManager/src/Unity.GrantManager.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreTenantDatabasePurger.cs | Changes connection-builder construction syntax. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Domain/Unity.GrantManager.Domain.csproj | Adds XML cryptography dependency pin. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Domain.Shared/Unity.GrantManager.Domain.Shared.csproj | Adds XML cryptography dependency pin. |
| applications/Unity.GrantManager/src/Unity.GrantManager.DbMigrator/Unity.GrantManager.DbMigrator.csproj | Adds XML cryptography dependency pin. |
| applications/Unity.GrantManager/src/Unity.GrantManager.DbMigrator/DbMigratorHostedService.cs | Simplifies application disposal scope. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/Unity.GrantManager.Application.csproj | Adds XML cryptography dependency pin. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/Notifications/AutomatedNotificationAppService.cs | Adds permissions and transactional template locking. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/Messaging/OutboxWorkerBase.cs | Adopts shared worker execution context. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/Messaging/InboxWorkerBase.cs | Adds tenant-scoped handler auditing. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/Integrations/Endpoints/EndpointManagementAppService.cs | Restricts endpoint administration. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/Intakes/BackgroundWorkers/IntakeSyncWorker.cs | Adds tenant audit scopes. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/History/HistoryAppService.cs | Requires authenticated access. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/History/AuditLogCleanupWorker.cs | Adopts tenant-scoped worker auditing. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/HealthChecks/BackgroundWorkers/DataHealthCheckWorker.cs | Adds tenant audit scopes. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/GrantsPortal/Notifications/ApplicantUpdateEmailRecoveryWorker.cs | Adds tenant-scoped recovery auditing. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/GrantsPortal/GrantsPortalMessageCleanupWorker.cs | Adopts shared worker execution context. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/GrantManagerApplicationModule.cs | Registers background-execution authorization. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/Events/DateBasedScheduledNotificationJob.cs | Adds tenant-scoped notification auditing. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/Applicants/BackgroundWorkers/FiscalYearEndRolloverWorker.cs | Adds tenant-scoped rollover auditing. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/Applicants/BackgroundWorkers/ApplicantTenantMapReconciliationWorker.cs | Adopts shared worker execution context. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application.Contracts/Unity.GrantManager.Application.Contracts.csproj | Adds XML cryptography dependency pin. |
| applications/Unity.GrantManager/package.json | Adds solution-level DOMPurify dependency. |
| applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Unity.AspNetCore.Mvc.UI.Theme.UX2.csproj | Adds theme embedding and Razor inputs. |
| applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Layouts/Empty.cshtml | Adds development browser refresh. |
| applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Layouts/Application.cshtml | Adds development browser refresh. |
| applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Layouts/Account.cshtml | Adds development browser refresh. |
| applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Components/Topbar/Default.cshtml | HTML-encodes badge claims. |
| applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Components/Toolbar/UserMenu/Default.cshtml | Uses current tenant availability. |
| applications/Unity.GrantManager/modules/Unity.SharedKernel/Utils/UnityQuartzBackgroundWorkerBase.cs | Centralizes worker identity and auditing. |
| applications/Unity.GrantManager/modules/Unity.SharedKernel/Utils/BackgroundJobContext.cs | Separates execution and audit scopes. |
| applications/Unity.GrantManager/modules/Unity.SharedKernel/Utils/BackgroundExecutionAuthorizationHandler.cs | Authorizes trusted background execution. |
| applications/Unity.GrantManager/modules/Unity.SharedKernel/Unity.SharedKernel.csproj | Adds Quartz and cryptography references. |
| applications/Unity.GrantManager/modules/Unity.SharedKernel/MessageBrokers.RabbitMQ/QueueConsumerHandler.cs | Adds bounded retries and isolates audit failures. |
| applications/Unity.GrantManager/modules/Unity.SharedKernel/MessageBrokers.RabbitMQ/QueueChannelProvider.cs | Implements delayed retry publishing. |
| applications/Unity.GrantManager/modules/Unity.SharedKernel/MessageBrokers.RabbitMQ/Interfaces/IQueueChannelProvider.cs | Defines retry-publishing contract. |
| applications/Unity.GrantManager/modules/Unity.SharedKernel/MessageBrokers.RabbitMQ/Constants/QueueingConstants.cs | Defines retry limits and delays. |
| applications/Unity.GrantManager/modules/Unity.Payments/test/Unity.Payments.Application.Tests/PaymentRequests/CasPaymentRequestCoordinatorTests.cs | Tests concurrency retries and stale results. |
| applications/Unity.GrantManager/modules/Unity.Payments/test/Unity.Payments.Application.Tests/Domain/PaymentRequests/PaymentRequest_Constructor_Tests.cs | Tests Level 3 slot management. |
| applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Web/Pages/PaymentApprovals/UpdatePaymentRequestStatus.cshtml.cs | Removes mutations during modal rendering. |
| applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Application/PaymentRequests/CasPaymentRequestCoordinator.cs | Adds concurrency-aware CAS updates. |
| applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Application/PaymentRequests/BackgroundJobWorkers/ReconciliationProducer.cs | Adopts shared worker execution context. |
| applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Application/PaymentRequests/BackgroundJobWorkers/FinancialSummaryNotifier.cs | Exposes per-tenant notification execution. |
| applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Application/PaymentRequests/BackgroundJobWorkers/FinancialNotificationSummaryWorker.cs | Wraps tenant notifications in audit scopes. |
| applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Application/Domain/Services/PaymentsManager.cs | Updates approval slots during commands. |
| applications/Unity.GrantManager/modules/Unity.Payments/src/Unity.Payments.Application/Domain/PaymentRequests/PaymentRequest.cs | Adds Level 3 slot management. |
| applications/Unity.GrantManager/modules/Unity.Notifications/test/Unity.Notifications.EntityFrameworkCore.Tests/TemplateLockRepositoryTests.cs | Tests active tenant-template lookup. |
| applications/Unity.GrantManager/modules/Unity.Notifications/test/Unity.Notifications.Application.Tests/TemplatesServiceTests.cs | Supplies new service dependencies. |
| applications/Unity.GrantManager/modules/Unity.Notifications/test/Unity.Notifications.Application.Tests/ScheduledNotificationHelperTests.cs | Tests decline-rationale token rendering. |
| applications/Unity.GrantManager/modules/Unity.Notifications/src/Unity.Notifications.Web/Views/Settings/NotificationsSettingGroup/Default.js | Stops deletion when preflight fails. |
| applications/Unity.GrantManager/modules/Unity.Notifications/src/Unity.Notifications.Web/Pages/Notifications/Index.js | Corrects table reload references. |
| applications/Unity.GrantManager/modules/Unity.Notifications/src/Unity.Notifications.EntityFrameworkCore/Repositories/TemplatesRepository.cs | Implements transactional template locking. |
| applications/Unity.GrantManager/modules/Unity.Notifications/src/Unity.Notifications.EntityFrameworkCore/EntityFrameworkCore/NotificationsDbContextModelCreatingExtensions.cs | Changes template-variable type default. |
| applications/Unity.GrantManager/modules/Unity.Notifications/src/Unity.Notifications.Domain/Templates/ITemplatesRepository.cs | Adds active-template locking contract. |
| applications/Unity.GrantManager/modules/Unity.Notifications/src/Unity.Notifications.Application/Templates/TemplatesService.cs | Adds permissions and protected deletion. |
| applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Views/Shared/Components/QuestionSelectListWidget/QuestionSelectListViewModel.cs | Makes property hiding explicit. |
| applications/Unity.GrantManager/modules/Unity.Flex/src/Unity.Flex.Web/Pages/Components/DataGrid/DataGridWriteService.cs | Makes row deletion publicly callable. |
| applications/Unity.GrantManager/modules/Unity.AI/src/Unity.AI.Application/Unity.AI.Application.csproj | Updates ImageSharp dependency. |
| applications/Unity.GrantManager/global.json | Pins the .NET SDK. |
| applications/Unity.GrantManager/common.props | Updates shared cryptography pin and warning suppression. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+490
to
+492
| b.HasIndex(x => x.EmailTemplateId); | ||
| // Foreign key constraint prevents concurrent template deletion races. | ||
| b.HasOne<EmailTemplate>().WithMany().HasForeignKey(x => x.EmailTemplateId).IsRequired().OnDelete(DeleteBehavior.Restrict); |
| return Ok(new List<RecipientDto>()); | ||
| } | ||
|
|
||
| [Authorize(GrantManagerPermissions.NotificationScheduler.Default)] |
…com/bcgov/Unity into feature/AB#34582-TightenAPISecurity
…com/bcgov/Unity into feature/AB#34582-TightenAPISecurity
|
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





No description provided.