Commit d5774ca
feat(api): support URL-backed phone gateways (#989)
* docs(api): design URL-backed notifications
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* docs(api): plan adapter gateway integration
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chore: ignore linked worktrees
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat(api): classify phone notification tokens
Add Phone.NotificationTransport and Phone.NotificationURL helpers with entity-level validation for FCM tokens and public HTTPS endpoints.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* feat(api): classify phone notification tokens
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* feat(api): tighten phone token classification
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* feat(api): validate adapter endpoints
* refactor(api): dispatch gateway notifications
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* feat(api): send notifications to adapters
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* fix(api): harden notification TLS transport
Clear TLS dial hooks and ServerName so policy validation and hostname verification cannot be bypassed. Restrict retries to standard 5xx statuses.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* feat(api): route phone gateway wake-ups
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* feat(api): enable URL-backed phone gateways
Validate adapter URLs with the same cached endpoint policy used by the secure notification dialer. Ignore private-host allowlists outside local environments.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* fix(api): preserve secured telemetry transport
Keep trusted HTTP middleware around the endpoint-policy transport so
notification delivery retains telemetry and connection hardening.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* fix(api): restrict trusted HTTP transports
Only service-created marked transports may preserve middleware. Opaque caller transports are replaced with policy-hardened transports so they cannot bypass SSRF dialing and TLS controls.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* test(api): cover URL-backed phone gateways
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* fix(api): harden adapter notifications
Enforce transport provenance and per-attempt endpoint checks to close
policy bypass and DNS timeout gaps.
Redact callback tokens from logs and telemetry. Encode TTLs with
protobuf JSON duration syntax.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* fix(api): relax adapter URL validation
Allow standard URL user information while retaining HTTPS and SSRF checks.
Construct endpoint policies on demand and share one only within each HTTP
sender graph so secured transport identity remains intact.
Keep FCM-token examples opaque to preserve the existing API guidance.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* refactor(api): simplify adapter delivery
Use the existing OpenTelemetry HTTP transport and retry-go delivery pattern.
Remove endpoint network policy and custom dialing while preserving callback
URL redaction in telemetry.
Reuse EventDispatcher directly and clarify the phone transport dispatcher
name.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* refactor(api): use standard logging paths
Use the same OpenTelemetry HTTP client as webhooks and preserve default
request, database, and notification logging without feature-specific
redaction.
Keep GORM query variables in traces.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* refactor(api): focus notification delivery
Reuse Firebase messages across transports and initialize one reusable retry
policy per HTTP sender. Split phone transport dispatch into its own component
and rely on the existing HTTP instrumentation.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* refactor(api): map notification clients
Reuse the existing FCMClient contract across Firebase and HTTP so new phone transports only require DI map configuration.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
* fix(api): restore phone request logs
Undo request-log scrubbing so phone handler failures retain the original URL and complete request parameters.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2884b08e-2828-4b50-a9e6-702dce51ec0d1 parent 2d17a90 commit d5774ca
36 files changed
Lines changed: 5435 additions & 169 deletions
File tree
- .github/workflows
- api
- docs
- pkg
- di
- entities
- handlers
- middlewares
- requests
- services
- validators
- docs/superpowers
- plans
- specs
- tests
- adapter-emulator
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2420 | 2420 | | |
2421 | 2421 | | |
2422 | 2422 | | |
2423 | | - | |
| 2423 | + | |
2424 | 2424 | | |
2425 | 2425 | | |
2426 | 2426 | | |
| |||
2483 | 2483 | | |
2484 | 2484 | | |
2485 | 2485 | | |
2486 | | - | |
| 2486 | + | |
2487 | 2487 | | |
2488 | 2488 | | |
2489 | 2489 | | |
| |||
4947 | 4947 | | |
4948 | 4948 | | |
4949 | 4949 | | |
| 4950 | + | |
4950 | 4951 | | |
4951 | 4952 | | |
4952 | 4953 | | |
| |||
4975 | 4976 | | |
4976 | 4977 | | |
4977 | 4978 | | |
| 4979 | + | |
4978 | 4980 | | |
4979 | 4981 | | |
4980 | 4982 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2417 | 2417 | | |
2418 | 2418 | | |
2419 | 2419 | | |
2420 | | - | |
| 2420 | + | |
2421 | 2421 | | |
2422 | 2422 | | |
2423 | 2423 | | |
| |||
2480 | 2480 | | |
2481 | 2481 | | |
2482 | 2482 | | |
2483 | | - | |
| 2483 | + | |
2484 | 2484 | | |
2485 | 2485 | | |
2486 | 2486 | | |
| |||
4944 | 4944 | | |
4945 | 4945 | | |
4946 | 4946 | | |
| 4947 | + | |
4947 | 4948 | | |
4948 | 4949 | | |
4949 | 4950 | | |
| |||
4972 | 4973 | | |
4973 | 4974 | | |
4974 | 4975 | | |
| 4976 | + | |
4975 | 4977 | | |
4976 | 4978 | | |
4977 | 4979 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
971 | 971 | | |
972 | 972 | | |
973 | 973 | | |
| 974 | + | |
| 975 | + | |
974 | 976 | | |
975 | 977 | | |
976 | 978 | | |
| |||
989 | 991 | | |
990 | 992 | | |
991 | 993 | | |
| 994 | + | |
| 995 | + | |
992 | 996 | | |
993 | 997 | | |
994 | 998 | | |
| |||
3337 | 3341 | | |
3338 | 3342 | | |
3339 | 3343 | | |
3340 | | - | |
| 3344 | + | |
| 3345 | + | |
3341 | 3346 | | |
3342 | 3347 | | |
3343 | 3348 | | |
| |||
3417 | 3422 | | |
3418 | 3423 | | |
3419 | 3424 | | |
3420 | | - | |
3421 | | - | |
| 3425 | + | |
| 3426 | + | |
| 3427 | + | |
| 3428 | + | |
3422 | 3429 | | |
3423 | 3430 | | |
3424 | 3431 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
565 | 565 | | |
566 | 566 | | |
567 | 567 | | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
568 | 586 | | |
569 | 587 | | |
570 | 588 | | |
| |||
1715 | 1733 | | |
1716 | 1734 | | |
1717 | 1735 | | |
1718 | | - | |
| 1736 | + | |
1719 | 1737 | | |
1720 | 1738 | | |
1721 | 1739 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
34 | 56 | | |
35 | 57 | | |
36 | 58 | | |
| |||
51 | 73 | | |
52 | 74 | | |
53 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
0 commit comments