Authentication

Configure login, API keys, rate limiting, and password storage.

Comicarr uses JWT session cookies for the web UI, optional API key access for a limited set of library endpoints, and several security hardening features.

HTTP Authentication

SettingTypeDefaultDescription
HTTP_USERNAMEstringLogin username.
HTTP_PASSWORDstringLogin password. Stored as a bcrypt hash.

Credentials are created during first-run setup. Do not hand-edit the bcrypt hash in config.ini.

Authentication Mode

SettingTypeDefaultDescription
AUTHENTICATIONint2Historical Mylar-era mode flag. First-run setup sets form-based login (2). The FastAPI UI uses form login + JWT sessions.

The modern web UI always uses form login with a JWT cookie. Treat basic-auth mode (0) as legacy.

Session Management

SettingTypeDefaultDescription
LOGIN_TIMEOUTint43800JWT token expiry in minutes. Default is approximately 30 days (43,800 minutes).

Sessions are JWT-based (HS256). The signing key lives under SECURE_DIR (default <data_dir>/.secure/), separate from the Fernet master key.

The token is set as an HttpOnly, SameSite=Strict cookie named comicarr_session.

CSRF Protection

Comicarr requires a custom header on all state-changing requests:

ParameterValue
Required headerX-Requested-With: ComicarrFrontend
Affected methodsPOST, PUT, DELETE, PATCH
Exempt paths/opds, /api/health

Security Headers

HeaderValue
X-Content-Type-Optionsnosniff
X-Frame-OptionsDENY
Referrer-Policystrict-origin-when-cross-origin
Permissions-Policycamera=(), microphone=(), geolocation=()
Cross-Origin-Opener-Policysame-origin
X-XSS-Protection0
Content-Security-PolicyRestricts sources for scripts, styles, images, etc.
Strict-Transport-SecurityAdded when ENABLE_HTTPS is true

Setup Gate

On first run, Comicarr blocks non-setup requests until credentials are configured. Allowed paths include:

  • /, /index.html, /login
  • /api/auth/setup, /api/auth/check-setup
  • /assets, /favicon.ico
  • /api/health

A setup token is printed to the console / container logs and must be supplied to /api/auth/setup when active.

API Access

SettingTypeDefaultDescription
API_KEYstringauto-generatedPersistent API key for library browse endpoints.
API_ENABLEDboolset true when a key is generatedAPI key auth for supported routes.

On first startup Comicarr generates a 32-character API key and enables API key support. Regenerate under Settings → API & providers.

Pass the key as the X-Api-Key header on the API key endpoints. Most app routes require a session cookie, not an API key.

Rate Limiting

Login is rate-limited against brute-force attacks:

ParameterValue
Maximum attempts5 per IP
Lockout duration300 seconds (5 minutes)

These values are hardcoded.

Password Storage

Comicarr uses bcrypt with 12 salt rounds for password hashing.

SettingTypeDefaultDescription
ENCRYPT_PASSWORDSboolTrueEnable bcrypt hashing for stored passwords.
SECURE_DIRstring<data_dir>/.secureDirectory for jwt.key, master.key, and related secrets.

Legacy Migration

Older installations may have passwords stored as base64-encoded strings. Comicarr detects these and migrates them to bcrypt. No user action is required.

Do not manually edit HTTP_PASSWORD in config.ini. Use first-run setup or the web UI to change your password.

On this page