Skip to content

fix: prevent Docker restart loop on auth failure#36

Merged
sunba91-su merged 1 commit into
mainfrom
fix/bot-login-hardening
Jun 8, 2026
Merged

fix: prevent Docker restart loop on auth failure#36
sunba91-su merged 1 commit into
mainfrom
fix/bot-login-hardening

Conversation

@sunba91-su

Copy link
Copy Markdown
Owner

Problem

When the bot fails to authenticate (wrong password, user not found, IP blocked), Docker's restart: unless-stopped restarts it indefinitely regardless of exit code, causing IP-based rate limiting and account lockout.

Fix

1. cmd/bot/main.go — Exit code 0 on auth error

Docker on-failure only restarts on non-zero exit codes. By exiting with code 0 on authentication failures, the container stays stopped permanently.

2. docker-compose.ymlrestart: on-failure

Transient errors (exit != 0, like network blips) still restart. Permanent auth errors (exit 0) keep the container stopped.

Policy Exit 0 Exit 1
unless-stopped Restarts ❌ Restarts ❌
on-failure Stays stopped Restarts ✅

Closes #35

Two changes to stop the bot from restarting indefinitely when
credentials are wrong:

1. Exit with code 0 on authentication errors (Docker only restarts
   on non-zero exit when policy is on-failure)
2. Change docker-compose restart policy from unless-stopped to
   on-failure so transient errors (exit 1) restart but permanent
   auth failures (exit 0) stay stopped

Closes #35
@sunba91-su sunba91-su merged commit 460e203 into main Jun 8, 2026
4 checks passed
@sunba91-su sunba91-su deleted the fix/bot-login-hardening branch June 8, 2026 16:30
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.

Docker restart loop on auth failure — exit code 0 and restart: on-failure

1 participant