• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 199 pages
Exam (elaborations)

WGU D522 Python for IT Automation — Secure Coding, Secrets and Logging Quick Reference | GitLab CI/CD and Security Checklists | Final Exam Practice 2026–2027

Document preview thumbnail
Preview 4 out of 199 pages

This quick-reference guide covers secure coding practices for Python IT automation, focusing on secrets management, application logging, GitLab CI/CD pipelines, and security checklists. It addresses secure credential handling, environment variables, sensitive data protection, error handling, log management, automated testing, pipeline security, and practical techniques for reducing security risks in automation scripts.

Content preview

WGU D522 PYTHON FOR IT AUTOMATION
SECURE CODING, SECRETS & LOGGING QUICK
REFERENCE | GITLAB CI/CD & SECURITY
CHECKLISTS
Final Exam Practice | 350 Questions with
Correct Answers & Detailed Rationales |
2026/2027




INTRODUCTION
This comprehensive practice exam is designed for students
preparing for the WGU D522 Python for IT Automation Final
Exam. The document contains 350 original practice questions
covering the core competency areas emphasized in the D522
security-focused exam blueprint: secure Python automation
against OWASP Top 10 vulnerabilities, secrets management and

,credential handling, structured logging and monitoring, GitLab
CI/CD security policies (SAST, DAST, dependency scanning), and
comprehensive security checklists for auditing automation
workflows .
Each question follows a four-option multiple-choice format
with a clearly identified correct answer and a detailed
rationale explaining why the correct choice reflects secure
coding and operational best practices, and why each distractor
represents a common but dangerous pattern. The questions
emphasize scenario-based application—diagnosing command
injection risks, configuring masked CI/CD variables,
implementing log redaction, and enforcing pipeline security
gates .
The guide is organized into seven sections: (1) Secure Python
Automation & OWASP Top 10 Mitigation; (2) Secrets
Management & Credential Handling; (3) Structured Logging,
Monitoring & Error Handling; (4) GitLab CI/CD Security Policies;
(5) Input Validation & Safe Command Execution; (6) Security
Checklists & Hardening Workflows; and (7) Integrated Scenarios
& Compliance.


SECTION 1: SECURE PYTHON AUTOMATION & OWASP TOP 10
MITIGATION
(Questions 1–60)

,Question 1
A Python automation script uses subprocess.run() with
shell=True to execute a user-supplied filename. Which
mitigation most effectively prevents command injection while
preserving functionality?
A) Validate the filename against a whitelist of allowed
characters
B) Use shlex.quote() to escape the filename before passing it to
the shell
C) Replace shell=True with a list of arguments and shell=False
D) Run the script with reduced privileges using a non-root user
Correct Answer: C
Rationale: Using shell=False with a list of arguments avoids
shell interpretation entirely, eliminating command injection.
Whitelisting (A) or quoting (B) may be bypassed by determined
attackers, and privilege reduction (D) does not prevent
injection—it only limits the damage after exploitation .


Question 2
A Python script constructs SQL queries by concatenating user
input. Which vulnerability does this introduce?

, A) Cross-site scripting (XSS)
B) SQL injection
C) Server-side request forgery (SSRF)
D) Insecure deserialization
Correct Answer: B
Rationale: Concatenating user input into SQL queries allows
attackers to inject malicious SQL, manipulating the query's
logic. Parameterized queries or prepared statements are the
correct mitigation .


Question 3
Which of the following is a primary risk of using pickle to
deserialize untrusted data in a Python automation script?
A) Pickle files are too large
B) Pickle can execute arbitrary code during deserialization
C) Pickle does not support dictionaries
D) Pickle cannot serialize strings
Correct Answer: B
Rationale: pickle deserialization can execute arbitrary code
embedded in the pickle data, making it a critical insecure
deserialization vulnerability. Untrusted data should never be
unpickled. JSON or other safe formats should be used instead .

Document information

Uploaded on
October 25, 2026
Number of pages
199
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$16.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Sold
14
Followers
1
Items
898
Last sold
23 hours ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions