Package Details: python-safehttpx 0.1.7-3

Git Clone URL: https://aur.archlinux.org/python-safehttpx.git (read-only, click to copy)
Package Base: python-safehttpx
Description: A small Python library created to help developers protect their applications from Server Side Request Forgery (SSRF) attacks.
Upstream URL: https://github.com/gradio-app/safehttpx
Licenses: Apache-2.0
Submitter: medaminezghal
Maintainer: medaminezghal
Last Packager: medaminezghal
Votes: 1
Popularity: 0.000091
First Submitted: 2025-02-19 14:27 (UTC)
Last Updated: 2025-12-01 09:03 (UTC)

Latest Comments

« First ‹ Previous 1 2

medaminezghal commented on 2025-08-11 11:39 (UTC)

@Felixoid I have made a script to test if the package works before I upload it to the AUR.

medaminezghal commented on 2025-08-11 11:37 (UTC)

@Felixoid the sed -i "/93.184.215.14.nip.io/d" test/test.py should remove the broken link from the tests.

Try to clear the cache and install it again.

Felixoid commented on 2025-08-11 11:34 (UTC) (edited on 2025-08-11 11:44 (UTC) by Felixoid)

Thanks.

Unfortunately, the check() is still completely broken.

  1. The 192.168.1.250.nip.io is an unknown host, so there are more broken tests
> dig 192.168.1.250.nip.io

; <<>> DiG 9.20.11 <<>> 192.168.1.250.nip.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37326
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;192.168.1.250.nip.io.          IN      A

;; Query time: 22 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Mon Aug 11 13:13:37 CEST 2025
;; MSG SIZE  rcvd: 49
python -m pytest test/test.py
===================================================================== test session starts ======================================================================
platform linux -- Python 3.13.5, pytest-8.4.1, pluggy-1.6.0
rootdir: /home/felixoid/.cache/yay/python-safehttpx/src/safehttpx-0.1.6
configfile: pyproject.toml
plugins: anyio-4.10.0, mock-3.14.0, xdist-3.6.1, cov-6.1.1, asyncio-0.26.0
asyncio: mode=Mode.STRICT, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collected 11 items

test/test.py .....F...F.                                                                                                                                 [100%]
....
E       AssertionError: Regex pattern did not match.
E        Regex: 'failed validation'
E        Input: 'Unable to resolve hostname 192.168.1.250.nip.io: [Errno -5] No address associated with hostname'

test/test.py:20: AssertionError
....
E       AssertionError: Regex pattern did not match.
E        Regex: 'failed validation'
E        Input: 'Unable to resolve hostname 192.168.1.250.nip.io: [Errno -5] No address associated with hostname'

test/test.py:48: AssertionError
=================================================================== short test summary info ====================================================================
FAILED test/test.py::test_local_urls_fail[http://192.168.1.250.nip.io] - AssertionError: Regex pattern did not match.
FAILED test/test.py::test_domain_whitelist - AssertionError: Regex pattern did not match.
================================================================= 2 failed, 9 passed in 1.28s ==================================================================
  1. The test environment looks broken, didn't you want to use the virtual-env that was created? In any case, using venv looks like an antipattern to me. Every package necessary for check must be defined in checkdepends list, so no "install" should be required.

That's how the git diff is looking for addressed issues:

--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@
 _name=safehttpx
 pkgname=python-${_name}
 pkgver=0.1.6
-pkgrel=2
+pkgrel=3
 pkgdesc='A small Python library created to help developers protect their applications from Server Side Request Forgery (SSRF) attacks.'
 arch=('any')
 url='https://github.com/gradio-app/safehttpx'
@@ -14,11 +14,6 @@ depends=('python>=3.9' 'python-httpx')
 makedepends=('python-hatchling' 'python-build' 'python-installer' 'python-wheel')
 checkdepends=('python-pytest')

-prepare(){
-  cd "${srcdir}"/${_name}-${pkgver}
-  sed -i "/93.184.215.14.nip.io/d" test/test.py
-}
-
 build() {
   cd "${srcdir}"/${_name}-${pkgver}
   python -m build --wheel --no-isolation
@@ -26,9 +21,9 @@ build() {

 check() {
   cd "${srcdir}"/${_name}-${pkgver}
-  python -m venv --system-site-packages test-env
-  test-env/bin/python -m installer dist/*.whl
-  test-env/bin/python -m pytest "${pytest_options[@]}" test/test.py
+  # The pytest expression for broken tests
+  broken_tests='not (.nip.io or test_domain_whitelist)'
+  python -m pytest test/test.py -k "${broken_tests}"
 }

 package() {

medaminezghal commented on 2025-08-11 04:45 (UTC)

@Felixoid I have fixed the issue by removing just the broken link. Thanks for mentioning python-build python-installer, I've added them to makedepends.

Felixoid commented on 2025-08-06 10:34 (UTC)

The package misses python-build python-installer makedepends

pqatsi commented on 2025-07-18 13:12 (UTC)

Created upstream issue https://github.com/gradio-app/safehttpx/issues/14

pqatsi commented on 2025-07-18 13:02 (UTC)

Indeed the public url is falling:

/usr/lib/python3.13/site-packages/httpx/_transports/default.py:118: ConnectError
=========================== short test summary info ============================
FAILED test/test.py::test_public_urls_pass[http://93.184.215.14.nip.io/] - httpx.ConnectError: All connection attempts failed
=================== 1 failed, 11 passed in 147.68s (0:02:27) ===================

salfter commented on 2025-07-03 16:46 (UTC)

Build test failures are causing the package to not install:

=============================================== short test summary info ================================================
FAILED test/test.py::test_local_urls_fail[http://192.168.1.250.nip.io] - AssertionError: Regex pattern did not match.
FAILED test/test.py::test_public_urls_pass[http://93.184.215.14.nip.io/] - httpx.ConnectError: All connection attempts failed
FAILED test/test.py::test_domain_whitelist - AssertionError: Regex pattern did not match.
======================================= 3 failed, 9 passed in 136.97s (0:02:16) ========================================

micwoj92 commented on 2025-04-10 23:37 (UTC)

Needs python-installer and python-build in makedeps.