Skip to content

refactor: authorize migrated legacy API operations - #273

Open
ralphhanna wants to merge 1 commit into
security/trusted-principalfrom
refactor/migrate-legacy-api-operations
Open

refactor: authorize migrated legacy API operations#273
ralphhanna wants to merge 1 commit into
security/trusted-principalfrom
refactor/migrate-legacy-api-operations

Conversation

@ralphhanna

Copy link
Copy Markdown
Collaborator

Summary

Provides authorized server-side wrappers for the useful operations being migrated from legacy /api.

  • Adds BPMNAPI.engine.get
  • Qualifies execution lookup, restart, and start-event queries through the trusted principal
  • Adds cursor-based instance search through BPMNAPI.data.find
  • Ensures deletion and migrated data access use principal-qualified queries
  • Adds boundary coverage and a Bump lodash from 4.17.15 to 4.17.19 in /WebApp #5 changelog entry

Stack

Depends on security/trusted-principal (#4).

Validation

  • 4/4 server API boundary tests pass.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3897352078

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/API/API.ts
class APIData extends APIComponent {
public async find(options: any = {}, user?: ISecureUser) {
user=this.getUser(user);
options = { ...options, filter: user.qualifyInstances(options.filter || {}) };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Qualify the item returned by cursor searches

When a non-admin calls api.data.find with an items.* filter, qualifyInstances adds its authorization rules as a top-level $or, but Aggregate.find applies that $or before unwinding items while applying items.* predicates afterward. An instance containing both an Alice-visible item and a Bob-only item can therefore pass authorization through Alice's item and return Bob's item when the caller filters for it. Apply the authorization predicates to the same post-unwind item match, or prevent this wrapper from accepting item-level filters.

Useful? React with 👍 / 👎.

Comment thread src/API/API.ts
}
public async startEvent(query, elementId, data = {}, user?: ISecureUser, options:IEngineOptions = {}): Promise<IExecution> {
user=this.getUser(user);
query = user.qualifyItems(query);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Resolve the authorized instance before calling startEvent

When a normal non-admin passes the string instance ID expected by Engine.startEvent, this line sends that primitive through SecureUser.qualifyItems, whose implementation assigns $or and optionally tenantId properties to its argument. In ESM strict mode this throws TypeError: Cannot create property '$or' on string ..., so authenticated non-admin callers can no longer start secondary events. Build and qualify an instance query, resolve its ID, and pass that ID to the engine instead.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant