Skip to content

gRPC Refactor for ShellContext#1864

Merged
KCarretto merged 10 commits intomainfrom
shellv2-grpc-refactor
Feb 23, 2026
Merged

gRPC Refactor for ShellContext#1864
KCarretto merged 10 commits intomainfrom
shellv2-grpc-refactor

Conversation

@KCarretto
Copy link
Collaborator

@KCarretto KCarretto commented Feb 23, 2026

Makes a number of updates to our gRPC API to better support execution of eldritch from ShellTasks and cleans up some of the naming now that methods may run from regular Tome tasks or a ShellTask.

Screenshots of Misc Testing

image image image image image image

KCarretto and others added 3 commits February 22, 2026 22:40
- 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>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 23, 2026

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2644    ±0 2644    ±0 0    ±0 0    ±0 0    ±0 0    ±0 1ms    ±0

Previous Results

Build 🏗️ Result 🧪 Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
#1114 2644 2644 0 0 0 0 35.8s

Insights

Average Tests per Run Total Flaky Tests Total Failed Slowest Test (p95)
2644 0 0 6.1s

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
TestDockerExecutor_Build_ContextCancellation 1 6.1s 6.1s
eldritch-libsys: std::dll_inject_impl::tests::test_dll_inject_simple 1 5.1s 5.1s
TestInteractiveShell 1 5.0s 5.0s
TestOtherStreamOutput 1 5.0s 5.0s
imix::bin/imix: install::tests::test_install_execution 3 1.5s 4.3s
imix::bin/imix: install::tests::test_install_execution 3 1.5s 4.3s
imix::bin/imix: install::tests::test_install_execution 3 1.5s 4.3s
TestDockerExecutor_Build_SimpleEcho 1 4.1s 4.1s
imix::bin/imix: tests::task_tests::test_task_streaming_output 3 3.0s 3.0s
imix::bin/imix: tests::task_tests::test_task_streaming_output 3 3.0s 3.0s

🎉 No failed tests in this run. | 🍂 No flaky tests in this run.

Github Test Reporter by CTRF 💚

🔄 This comment has been updated

KCarretto and others added 6 commits February 23, 2026 02:02
- 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>
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>
@KCarretto KCarretto requested a review from hulto February 23, 2026 02:51
@KCarretto KCarretto marked this pull request as ready for review February 23, 2026 02:51
@KCarretto KCarretto enabled auto-merge February 23, 2026 02:51
)

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>
@KCarretto KCarretto added this pull request to the merge queue Feb 23, 2026
Merged via the queue into main with commit c04ff00 Feb 23, 2026
9 checks passed
@KCarretto KCarretto deleted the shellv2-grpc-refactor branch February 23, 2026 04:02
stream_id,
seq_id,
};
// Portal execution doesn't have a task context really, or it inherits previous?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI comments to itself?

wantResp: &c2pb.ReportOutputResponse{},
wantCode: codes.OK,
wantOutput: "TestOutput", // Output is additive, previous test ran first? No, tests are independent runs unless I chain them?
// Tests run in loop. `existingTasks[0]` is modified by previous test case?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI notes to self? I'd clean them up or remove.

// Set JWT if needed (already set in cases above)
// But if we wanted to enforce it here:
if msg, ok := tc.req.Message.(*c2pb.ReportOutputRequest_TaskOutput); ok {
if msg.TaskOutput.Context == nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead code

PrivKey ed25519.PrivateKey
}

func generateJWT(t testing.TB, privKey ed25519.PrivateKey) string {
Copy link
Collaborator

@hulto hulto Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the real CreateCA function?

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.

3 participants