Skip to content

feat(examples): add supervisor middleware content guard - #2169

Merged
pimlock merged 15 commits into
mainfrom
1733-supervisor-middleware-example/pimlock
Jul 28, 2026
Merged

feat(examples): add supervisor middleware content guard#2169
pimlock merged 15 commits into
mainfrom
1733-supervisor-middleware-example/pimlock

Conversation

@pimlock

@pimlock pimlock commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add a runnable supervisor middleware content-guard example for the middleware shipped in #2027. The example demonstrates operator-run service registration, policy attachment, request-body inspection, and allow, deny, and redact responses.

Related Issue

Related to #1733

Changes

  • Add a standalone Rust content-guard gRPC service using the supervisor middleware API
  • Support configurable term matching with redact and deny modes, audit-safe findings, and a stable deny reason code
  • Add an example policy using the keyed network_middlewares format and operator-owned registration name
  • Add smoke.sh to build and launch the gateway, middleware, and sandbox with automatic cleanup
  • Demonstrate the same payload going through a guarded httpbin.org request and an unguarded httpbingo.org request
  • Document the smoke flow, openshell.supervisor.middleware registration, body limit, and timeout behavior
  • Keep the example lockfile reproducible and aligned with the current workspace dependencies

Testing

  • mise run pre-commit passes
  • examples/supervisor-middleware-content-guard/smoke.sh --test-suite passes
  • cargo test --manifest-path examples/supervisor-middleware-content-guard/Cargo.toml passes
  • Unit tests cover redaction, denial and reason code, pass-through, and invalid configuration
  • Smoke coverage verifies a selected request is filtered and an allowed unselected request is unchanged

Checklist

@copy-pr-bot

copy-pr-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@pimlock

pimlock commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test 06c0433

@pimlock

pimlock commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test e8e6456

Base automatically changed from 1733-supervisor-middleware/pmlocek to main July 17, 2026 00:47
@pimlock pimlock self-assigned this Jul 17, 2026
@pimlock
pimlock force-pushed the 1733-supervisor-middleware-example/pimlock branch from 482309c to 6f57bfd Compare July 17, 2026 18:39
@pimlock
pimlock marked this pull request as ready for review July 17, 2026 18:40
pimlock added 9 commits July 28, 2026 09:53
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
@pimlock
pimlock force-pushed the 1733-supervisor-middleware-example/pimlock branch from b03d1d7 to bf8937e Compare July 28, 2026 16:56

@drew drew left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

Validation: This PR is project-valid because it adds a focused runnable example for the supervisor middleware roadmap tracked by #1733.
Head SHA: bf8937e60420fee61a22688495d13a2ea92f6f62

Review findings:

  • Two warnings should be fixed before gator can move this PR to pipeline watch.

Docs: Example README is included; published Fern docs already cover the registration and policy fields used here, so no navigation change is required for this example-only addition.

Checks: Required branch checks, Helm Lint, Markdown, license, DCO, and Rust jobs are currently passing.

E2E: Deferred until review feedback is resolved.

Next state: gator:in-review

Comment thread examples/supervisor-middleware-content-guard/src/main.rs Outdated
Comment thread examples/supervisor-middleware-content-guard/smoke.sh Outdated
@drew drew added the gator:in-review Gator is reviewing or awaiting PR review feedback label Jul 28, 2026
pimlock added 2 commits July 28, 2026 11:39
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>

@drew drew left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

Validation: This PR is project-valid because it adds a focused runnable example for supervisor middleware work related to #1733.
Head SHA: e860e01192069af7f556e992999f8f266e4f3f1d

Thanks @pimlock, I checked your follow-up on the prior gator findings. The optional-field validation now rejects malformed mode and replacement values, and the smoke launcher now resolves the root and example Cargo target directories before launching binaries.

Review findings:

  • One warning remains on redaction behavior for overlapping configured terms.

Docs: Example README is included; this is example-local UX documentation, so I do not see a Fern docs or navigation update requirement for this PR.

Checks: DCO, Markdown, License Headers, Helm Lint, and several branch-check jobs are passing; OpenShell / Branch Checks and Rust jobs are still pending on the current head.

E2E: test:e2e is not applied yet. E2E should be decided after review feedback is resolved.

Next state: gator:in-review

Comment thread examples/supervisor-middleware-content-guard/src/main.rs Outdated
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>

@drew drew left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

Validation: This PR is project-valid because it adds a focused runnable example for supervisor middleware work related to #1733.
Head SHA: 2f5751a706e894853ebe5bd46b2fe4f8adc1f2d6

Thanks @pimlock, I checked the latest update. The optional-field validation and target-directory handling remain resolved, and the new longest-first ordering fixes the prefix-overlap case from the prior review.

Review findings:

  • One warning remains on redaction behavior for partially overlapping configured terms.

Docs: Example README is included; this is example-local UX documentation, so I do not see a Fern docs or navigation update requirement for this PR.

Checks: DCO, Markdown, License Headers, Helm Lint, Branch Checks, Rust, Python, and mise Lockfile are passing on the current head.

E2E: test:e2e is not applied yet. E2E should be decided after review feedback is resolved.

Next state: gator:in-review

Comment thread examples/supervisor-middleware-content-guard/src/main.rs Outdated

@drew drew left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

Validation: This PR is project-valid because it adds a focused runnable example for supervisor middleware work related to #1733.
Head SHA: 9ca89d99c3ca7bb7fcecebd2f79b9584505f521f

Thanks @pimlock, I checked the README warning-alert update in this head. The docs markup change is fine, but the redaction behavior issue from the prior head is still present because the Rust code did not change.

Review findings:

  • One warning remains on redaction behavior for partially overlapping configured terms.

Docs: Example README is included; this is example-local UX documentation, so I do not see a Fern docs or navigation update requirement for this PR.

Checks: CI has restarted for this head; DCO is passing, and Branch Checks, Helm Lint, Rust, Python, Markdown, License Headers, and mise Lockfile are pending.

E2E: test:e2e is not applied yet. E2E should be decided after review feedback is resolved.

Next state: gator:in-review

Comment thread examples/supervisor-middleware-content-guard/src/main.rs Outdated
pimlock added 2 commits July 28, 2026 12:21
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>
Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com>

@drew drew left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

Validation: This PR is project-valid because it adds a focused runnable example for supervisor middleware work related to #1733.
Head SHA: 0623b7030ff867e775b345915039e990af2c9b23

Thanks @pimlock, I checked your latest follow-up on the overlapping redaction findings. The current implementation computes matches from the original UTF-8 body, merges overlapping ranges, rebuilds the redacted body once, and includes partial/self-overlap regression coverage.

Review findings:

  • No blocking findings remain.

Docs: Example README is included; this is example-local UX documentation, so I do not see a Fern docs or docs/index.yml navigation update requirement.

Checks: Required Branch Checks, Helm Lint, DCO, Markdown, License Headers, Rust, Python, and mise Lockfile are passing on the current head.

E2E: test:e2e is required for this supervisor middleware/network-policy smoke example and is being applied for pipeline monitoring.

Next state: gator:watch-pipeline

@drew drew added gator:watch-pipeline Gator is monitoring PR CI/CD status test:e2e Requires end-to-end coverage and removed gator:in-review Gator is reviewing or awaiting PR review feedback labels Jul 28, 2026
@github-actions

Copy link
Copy Markdown

Label test:e2e applied for 0623b70. Open the existing run and click Re-run all jobs to execute with the label set. The run will execute the standard E2E suite after building the required gateway and supervisor images once. The matching required CI gate status on this PR will flip green automatically once the run finishes.

@drew drew added gator:approval-needed Gator completed review; maintainer approval needed and removed gator:watch-pipeline Gator is monitoring PR CI/CD status labels Jul 28, 2026
@drew drew added gator:merge-ready gator:watch-pipeline Gator is monitoring PR CI/CD status and removed gator:approval-needed Gator completed review; maintainer approval needed gator:merge-ready gator:watch-pipeline Gator is monitoring PR CI/CD status labels Jul 28, 2026
@pimlock
pimlock added this pull request to the merge queue Jul 28, 2026
Merged via the queue into main with commit 2b7f04f Jul 28, 2026
74 of 80 checks passed
@pimlock
pimlock deleted the 1733-supervisor-middleware-example/pimlock branch July 28, 2026 22:08
@drew

drew commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

gator-agent

Monitoring Complete

Monitoring is complete because this PR has merged.

Final status: The last gator state was gator:merge-ready; review had no blocking findings, required checks and test:e2e were complete, and maintainer approval was present before merge.

I removed the active gator:* label because there is nothing left for gator to monitor on this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants