# Object Relationship Mapping

> Map which objects reference which, so object-level tests can follow ownership chains instead of guessing identifier pairs. Use when the API exposes several object types with references between them, such as accounts, orders, invoices and files

- Skill: `wsh7ash/object-relationship-mapping` (Agent Skill)
- Install (CLI): `npx get-skill add wsh7ash/object-relationship-mapping`
- Raw SKILL.md: https://api.skillmd.com/api/skills/wsh7ash/object-relationship-mapping/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: Wsh7Ash (https://skillmd.com/u/wsh7ash)
- Updated: 2026-11-22
- Page: https://skillmd.com/skills/wsh7ash/object-relationship-mapping

---


# Object Relationship Mapping

> Map which objects reference which, so object-level tests can follow ownership chains instead of guessing identifier pairs

**Use when:** the API exposes several object types with references between them, such as accounts, orders, invoices and files

**Avoid when:** a single flat object type is exposed with no relationships to reason about

## Procedure

1. List object types from schemas and responses, then record the ownership field each one carries: owner, tenant, organization or parent.
2. Draw the reference graph: which object embeds, points at or lists another object's identifier.
3. Mark edges where ownership can change over time, such as transferred accounts or shared workspaces.
4. Identify list endpoints that return identifiers you do not own, since those feed directly into object-level tests.
5. Note aggregation endpoints that read several object types, where a check on one type often gets forgotten.
6. Persist the graph so later tests can say precisely which relationship a failing check would violate.

## Signals

- A list endpoint returns identifiers belonging to objects outside the caller's tenant.
- An object references a parent by identifier alone, with no ownership field on the child record.
- Ownership is derived from a header or host rather than from the session, which invites confusion about who is asking.
- Shared or delegated access exists, meaning ownership is a set of principals rather than one column.

## Patterns

**1. Graph edge**

```text
account 1--n order   ownership=account_id on order
order   1--n invoice ownership=order_id  on invoice (derived, not stored)
```

**2. Aggregation risk**

```text
GET /dashboard joins account, orders, invoices
-> any one missing ownership filter leaks the others' data
```

**3. Change note**

```text
workspace.transfer() moves membership -> re-test edges after transfer
```

## Pitfalls

- Assuming stored ownership when the field is derived at query time and can miss a filter.
- Ignoring shared-resource models where a single owner column does not exist.
- Building the graph from documentation while the implementation adds relationships the docs omit.

## Done when

- Every object type has a recorded ownership mechanism and the reference graph covers all documented edges.
- Aggregation and shared-ownership cases are marked as higher-risk edges for the object-level phase.

## References

- [OWASP API Security Top 10 - BOLA](https://owasp.org/www-project-api-security/)
- [OWASP Web Security Testing Guide](https://owasp.org/www-project-web-security-testing-guide/)

