[API Policies] Azure Content Safety Content Moderation Policy Issue
@Thenujan-Nagaratnam is already working on this.
Since Jan 15, 2026.
- Dominant language
- Go
- Stars
- 71
- Forks
- 111
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 110
Description
Overview
Nil pointer dereference vulnerability in retry logic can cause application panic when Azure API is unavailable.
Issue Details
Potential Nil Pointer Dereference After Retry Exhaustion
File: azurecontentsafetycontentmoderation.go (lines 411-454)
Description:
If all 5 retries fail with 5xx errors, the retry loop exits without setting lastErr, and resp remains nil (closed on line 434). The subsequent defer resp.Body.Close() on line 454 will panic when trying to access resp.Body on a nil pointer.
Failure Scenario:
- Azure API returns 5xx errors for all retry attempts
- Loop exits with
resp = nil defer resp.Body.Close()attempts to access nil pointer- Application panics
Proposed Fix:
Check if resp is not nil before accessing resp.Body.Close(). Alternatively, restructure the retry logic to ensure resp is properly handled.
Impact:
Application panic when Azure API is unavailable and all retries are exhausted.
Reference
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.