Skip to content

fix: do not subscribe a webhook_url that is not an absolute URL #2206 - #2372

Open
Khan-Tzar wants to merge 1 commit into
aboutcode-org:mainfrom
Khan-Tzar:fix/2206-relative-webhook-url
Open

Khan-Tzar wants to merge 1 commit into
aboutcode-org:mainfrom
Khan-Tzar:fix/2206-relative-webhook-url

Conversation

@Khan-Tzar

Copy link
Copy Markdown

Issues

Changes

The delivery error in #2206 ("No connection adapters were found for '/notifications/send_scan_notification/...'") comes from a relative target URL. DejaCode builds the URL as settings.SITE_URL + reverse(...), and with an empty SITE_URL only the path is sent. The signed key in the path contains :, which is why requests raises InvalidSchema rather than MissingSchema.

On the ScanCode.io side, the single webhook_url field of the project API is a plain CharField, so any string was stored as the subscription target_url and the problem only appeared as a delivery error after the pipeline had run.

With this change, a webhook_url that is not an absolute http(s) URL is not subscribed. The project is still created and gets a warning message that names the value.

Two choices worth explaining:

  • No 400 on project creation. DejaCode does not look at the response of its submit call (dje/tasks.py), so rejecting the request would make the scan silently never run, which is worse than a missing notification.
  • urlparse (scheme + host) instead of Django's URLValidator. The validator rejects single-label hosts such as http://dejacode:8000/, the usual address in a compose network, and http://server/... used by the existing purldb tests.

The webhooks list and the add-webhook action are not touched.

Tests: three new tests in scanpipe/tests/test_api.py (valid single URL, relative path, the helper). scanpipe.tests.test_api passes (56 tests) in the v38.3.1-full image with this branch mounted; without the fix the relative-path test fails. ruff check and ruff format --check are clean on both files.

AI usage: I used Claude to read the two code bases, draft the change and the tests, and run them. I reviewed every line and can explain it.

Checklist

  • I have read the contributing guidelines
  • I have linked an existing issue above
  • I have added unit tests covering the new code
  • I have reviewed and understood every line of this PR

…code-org#2206

The single webhook_url field of the project API was saved as the target
URL without any check, so a relative path only showed up as a delivery
error once the pipeline had run. The project is now created without that
webhook and gets a warning message instead.

Signed-off-by: ivasilev <ivasgo@gmail.com>
@Khan-Tzar
Khan-Tzar force-pushed the fix/2206-relative-webhook-url branch from ad0f877 to 43a71e8 Compare November 23, 2026 22:31

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delivery Error in scan_single_package: No connection adapters were found for '/notifications/send_scan_notification/

1 participant