• 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 34 pages
Exam (elaborations)

Wgu D385 Software Security And Testing Static Code Analysis & Flake8 Practice Lab Python Security, Logging, Testing & Remediation| Instant Download

Document preview thumbnail
Preview 4 out of 34 pages

This WGU D385 study resource covers static code analysis with Flake8 and Bandit, Python security flaws, secure logging, password hashing, and remediation strategies. Each question includes four options, a keyed answer, and a rationale to help you understand why the correct choice is right. Use it to practice edge cases, spot distractors, and prepare for the exam.

Content preview

WGU D385 Software Security and
Testing Static Code Analysis & Flake8
Practice Lab Python Security, Logging,
Testing & Remediation 2026 | Verified
WGU D385 Software Security and Testing Static | Comprehensive
Examination
WGU D385 Software Security and Testing Static Code
Analysis & Flake8 Practice Lab Python Security, Logging,
Testing & Remediation 2026 actual exam preparation




INTRODUCTION
This document is an important and very helpful preparation
resource for WGU D385 Software Security and Testing Static
Code Analysis & Flake8 Practice Lab Python Security, Logging,
Testing & Remediation 2026. Every item uses a focused exam
stem, four response options, a keyed response, and a clear
rationale, making it easier to understand the subject, spot
distractors, and build real exam confidence.




Page 1

, Question 1
A flake8 run with the bandit plugin reports B301: pickle.loads() on untrusted
data. Which remediation best preserves functionality while eliminating the
vulnerability?
A. Replace pickle with json and validate the schema with pydantic before
use.
B. Wrap pickle.loads in a try/except and log the exception.
C. Use pickle.Unpickler with find_class restricted to a whitelist of safe
classes.
D. Enable Python's -X dev mode to catch deserialization errors.
Correct Answer: C - Use pickle.Unpickler with find_class
restricted to a whitelist of safe classes.


RATIONALE
Restricting find_class to a whitelist maintains pickle compatibility
while blocking arbitrary code execution. JSON (A) may not support
all types; try/except (B) does not prevent exploitation; -X dev (D) only
adds runtime checks, not security.

Question 2
In a CI pipeline, flake8 reports E501 line too long on a line containing a
hardcoded AWS secret. Which action best aligns with secure remediation and
linting policy?
A. Add # noqa: E501 to suppress the warning and commit.
B. Refactor the line and move the secret to an environment variable, then
rotate the exposed key.
C. Increase max-line-length in setup.cfg to 120.
D. Use a pre-commit hook to auto-format with black.
Correct Answer: B - Refactor the line and move the secret to an
environment variable, then rotate the exposed key.



Page 2

, RATIONALE
The secret must be removed from source and rotated; refactoring
addresses the lint issue. Suppression (A) or config change (C) hides
the problem; auto-formatting (D) does not remove the secret.

Question 3
Which flake8 plugin combination best detects both style and security issues in
Python code?
A. flake8-docstrings and flake8-import-order
B. flake8-bugbear and flake8-comprehensions
C. flake8-bandit and flake8-bugbear
D. flake8-annotations and flake8-quotes
Correct Answer: C - flake8-bandit and flake8-bugbear


RATIONALE
flake8-bandit integrates Bandit security checks; flake8-bugbear
catches likely bugs. The others focus on style, documentation, or
import ordering, not security.

Question 4
A developer uses logging.info(f"User {user} logged in with password
{password}"). What is the most critical security flaw?
A. Using f-strings instead of %-formatting causes performance overhead.
B. Logging at INFO level may be disabled in production.
C. Sensitive credentials are written to logs, risking exposure.
D. The log message lacks a timestamp and correlation ID.
Correct Answer: C - Sensitive credentials are written to logs,
risking exposure.




Page 3

, RATIONALE
Logging passwords is a severe data leakage vulnerability. Performance
(A) and log level (B) are secondary; missing metadata (D) is an audit
concern, not the primary flaw.

Question 5
Which testing approach is most effective for uncovering edge cases in a
function that parses untrusted input?
A. Unit tests with mocked inputs
B. Property-based testing with Hypothesis
C. Integration tests with a real database
D. Manual exploratory testing
Correct Answer: B - Property-based testing with Hypothesis


RATIONALE
Property-based testing generates diverse inputs to find edge cases.
Unit tests (A) may miss unexpected inputs; integration tests (C) focus
on system interaction; manual testing (D) is not systematic.

Question 6
A flake8 report shows F401 'module imported but unused' for the
'cryptography' module. What is the best remediation?
A. Remove the import if truly unused.
B. Add # noqa: F401 to suppress the warning.
C. Use the module in a dummy function to avoid the warning.
D. Move the import inside a function.
Correct Answer: A - Remove the import if truly unused.




Page 4

Document information

Uploaded on
September 29, 2026
Number of pages
34
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$30.00

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.
GoldenExams
4.4
(74)
Sold
81
Followers
20
Items
11448
Last sold
1 day 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