Secure SDLC practices in Cybersecurity - Time & Space Complexity
We want to understand how the time needed for Secure SDLC practices grows as the project size increases.
How does adding more features or code affect the time spent on security steps?
Analyze the time complexity of the following Secure SDLC process steps.
// Simplified Secure SDLC steps
for each feature in project_features:
perform threat modeling
conduct secure code review
run security testing
fix identified vulnerabilities
This code snippet shows security tasks repeated for each feature in a project.
Look for repeated actions that take time.
- Primary operation: Looping through each feature to do security tasks.
- How many times: Once for every feature in the project.
As the number of features grows, the time spent on security tasks grows too.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 | 10 sets of security tasks |
| 100 | 100 sets of security tasks |
| 1000 | 1000 sets of security tasks |
Pattern observation: Time grows directly with the number of features; doubling features doubles the work.
Time Complexity: O(n)
This means the time needed grows in a straight line as the number of features increases.
[X] Wrong: "Security tasks take the same time no matter how many features there are."
[OK] Correct: Each feature adds more work because security checks must be done separately for each one.
Understanding how security work scales helps you explain project planning and risk management clearly.
"What if security testing was done only once for the whole project instead of per feature? How would the time complexity change?"
Practice
Solution
Step 1: Understand the purpose of Secure SDLC
Secure SDLC aims to include security at every stage of software creation, not just at the end.Step 2: Compare options with this goal
Only To integrate security measures throughout the software development process describes integrating security throughout the process, which matches the goal.Final Answer:
To integrate security measures throughout the software development process -> Option CQuick Check:
Secure SDLC = Integrate security [OK]
- Thinking security is only for testing phase
- Believing Secure SDLC speeds up development by skipping steps
- Assuming Secure SDLC ignores user needs
Solution
Step 1: Identify secure development practices
Static code analysis helps find security issues early in development.Step 2: Evaluate each option
Performing static code analysis to find vulnerabilities is a known secure practice; others ignore security or increase risk.Final Answer:
Performing static code analysis to find vulnerabilities -> Option AQuick Check:
Development phase = Static code analysis [OK]
- Skipping code reviews thinking they waste time
- Delaying security testing until after deployment
- Not protecting source code access
phases = ['Planning', 'Design', 'Development', 'Testing', 'Deployment']
security_checks = {'Planning': True, 'Design': True, 'Development': False, 'Testing': True, 'Deployment': True}
secure_phases = [phase for phase in phases if security_checks.get(phase)]
print(secure_phases)What will be the output?
Solution
Step 1: Understand the list comprehension filtering
The code selects phases where security_checks is True.Step 2: Check each phase's security status
'Development' is False, so it is excluded; others are True and included.Final Answer:
['Planning', 'Design', 'Testing', 'Deployment'] -> Option DQuick Check:
Filter True phases = ['Planning', 'Design', 'Testing', 'Deployment'] [OK]
- Including phases with False security checks
- Confusing list comprehension syntax
- Assuming all phases are included
phases = ['Planning', 'Design', 'Development', 'Testing', 'Deployment']
security_checks = {'Planning': True, 'Design': True, 'Development': False, 'Testing': True, 'Deployment': True}
all_secure = all(security_checks[phase] for phase in phases)
print(all_secure)What is the output and why?
Solution
Step 1: Understand the all() function usage
all() returns True only if every item is True; here it checks each phase's security status.Step 2: Check security status for each phase
'Development' is False, so all() returns False.Final Answer:
False, because 'Development' phase lacks security checks -> Option BQuick Check:
all() with one False = False [OK]
- Assuming all() returns True if most are True
- Thinking dictionary access causes error here
- Confusing all() with any()
Solution
Step 1: Identify the goal of adding automated security testing
The goal is to catch security issues early and continuously during development.Step 2: Evaluate options for fitting this goal
Integrate continuous security testing tools in the CI/CD pipeline uses automated tools integrated in CI/CD, ensuring continuous checks before deployment.Final Answer:
Integrate continuous security testing tools in the CI/CD pipeline -> Option AQuick Check:
Automated testing in CI/CD = Best practice [OK]
- Relying only on manual reviews after deployment
- Skipping testing to save time
- Leaving security testing optional
Ready to prove it?
Pass the test and this pattern moves unknown
