Skip to content

Commit f074be2

Browse files
committed
Undeprecate InsecureSkipVerify
It's more clear than * as an origin pattern.
1 parent 71a12fb commit f074be2

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Diff for: accept.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ type AcceptOptions struct {
2828

2929
// InsecureSkipVerify is used to disable Accept's origin verification behaviour.
3030
//
31-
// Deprecated: Use OriginPatterns with a match all pattern of * instead to control
32-
// origin authorization yourself.
31+
// You probably want to use OriginPatterns instead.
3332
InsecureSkipVerify bool
3433

3534
// OriginPatterns lists the host patterns for authorized origins.
@@ -46,6 +45,9 @@ type AcceptOptions struct {
4645
//
4746
// Please ensure you understand the ramifications of enabling this.
4847
// If used incorrectly your WebSocket server will be open to CSRF attacks.
48+
//
49+
// Do not use * as a pattern to allow any origin, prefer to use InsecureSkipVerify instead
50+
// to bring attention to the danger of such a setting.
4951
OriginPatterns []string
5052

5153
// CompressionMode controls the compression mode.

Diff for: conn_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ func TestWasm(t *testing.T) {
273273

274274
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
275275
c, err := websocket.Accept(w, r, &websocket.AcceptOptions{
276-
Subprotocols: []string{"echo"},
277-
OriginPatterns: []string{"*"},
276+
Subprotocols: []string{"echo"},
277+
InsecureSkipVerify: true,
278278
})
279279
if err != nil {
280280
t.Errorf("echo server failed: %v", err)

0 commit comments

Comments
 (0)