Skip to content

refactor: migrate useful legacy routes into API v1 - #29

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

refactor: migrate useful legacy routes into API v1#29
ralphhanna wants to merge 1 commit into
security/trusted-principalfrom
refactor/migrate-legacy-api-operations

Conversation

@ralphhanna

@ralphhanna ralphhanna commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Migrates useful legacy operations into the canonical /api/v1 surface and routes each through BPMNAPI authorization.

Migrated

  • GET /engine/get
  • PUT /engine/restart
  • Cursor-based /datastore/find
  • Authorized instance deletion

Intentionally not migrated

  • /query because it duplicates instance search
  • /engine/status because it exposes global live-engine diagnostics
  • /engine/upgrade because it is privileged administration rather than a runtime operation

Includes route inventory tests and a #5 changelog entry.

Stack

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

Validation

  • 18/18 focused web 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: bf0e79d2c7

ℹ️ 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/routes/api-v1.ts
Comment on lines +349 to +353
const context = await api.engine.restart(
request.body.query,
request.body.data,
self.getUser(request),
request.body.options || {}

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 restart queries before executing them

When the runtime principal is a non-admin or belongs to a tenant, this route still allows its query to select an item owned by another user or tenant. BPMNAPI's APIEngine.restart only extracts user.userName and passes the original query unchanged to Engine.restart, which calls dataStore.findItem(itemQuery) directly; unlike invoke and assign, it never calls user.qualifyItems. Therefore, exposing this route on the default /api/v1 surface lets any holder of the runtime API key restart an arbitrary completed instance if they know a matching item query. Qualify the query with the trusted principal before calling restart.

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