




























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























Question 1: What is the Task 2 scenario in one line? A. A healthcare API suffering from HIPAA violations requiring encryption B. Internal Construction Equipment Rental API (v2.2.0, endpoints under /api/v1/) suffering unauthorized access attempts, suspicious input patterns, and failing authorization logic C. A banking application requiring PCI-DSS compliance D. A retail website experiencing DDoS attacks Correct Answer: B. Internal Construction Equipment Rental API (v2.2.0, endpoints under /api/v1/) suffering unauthorized access attempts, suspicious input patterns, and failing authorization logic Rationale: Task 2 involves securing the Internal Construction Equipment Rental API (v2.2.0, endpoints under /api/v1/) that is suffering unauthorized access attempts, suspicious input patterns, and failing authorization logic - you are the developer securing it. Source: WGU D385 Task 2 Secure Coding and API Security Updated Actual Questions
in template) C. Only the test script D. Only the report template Correct Answer: B. app_student.py (vulnerable code), task_2_flake8_report.txt (general vulns for Section A), task_2_bandit_report.txt (API vulns for Section B), network_security_log.txt (attack evidence), penetration_test_report.json (fill-in template) Rationale: The evidence files provided with the starter are app_student.py (vulnerable code), task_2_flake8_report.txt (general vulns for Section A), task_2_bandit_report.txt (API vulns for Section B), network_security_log.txt (attack evidence), and penetration_test_report.json (fill-in template). Source: WGU D385 Task 2 Secure Coding and API Security Question 5: What security principles does the Task 2 intro name? A. Encryption, hashing, salting, and TLS only B. Least privilege, defense in depth, encryption, API keys, and OAuth C. Authentication, authorization, and accounting D. Confidentiality, integrity, and availability Correct Answer: B. Least privilege, defense in depth, encryption, API keys, and OAuth Rationale: The security principles the task intro names are least privilege, defense in depth, encryption, API keys, and OAuth - be ready to explain how each protects modern APIs. Source: WGU D385 Task 2 Secure Coding and API Security Question 6: What course textbook should be cited in the Task 2 report? A. "Clean Code" by Robert Martin B. "Full Stack Python Security" by Dennis Byrne C. "The Web Application Hacker's Handbook" D. "Security Engineering" by Ross Anderson
Correct Answer: B. "Full Stack Python Security" by Dennis Byrne Rationale: The course textbook to cite in the report is "Full Stack Python Security" by Dennis Byrne - hashing/salting, TLS, and attack chapters map directly to D1-D sections. Source: WGU D385 Task 2 Secure Coding and API Security Question 7: What are the two submission gates before evaluation? A. Peer review and instructor approval B. WGU similarity checker and Grammarly for Education C. Automated testing and manual review D. Plagiarism check and citation review Correct Answer: B. WGU similarity checker and Grammarly for Education Rationale: The two submission gates before evaluation are the WGU similarity checker (wait for the report and review it) and Grammarly for Education (submission cannot pass without professional communication passing). Source: WGU D385 Task 2 Secure Coding and API Security Question 8: What does Section A of the Task 2 rubric require (A1-A3)? A. Pick 2 general vulnerabilities from the flake8 report; screenshot insecure code with line numbers; implement secure replacement; comment out original code B. Pick 2 API vulnerabilities from Bandit report C. Write 4 tests D. Explain encryption methods Correct Answer: A. Pick 2 general vulnerabilities from the flake report; screenshot insecure code with line numbers; implement secure replacement; comment out original code
Rationale: Section C requires C1 pytest functions named test_*, C2 assert in every test, C3 all tests pass, C4 descriptive print() lines explaining each outcome for the console screenshot, and C5 four passing-test screenshots: 2 general + 2 API. Source: WGU D385 Task 2 Complete Practice Guide Question 11: What does Section D of the Task 2 rubric require (D1-D4)? A. D1 two mitigation strategies for EACH of the 4 remediated vulnerabilities, D2 two input validation techniques, D3 two exception handling improvements, D4 one encryption method securing application traffic B. Only D C. Only D D. D1 one mitigation strategy, D2 one validation technique Correct Answer: A. D1 two mitigation strategies for EACH of the 4 remediated vulnerabilities, D2 two input validation techniques, D two exception handling improvements, D4 one encryption method securing application traffic Rationale: Section D report structure requires D1 two mitigation strategies for EACH of the 4 remediated vulnerabilities, D2 two input validation techniques, D3 two exception handling improvements, and D4 one encryption method securing application traffic. Source: WGU D385 Task 2 Complete Practice Guide Question 12: Why should you comment out the original insecure code instead of deleting it? A. To save file space B. The evaluator must see before-and-after in the same file - proof you found the exact lines, replaced them securely, and disabled the old path C. To maintain code readability D. To avoid syntax errors
Correct Answer: B. The evaluator must see before-and-after in the same file - proof you found the exact lines, replaced them securely, and disabled the old path Rationale: The evaluator must see before-and-after in the same file - proof you found the exact lines, replaced them securely, and disabled the old path; secure replacements must not introduce new vulnerabilities. Source: WGU D385 Task 2 Complete Practice Guide
Question 13: What vulnerability exists in require_api_key() as shipped? A. Returns None, meaning NO endpoint is ever authenticated (CWE-306) B. Returns True, allowing all access C. Properly validates API keys D. Logs all requests Correct Answer: A. Returns None, meaning NO endpoint is ever authenticated (CWE-306) Rationale: require_api_key() as shipped always returns None, meaning NO endpoint is ever authenticated (CWE-306 Missing Authentication for Critical Function). The fix is to read the Authorization header, strip the Bearer prefix, validate the key against USERS_DB, and return the username or None. Source: WGU D385 Task 2 Secure Coding and API Security Question 14: What is the remediation for missing authentication (CWE- 306)?
user > guest C. Implement rate limiting D. Log all requests Correct Answer: B. Look up the user's role in USERS_DB and enforce the hierarchy admin > user > guest Rationale: The remediation for broken authorization is to look up the user's role in USERS_DB and enforce the hierarchy admin > user > guest. This ensures that users can only access resources they are authorized to use. Source: WGU D385 Task 2 Secure Coding and API Security Question 17: What vulnerability exists in check_rate_limit() as shipped? A. Always returns True - no rate limiting at all (CWE-307) B. Always returns False - blocks all requests C. Properly limits requests D. Logs all rate limit checks **Correct Answer: A. Always returns True - no rate limiting at all (CWE-
Rationale:** check_rate_limit() as shipped always returns True - no rate limiting at all (CWE-307 Improper Restriction of Excessive Authentication Attempts). The fix is to track request counts per IP or API key per time window and reject over the cap. Source: WGU D385 Task 2 Secure Coding and API Security Question 18: What is the remediation for missing rate limiting (CWE-307)? A. Cap requests per key/IP per window (e.g., Flask-Limiter) and return 429 Too Many Requests B. Encrypt the API C. Add more servers D. Log all requests
Correct Answer: A. Cap requests per key/IP per window (e.g., Flask- Limiter) and return 429 Too Many Requests Rationale: The remediation for missing rate limiting is to cap requests per key/IP per window (e.g., Flask-Limiter) and return 429 Too Many Requests. Unlimited requests enable brute force and DoS. Source: WGU D385 Full Course Bank Question 19: What vulnerabilities exist in the admin endpoints? A. GET /api/v1/admin/users and DELETE /api/v1/admin/delete_user have zero authentication or authorization - a destructive delete anyone can call (CWE- 306, broken access control) B. Only missing rate limiting C. Only SQL injection D. Only XSS vulnerability Correct Answer: A. GET /api/v1/admin/users and DELETE /api/v1/admin/delete_user have zero authentication or authorization
- a destructive delete anyone can call (CWE-306, broken access control) Rationale: GET /api/v1/admin/users and DELETE /api/v1/admin/delete_user have zero authentication or authorization - a destructive delete anyone can call (CWE-306, broken access control). Source: WGU D385 Task 2 Secure Coding and API Security Question 20: What is the remediation for broken access control on admin endpoints? A. Requiring authentication then enforcing role checks (least privilege) on every endpoint, not just the UI B. Encrypting the API C. Adding more servers D. Logging all requests
Rationale: The principle of least privilege ensures that users, processes, and systems have only the minimum levels of access and permissions necessary to perform their specific tasks. This reduces the potential attack surface and minimizes the risk of unauthorized or unintended actions. Source: WGU D385 OA | Objective Assessment Question 23: What is the difference between authentication and authorization? A. Authentication grants access; authorization verifies identity B. Authentication encrypts data; authorization decrypts data C. Authentication verifies identity; authorization determines access rights D. They are the same concept Correct Answer: C. Authentication verifies identity; authorization determines access rights Rationale: Authentication is the process of verifying who a user is, while authorization determines what a user can do. Authentication confirms a user's identity; authorization determines what resources they can access. Source: WGU D385 OA | Objective Assessment Question 24: What is the primary purpose of authentication in an API? A. To verify the identity of the client making the request B. To determine what actions the client is allowed to perform C. To encrypt the data transmitted between client and server D. To log all API requests for auditing Correct Answer: A. To verify the identity of the client making the request Rationale: Authentication verifies the identity of the client making the request. Authorization determines what actions the authenticated client is allowed to perform. Encryption protects data in transit, and logging provides an audit trail.
Source: WGU D385 V2 Software Security and Testing Master Study Guide Question 25: Which of the following is a common method for API authentication? A. OAuth 2. B. API keys C. JWT (JSON Web Tokens) D. All of the above Correct Answer: D. All of the above Rationale: OAuth 2.0, API keys, and JWT are all common methods for API authentication. Each has different use cases and security considerations. Source: WGU D385 V2 Software Security and Testing Master Study Guide Question 26: What is the primary purpose of rate limiting in an API? A. To prevent denial-of-service attacks and abuse B. To improve API performance C. To authenticate users D. To log API requests Correct Answer: A. To prevent denial-of-service attacks and abuse Rationale: Rate limiting controls the number of requests a client can make in a given time period, preventing denial-of-service attacks and abuse. It is a critical security control for public APIs. Source: WGU D385 V2 Software Security and Testing Master Study Guide Question 27: What is privilege escalation?
C. Access any website without restrictions D. Disable firewalls Correct Answer: A. Override same-origin policy for specific resources Rationale: CORS allows users to override the same-origin policy for specific resources. The access control allow origin client sends a request to the server, and the server sends back the ACAO (Access Control Allow Origin) header. Source: WGU D385 Software Security and Testing Complete Exam Review Question 30: Which protocol caches a token after it has been acquired? A. MSAL B. Auth C. OAuth D. SAML Correct Answer: A. MSAL Rationale: MSAL (Microsoft Authentication Library) caches tokens after acquisition to improve performance and reduce authentication overhead. Source: WGU D385 Questions and Answers Set A
Question 31: What vulnerability exists in Line 319 of the starter code? A. Hardcoded credentials B. SQL injection: the SELECT for /api/v1/user is built by concatenating the
username into the query string (B608, CWE-89) C. XSS vulnerability D. Missing rate limiting **Correct Answer: B. SQL injection: the SELECT for /api/v1/user is built by concatenating the username into the query string (B608, CWE-
Rationale:** Line 319 contains SQL injection: the SELECT for /api/v1/user is built by concatenating the username into the query string (B608, CWE-89). The fix is to use a parameterized query - a placeholder in the SQL with the value passed as a tuple so data never becomes query structure. Source: WGU D385 Task 2 Secure Coding and API Security Question 32: What is the remediation for SQL injection? A. Encrypt the database B. Use parameterized queries/prepared statements, never string concatenation, plus input validation as depth C. Use shorter usernames D. Restrict database access Correct Answer: B. Use parameterized queries/prepared statements, never string concatenation, plus input validation as depth Rationale: The remediation for SQL injection is to use parameterized queries/prepared statements, never string concatenation, plus input validation as depth. Attacker input alters the SQL query structure (the classic quote OR 1 equals 1 comment payload). Source: WGU D385 Full Course Bank Question 33: What vulnerabilities exist in POST /api/v1/rentals? A. No input validation: days accepts negatives or strings (type and boundary checks missing) and new records embed an SSN field that should never be stored B. Only missing authentication