Embed go exp package requirements to ensure we don't use arbitrary exp, move utilities to utils

This commit is contained in:
WeebDataHoarder
2025-04-06 02:02:54 +02:00
parent 105477c3ee
commit 7d436cbdb4
9 changed files with 7 additions and 6 deletions

View File

@@ -5,7 +5,7 @@ import (
"crypto/subtle" "crypto/subtle"
"encoding/binary" "encoding/binary"
"git.gammaspectra.live/git/go-away/lib/challenge" "git.gammaspectra.live/git/go-away/lib/challenge"
"git.gammaspectra.live/git/go-away/lib/challenge/inline" "git.gammaspectra.live/git/go-away/utils/inline"
"math/bits" "math/bits"
"strconv" "strconv"
) )

1
go.mod
View File

@@ -30,4 +30,5 @@ require (
) )
// Used by github.com/antlr4-go/antlr v4.13.0 via github.com/google/cel-go // Used by github.com/antlr4-go/antlr v4.13.0 via github.com/google/cel-go
// Ensure we have no other exp package usages by only proxying the slices functions in that package
replace golang.org/x/exp v0.0.0 => ./utils/exp replace golang.org/x/exp v0.0.0 => ./utils/exp

View File

@@ -2,7 +2,7 @@ package challenge
import ( import (
"encoding/json" "encoding/json"
"git.gammaspectra.live/git/go-away/lib/challenge/inline" "git.gammaspectra.live/git/go-away/utils/inline"
) )
type MakeChallenge func(in Allocation) (out Allocation) type MakeChallenge func(in Allocation) (out Allocation)

View File

@@ -10,8 +10,8 @@ import (
"errors" "errors"
"fmt" "fmt"
"git.gammaspectra.live/git/go-away/embed" "git.gammaspectra.live/git/go-away/embed"
"git.gammaspectra.live/git/go-away/lib/network"
"git.gammaspectra.live/git/go-away/lib/policy" "git.gammaspectra.live/git/go-away/lib/policy"
"git.gammaspectra.live/git/go-away/utils"
"github.com/google/cel-go/common/types" "github.com/google/cel-go/common/types"
"html/template" "html/template"
"io" "io"
@@ -91,7 +91,7 @@ func makeReverseProxy(target string) (*httputil.ReverseProxy, error) {
return dialer.DialContext(ctx, "unix", addr) return dialer.DialContext(ctx, "unix", addr)
} }
// tell transport how to handle the unix url scheme // tell transport how to handle the unix url scheme
transport.RegisterProtocol("unix", network.UnixRoundTripper{Transport: transport}) transport.RegisterProtocol("unix", utils.UnixRoundTripper{Transport: transport})
} }
rp := httputil.NewSingleHostReverseProxy(u) rp := httputil.NewSingleHostReverseProxy(u)

View File

@@ -13,9 +13,9 @@ import (
"fmt" "fmt"
"git.gammaspectra.live/git/go-away/embed" "git.gammaspectra.live/git/go-away/embed"
challenge2 "git.gammaspectra.live/git/go-away/lib/challenge" challenge2 "git.gammaspectra.live/git/go-away/lib/challenge"
"git.gammaspectra.live/git/go-away/lib/challenge/inline"
"git.gammaspectra.live/git/go-away/lib/condition" "git.gammaspectra.live/git/go-away/lib/condition"
"git.gammaspectra.live/git/go-away/lib/policy" "git.gammaspectra.live/git/go-away/lib/policy"
"git.gammaspectra.live/git/go-away/utils/inline"
"github.com/google/cel-go/cel" "github.com/google/cel-go/cel"
"github.com/google/cel-go/common/types" "github.com/google/cel-go/common/types"
"github.com/google/cel-go/common/types/ref" "github.com/google/cel-go/common/types/ref"

View File

@@ -1,4 +1,4 @@
package network package utils
import "net/http" import "net/http"