• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 3 fuera de 21 páginas
Examen

WGU D385 ZHN1 Task 1 – Software Security and Testing | Complete Static Code Analysis, Python Application Logging, Debugging, Exception Handling & Unit Testing | 2026/2027 Updated

Document preview thumbnail
Vista previa 3 fuera de 21 páginas

WGU D385 ZHN1 Task 1 – Software Security and Testing | Complete Static Code Analysis, Python Application Logging, Debugging, Exception Handling & Unit Testing | 2026/2027 Updated

Vista previa del contenido

WGU D385 ZHN1 Task 1 – Software Security and Testing |
Complete Static Code Analysis, Python Application Logging,
Debugging, Exception Handling & Unit Testing | 2026/2027
Updated 50 QUESTIONS
Actual Q&A – A+ Guarantee Format | WGU D385 Software Security and Testing Task 1




1. A developer runs Bandit on a Python Flask app and gets B105:
hardcoded_password_string. The flagged line is api_key = 'sk_live_12345'.
Which is the most secure remediation?
A) Move the secret to an environment variable or secret manager and load via
os.getenv
B) Add # nosec comment to suppress the Bandit warning
C) Rename the variable to my_api_key but keep the literal value
D) Base64 encode the key and decode at runtime

Answer: B
<b>Rationale:</b> Option A is correct because secrets must not be in source
code; environment variables or a secret manager like AWS Secrets Manager
keeps them out of version control and allows rotation. Option B is wrong
because # nosec only hides the finding and leaves the vulnerability. Option C
is wrong because renaming does not remove the hardcoded secret; Bandit
still detects the entropy. Option D is wrong because Base64 is encoding not
encryption and is trivially reversible, still considered hardcoded.

2. During static analysis, a Python file contains cursor.execute(f"SELECT *
FROM users WHERE id = {user_id}"). Which vulnerability does Bandit rule B608
detect and what is the correct fix?
A) SQL injection; use parameterized query cursor.execute("SELECT * FROM
users WHERE id = %s", (user_id,))
B) Cross-site scripting; use html.escape()
C) Hardcoded password; move to .env
D) Insecure randomness; use secrets module

Answer: A

,<b>Rationale:</b> Option A is correct because f-string interpolation builds
SQL with untrusted input, enabling SQL injection; parameterized queries
separate code from data. Option B is wrong because XSS is for HTML
output, not SQL execution. Option C is wrong because this is not a secret
storage issue. Option D is wrong because randomness is unrelated to query
construction.

3. Your CI pipeline runs pylint and flake8. What is the key functional difference
between them for WGU D385 Task 1?
A) pylint performs deeper semantic analysis including type inference and design
issues; flake8 focuses on style and syntax via pycodestyle, pyflakes, and
mccabe complexity
B) Both tools only check for security vulnerabilities
C) flake8 executes unit tests
D) pylint is only a code formatter like black

Answer: A
<b>Rationale:</b> Option A is correct because pylint analyzes AST for
logical errors, undefined variables, and refactoring suggestions, while flake8
is a wrapper for style and simple logic errors. Option B is wrong because
neither is primarily a security scanner; Bandit is for security. Option C is
wrong because flake8 does not run pytest or unittest. Option D is wrong
because pylint is a linter not a formatter; black is the formatter.

4. Bandit reports B301: pickle deserialization. Code: data =
pickle.loads(user_uploaded_file). Why is this high severity?
A) pickle can execute arbitrary code during deserialization, allowing remote
code execution if loading untrusted data
B) pickle is slow and causes performance issues
C) pickle only works with integers
D) pickle requires internet connection

Answer: A
<b>Rationale:</b> Option A is correct because Python's pickle protocol can
call __reduce__ and execute arbitrary Python, so untrusted pickle is RCE.
Option B is wrong because performance is not a security severity. Option C is
wrong because pickle handles many types. Option D is wrong because pickle

, is offline serialization.

5. In static code analysis, what does SAST stand for and when is it run in the
SDLC for D385?
A) Static Application Security Testing; run on source code before execution,
early in CI pipeline
B) System Active Service Test; run after deployment in production
C) Software Acceptance Stress Test; run only during user acceptance
D) Secure API Standard Testing; run only on APIs

Answer: A
<b>Rationale:</b> Option A is correct because SAST analyzes source
without running it, ideal early to shift left. Option B is wrong because it invents
a term and timing is too late. Option C is wrong because acceptance testing
is functional not SAST. Option D is wrong because SAST covers whole
codebase not only APIs.

6. A Bandit scan shows B110: try_except_pass. The code has except: pass. Why
is this flagged as a security and maintainability issue?
A) Silently swallowing all exceptions hides failures including security-relevant
errors and makes debugging impossible
B) try/except blocks are banned entirely in Python
C) pass is a reserved keyword that crashes Python
D) It causes memory leak only

Answer: A
<b>Rationale:</b> Option A is correct because bare except: pass catches
SystemExit, KeyboardInterrupt and security exceptions like authentication
failures without logging, violating secure logging and error handling. Option B
is wrong because try/except is allowed when specific. Option C is wrong
because pass is valid syntax. Option D is wrong because memory leak is not
the primary concern.

7. Which Python construct would Bandit flag as B324: use of insecure hash MD5
for security purposes in password hashing?
A) hashlib.md5(password.encode()).hexdigest() used to store user passwords
B) hashlib.sha256() used for file integrity check with salt

Información del documento

Subido en
2 de noviembre de 2026
Número de páginas
21
Escrito en
2026/2027
Tipo
Examen
Contiene
Preguntas y respuestas
$18.49

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
GradeAchiver
3.5
(11)
Vendido
68
Seguidores
3
Artículos
7841
Última venta
2 días hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes