BETA Shoulder is in beta — Findings may sometimes be wrong. Your feedback shapes what we fix next. Share feedback
Rules / Go

Insecure Direct Object Reference (IDOR)

Description

Detects IDOR vulnerabilities where user-supplied IDs access resources without authorization checks.

What Shoulder detects

User-supplied ID used to access resource without authorization check

How to fix

Validate ownership before accessing resources.

```go
if requestedID != currentUserID && !isAdmin(currentUserID) {
    return errors.New("unauthorized")
}
```

Learn more: https://shoulder.dev/learn/go/cwe-639/idor

Applies to

Languages

References

Scan for this issue

Detect with Shoulder CLI
npx @shoulderdev/cli trust --rule=go-idor .

Related rules