Commit cb73317
committed
fix(dev): use localhost port wildcard for default CORS/WebSocket origins
Replace the hardcoded :8080 default origins with the localhost
port-wildcard pattern (http://localhost:[*], http://127.0.0.1:[*]) so the
allowlist no longer assumes the server runs on 8080 (it may run on any
port, e.g. ng serve on 4200 or a user-set server.port).
Switch both origin sinks from setAllowedOrigins to setAllowedOriginPatterns
(AdkWebCorsConfig HTTP CORS and WebSocketConfig /run_live), since the [*]
port pattern is only honored by the *Patterns API; with setAllowedOrigins
it would be treated as a literal and match nothing.
Security posture is unchanged: any localhost port is allowed, while remote
origins, suffix tricks (evil.localhost.com) and non-http schemes remain
blocked.1 parent de85300 commit cb73317
3 files changed
Lines changed: 3 additions & 3 deletions
File tree
- dev/src/main/java/com/google/adk/web
- config
- websocket
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
0 commit comments