Skip to content

Fix portal tests by adding JWT to TaskContext#1867

Merged
KCarretto merged 1 commit intoshellv2-grpc-refactorfrom
fix-portal-tests-jwt-13053957921255342923
Feb 23, 2026
Merged

Fix portal tests by adding JWT to TaskContext#1867
KCarretto merged 1 commit intoshellv2-grpc-refactorfrom
fix-portal-tests-jwt-13053957921255342923

Conversation

@KCarretto
Copy link
Collaborator

Fixed failing Go tests in tavern/internal/portals by ensuring that CreatePortalRequest messages include a valid signed JWT in their TaskContext. The server-side validation now enforces this, so tests were updated to generate and attach these tokens using the test environment's private key.

Changes:

  • Modified TestEnv in tavern/internal/portals/integration_test.go to store PrivKey.
  • Added generateJWT helper function.
  • Updated TestPortalIntegration, TestPortalClose, and BenchmarkPortalThroughput to usage the new helper.

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

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: 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:49
@KCarretto KCarretto merged commit e24a35d into shellv2-grpc-refactor Feb 23, 2026
@KCarretto KCarretto deleted the fix-portal-tests-jwt-13053957921255342923 branch February 23, 2026 02:49
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