# Scope Limited Token Check

> Verify that token scopes match the operations they permit, so a read-only or narrow scope never silently unlocks privileged functions. Use when the API supports scoped tokens, OAuth scopes or machine-service credentials that callers may hold at reduced width

- Skill: `wsh7ash/scope-limited-token-check` (Agent Skill)
- Install (CLI): `npx get-skill add wsh7ash/scope-limited-token-check`
- Raw SKILL.md: https://api.skillmd.com/api/skills/wsh7ash/scope-limited-token-check/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/scope-limited-token-check

---


# Scope-Limited Token Function Check

> Verify that token scopes match the operations they permit, so a read-only or narrow scope never silently unlocks privileged functions

**Use when:** the API supports scoped tokens, OAuth scopes or machine-service credentials that callers may hold at reduced width

**Avoid when:** authorization works purely on sessions and roles without any scope dimension to model

## Procedure

1. List all scopes the product issues, then outline which operations each scope should permit per the documentation.
2. Issue narrow tokens for your own account or machine-credentials and compare observed permitted set against expectations.
3. For read-only credentials, replay them against every mutating operation you can reach and record the outcomes.
4. Check scope-to-route-granularity: whether a scope gates an entire path family or the whole backend surface.
5. Look for operations that accept a scope-limited credential but behave in ways the scope family never advertised.
6. Build a scope-by-permission matrix so a reviewer can see which pairings are intended, redundant or unguarded.

## Signals

- A read-only narrow credential invokes an operation that writes or dispatches something the documentation never mentioned.
- One scope serves every operation in a path family, so revoking a specific width requires revoking a much broader grant.
- Operations ignore the scope dimension entirely, so scope is descriptive echo rather than a real authorization actor.
- Two scopes claim separation in the docs but a single token with one of them links both families' resources.

## Patterns

**1. Scope bin**

```text
scope=read:orders -> GET ok, POST /api/orders/status-change 200 -> read-only violated
```

**2. Granularity row**

```text
scopes apply at: route(3) path-family(5) resource(12) -> family-middle operations avoid per-scope checks
```

**3. Result row**

```text
scope=read:orders routes=23 writes-permitted=2 ops=status-change,export
```

## Pitfalls

- Testing with the owner's full-privileged service-token and calling that a scope test, which proves nothing.
- Missing machine-to-machine flows where a scope check exists only at ingress and not at the operation.
- Forgetting refresh-token behavior, where a refreshed narrower credential can quietly widen its scope family.

## Done when

- Every issued scope family has been tested against operations both inside and outside its documented width.
- A written scope x permission matrix is available and matches the observed outcomes before any report goes out.

## References

- [RFC 6749 - OAuth 2.0 authorization framework](https://www.rfc-editor.org/rfc/rfc6749)
- [OWASP - authorization testing guide](https://owasp.org/www-project-web-security-testing-guide/)

