• 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 Task 1 Performance Assessment Guide Software Security & Testing Python Logging, Assertions, Static Code Analysis & Testing| Instant Download

Document preview thumbnail
Preview 4 out of 34 pages

This WGU D385 Task 1 guide covers software security and testing with Python logging, assertions, static code analysis, and testing techniques. Each question includes four options, a keyed answer, and a rationale explaining why the correct choice works and why distractors fail. Use it to practice exam-style scenarios and strengthen your understanding of secure coding and testing concepts.

Content preview

WGU D385 Task 1 Performance
Assessment Guide Software Security &
Testing Python Logging, Assertions,
Static Code Analysis & Testing 2026 |
WGU D385 Task 1 Performance Assessment Guide |
Comprehensive Examination
WGU D385 Task 1 Performance Assessment Guide Software
Security & Testing Python Logging, Assertions, Static Code
Analysis & Testing 2026 actual exam preparation document




INTRODUCTION
This document is an important and very helpful preparation
resource for WGU D385 Task 1 Performance Assessment Guide
Software Security & Testing Python Logging, Assertions, Static
Code Analysis & Testing 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 logging configuration uses logging.basicConfig(format='%(asctime)s
%(levelname)s %(message)s') and logs a user-supplied username directly. An
attacker sets the username to a string containing a newline followed by a
forged log entry. Which mitigation most directly prevents log injection while
preserving structured auditability?
A. Set the logging level to WARNING to reduce the attack surface.
B. Use a JSON formatter that serializes the message field and escapes
control characters.
C. Wrap the log call in a try/except to catch injection exceptions.
D. Encode the username with base64 before logging.
Correct Answer: B - Use a JSON formatter that serializes the
message field and escapes control characters.


RATIONALE
Structured JSON logging serializes and escapes newlines/control
characters, neutralizing forged entries while keeping fields queryable.
Level changes and exception handling do not sanitize content, and
base64 obscures but does not structurally separate attacker-controlled
data from log metadata.

Question 2
A developer writes: assert user.is_admin, 'denied' to guard a privileged
function, then deploys with PYTHONOPTIMIZE=1. Which statement best
characterizes the resulting security posture?
A. The assertion still raises AssertionError because the message is
present.
B. The assertion is stripped, so the guard never executes and the function
becomes unconditionally accessible.
C. The assertion is converted to a warning but execution continues.
D. PYTHONOPTIMIZE only affects docstrings, so the assertion is


Page 2

, unaffected.


Correct Answer: B - The assertion is stripped, so the guard never
executes and the function becomes unconditionally accessible.


RATIONALE
Under -O/PYTHONOPTIMIZE, the compiler removes assert
statements entirely, eliminating the guard and its message. Assertions
must never enforce security; explicit if/raise or authorization
decorators are required. The other options misstate optimization
semantics.

Question 3
Bandit reports B301 (pickle) on a function that deserializes data from a trusted
internal queue, but the queue is fed by a webhook that accepts unauthenticated
JSON. Which action best reflects correct triage?
A. Suppress B301 with # nosec because the queue is internal.
B. Treat the finding as a true positive and replace pickle with a safe
format (e.g., JSON) plus schema validation.
C. Downgrade severity to LOW because the queue is internal.
D. Add a try/except around pickle.loads to catch malicious payloads.
Correct Answer: B - Treat the finding as a true positive and
replace pickle with a safe format (e.g., JSON) plus schema
validation.


RATIONALE
Taint flows from an unauthenticated webhook through the queue to
pickle.loads, making the finding a true positive with potential RCE.
Suppression or severity downgrade ignores the taint path, and
try/except cannot prevent code execution during deserialization.




Page 3

, Question 4
A test suite achieves 100% line coverage yet misses a bug where a function
returns None for empty input. Which testing technique would most likely
expose this defect?
A. Increasing line coverage to 100% on all branches.
B. Adding property-based tests that assert invariants across generated
inputs, including empty sequences.
C. Running the suite under pytest -x to stop on first failure.
D. Adding more assertions inside the function under test.
Correct Answer: B - Adding property-based tests that assert
invariants across generated inputs, including empty sequences.


RATIONALE
Line coverage does not guarantee oracle quality or input diversity;
property-based testing generates edge cases like empty inputs and
checks invariants, exposing the None return. Branch coverage may
still miss it, -x only changes failure handling, and internal assertions
do not create external test oracles.

Question 5
A Semgrep rule flags f"SELECT * FROM users WHERE name = '{name}'"
but the codebase uses a custom ORM that parameterizes queries before
execution. What is the most rigorous next step?
A. Disable the rule globally to reduce false positives.
B. Verify the ORM's parameterization path with a taint-mode Semgrep
rule and adjust the rule's sanitizer configuration.
C. Convert all queries to string concatenation to satisfy the rule.
D. Add # nosemgrep to every flagged line.
Correct Answer: B - Verify the ORM's parameterization path
with a taint-mode Semgrep rule and adjust the rule's sanitizer
configuration.


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