Skip to content

fix: add organization-level access control to human-inputs endpoints#264

Merged
betterclever merged 1 commit intomainfrom
fix/approval-idor-vulnerability
Feb 4, 2026
Merged

fix: add organization-level access control to human-inputs endpoints#264
betterclever merged 1 commit intomainfrom
fix/approval-idor-vulnerability

Conversation

@betterclever
Copy link
Contributor

Description

This PR fixes a critical IDOR vulnerability in the human-inputs (approvals) endpoints.

Problem

Approval requests were visible and accessible across all organizations, allowing users to:

  • View other organizations' approvals
  • Access approval details from other orgs
  • Potentially resolve approvals they don't own

Solution

  • Added organization-level filtering to all human-inputs endpoints (list, get, resolve)
  • Enforced authentication and organizationId validation in the controller
  • Used @CurrentAuth() decorator pattern consistent with the codebase
  • Throws UnauthorizedException if auth context or organizationId is missing

Changes

  • Controller: Added auth validation and organization context passing
  • Service: Added organizationId parameter to all query methods with org filtering
  • Tests: Added comprehensive unit tests covering IDOR protection scenarios

Files Modified

  • backend/src/human-inputs/human-inputs.controller.ts
  • backend/src/human-inputs/human-inputs.service.ts
  • backend/src/human-inputs/__tests__/human-inputs.service.test.ts (new)

Verification

✅ All tests pass (499 pass, 0 fail)
✅ Typecheck passes
✅ Lint passes (with fix)

- Add organization filtering to list(), getById(), resolve() methods
- Enforce authentication and organizationId validation in controller
- Prevent cross-organization approval access (IDOR vulnerability)
- Add comprehensive unit tests for IDOR protection

Fixes: Approval data was visible across all organizations
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c2a28-b06a-742a-a3bb-019eda8d723f
Co-authored-by: Amp <amp@ampcode.com>
@betterclever betterclever merged commit ce9ee58 into main Feb 4, 2026
3 checks passed
@LuD1161 LuD1161 deleted the fix/approval-idor-vulnerability branch February 12, 2026 22:39
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