Skip to content

DeepTeam is a framework to red team LLMs and AI agents.

refac: tests and endpoint body

tanayvaswani6eafc9dd60dc
diff --git a/deepteam/code_scanner/github_report.py b/deepteam/code_scanner/github_report.py
index 4371d80d..914d45a8 100644
--- a/deepteam/code_scanner/github_report.py
+++ b/deepteam/code_scanner/github_report.py
@@ -7,8 +7,9 @@ from deepeval.confident.api import get_base_api_url
from .schema import CodeFinding
-PR_COMMENTS_ENDPOINT = "/v1/deepteam/code-scan/comments"
+PR_COMMENTS_ENDPOINT = "/v1/github-app/code-scan/comments"
_OIDC_AUDIENCE = "confident-code-scan"
+_APP = "deepteam"
def _github_oidc_token() -> Optional[str]:
@@ -21,9 +22,7 @@ def _github_oidc_token() -> Optional[str]:
return None
resp = requests.get(
f"{req_url}&audience={_OIDC_AUDIENCE}",
- headers={
- "Authorization": f"bearer {req_token}"
- },
+ headers={"Authorization": f"bearer {req_token}"},
timeout=15,
)
resp.raise_for_status()
@@ -82,6 +81,7 @@ def post_pr_comments(
base = api_url or get_base_api_url()
payload = {
+ "app": _APP,
"repo": repo,
"pr": pr_number,
"oidc": oidc,
diff --git a/tests/test_core/test_code_scanner/test_github_report.py b/tests/test_core/test_code_scanner/test_github_report.py
index 3bef0d3d..6be8a65b 100644
--- a/tests/test_core/test_code_scanner/test_github_report.py
+++ b/tests/test_core/test_code_scanner/test_github_report.py
@@ -58,9 +58,11 @@ class TestGithubReport:
gr.post_pr_comments([_finding()])
assert (
- captured["url"] == "https://api.test/v1/deepteam/code-scan/comments"
+ captured["url"]
+ == "https://api.test/v1/github-app/code-scan/comments"
)
body = captured["json"]
+ assert body["app"] == "deepteam"
assert body["repo"] == "octo/repo"
assert body["pr"] == 42
assert body["oidc"] == "jwt"