Skip to content

fix: add timeouts to all http.DefaultClient calls #19

Description

@peg

Problem

Several CLI commands use http.DefaultClient with no timeout. If snare.sh is unreachable, the CLI hangs forever. Affects snare events, snare test, snare status, and the arm/disarm registration calls.

Fix

Replace http.DefaultClient with a client that has a 15-30s timeout, or use context.WithTimeout on all outbound requests.

client := &http.Client{Timeout: 15 * time.Second}

Affected files

  • internal/cli/cli.go
  • internal/serve/serve.go

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions