Skip to content

Security Task Company Checks REST API

Ed Mozley edited this page Nov 17, 2026 · 1 revision

Security: tasks could reach another company's work through the REST API

Fixed in 5.5.0 Β· Reported and fixed by @cloudcogsio (#371, PR #372) Β· Present in every release from 1.0.0 up to and including 5.4.1 Β· Affects multi-company installs with company-limited API keys only Β· Module: Tasks, REST API


Timeline

Date What happened
16 November 2026 Reported in public issue #371 by @cloudcogsio, as part of a wider report on how the REST API handles a task's company. Reproduced the same day on a test install.
17 November 2026 Fixed by @cloudcogsio's PR #372, reviewed and merged after its 30 checks failed on the old code and passed with the change.
17 November 2026 Released in 5.5.0, and this write-up published.

Because the report was public from the start, there was no private period: the fix went out in the next release, which was cut as soon as it was merged. Upgrading to 5.5.0 is the fix. A single-company install was never affected, and neither was any install whose API keys can reach every company. The screens were not affected.

The short version

What that could do. Through POST /api/v1/tasks, an API key limited to some companies could:

  • link a new task to a change in another company - the change id was never checked against the key's companies, although a ticket id was;
  • create a subtask under another company's task, which put the new task in that company, out of the key's own reach;
  • learn whether a change number existed from the different reply for "no such change" and "a change you may link".

It could not read or change the other company's change or task itself - only attach new work to it.

Nothing to do beyond upgrading. If you want to be thorough, a task's history records who created it and what it was linked to.

What was wrong

TasksService::validateLink() (includes/services/tasks.php) checked a ticket_id against the caller's companies (ticketAccessible()), and a contract_id against contract visibility, but change_id and parent_task_id only had to exist:

case 'change_id':      $stmt = $conn->prepare("SELECT id FROM changes WHERE id = ?"); break;
case 'parent_task_id': $stmt = $conn->prepare("SELECT id FROM tasks WHERE id = ?");   break;

and a subtask always takes its parent's company, so the second one also moved the new task out of the key's scope.

The fix

Both links go through recordAccessible(), which reads the record's company (NULL is the Default company) and refuses one outside the caller's scope with the same "unknown id" answer as a record that does not exist, so the reply no longer confirms anything. A task linked to a change now takes the change's company, as one linked to a ticket did; a company that disagrees with the linked record is a 422. The same PR added company to the task API, the company_id filter, and refused company changes through PATCH - see REST API: Tasks.

Test: tests/api-task-company.php (30 checks over real HTTP, each refusal with a positive control).

Related

#371 Β· REST API: Tasks Β· Bugs resolved Β· Security: asset holders through the API

FreeITSM

Getting Started

Modules

Multi-tenancy (planned)

Responses to feedback

Blue sky thinking

Bugs resolved

Pull requests

Links

Clone this wiki locally