[teams] feat(injector): add Microsoft Teams injector (#141)#142
[teams] feat(injector): add Microsoft Teams injector (#141)#142RomuDeuxfois wants to merge 8 commits intomainfrom
Conversation
2d2bab6 to
f1dbef3
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a Microsoft Teams injector to the OpenAEV platform, enabling notifications to Teams channels via Power Automate HTTP webhooks. The implementation follows existing injector patterns (nuclei, nmap, http-query) and introduces shared helper code in injector_common.
Changes:
- New Teams injector with client, contracts, helpers, and main entry point
- Shared
DataHelpersclass ininjector_commonfor data extraction (used by Teams, can benefit others) - Docker/deployment configuration and comprehensive documentation
Reviewed changes
Copilot reviewed 12 out of 19 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| teams/teams/openaev_teams.py | Main entry point with message processing and execution logic |
| teams/teams/client/teams_client.py | HTTP client for sending Teams notifications |
| teams/teams/helpers/teams_helper.py | Payload builder for Teams messages |
| teams/teams/contracts_teams.py | Contract definitions for Teams integration |
| injector_common/injector_common/data_helpers.py | Shared data extraction helpers (new file) |
| teams/pyproject.toml | Python dependencies and project configuration |
| teams/Dockerfile | Multi-stage Docker build configuration |
| teams/docker-compose.yml | Docker deployment configuration |
| teams/README.md | Comprehensive documentation including Power Automate setup |
teams/teams/client/teams_client.py
Outdated
| response = requests.post(url=url, json=payload) | ||
| return ExecutionResult.from_http_response(response) |
There was a problem hiding this comment.
HTTP errors (4xx, 5xx) with response bodies are not captured. The from_http_response only checks status codes but doesn't extract error details from response.text. This makes debugging failed webhook calls difficult. Consider including response body in error messages for non-2xx responses.
teams/teams/client/teams_client.py
Outdated
| import requests | ||
| from requests.exceptions import RequestException, Timeout | ||
|
|
||
| DEFAULT_TIMEOUT = 5 # secondes |
There was a problem hiding this comment.
The DEFAULT_TIMEOUT constant has a French comment ("secondes"). For consistency with the codebase and professional standards, this should be in English: "seconds".
| DEFAULT_TIMEOUT = 5 # secondes | |
| DEFAULT_TIMEOUT = 5 # seconds |
| from typing import Dict | ||
|
|
||
|
|
||
| class TeamsPayloadBuilder: | ||
|
|
||
| @staticmethod | ||
| def build(content: Dict) -> Dict: | ||
| return { | ||
| "title": content["title"], | ||
| "message": content["message"], | ||
| } |
There was a problem hiding this comment.
The Teams injector is missing test coverage. According to the repository guidelines, each injector should have its own test suite. The http-query injector has tests for its helpers, and other injectors (nuclei, nmap) have tests. Consider adding unit tests for TeamsPayloadBuilder.build(), TeamsClient.post_message(), and the DataHelpers methods to maintain consistency with the repository's testing practices.
fe1c0f6 to
4e5aa33
Compare
4e5aa33 to
cda9eee
Compare
cda9eee to
8131aea
Compare
teams/README.md
Outdated
| First, create a dedicated virtual environment to keep things isolated: | ||
|
|
||
| ```shell | ||
| py -3.12 -m venv venv |
There was a problem hiding this comment.
Normally, Poetry creates a virtual environment automatically, so this step shouldn’t be necessary.
| docker push openaev/injector-nuclei:latest | ||
| docker push openbas/injector-nuclei:latest | ||
| for injector in $INJECTORS; do | ||
| docker tag openaev/injector-$injector:${IMAGETAG} openaev/injector-$injector:latest |
There was a problem hiding this comment.
Q: Do we still need to maintain the openbas reference? @antoinemzs
| working_directory: ~/openaev | ||
| command: | | ||
| poetry install --extras prod | ||
| INJECTORS="nuclei nmap http-query" |
There was a problem hiding this comment.
S: I have also added some tests in injector_common, maybe you could include it? and maybe you could add some tests to this new injector?
savacano28
left a comment
There was a problem hiding this comment.
Hi, I just added a few questions to the config.yml but it’s not blocking.
13db9b3 to
3d99e2b
Compare
|
was committed in a merged PR |





Proposed changes
Related issues