Skip to content

feat: Support creating portals from ShellTask context#1866

Merged
KCarretto merged 1 commit intoshellv2-grpc-refactorfrom
feat/portal-shell-task-support-13250956419771946780
Feb 23, 2026
Merged

feat: Support creating portals from ShellTask context#1866
KCarretto merged 1 commit intoshellv2-grpc-refactorfrom
feat/portal-shell-task-support-13250956419771946780

Conversation

@KCarretto
Copy link
Collaborator

This PR enables creating portals directly from a ShellTask context, in addition to the existing Task context. This aligns with recent changes in the context system where ShellTasks are first-class entities for execution.

Key changes:

  • tavern/internal/ent/schema/portal.go: Updated schema to support ShellTask relation.
  • tavern/internal/portals/mux/mux_create.go: Updated logic to handle shellTaskID.
  • tavern/internal/c2/api_create_portal.go: Updated gRPC handler to support ShellTaskContext properly.
  • tavern/internal/portals/mux/mux_test.go: Added TestMux_CreatePortal_ShellTask.

PR created automatically by Jules for task 13250956419771946780 started by @KCarretto

- 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>
@google-labs-jules
Copy link
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@KCarretto KCarretto marked this pull request as ready for review February 23, 2026 02:29
@KCarretto KCarretto merged commit d5d2923 into shellv2-grpc-refactor Feb 23, 2026
@KCarretto KCarretto deleted the feat/portal-shell-task-support-13250956419771946780 branch February 23, 2026 02:29
github-merge-queue bot pushed a commit that referenced this pull request Feb 23, 2026
* 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>
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.

1 participant