1
0
mirror of https://github.com/sredevopsorg/deepseek-kubernetes-sandbox.git synced 2026-11-03 01:13:24 +00:00
Files
deepseek-kubernetes-sandbox/examples
SREDevOps.org Agent 1a929e3e24 fix(gateway)!: replace token cookies with revocable sessions and harden abuse controls (#40)
- Replace user:token cookies with opaque server-side sessions, revocable on logout, delete, recreate and expiry; bind every credential to the path user and add cross-user regression tests.
- Rate-limit /users and /login, add optional signup invite codes and form same-origin checks, and unify login failures to 401.
- Require explicit ALLOW_INSECURE_COOKIES for plain HTTP, use __Host-dsh_gw_session when secure, and fix secure cookie deletion.
- Strip client-supplied forwarding/SSO headers, add an optional upstream allowlist, per-user in-flight and WebSocket message caps, credential-free handshake errors, and sweep-time state pruning.
- Digest-pin base images, hash-pin gateway dependencies, verify DSH_COMMIT in the build, and run the gateway image as non-root with a pinned Python base.
- Update manifests, production checklist, architecture/security docs and add an SSO preflight script.

BREAKING CHANGE: existing dsh_gw_session=<user>:<token> cookies are invalid; users must sign in again. Unknown users on POST /login now return 401 instead of 404, and the gateway refuses COOKIE_SECURE=false unless ALLOW_INSECURE_COOKIES=1.

Co-authored-by: SREDevOpsAgents <agents@sredevops.org>
2026-10-31 00:57:35 -03:00
..

Examples

Every implementation in this repository is a self-contained example: one directory, plain kubectl, an end-to-end README, and a cleanup command. Examples consume the main DSH Web image; they are reference material, not libraries.

Example What it demonstrates Needs
examples/dsh-agents-as-a-service/ The full multi-tenant platform pattern: one SandboxTemplate with per-user PVCs, a warm pool, one ~10-line SandboxClaim per user, suspend-when-idle / wake-on-return, and a browser gateway with signup, HttpOnly sessions, an HTTP + WebSocket proxy and two exposure variants (Ingress, or Gateway API + GitHub SSO). agent-sandbox with extensions; kind for the e2e script.
examples/minimal-single-tenant/ The smallest useful setup: a single SandboxTemplate and one SandboxClaim, no gateway — reach DSH Web with a launch-token URL through kubectl port-forward. agent-sandbox with extensions.

The multi-tenant example also documents opt-in gVisor, nodeSelector, NetworkPolicy, extra provider-key hardening and failed-Pod recovery in optional hardening.

The example contract (short version)

Full rules: docs/examples.md. scripts/check-examples.sh enforces the layout, and make check runs it.

  • README.md is the walkthrough; manifests/NN-*.yaml is applied with plain kubectl and read in order.
  • Optional manifests/optional/<feature>/ and manifests/exposure/<variant>/ each ship a README; exposure variants are mutually exclusive.
  • Optional scripts/ must be executable, idempotent and self-cleaning; docs/ holds deeper material.
  • Components with a Dockerfile need a README and tests; images are published nested below the main image (<registry>/<owner>/<repo>/<example>/<component>).
  • Secrets are *.yaml.example with placeholders; every example is listed above with its literal examples/<name>/ path.

Running an example

Each example README has the exact prerequisites, commands, optional hardening, exposure options and teardown. The multi-tenant example also has a full kind walkthrough that cleans up after itself:

examples/dsh-agents-as-a-service/scripts/e2e-kind.sh

kubectl apply -f manifests/ is non-recursive: optional/ and exposure/ subdirectories are applied explicitly.