fix: pentest session ID propagation, target name resolution, BSON field paths

- Set session.id from insert_one result so orchestrator has the ID
- Enrich sessions with target_name by joining DAST targets in server fns
- Fix _id.$oid BSON field path for target dropdown and session list
- Fix send_message URL to /chat (was /messages)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-03-11 21:48:54 +01:00
parent af98e3e070
commit 30301a12b5
3 changed files with 76 additions and 7 deletions

View File

@@ -76,7 +76,7 @@ pub async fn create_session(
let mut session = PentestSession::new(req.target_id.clone(), strategy);
session.repo_id = target.repo_id.clone();
agent
let insert_result = agent
.db
.pentest_sessions()
.insert_one(&session)
@@ -88,6 +88,9 @@ pub async fn create_session(
)
})?;
// Set the generated ID back on the session so the orchestrator has it
session.id = insert_result.inserted_id.as_object_id();
let initial_message = req.message.unwrap_or_else(|| {
format!(
"Begin a {} penetration test against {} ({}). \