Merge pull request #2 from Harrison-Wells-Cyber/codex/review-proxy-tool-for-internal-ad-environment

Add reconnect tokens, DNS relay, stream limits, local write queues, agent reconnect/backoff and status endpoint
This commit is contained in:
Harrison-Wells-Cyber
2026-07-22 12:58:19 -07:00
committed by GitHub
3 changed files with 20 additions and 2 deletions
+1 -1
View File
@@ -10,7 +10,6 @@ import (
"errors"
"flag"
"fmt"
"html/template"
"io"
"log"
"net"
@@ -23,6 +22,7 @@ import (
"sync"
"sync/atomic"
"syscall"
"text/template"
"time"
"github.com/psproxy/psproxy/internal/protocol"
+1 -1
View File
@@ -4,9 +4,9 @@ import (
"crypto/rand"
"encoding/base64"
"errors"
"html/template"
"net/http"
"sync"
"text/template"
"time"
)
+18
View File
@@ -1,7 +1,9 @@
package staging
import (
"net/http/httptest"
"testing"
"text/template"
"time"
)
@@ -47,3 +49,19 @@ func TestReconnectTokenSurvivesEnrollmentURLTTL(t *testing.T) {
t.Fatalf("reconnect token should survive URL TTL after enrollment: %v", err)
}
}
func TestAgentHandlerDoesNotHTMLEscapeAssemblyBase64(t *testing.T) {
store := NewStore(time.Minute)
sess, err := store.Create("c2.example.com", 443, "pin", "")
if err != nil {
t.Fatalf("create session: %v", err)
}
tmpl := template.Must(template.New("agent").Parse("{{.AssemblyB64}}"))
r := httptest.NewRequest("GET", "/a/"+sess.ID, nil)
r.SetPathValue("id", sess.ID)
w := httptest.NewRecorder()
AgentHandler(store, tmpl, "AA+/=").ServeHTTP(w, r)
if got := w.Body.String(); got != "AA+/=" {
t.Fatalf("assembly base64 was escaped or changed: %q", got)
}
}