Skip to content

feat: optional cookies for basicauth - #33

Merged
Lemmmy merged 1 commit into
masterfrom
lemmmy/basicauth-cookie
Jul 29, 2026
Merged

feat: optional cookies for basicauth#33
Lemmmy merged 1 commit into
masterfrom
lemmmy/basicauth-cookie

Conversation

@Lemmmy

@Lemmmy Lemmmy commented Jul 28, 2026

Copy link
Copy Markdown
Member

adds optional configuration for storing basicauth in a cookie, since browsers only store it for session lifetime. there's probably something to be said about the security of this, but i don't think it's really any less than basicauth itself is, or cookies in general. by default the cookies will refresh on half TTL (to avoid set-cookie spam and races), which is why there's an additional timestamp cookie stored. of course the user can tamper with this value, so there's no expectation of serverside enforcement of TTLs here. if the user's cookies are exfiltrated then they have bigger problems. if the sitemaster needs more security, then they should look at other auth solutions imo

configuration:

basicauth / username password {
  # default TTL 24h
  cookie
}

basicauth / username password {
  cookie {
    ttl 8760h # custom TTL
    refresh 168h # optional
  }
}

basicauth / username password {
  cookie {
    ttl 24h
    refresh 0 # never refresh
    name foo # custom cookie name
  }
}

@Lemmmy
Lemmmy requested a review from 1lann July 28, 2026 05:28
@Lemmmy Lemmmy added the enhancement New feature or request label Jul 28, 2026
@Lemmmy
Lemmmy merged commit e2152d1 into master Jul 29, 2026
1 check passed
@Lemmmy
Lemmmy deleted the lemmmy/basicauth-cookie branch July 29, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants