httpx-secure 1.2.0__tar.gz → 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,502 @@
1
+ # File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
2
+ # Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,linux,c,cmake,direnv,dotenv,node,python,rust
3
+ # Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,linux,c,cmake,direnv,dotenv,node,python,rust
4
+
5
+ ### C ###
6
+ # Prerequisites
7
+ *.d
8
+
9
+ # Object files
10
+ *.o
11
+ *.ko
12
+ *.obj
13
+ *.elf
14
+
15
+ # Linker output
16
+ *.ilk
17
+ *.map
18
+ *.exp
19
+
20
+ # Precompiled Headers
21
+ *.gch
22
+ *.pch
23
+
24
+ # Libraries
25
+ *.lib
26
+ *.a
27
+ *.la
28
+ *.lo
29
+
30
+ # Shared objects (inc. Windows DLLs)
31
+ *.dll
32
+ *.so
33
+ *.so.*
34
+ *.dylib
35
+
36
+ # Executables
37
+ *.exe
38
+ *.out
39
+ *.app
40
+ *.i*86
41
+ *.x86_64
42
+ *.hex
43
+
44
+ # Debug files
45
+ *.dSYM/
46
+ *.su
47
+ *.idb
48
+ *.pdb
49
+
50
+ # Kernel Module Compile Results
51
+ *.mod*
52
+ !h2corn/bench/grpc_client/go.mod
53
+ *.cmd
54
+ .tmp_versions/
55
+ modules.order
56
+ Module.symvers
57
+ Mkfile.old
58
+ dkms.conf
59
+
60
+ ### CMake ###
61
+ CMakeLists.txt.user
62
+ CMakeCache.txt
63
+ CMakeFiles
64
+ CMakeScripts
65
+ Testing
66
+ Makefile
67
+ cmake_install.cmake
68
+ install_manifest.txt
69
+ compile_commands.json
70
+ CTestTestfile.cmake
71
+ _deps
72
+
73
+ ### CMake Patch ###
74
+ CMakeUserPresets.json
75
+
76
+ # External projects
77
+ *-prefix/
78
+
79
+ ### direnv ###
80
+ .direnv
81
+ .envrc
82
+
83
+ ### dotenv ###
84
+ .env
85
+
86
+ ### Linux ###
87
+ *~
88
+
89
+ # temporary files which can be created if a process still has a handle open of a deleted file
90
+ .fuse_hidden*
91
+
92
+ # KDE directory preferences
93
+ .directory
94
+
95
+ # Linux trash folder which might appear on any partition or disk
96
+ .Trash-*
97
+
98
+ # .nfs files are created when an open file is removed but is still being accessed
99
+ .nfs*
100
+
101
+ ### Node ###
102
+ # Logs
103
+ logs
104
+ *.log
105
+ npm-debug.log*
106
+ yarn-debug.log*
107
+ yarn-error.log*
108
+ lerna-debug.log*
109
+ .pnpm-debug.log*
110
+
111
+ # Diagnostic reports (https://nodejs.org/api/report.html)
112
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
113
+
114
+ # Runtime data
115
+ pids
116
+ *.pid
117
+ *.seed
118
+ *.pid.lock
119
+
120
+ # Directory for instrumented libs generated by jscoverage/JSCover
121
+ lib-cov
122
+
123
+ # Coverage directory used by tools like istanbul
124
+ /coverage/
125
+ *.lcov
126
+
127
+ # nyc test coverage
128
+ .nyc_output
129
+
130
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
131
+ .grunt
132
+
133
+ # Bower dependency directory (https://bower.io/)
134
+ bower_components
135
+
136
+ # node-waf configuration
137
+ .lock-wscript
138
+
139
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
140
+ build/Release
141
+
142
+ # Dependency directories
143
+ node_modules/
144
+ jspm_packages/
145
+
146
+ # Snowpack dependency directory (https://snowpack.dev/)
147
+ web_modules/
148
+
149
+ # TypeScript cache
150
+ *.tsbuildinfo
151
+
152
+ # Optional npm cache directory
153
+ .npm
154
+
155
+ # Optional eslint cache
156
+ .eslintcache
157
+
158
+ # Optional stylelint cache
159
+ .stylelintcache
160
+
161
+ # Microbundle cache
162
+ .rpt2_cache/
163
+ .rts2_cache_cjs/
164
+ .rts2_cache_es/
165
+ .rts2_cache_umd/
166
+
167
+ # Optional REPL history
168
+ .node_repl_history
169
+
170
+ # Output of 'npm pack'
171
+ *.tgz
172
+
173
+ # Yarn Integrity file
174
+ .yarn-integrity
175
+
176
+ # dotenv environment variable files
177
+ .env.development.local
178
+ .env.test.local
179
+ .env.production.local
180
+ .env.local
181
+
182
+ # parcel-bundler cache (https://parceljs.org/)
183
+ .cache
184
+ .parcel-cache
185
+
186
+ # Next.js build output
187
+ .next
188
+ out
189
+
190
+ # Nuxt.js build / generate output
191
+ .nuxt
192
+ dist
193
+
194
+ # Gatsby files
195
+ .cache/
196
+ # Comment in the public line in if your project uses Gatsby and not Next.js
197
+ # https://nextjs.org/blog/next-9-1#public-directory-support
198
+ # public
199
+
200
+ # vuepress build output
201
+ .vuepress/dist
202
+
203
+ # vuepress v2.x temp and cache directory
204
+ .temp
205
+
206
+ # Docusaurus cache and generated files
207
+ .docusaurus
208
+
209
+ # Serverless directories
210
+ .serverless/
211
+
212
+ # FuseBox cache
213
+ .fusebox/
214
+
215
+ # DynamoDB Local files
216
+ .dynamodb/
217
+
218
+ # TernJS port file
219
+ .tern-port
220
+
221
+ # Stores VSCode versions used for testing VSCode extensions
222
+ .vscode-test
223
+
224
+ # yarn v2
225
+ .yarn/cache
226
+ .yarn/unplugged
227
+ .yarn/build-state.yml
228
+ .yarn/install-state.gz
229
+ .pnp.*
230
+
231
+ ### Node Patch ###
232
+ # Serverless Webpack directories
233
+ .webpack/
234
+
235
+ # Optional stylelint cache
236
+
237
+ # SvelteKit build / generate output
238
+ .svelte-kit
239
+
240
+ ### Python ###
241
+ # Byte-compiled / optimized / DLL files
242
+ __pycache__/
243
+ *.py[cod]
244
+ *$py.class
245
+
246
+ # C extensions
247
+
248
+ # Distribution / packaging
249
+ .Python
250
+ build/
251
+ develop-eggs/
252
+ dist/
253
+ downloads/
254
+ eggs/
255
+ .eggs/
256
+ lib/
257
+ lib64/
258
+ parts/
259
+ sdist/
260
+ var/
261
+ wheels/
262
+ share/python-wheels/
263
+ *.egg-info/
264
+ .installed.cfg
265
+ *.egg
266
+ MANIFEST
267
+
268
+ # PyInstaller
269
+ # Usually these files are written by a python script from a template
270
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
271
+ *.manifest
272
+ *.spec
273
+
274
+ # Installer logs
275
+ pip-log.txt
276
+ pip-delete-this-directory.txt
277
+
278
+ # Unit test / coverage reports
279
+ htmlcov/
280
+ .tox/
281
+ .nox/
282
+ .coverage
283
+ .coverage.*
284
+ nosetests.xml
285
+ coverage.xml
286
+ *.cover
287
+ *.py,cover
288
+ .hypothesis/
289
+ .pytest_cache/
290
+ cover/
291
+
292
+ # Translations
293
+ *.mo
294
+ *.pot
295
+
296
+ # Django stuff:
297
+ local_settings.py
298
+ db.sqlite3
299
+ db.sqlite3-journal
300
+
301
+ # Flask stuff:
302
+ instance/
303
+ .webassets-cache
304
+
305
+ # Scrapy stuff:
306
+ .scrapy
307
+
308
+ # Sphinx documentation
309
+ docs/_build/
310
+
311
+ # PyBuilder
312
+ .pybuilder/
313
+ target/
314
+
315
+ # Jupyter Notebook
316
+ .ipynb_checkpoints
317
+
318
+ # IPython
319
+ profile_default/
320
+ ipython_config.py
321
+
322
+ # pyenv
323
+ # For a library or package, you might want to ignore these files since the code is
324
+ # intended to run in multiple environments; otherwise, check them in:
325
+ # .python-version
326
+
327
+ # pipenv
328
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
329
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
330
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
331
+ # install all needed dependencies.
332
+ #Pipfile.lock
333
+
334
+ # poetry
335
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
336
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
337
+ # commonly ignored for libraries.
338
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
339
+ #poetry.lock
340
+
341
+ # pdm
342
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
343
+ #pdm.lock
344
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
345
+ # in version control.
346
+ # https://pdm.fming.dev/#use-with-ide
347
+ .pdm.toml
348
+
349
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
350
+ __pypackages__/
351
+
352
+ # Celery stuff
353
+ celerybeat-schedule
354
+ celerybeat.pid
355
+
356
+ # SageMath parsed files
357
+ *.sage.py
358
+
359
+ # Environments
360
+ .venv
361
+ env/
362
+ venv/
363
+ ENV/
364
+ env.bak/
365
+ venv.bak/
366
+
367
+ # Spyder project settings
368
+ .spyderproject
369
+ .spyproject
370
+
371
+ # Rope project settings
372
+ .ropeproject
373
+
374
+ # mkdocs documentation (build output, any package)
375
+ site/
376
+
377
+ # mypy
378
+ .mypy_cache/
379
+ .dmypy.json
380
+ dmypy.json
381
+
382
+ # Pyre type checker
383
+ .pyre/
384
+
385
+ # pytype static type analyzer
386
+ .pytype/
387
+
388
+ # Cython debug symbols
389
+ cython_debug/
390
+
391
+ # PyCharm
392
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
393
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
394
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
395
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
396
+ #.idea/
397
+
398
+ ### Python Patch ###
399
+ # Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
400
+ poetry.toml
401
+
402
+ # ruff
403
+ .ruff_cache/
404
+
405
+ # LSP config files
406
+ pyrightconfig.json
407
+
408
+ ### Rust ###
409
+ # Generated by Cargo
410
+ # will have compiled files and executables
411
+ debug/
412
+
413
+ # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
414
+ # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
415
+ Cargo.lock
416
+
417
+ # These are backup files generated by rustfmt
418
+ **/*.rs.bk
419
+
420
+ # MSVC Windows builds of rustc generate these, which store debugging information
421
+
422
+ ### VisualStudioCode ###
423
+ .vscode/*
424
+ !.vscode/settings.json
425
+ !.vscode/tasks.json
426
+ !.vscode/launch.json
427
+ !.vscode/extensions.json
428
+ !.vscode/*.code-snippets
429
+
430
+ # Local History for Visual Studio Code
431
+ .history/
432
+
433
+ # Built Visual Studio Code Extensions
434
+ *.vsix
435
+
436
+ ### VisualStudioCode Patch ###
437
+ # Ignore all local history of files
438
+ .history
439
+ .ionide
440
+
441
+ # End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,linux,c,cmake,direnv,dotenv,node,python,rust
442
+
443
+ # Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
444
+ #
445
+ # Commit sources and generators, not build, documentation, license, or benchmark outputs.
446
+
447
+ !.envrc
448
+ !/Cargo.lock
449
+
450
+ .codex
451
+ .claude/
452
+ .agents/
453
+ .codex/
454
+ **/AGENTS.md
455
+ **/CLAUDE.md
456
+ .uv-cache/
457
+ repomix-output.xml
458
+ uv.lock
459
+ # Free-threaded / variant venvs (uv creates .venv-t etc.; plain .venv is above)
460
+ .venv*/
461
+ **/.venv*/
462
+
463
+ # LLVM/coverage profiles (also under target/, but may land elsewhere)
464
+ .pgo/
465
+ *.profraw
466
+ *.profdata
467
+
468
+ # Per-package cargo targets (h2corn target-py314t, gometry target-local, …)
469
+ **/target-*/
470
+
471
+ githead/tests/git/HEAD
472
+ jinja2-htmlmin/tests/templates/.*
473
+
474
+ # Benchmark measurements, provenance, tables, and plots are external artifacts.
475
+ **/bench/results/
476
+ **/benches/results/
477
+ **/benchmarks/results/
478
+ **/docs/assets/benchmark-runs/
479
+ **/docs/assets/benchmark-*.svg
480
+ h2corn/bench/*.bin
481
+ h2corn/examples/grpc/gen/
482
+
483
+ # gometry: the only genuinely package-specific rules (build artifacts and
484
+ # LICENSE-*.md are already covered by the general `target/` and `**/LICENSE*.md`
485
+ # rules above). This coverage output is gometry-tool-specific:
486
+ gometry/coverage-python/
487
+ # The root Node-template `coverage` rule would otherwise hide this Rust source
488
+ # module; generated Python coverage reports remain ignored above.
489
+ !gometry/src/geometry/coverage/
490
+ !gometry/src/geometry/coverage/**
491
+
492
+ # mkdocs / properdocs build output (any package)
493
+ **/site/
494
+ test-results/
495
+
496
+ # Generated license files (any released package). Rendered at build time by
497
+ # .github/scripts/gen_licenses.py from each pyproject's SPDX expression (own
498
+ # license, one file per OR choice) and the Cargo dependency graph (rusty
499
+ # third-party bundle), then bundled into the wheel/sdist via the PEP 639
500
+ # default license-files glob. Every generated license file is LICENSE*.md;
501
+ # no license text is ever committed.
502
+ **/LICENSE*.md
@@ -1,4 +1,6 @@
1
- BSD Zero Clause License
1
+ # 0BSD License
2
+
3
+ Copyright (c) 2026 Kamil Monicz
2
4
 
3
5
  Permission to use, copy, modify, and/or distribute this software for any
4
6
  purpose with or without fee is hereby granted.
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.5
2
+ Name: httpx-secure
3
+ Version: 2.0.0
4
+ Summary: Connection-level SSRF protection for existing HTTPX async clients
5
+ Project-URL: Issues, https://github.com/Zaczero/pkgs/issues
6
+ Project-URL: Repository, https://github.com/Zaczero/pkgs/tree/main/httpx-secure
7
+ Author-email: Kamil Monicz <kamil@monicz.dev>
8
+ License-Expression: 0BSD
9
+ License-File: LICENSE.md
10
+ Keywords: anyio,async,asyncio,client,dns,dns-cache,http,httpx,security,ssrf,ssrf-protection,trio,web-security
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Framework :: AnyIO
13
+ Classifier: Framework :: AsyncIO
14
+ Classifier: Framework :: Trio
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: Zero-Clause BSD (0BSD)
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Programming Language :: Python :: 3.15
23
+ Classifier: Topic :: Internet :: WWW/HTTP
24
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
25
+ Classifier: Topic :: Security
26
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
+ Classifier: Topic :: System :: Networking
28
+ Classifier: Typing :: Typed
29
+ Requires-Python: >=3.11
30
+ Requires-Dist: anyio<5,>=4
31
+ Requires-Dist: httpcore<1.1,>=1.0.9
32
+ Requires-Dist: httpx<0.29,>=0.28.1
33
+ Description-Content-Type: text/markdown
34
+
35
+ # httpx-secure
36
+
37
+ <a id="why-use-this"></a>
38
+
39
+ Block requests to private and non-global IP addresses in an existing HTTPX
40
+ `AsyncClient`. Add your own destination rules without changing HTTPX's request
41
+ API. Python 3.11+, with asyncio or Trio.
42
+
43
+ ## Installation
44
+
45
+ ```sh
46
+ pip install httpx-secure
47
+ ```
48
+
49
+ HTTP/2 remains optional: install `httpx[http2]` when configuring an HTTP/2 client.
50
+
51
+ ## Quick Start
52
+
53
+ Configure a direct client before making requests:
54
+
55
+ ```python
56
+ import asyncio
57
+ import httpx
58
+ from httpx_secure import SSRFProtectionError, httpx_ssrf_protection
59
+
60
+ async def main():
61
+ async with httpx.AsyncClient(trust_env=False) as client:
62
+ httpx_ssrf_protection(client)
63
+ try:
64
+ await client.get("http://127.0.0.1/private")
65
+ except SSRFProtectionError as error:
66
+ print(f"Blocked: {error.hostname}")
67
+
68
+ asyncio.run(main()) # Blocked: 127.0.0.1
69
+ ```
70
+
71
+ The returned object is the same client. Keep using its ordinary `get`, `post`,
72
+ `send`, `stream` and async context-manager interfaces. HTTPX continues to own
73
+ timeouts, authentication, TLS configuration and response streaming.
74
+ See [connection authorization](#connection-authorization) for the policy boundary.
75
+
76
+ ## Custom Validation
77
+
78
+ A validator receives the logical hostname, selected `IPv4Address` or
79
+ `IPv6Address`, and effective destination port. It may return a bool directly or
80
+ asynchronously. The global-address check runs first and cannot be overridden by
81
+ an accepting custom validator.
82
+
83
+ For example, restrict connections to port 443:
84
+
85
+ ```python
86
+ import asyncio
87
+ import httpx
88
+ from httpx_secure import httpx_ssrf_protection
89
+
90
+ def https_port_only(hostname, address, port):
91
+ return port == 443
92
+
93
+ async def main():
94
+ async with httpx.AsyncClient(trust_env=False) as client:
95
+ httpx_ssrf_protection(client, custom_validator=https_port_only)
96
+ # Make requests with client here.
97
+
98
+ asyncio.run(main())
99
+ ```
100
+
101
+ Set `check_globally_reachable=False` only when your custom validator owns the
102
+ entire destination policy, such as explicitly permitting a particular internal
103
+ service. A custom validator is required in that configuration.
104
+
105
+ ## Supported Clients
106
+
107
+ Call the helper while exclusively configuring the client on its owning async
108
+ runtime. A newly created client or a client inside its context manager is
109
+ supported. Already-used clients are supported when every response has finished
110
+ or been closed and no requests remain active or queued.
111
+
112
+ The helper retains the existing client, standard `AsyncHTTPTransport` instances,
113
+ connection pools, SSL contexts, HTTP-version settings, limits and direct mounts.
114
+ Existing idle HTTP/1.1 and HTTP/2 connections expire before reuse. Their pools close
115
+ them on the next request or during client closure.
116
+
117
+ Setup fails before changing any route when the client has:
118
+
119
+ - HTTP, HTTPS or SOCKS proxy routes, including environment-created proxy mounts;
120
+ - Unix-domain sockets, custom transports or custom network backends;
121
+ - custom client routing instead of HTTPX's normal transport selection;
122
+ - active requests, pending requests or open streamed responses; or
123
+ - unsupported transport/connection state.
124
+
125
+ For an intended direct client, `trust_env=False` avoids environment-created proxy
126
+ routes. `trust_env=True` is supported when no proxy route is actually configured;
127
+ existing environment-derived SSL trust is retained. The helper does not remove
128
+ proxies or silently fall back to weaker protection for unsupported routes.
129
+
130
+ Sharing a transport between clients also shares its connector policy. Configure
131
+ such transports exclusively; do not mutate routing or replace transports after
132
+ installation. Async task sharing after setup follows HTTPX's normal client
133
+ lifecycle. Cross-thread or cross-event-loop configuration is not supported.
134
+
135
+ <a id="how-it-works"></a>
136
+
137
+ ## Connection Authorization
138
+
139
+ For a new connection, the connector selects an IP, applies the global-address and
140
+ custom checks, and opens the data-bearing connection to that exact numeric IP
141
+ and port. HTTPX and HTTPcore retain the logical origin for pooling, TLS certificate
142
+ verification/SNI, redirects, cookies and Host authority. Absolute redirects that
143
+ need another connection receive that destination's policy check.
144
+
145
+ **Hostname selection can open and close plain TCP probes, including to a denied
146
+ address. Probes send no HTTP or application data.** This package does not promise
147
+ zero TCP contact with denied addresses. Literal IPs do not need a selection probe.
148
+ A failed validated-IP connection does not fall back to an unvalidated hostname.
149
+
150
+ Authorization lasts for the established connection's lifetime. The bounded
151
+ address-selection cache stores approved selections and denials; expiry affects
152
+ new connections, not requests on an established socket. To apply a changed custom
153
+ policy immediately, close the client and create/configure another client.
154
+
155
+ The default check uses Python's `ipaddress.is_global` classification and also
156
+ blocks non-global IPv4 addresses embedded in the well-known NAT64 prefix. It is
157
+ an endpoint-IP policy, not a network firewall or a policy for what an authorized
158
+ remote application may do. Caller-supplied Host/SNI overrides and the client's
159
+ trusted routing configuration remain the caller's responsibility.
160
+
161
+ ## API Reference
162
+
163
+ ### httpx_ssrf_protection
164
+
165
+ Accepts an existing `httpx.AsyncClient` and returns that **same instance**.
166
+ See [the function reference](https://github.com/Zaczero/pkgs/blob/main/httpx-secure/httpx_secure/__init__.py)
167
+ or `help(httpx_ssrf_protection)` for its signature and defaults.
168
+
169
+ | Parameter | Meaning |
170
+ | --- | --- |
171
+ | `client` | Quiescent existing client with supported direct routes. |
172
+ | `check_globally_reachable` | Apply the global-IP and NAT64 checks. |
173
+ | `custom_validator` | Optional sync/async `(hostname, address, port) -> bool` policy; required when the global check is disabled. |
174
+ | `dns_cache_size` | Maximum cached selections/denials; zero disables retention. Keys distinguish hostname, port and local bind address. |
175
+ | `dns_cache_ttl` | Cache lifetime in seconds, applied to new connections. |
176
+ | `happy_eyeballs_delay` | Seconds between hostname-selection probe attempts. |
177
+
178
+ The current request's connect timeout bounds cache-lock waiting, probe,
179
+ asynchronous validation and final TCP connection together. TLS, pool, read and
180
+ write timeouts retain HTTPX/HTTPcore's separate phase semantics. Custom-validator
181
+ exceptions propagate; temporary connection failures and cancellation are not
182
+ cached as denials.
183
+
184
+ `TypeError` reports a non-`AsyncClient` or non-callable validator. `ValueError`
185
+ reports unsupported routing/configuration or a completely disabled policy.
186
+ `RuntimeError` reports a closed/already-protected client or setup attempted during
187
+ active use. Finish or close outstanding responses before retrying setup.
188
+
189
+ ### SSRFProtectionError
190
+
191
+ An HTTPX `RequestError` raised when the selected destination is denied. Each
192
+ failure is a fresh exception with the current `request`, logical `hostname`,
193
+ selected `ip_addr` (`IPv4Address`, `IPv6Address`, or None for an invalid address)
194
+ and effective `port`.
195
+
196
+ Its `invalid_ip`, `non_global` and `custom_validation_failed` classmethods construct
197
+ the corresponding unbound errors; requests through HTTPX bind them to the current
198
+ request. DNS/connection failures use HTTPX `ConnectError`, and connect deadlines
199
+ use `ConnectTimeout`. Catch those separately when deciding whether to retry.
200
+
201
+ ## Support
202
+
203
+ [Issues and questions](https://github.com/Zaczero/pkgs/issues) ·
204
+ [Private security reports](https://github.com/Zaczero/pkgs/security/advisories/new) ·
205
+ [Premium support](https://monicz.dev/#get-in-touch)