feat: Support creating portals from ShellTask context#1866
Conversation
- Modifies `Portal` ent schema to add optional `shell_task` edge and make `task` edge optional. - Updates `CreatePortal` in `mux` to accept `taskID` and `shellTaskID`, allowing creation from either context. - Updates C2 `CreatePortal` handler to pass `shellTaskID` directly instead of resolving `Task` from `ShellTask`. - Updates tests to verify new functionality. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
* proto changes * Update C2 and Agent to support ShellTaskContext (#1863) - Updated `c2.proto` logic in Go backend to support `oneof` context field (TaskContext or ShellTaskContext). - Renamed `ReportTaskOutput` to `ReportOutput` in Go backend and Rust agent to reflect generic reporting. - Updated `ImixAgent` and `Eldritch` interpreter in Rust to use `Context` enum for handling task vs shell task execution. - Refactored `api_reverse_shell.go` to use line-of-sight coding for context resolution. - Updated Go tests, including fixing `TestReverseShell_E2E` by adding JWT generation. - Added `ReportFileKind` support to file reporting. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * cargo fmt * fix tests * fix most go tests * feat: Support creating portals from ShellTask context (#1866) - Modifies `Portal` ent schema to add optional `shell_task` edge and make `task` edge optional. - Updates `CreatePortal` in `mux` to accept `taskID` and `shellTaskID`, allowing creation from either context. - Updates C2 `CreatePortal` handler to pass `shellTaskID` directly instead of resolving `Task` from `ShellTask`. - Updates tests to verify new functionality. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * small test fixes * Fix portal tests by adding JWT to TaskContext (#1867) The `CreatePortal` API now requires a valid JWT in the `TaskContext` or `ShellTaskContext`. This commit updates the integration and benchmark tests in `tavern/internal/portals` to: 1. Store the generated `ed25519` private key in `TestEnv`. 2. Use a helper `generateJWT` to sign a valid JWT. 3. Include the JWT in `CreatePortalRequest` calls in `TestPortalIntegration`, `TestPortalClose`, and `BenchmarkPortalThroughput`. This resolves the test failures where the server was rejecting the requests due to missing or invalid JWTs. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * Fix e2e test failure by updating REPL prompt to match expectation (#1870) The end-to-end test `tests/repl.spec.ts` expects the reverse shell REPL prompt to be `>>> `. However, the `imix` agent was outputting `> `. This change updates `implants/imix/src/shell/repl.rs` to use `>>> ` as the prompt, aligning the agent behavior with the test expectation and standard Python/Eldritch REPL prompts. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>
This PR enables creating portals directly from a
ShellTaskcontext, in addition to the existingTaskcontext. This aligns with recent changes in the context system whereShellTasks are first-class entities for execution.Key changes:
tavern/internal/ent/schema/portal.go: Updated schema to supportShellTaskrelation.tavern/internal/portals/mux/mux_create.go: Updated logic to handleshellTaskID.tavern/internal/c2/api_create_portal.go: Updated gRPC handler to supportShellTaskContextproperly.tavern/internal/portals/mux/mux_test.go: AddedTestMux_CreatePortal_ShellTask.PR created automatically by Jules for task 13250956419771946780 started by @KCarretto