Commit 962d735
authored
fix(home-assistant): respect OOMOL_CONNECT_ALLOW_PRIVATE_NETWORK (#220)
## Summary
- Home Assistant connections to a LAN instance fail with `request URL
must not target private or reserved IP addresses`, even when the
deployment sets
`OOMOL_CONNECT_ALLOW_PRIVATE_NETWORK`.
- `src/providers/home_assistant/executors.ts` never passed
`allowPrivateNetwork` to `defineProviderExecutors`, so the flag had no
effect for this
provider.
- Adds the one-line opt-in, matching the 26 other providers that already
wire it.
## Problem
`defineProviderExecutors` builds a private-network-aware egress fetch
only when a provider opts in; otherwise it falls back to the public-only
`providerFetch`. Home Assistant took that fallback, so the flag could
never reach a `192.168.x.x` or `10.x.x.x` instance — the self-hosted
case it exists for. `homeassistant.local:8123`, the placeholder shown in
the connection form, was unreachable for the same reason.
Default behavior is unchanged: with the flag unset, private targets stay
blocked. Loopback, link-local, and cloud-metadata targets stay blocked
either way.
## Scope
Only the executor needed wiring. Home Assistant has no
`assertPublicHttpUrl` call site to thread the flag into
`resolveHomeAssistantBaseUrl` and `validateHomeAssistantCredential` both
route through the provider-local `normalizeBaseUrl` — and no
`proxy.registry.ts` entry. Migrating `normalizeBaseUrl` onto the shared
`assertPublicHttpUrl` is a separate change, not attempted here.
## Tests
Added to `src/providers/provider-runtime.test.ts` rather than a
provider-local file, per AGENTS.md: "Keep open-source-only
shared-infrastructure tests beside the shared module rather than inside
a provider directory." Three cases cover the shared opt-in path: default
blocks a private target, an opted-in executor reaches it once the flag
is enabled, and loopback stays blocked even then.
## Verification
`npm run fix-check` (clean) and `npm test` — 57 files, 566 tests
passing.1 parent 8dfd8de commit 962d735
2 files changed
Lines changed: 65 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
139 | 201 | | |
140 | 202 | | |
141 | 203 | | |
| |||
0 commit comments