Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ Since WebSockets support is required:
- `1.8` - Move to a `scratch`Docker image
- `1.9` - Bump to Go 1.21. Switch from `--key` seed to P256 key strings with `--key{gen,file}` (by @cmenginnz)
- `1.10` - Bump to Go 1.22. Add `.rpm` `.deb` and `.akp` to releases. Fix bad version comparison.
- `1.11` - Bump to Go 1.25.1. Update all dependencies.

## License

Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/jpillora/chisel

go 1.24.6
go 1.25.1

require (
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
Expand All @@ -9,17 +9,17 @@ require (
github.com/jpillora/backoff v1.0.0
github.com/jpillora/requestlog v1.0.0
github.com/jpillora/sizestr v1.0.0
golang.org/x/crypto v0.41.0
golang.org/x/net v0.43.0
golang.org/x/sync v0.16.0
golang.org/x/crypto v0.42.0
golang.org/x/net v0.44.0
golang.org/x/sync v0.17.0
)

require (
github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2 // indirect
github.com/jpillora/ansi v1.0.3 // indirect
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce // indirect
golang.org/x/sys v0.35.0 // indirect
golang.org/x/text v0.28.0 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/text v0.29.0 // indirect
)

replace github.com/jpillora/chisel => ../chisel
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ github.com/jpillora/sizestr v1.0.0 h1:4tr0FLxs1Mtq3TnsLDV+GYUWG7Q26a6s+tV5Zfw2yg
github.com/jpillora/sizestr v1.0.0/go.mod h1:bUhLv4ctkknatr6gR42qPxirmd5+ds1u7mzD+MZ33f0=
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce h1:fb190+cK2Xz/dvi9Hv8eCYJYvIGUTN2/KLq1pT6CjEc=
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4=
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw=
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.35.0 h1:bZBVKBudEyhRcajGcNc3jIfWPqV4y/Kt2XcoigOWtDQ=
golang.org/x/term v0.35.0/go.mod h1:TPGtkTLesOwf2DE8CgVYiZinHAOuy5AYUYT1lENIZnA=
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ func server(args []string) {
}
if config.KeyFile == "" {
config.KeyFile = settings.Env("KEY_FILE")
} else if config.KeySeed == "" {
}
if config.KeySeed == "" {
config.KeySeed = settings.Env("KEY")
}
if config.Auth == "" {
Expand Down
65 changes: 65 additions & 0 deletions test/e2e/env_key_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package e2e_test

import (
"os"
"testing"

chclient "github.com/jpillora/chisel/client"
chserver "github.com/jpillora/chisel/server"

Choose a reason for hiding this comment

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

Is this testing our version of chisel or jpillora's version?

Copy link
Author

Choose a reason for hiding this comment

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

good catch! but the tests are actually testing our OutSystems version.
We have a replace directive in go.mod that redirects all github.com/jpillora/chisel imports to use our local code instead. So even though the import paths show the upstream repo, Go automatically uses our OutSystems fork when running the tests.

)

func TestChiselKeyEnvironmentVariable(t *testing.T) {
// Set the CHISEL_KEY environment variable
os.Setenv("CHISEL_KEY", "test-key-value")
defer os.Unsetenv("CHISEL_KEY")

tmpPort := availablePort()

// Create server with empty config - should pick up CHISEL_KEY env var
serverConfig := &chserver.Config{}

// Setup server and client
teardown := simpleSetup(t,
serverConfig,
&chclient.Config{
Remotes: []string{tmpPort + ":$FILEPORT"},
})
defer teardown()

// Test that the connection works - if the key is properly set,
// the server should start successfully and connections should work
result, err := post("http://localhost:"+tmpPort, "env-key-test")
if err != nil {
t.Fatal(err)
}
if result != "env-key-test!" {
t.Fatalf("expected exclamation mark added, got: %s", result)
}
}

func TestChiselKeyEnvironmentVariableConsistency(t *testing.T) {
// This test verifies that the same CHISEL_KEY value produces
// consistent behavior (same fingerprint) by manually setting KeySeed
keyValue := "consistency-test-key"

// Create two server instances with the same KeySeed (simulating what main.go does)
server1, err := chserver.NewServer(&chserver.Config{
KeySeed: keyValue,
})
if err != nil {
t.Fatalf("Failed to create first server: %v", err)
}

server2, err := chserver.NewServer(&chserver.Config{
KeySeed: keyValue,
})
if err != nil {
t.Fatalf("Failed to create second server: %v", err)
}

// Both servers should have the same fingerprint since they use the same key
if server1.GetFingerprint() != server2.GetFingerprint() {
t.Fatalf("Expected same fingerprint for same key, got %s and %s",
server1.GetFingerprint(), server2.GetFingerprint())
}
}