Your company bans a specific unsafe internal helper function. How do you enforce it automatically?
IntermediateScenarioPipeline Security Scanning
Answer
Situation read → This is a custom SAST rule, which is cheap with Semgrep.
What I'd do →
- Write a rule:
rules:
- id: no-legacy-exec-helper
languages: [python]
severity: ERROR
message: "legacy_exec() is banned, use safe_run() instead"
pattern: legacy_exec(...)
- Test it with
semgrep --testusing annotated test files. - Publish it in a shared rules repo and run it in all pipelines:
semgrep ci --config ./rules. - Announce with a migration guide and an autofix where possible (
fix:).
Why → Codifying lessons from incidents means the same bug cannot return.
Interview tip → Mention rules as code with unit tests.
More on Pipeline Security Scanning
You are asked to add security to an existing CI pipeline. Where do SAST, SCA, secrets scanning and DAST each go?BeginnerGitleaks flags an AWS access key in a pull request. The developer says it is a test key. What do you do?BeginnerDevelopers fear security scans will slow the pipeline from 6 to 20 minutes. How do you roll them out?BeginnerA SAST tool reports 2,000 findings on a legacy repo the first time you run it. How do you introduce it without freezing delivery?IntermediateA developer insists a scanner finding is a false positive. What is your process?BeginnerSCA flags a critical CVE in a transitive dependency and no patched version exists. What are your options?Intermediate