| 546 | } |
| 547 | |
| 548 | func TestNoopWebpusher(t *testing.T) { |
| 549 | t.Parallel() |
| 550 | |
| 551 | noop := &webpush.NoopWebpusher{ |
| 552 | Msg: "push disabled", |
| 553 | } |
| 554 | |
| 555 | dispatchErr := noop.Dispatch(context.Background(), uuid.New(), codersdk.WebpushMessage{}) |
| 556 | require.Error(t, dispatchErr) |
| 557 | require.Contains(t, dispatchErr.Error(), "push disabled") |
| 558 | |
| 559 | testErr := noop.Test(context.Background(), codersdk.WebpushSubscription{}) |
| 560 | require.Error(t, testErr) |
| 561 | require.Contains(t, testErr.Error(), "push disabled") |
| 562 | |
| 563 | require.Empty(t, noop.PublicKey()) |
| 564 | } |
| 565 | |
| 566 | // TestSSRFPrevention verifies that the default SSRF-safe HTTP client blocks |
| 567 | // webpush delivery to loopback (and other non-public) addresses. This |