Skip to content

Harden state-changing endpoints by replacing unsafe GETs with POST/DELETE#18

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-http-verbs-on-endpoints
Draft

Harden state-changing endpoints by replacing unsafe GETs with POST/DELETE#18
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-http-verbs-on-endpoints

Conversation

Copy link
Copy Markdown

Copilot AI commented May 8, 2026

Two API routes were mutating state via GET, allowing unintended writes/deletes from crawlers, prefetchers, or embedded links. This PR aligns those routes with correct HTTP verbs and updates the client contract accordingly.

  • API verb corrections

    • PrismController.Remove changed from HttpGet to HttpDelete
    • UserController.Get (get-or-create behavior) changed from HttpGet to HttpPost
  • Client contract updates

    • BeamApiService.UnPrismRay(...) now calls DeleteAsync(...) instead of GetFromJsonAsync(...)
    • BeamApiService.GetOrCreateUser(...) now calls PostAsync(...) and deserializes response content
    • Added EnsureSuccessStatusCode() on both updated client calls to fail fast on non-2xx responses
  • Behavioral impact

    • Removes CSRF-by-GET class risk for prism deletion
    • Prevents passive GET traffic from auto-creating users
// Before
[HttpGet("[action]/{UserId}/{RayId}")]
public List<Ray> Remove(int UserId, int RayId)

// After
[HttpDelete("[action]/{UserId}/{RayId}")]
public List<Ray> Remove(int UserId, int RayId)

Copilot AI changed the title [WIP] Replace HTTP GET with correct verbs on state-changing endpoints Harden state-changing endpoints by replacing unsafe GETs with POST/DELETE May 8, 2026
Copilot finished work on behalf of Dedac May 8, 2026 15:00
Copilot AI requested a review from Dedac May 8, 2026 15:00
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.

Replace HTTP GET with Correct Verbs on State-Changing Endpoints

2 participants