• ¿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 30 páginas
Examen

WGU D385 Software Security and Testing | Python Secure-Coding Practice Workbook | 40 Exercises + 4 Capstones | 2026

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

Master the practical secure-coding skills covered in WGU D385 – Software Security and Testing with this detailed 30-page Python Secure-Coding Practice Workbook, created for focused September 2026 study and skills development. This resource contains 40 focused original exercises plus 4 integrated capstone activities, with worked solutions designed to help learners move beyond memorization and actually practice identifying, correcting, testing, and documenting software-security problems. Topics covered include: Python assertions and security validation, Python logging and sensitive-data protection, secure exception handling, input validation and allowlisting, authentication and authorization, access-control mistakes, insecure data handling, password and secret protection, unit testing, security regression testing, and debugging vulnerable Python code. The workbook also uses a structured secure-coding remediation workflow that guides you through reproducing a vulnerability, locating the problematic code, classifying the security issue, applying an appropriate fix, verifying the remediation with tests, and documenting the result. Each activity encourages hands-on analysis of trust boundaries, protected assets, failure modes, security properties, negative tests, positive tests, and remediation evidence, making this a strong supplementary resource for developing practical D385 security-testing skills. Includes: 30 pages of structured D385 practice 40 original secure-coding exercises 4 integrated capstone challenges Vulnerable Python code examples Step-by-step worked solutions Security checkpoints and explanations Positive and negative unit-testing practice Vulnerability identification and remediation Secure logging and debugging exercises Access-control and data-security scenarios The workbook is broadly aligned with D385 areas such as web security, permissions and identity security, debugging, log-file analysis, API security, and encryption/cryptography. Perfect for: WGU D385 students, Python secure-coding practice, software-security review, vulnerability-remediation practice, unit-testing preparation, and hands-on debugging skills.

Vista previa del contenido

D385 Software Security and Testing | Python Secure-Coding Practice Workbook | Sept 2026




WGU D385
Software Security and Testing
Python Secure-Coding Practice Workbook
Original exercises + worked solutions | September 2026 alignment edition


40 focused exercises + 4 integrated capstones
Assertions | logging | exception handling | input validation | access control | insecure data handling
| unit tests | debugging vulnerable code




STUDY USE NOTICE
This is an independently created practice workbook. It is not an official WGU assessment, rubric,
task submission, answer key, or reproduction of protected course content. Use it to practice secure-
coding reasoning and testing skills.




Original study workbook - not an official WGU assessment | Page 1

, D385 Software Security and Testing | Python Secure-Coding Practice Workbook | Sept 2026

1. September 2026 Course Alignment
Official catalog basis. The WGU Institutional Catalog - September 2026 describes D385 Software Security and
Testing as preparing learners to recognize software vulnerabilities, plan interventions, develop those
interventions, and test them. It names Web security, permissions and identity security, debugging, log file
analysis, API security, and encryption/cryptography concepts as course topics.
Important scope note: The catalog supports the broad alignment above. The Python-specific workbook topics requested here -
assertions, unittest patterns, concrete logging snippets, and the exact exercises - are original practice material and should not be
presented as official WGU tasks or exam questions.

Workbook topic D385 catalog area Practice emphasis
Assertions Debugging; testing interventions Internal invariants, unsafe assert usage,
regression tests
Python logging Log file analysis; debugging Severity, redaction, exception logging,
auditable denial events
Exception handling Debugging; intervention design Narrow catches, fail-closed behavior, safe
error responses
Input validation Web security; API security Type/range/length validation, allowlists,
path/file constraints
Access-control mistakes Permissions and identity security Ownership, roles, authentication vs.
authorization, default deny
Insecure data handling Encryption/cryptography; Web/API Secrets, password hashing interface,
security token comparison, minimization
Unit tests Develop and test interventions Boundary tests, negative tests, mocks,
security regressions
Debugging vulnerable code Recognize vulnerabilities; debugging; test Reproduce, classify, remediate, verify,
fixes document



2. How to Use This Workbook
 Attempt the vulnerable-code analysis before reading the worked solution.
 For each exercise, name the trust boundary, protected asset, failure mode, and intended security property.
 Run or adapt the snippets in an isolated local Python environment. Many examples use placeholders such as
repository, client, or policy_service to keep the focus on the security decision.
 After reviewing a remediation, write at least one negative test that reproduces the original unsafe condition
and one positive test that preserves intended functionality.
 Use the capstones at the end as integrated practice: identify, remediate, test, and document rather than
solving only one line of code.


3. Secure-Coding Debug Workflow
1. Reproduce: State the exact unsafe behavior and the conditions that trigger it.
2. Localize: Find the smallest code path responsible for the decision or data flow.
3. Classify: Label the issue: validation, access control, sensitive data, exception flow, logging, cryptographic
misuse, or another category.
4. Remediate: Change the control closest to the root cause; avoid cosmetic fixes.
5. Verify: Add tests for the original bad case, boundary cases, and expected legitimate behavior.
6. Document: Record the finding, risk, intervention, evidence, and remaining assumptions.




Original study workbook - not an official WGU assessment | Page 2

, D385 Software Security and Testing | Python Secure-Coding Practice Workbook | Sept 2026

Module 1 - Assertions: Internal Invariants vs. Security Validation
Alignment: Supports debugging and intervention testing. The Python emphasis is an original practice layer; the
September 2026 WGU catalog names debugging and testing interventions, but does not prescribe these exact
exercises.

Core concepts
 Use assert for internal developer assumptions and invariants, not for validating untrusted user input.
 Python assertions may be removed when the interpreter runs with optimization (-O), so security checks
must use explicit conditionals and exceptions.
 A good assertion states an invariant that should never be false if the program is correct.
 Unit-test assertions are different from production assert statements: test frameworks use assertions to
verify observable behavior.

Exercise 1.1 - Replace an Unsafe Authorization Assertion
Objective: Distinguish a developer assertion from an authorization control.
Scenario: A profile service uses assert to prevent ordinary users from editing administrator profiles.
Starting code
def update_profile(actor_role, target_role, display_name):
assert actor_role == "admin" or target_role != "admin"
return {"role": target_role, "display_name": display_name}

Your tasks
 Identify why the assert statement is unsafe as an access-control boundary.
 Rewrite the function so the security decision cannot disappear under optimized execution.
 Choose an exception type that makes the denial explicit.

Worked solution
class AuthorizationError(PermissionError):
pass


def update_profile(actor_role, target_role, display_name):
if target_role == "admin" and actor_role != "admin":
raise AuthorizationError("Administrator profile changes require admin privileges")
return {"role": target_role, "display_name": display_name}

Why this works: Authorization is a runtime security requirement. Explicit conditional logic remains active
regardless of Python optimization settings, while assert may not.
Security checkpoint: If a check protects data, identity, money, permissions, or another security boundary, do
not rely on production assert.

Exercise 1.2 - Preserve a Legitimate Internal Invariant
Objective: Recognize a case where assert is appropriate.
Scenario: A private helper normalizes a percentage before calling a formatter. All public callers validate the
input first.
Starting code
def _format_percentage(normalized):
# normalized is produced only by trusted internal code
return f"{normalized * 100:.1f}%"

Your tasks
 Add an assertion that documents the internal invariant.
 Explain why the assertion is acceptable here but would be insufficient at an API boundary.

Worked solution
Original study workbook - not an official WGU assessment | Page 3

Información del documento

Subido en
9 de septiembre de 2026
Número de páginas
30
Escrito en
2026/2027
Tipo
Examen
Contiene
Preguntas y respuestas
$18.99

¿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.
EvaTee
3.9
(990)
Vendido
5490
Seguidores
3584
Artículos
59527
Última venta
3 horas 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