Skip to content

Conversation

@theCyberTech
Copy link
Member

Potential fix for https://github.com/crewAIInc/crewAI/security/code-scanning/26

To fix this problem, the code should parse the endpoint string as a URL and then check whether the parsed host (netloc) matches the expected domain. Instead of doing a substring test, it should extract the actual host (using urllib.parse.urlparse) and check if it is exactly openai.azure.com or ends with .openai.azure.com. This approach prevents attacker-controlled endpoints with hosts like malicious.openai.azure.com.evil.com from being accepted. The fix should import urlparse from urllib.parse if not already present, parse self.endpoint, and use the parsed hostname in the comparison. All changes should be localized within the shown code region in lib/crewai/src/crewai/llms/providers/azure/completion.py.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…g sanitization

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
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