Skip to content

OWASP A06:2025 – Remove destructive endpoint, enforce input constraints, fix SQL injection#43

Draft
Copilot wants to merge 10 commits intomainfrom
copilot/vscode-mn5wr2ee-8j3d
Draft

OWASP A06:2025 – Remove destructive endpoint, enforce input constraints, fix SQL injection#43
Copilot wants to merge 10 commits intomainfrom
copilot/vscode-mn5wr2ee-8j3d

Conversation

Copy link

Copilot AI commented Mar 25, 2026

The API exposed an unauthenticated DELETE /api/v1/gods (delete-all) endpoint, accepted unbounded bulk inputs, had no model-level validation, and used raw SQL string interpolation in name searches — a combination of insecure-by-design flaws per OWASP A06:2025.

Endpoint changes

  • Removed DELETE /api/v1/gods (unprotected delete-all)
  • Added DELETE /api/v1/gods/{id} — targeted deletion only
  • Extracted GetGodById and SearchGodsByName from anonymous lambdas into named static methods with validation

Input validation

  • AddOrUpdateGods: rejects empty lists and batches > 100 items → 400 BadRequest
  • GetGodById: rejects id ≤ 0400 BadRequest; missing god → 404 NotFound
  • SearchGodsByName: rejects empty/whitespace names → 400 BadRequest

Model constraints (GodInput)

[Required]
[StringLength(100, MinimumLength = 1)]
public string Name { get; set; } = null!;

[Required]
[StringLength(500, MinimumLength = 1)]
public string Description { get; set; } = null!;

SQL injection fix

Replaced FromSqlRaw with string interpolation in GetGodByNameAsync with parameterized EF.Functions.Like() LINQ queries — including alias search path.

Repository interface

  • GetGodAsync now returns God? + FirstOrDefaultAsync (was throwing on missing records)
  • DeleteAllGodsAsync removed; DeleteGodByIdAsync(GodParameter) added
Original prompt

Starte Issue 35

[Chronological Review: The conversation began with the user requesting the latest 5 issues in the repository. Following that, the user instructed to start Issue 35, indicating a focus on managing issues within a project repository.] [Intent Mapping: 1. "Was sind die neuesten 5 issues im repo?" - The user is looking for the most recent issues in the repository. 2. "Starte Issue 35" - The user wants to initiate or create Issue 35, indicating a need to address a specific task or bug in the project.] [Technical Inventory: The conversation involves a project repository, likely hosted on a platform like GitHub or GitLab, where issues are tracked and managed.] [Code Archaeology: No specific files or code changes were discussed in detail, but the context suggests interaction with a repository's issue tracking system.] [Progress Assessment: The user has not yet received the latest issues and has initiated a new issue (Issue 35), indicating ongoing project management.] [Context Validation: The user is actively managing issues in a project repository, specifically looking for recent issues and starting a new one.] [Recent Commands Analysis: - Last Agent Commands: The user requested the latest issues and then commanded to start Issue 35. - Tool Results Summary: No specific tool results were returned as the commands were user requests rather than tool executions. - Pre-Summary State: The agent was focused on retrieving issue information and starting a new issue when the token budget was exceeded. - Operation Context: These commands relate to the user's goal of managing project tasks effectively by keeping track of issues and addressing them promptly.] 1. Conversation Overview: - Primary Objectives: 1. "Was sind die neuesten 5 issues im repo?" - The user seeks the latest issues in the repository. 2. "Starte Issue 35" - The user intends to initiate Issue 35. - Session Context: The conversation revolves around managing issues in a project repository, with the user actively seeking information and taking action on issues. - User Intent Evolution: The user started by wanting to gather information about recent issues and then moved to actively create a new issue, indicating a proactive approach to project management.
  1. Technical Foundation:
  • Repository Management: The conversation involves managing issues within a project repository, likely using a platform like GitHub or GitLab.
  1. Codebase Status:
  • No specific files or code changes were discussed, but the context indicates interaction with the repository's issue tracking system.
  1. Problem Resolution:
  • Issues Encountered: The user has not yet received the latest issues, which may indicate a need for better visibility into project tasks.
  • Solutions Implemented: The user has taken the initiative to start a new issue, demonstrating a hands-on approach to project management.
  1. Progress Tracking:
  • Completed Tasks: The user has requested the latest issues but has not yet received them.
  • Partially Complete Work: The user has initiated Issue 35, indicating ongoing work on project tasks.
  1. Active Work State:
  • Current Focus: The user was focused on retrieving the latest issues and starting Issue 35.
  • Recent Context: The last few exchanges involved requests for issue information and the initiation of a new issue.
  • Immediate Context: The user was actively managing issues in the repository when the token budget was exceeded.
  1. Recent Operations:
  • Last Agent Commands:
    1. "Was sind die neuesten 5 issues im repo?" - Request for recent issues.
    2. "Starte Issue 35" - Command to start a new issue.
  • Tool Results Summary: No specific results were returned as these were user commands.
  • Pre-Summary State: The agent was engaged in managing project issues when the token budget was exceeded.
  • Operation Context: The commands executed are directly related to the user's goal of effectively managing project tasks and issues.
  1. Continuation Plan:
  • Pending Task 1: Retrieve the latest 5 issues from the repository.
  • Pending Task 2: Provide details or context for Issue 35 that the user has initiated.
  • Priority Information: The immediate next step is to fetch the latest issues to keep the user informed.
  • Next Action: Execute the command to retrieve the latest issues in the repository.

Created from VS Code.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

aatmmr added 9 commits March 5, 2026 10:59
- Added global exception handling middleware to improve error management and response consistency.
- Refactored repository methods to use `FirstOrDefaultAsync` and handle null returns appropriately.
- Enhanced endpoint methods to validate input and return proper HTTP status codes.
- Fixed SQL injection vulnerabilities by replacing raw SQL queries with parameterized LINQ queries.
- Added comprehensive input validation using FluentValidation.
- Created integration tests for mythology endpoints to ensure correct behavior and responses.
- Updated unit tests for god and mythology endpoints to use NSubstitute for mocking dependencies.
…t validation and safe deletion

Co-authored-by: aatmmr <15815012+aatmmr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/SolidifyDemo/mythapi-training-demo/sessions/1a20643c-86a6-4e4e-9d03-bcfc71dd1573
Copilot AI changed the title [WIP] Start work on issue 35 OWASP A06:2025 – Remove destructive endpoint, enforce input constraints, fix SQL injection Mar 25, 2026
Copilot AI requested a review from aatmmr March 25, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants