Add security policy to Engine-Only endpoints#2082
Merged
MarceloRGonc merged 6 commits intomainfrom Mar 6, 2026
Merged
Conversation
MarceloRGonc
commented
Mar 6, 2026
Comment on lines
+50
to
+53
| config: { | ||
| allowedPrincipals: [PrincipalType.ENGINE], | ||
| security: ENGINE_ROUTE_POLICY, | ||
| }, |
Contributor
Author
There was a problem hiding this comment.
The file has a preHandler. So this is the same behavior.
app.addHook('preHandler', allowWorkersOnly);
export const allowWorkersOnly: onRequestHookHandler = (request, _res, done) => {
if (request.principal.type !== PrincipalType.ENGINE) {
throw new ApplicationError({
code: ErrorCode.AUTHORIZATION,
params: {},
});
}
done();
};
MarceloRGonc
commented
Mar 6, 2026
Contributor
Author
There was a problem hiding this comment.
Same for this file
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a reusable “engine-only” security policy and applies it to Engine-only API endpoints to make their access rules explicit and consistent (OPS-3866).
Changes:
- Add shared
ENGINE_ROUTE_POLICYand supporting unscoped route/policy types in@openops/shared. - Attach
config.security: ENGINE_ROUTE_POLICYto multiple engine-only endpoints (workers, store-entry, project worker, flags, app-connection worker). - Begin wiring shared
UnscopedAuthorizationPolicyinto the server route-policy type definitions.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/shared/src/lib/authentication/model/principal-type.ts | Adds unscoped policy types and a shared ENGINE_ROUTE_POLICY. |
| packages/server/api/src/app/workers/engine-controller.ts | Applies ENGINE_ROUTE_POLICY to engine worker endpoints. |
| packages/server/api/src/app/store-entry/store-entry.controller.ts | Applies ENGINE_ROUTE_POLICY to store-entry endpoints. |
| packages/server/api/src/app/project/project-worker-controller.ts | Applies ENGINE_ROUTE_POLICY to the project worker endpoint. |
| packages/server/api/src/app/flags/flag.module.ts | Applies ENGINE_ROUTE_POLICY to the engine-only flags endpoint. |
| packages/server/api/src/app/core/security/route-policies/route-security-policy.ts | Imports shared UnscopedAuthorizationPolicy (currently conflicting with a local type). |
| packages/server/api/src/app/app-connection/app-connection-worker-controller.ts | Applies ENGINE_ROUTE_POLICY to the worker app-connection endpoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/server/api/src/app/core/security/route-policies/route-security-policy.ts
Show resolved
Hide resolved
|
bigfluffycookie
approved these changes
Mar 6, 2026
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.



Fixes OPS-3866.