Detect Segregation of Duties Conflicts Through Inherited Roles
Last updated: November 29, 2026
Quick Overview
Users are granted roles, roles can inherit other roles, and each role grants permissions. Given a list of conflicting permission pairs (for example create vendor and release payment), return every user who effectively holds both sides of a conflict, and fail clearly if role inheritance has a cycle.
PwC
November 29, 20260
0
0 solved
Users are granted roles, roles can inherit other roles, and each role grants permissions. Given a list of conflicting permission pairs (for example create vendor and release payment), return every user who effectively holds both sides of a conflict, and fail clearly if role inheritance has a cycle.
Access reviews and segregation of duties analysis are a core part of PwC's IT audit and risk consulting work on ERP systems, where composite roles hide toxic permission combinations. The interviewer checks graph traversal with memoization, cycle detection, and output that an auditor can trust.
What the Interviewer Expects
- Model roles as a directed graph and compute effective permissions with DFS
- Memoize resolved roles so shared sub-roles are computed once
- Detect and report cycles instead of recursing forever
- Check each conflict pair against the user's effective permission set
- Return deterministic, sorted output
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you also report which role path granted each conflicting permission?
- How would you handle mitigating controls that waive a conflict for a specific user?
- Role graphs can have tens of thousands of roles; would you switch to an iterative DFS?
- How would you find the smallest set of role removals that clears a user?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Inputs: user_roles (user to directly assigned roles), role_children (composite role to inherited roles), role_perms (role to direct permissions), conflicts (permission pairs). Output: for each...
High-Level Design
Effective permissions of a role are its direct permissions unioned with those of every role it inherits. Compute this with DFS and three-color marking: unvisited, visiting, done. Hitting a visiting no...