Automating security
SecurityX CAS-005 · Lesson 18 of 24 · 2:39:40
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the CompTIA SecurityX (CAS-005) exam. In this lesson: scripting, scheduled tasks, and event-based triggers, infrastructure as code and configuration files, APIs, SDKs, and webhooks, SOAR runbooks and playbooks, automated patching and containment, generative AI, and SCAP (CVE, CPE, CVSS, OVAL, and XCCDF). Includes three original practice questions, with Thornbury Biotech, a fictional biotech company whose security architect designs and runs its security, as the example.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Four people, thousands of alerts
Thornbury Biotech's security team of four handles thousands of alerts a week, patches hundreds of servers by hand, and checks configurations once a year. Most of that work repeats the same steps. Automation can take over the repetition, as long as it is designed, tested, and secured like any other system.
Scripts and triggers
Scripting is the starting point: PowerShell manages Windows and Microsoft cloud services, Bash drives Linux and its command line tools, and Python works everywhere, with libraries for almost any API. Scripts need the same care as code: version control, peer review, signing where the platform supports it, and no secrets written inside them. Cron jobs on Linux and scheduled tasks on Windows run scripts at fixed times, like a nightly check of admin group members, or a weekly cleanup of stale accounts. Event-based triggers run automation when something happens instead, like a new alert, a file landing in a storage bucket, or a change in a cloud configuration, so the response starts in seconds. Each scheduled or triggered job runs under an identity, so give it only the rights it needs, and log what it does.
Code, configuration files, and APIs
Infrastructure as code describes networks, servers, and policies in files, so every deployment is identical, reviewed, and easy to rebuild, and security checks can scan the files before anything is deployed. Configuration files come in several formats: YAML relies on indentation and is common in pipelines and Kubernetes, JSON uses braces and is common in APIs and cloud policies, XML uses tags, and TOML uses simple sections of keys and values. A single wrong indent in YAML, or a missing comma in JSON, can break a deployment or quietly change a security setting, so validate files against a schema before use. Cloud APIs and software development kits, or SDKs, let scripts create, inspect, and fix resources, and webhooks push an event to a web address the moment it happens, instead of waiting to be asked. Protect API keys and webhook endpoints: store keys in a secrets manager, verify each webhook's signature, and accept requests only over TLS.
Orchestration and response
Security orchestration, automation, and response, or SOAR, connects tools like the SIEM, EDR, firewalls, and ticketing, and runs response steps automatically or with one click. A playbook describes the overall response to a type of incident, with decisions and roles, while a runbook lists the exact technical steps of one task, and SOAR turns both into workflows. Automatic containment acts without waiting for a person, like isolating a laptop when EDR detects ransomware behavior, or disabling an account after impossible travel. Because automatic actions can disrupt the business, reserve them for high-confidence detections, add approval steps for critical systems, and test playbooks before turning them on. Workflow automation handles the surrounding routine too: enriching alerts with threat intelligence, opening tickets, notifying owners, and closing the loop when the fix is confirmed.
Containers, patching, and generative AI
Containerization packages an application with its dependencies in an image, so security is built in once: scan the image, use minimal base images, and rebuild instead of patching running containers. Automated patching deploys fixes in rings, starting with a test group, then pilots, then everyone, with an automatic rollback when health checks fail. Generative AI helps with code assist, suggesting scripts, queries, and detection rules, and with documentation, drafting runbooks and summarizing incidents. Its output can be wrong, insecure, or invented, so review every suggestion like a colleague's code, test it, and never paste secrets or sensitive data into tools that are not approved. Automation multiplies good and bad changes alike, so every pipeline needs reviews, logging, and a way to stop it quickly.
Vulnerability scanning and reporting
Vulnerability scanning should run on a schedule and after every major change, so new systems and new flaws are found quickly. Credentialed scans sign in to each system, so they see installed software and missing patches, while uncredentialed scans only see what is exposed on the network. Prioritize with more than severity: combine the CVSS score with whether the flaw is actively exploited, how exposed the system is, and what data it holds. Reporting should go to the owners who fix things, with tickets created automatically, deadlines by severity, and trends that management can follow. End with a rescan that confirms each fix, and track exceptions with an owner and an expiry date.
SCAP
The Security Content Automation Protocol, or SCAP, is a suite of standards maintained by NIST that lets tools exchange checks and results in a common format. CVE gives each publicly known vulnerability a unique identifier, and CPE names platforms, products, and versions in a standard format, so a scanner knows which flaws apply to which software. CVSS scores severity from zero to ten, and version 4.0 adds threat and environmental metrics to the base score. OVAL describes how to test a system's state, like whether a patch is installed or a setting is correct, and XCCDF describes checklists, called benchmarks, built from rules grouped into profiles. Together, they let one tool check thousands of systems against a published benchmark, and produce results that other tools can process, for example for a compliance audit.
Recap
Let's recap. PowerShell, Bash, and Python scripts are code to review, run by cron jobs, scheduled tasks, or event-based triggers, under least privilege. Infrastructure as code and configuration files in YAML, JSON, XML, and TOML need validation, and APIs, SDKs, and webhooks need protected keys and signatures. SOAR runs playbooks and runbooks, automatic containment acts on high-confidence detections, and containers, patch rings, and generative AI all need review. Scanning runs on a schedule with credentials, prioritizes beyond CVSS, and closes the loop with rescans. And SCAP combines CVE, CPE, CVSS, OVAL, and XCCDF to check systems against benchmarks.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Thornbury wants a script to run within seconds whenever a storage bucket becomes publicly readable, and to make it private again. What should start the script?
- A cron job that runs every night
- An admin who runs it after each audit
- An event trigger on the policy change
- A yearly configuration review
Show the answer
An event trigger on the policy change
An event-based trigger fires as soon as the configuration changes, so the bucket is fixed in seconds. “A cron job that runs every night” would leave the bucket public for up to a day. “An admin who runs it after each audit” depends on audits, so the exposure could last for months. And “A yearly configuration review” is far too slow for an exposure like this.
Thornbury’s EDR detects ransomware behavior on a laptop at three in the morning, and the analysts start work at eight. What should happen automatically?
- Isolate the laptop from the network
- Reimage every laptop in the company
- Disable the EDR to save resources
- Wait for an analyst to approve each step
Show the answer
Isolate the laptop from the network
Ransomware behavior is a high-confidence detection, so automatic containment isolates the laptop at once, and analysts investigate later. “Reimage every laptop in the company” would disrupt the whole company for one device. “Disable the EDR to save resources” would remove protection when it matters most. And “Wait for an analyst to approve each step” would give the ransomware five hours to spread.
Auditors ask Thornbury to prove that five hundred Linux servers meet a published hardening benchmark, with results that their own tools can import. Which approach fits?
- A manual review of a sample of servers
- A SCAP scan with the XCCDF benchmark
- A CVSS score for each server
- An uncredentialed port scan of the network
Show the answer
A SCAP scan with the XCCDF benchmark
SCAP tools check every server against an XCCDF benchmark, using OVAL tests, and produce standard results that other tools can import. “A manual review of a sample of servers” would cover only part of the servers, in a format nobody can import. “A CVSS score for each server” only scores the severity of vulnerabilities, not configurations. And “An uncredentialed port scan of the network” only sees open ports, not the settings on each server.