Access control models (MAC, DAC, ABAC) in Cybersecurity - Time & Space Complexity
Start learning this pattern below
Jump into concepts and practice - no test required
We want to understand how the time it takes to check access permissions changes as the number of users and resources grows.
How does the system handle more users or rules without slowing down too much?
Analyze the time complexity of this simplified access check function.
function checkAccess(user, resource, action) {
for (let rule of accessRules) {
if (rule.appliesTo(user, resource, action)) {
return rule.isAllowed;
}
}
return false;
}
This code checks each access rule one by one to see if it applies to the user, resource, and action requested.
Look for loops or repeated checks in the code.
- Primary operation: Looping through all access rules.
- How many times: Once for each rule until a match is found or all rules are checked.
As the number of access rules grows, the time to check access grows too.
| Input Size (number of rules) | Approx. Operations (rule checks) |
|---|---|
| 10 | Up to 10 checks |
| 100 | Up to 100 checks |
| 1000 | Up to 1000 checks |
Pattern observation: The time grows roughly in direct proportion to the number of rules.
Time Complexity: O(n)
This means the time to check access grows linearly with the number of access rules.
[X] Wrong: "Checking access is always instant no matter how many rules there are."
[OK] Correct: Each rule must be checked until a match is found, so more rules mean more work and longer time.
Understanding how access checks scale helps you design systems that stay fast as they grow, a key skill in cybersecurity roles.
"What if access rules were organized in a way that lets us find the right rule without checking them all? How would that change the time complexity?"
Practice
Solution
Step 1: Understand MAC characteristics
MAC uses labels and system rules to control access, not user choice.Step 2: Compare with other models
DAC lets owners decide, ABAC uses attributes, RBAC uses roles. Only MAC uses labels and system rules.Final Answer:
Mandatory Access Control (MAC) -> Option AQuick Check:
Labels + system rules = MAC [OK]
- Confusing DAC with MAC because both control access
- Thinking ABAC uses labels like MAC
- Mixing RBAC roles with MAC labels
Solution
Step 1: Recall DAC definition
DAC allows resource owners to decide who can access their resources.Step 2: Eliminate other options
System-enforced labels describe MAC, attributes describe ABAC, roles describe RBAC.Final Answer:
Resource owners decide who can access their resources -> Option DQuick Check:
Owner control = DAC [OK]
- Confusing DAC with MAC which uses system labels
- Mixing ABAC attributes with DAC
- Assuming roles control DAC access
Solution
Step 1: Identify key access factors
Access depends on user attributes (department) and conditions (time).Step 2: Match model to attribute-based rules
ABAC uses attributes like department and time to decide access.Final Answer:
Attribute-Based Access Control (ABAC) -> Option CQuick Check:
Attributes + conditions = ABAC [OK]
- Choosing MAC because of strict rules
- Confusing RBAC roles with attributes
- Thinking DAC controls by owner only
Solution
Step 1: Analyze the setup
Users control sharing (DAC), but system enforces labels (MAC).Step 2: Identify conflict
Mixing DAC and MAC can cause conflicts because MAC labels cannot be overridden by users.Final Answer:
It mixes DAC and MAC models incorrectly -> Option BQuick Check:
Mixing DAC and MAC causes conflicts [OK]
- Assuming ABAC is used without attributes
- Thinking users can override MAC labels
- Ignoring the presence of enforced labels
Solution
Step 1: Identify requirements
Access depends on role, time, location (attributes) and security clearance labels (system-enforced).Step 2: Match models to requirements
ABAC handles attributes like role, time, location; MAC enforces security clearance labels.Step 3: Combine models for full coverage
Using MAC with ABAC covers both label enforcement and attribute-based conditions.Final Answer:
Mandatory Access Control (MAC) combined with Attribute-Based Access Control (ABAC) -> Option AQuick Check:
Labels + attributes = MAC + ABAC [OK]
- Choosing RBAC only, missing label enforcement
- Using DAC which lacks system labels
- Assuming ABAC alone handles security labels
