mybb / mybb/docs.mybb.com

Refine cookie-related docs about cookie domain and cookie prefix

Open
#195 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
27
Forks
76
PR merge metrics
No merged PRs in 30d

Description

Relevant docs:
https://docs.mybb.com/1.8/development/cookies/
https://docs.mybb.com/1.8/faq/login-problems/

Points to refine:

  • The leading dot in cookie's domain setting shouldn't get emphasized.
  • Cookie prefix may cause login problem in some circumstances.
    Although rare, installing two MyBB with default settings, with same relative path but under different levels of a same domain (a domain and a sub-domain w.r.t. the first one), may cause login credential mismatch (before 1.8.16) or authorization code mismatch (as of 1.8.16). Please refer to this help: https://community.mybb.com/thread-227679-post-1349235.html#pid1349235

References:

  • From https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie we know:

    • Domain=<domain-value>: Host to which the cookie will be sent.
      • If omitted, defaults to the host of the current document URL, not including subdomains.
      • Contrary to earlier specifications, leading dots in domain names (.example.com) are ignored.
      • Multiple host/domain values are not allowed, but if a domain is specified, then subdomains are always included.
  • From https://tools.ietf.org/html/rfc6265#section-5.4 we know:

    • 1, Let cookie-list be the set of cookies from the cookie store that meets all of the following requirements:
      • Either: The cookie's host-only-flag is true and the canonicalized request-host is identical to the cookie's domain.
      • Or: The cookie's host-only-flag is false and the canonicalized request-host domain-matches the cookie's domain.
      • ...
    • 2, The user agent SHOULD sort the cookie-list in the following order:
      • Cookies with longer paths are listed before cookies with shorter paths.
      • Among cookies that have equal-length path fields, cookies with earlier creation-times are listed before cookies with later creation-times.
  • A more plain explanation: https://stackoverflow.com/a/4327214/6681141

Further, I think, in future release MyBB's default install script should remove the leading dot on cookie domain auto-detect and alert user about add cookie prefix if installing multiple mybb under sub-domains or just provide a random value for cookie prefix. I know Discuz! does the latter by setting a random cookie prefix.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the cookie documentation and login-problems FAQ linked in the issue, then compare their current wording with the cited MDN, RFC 6265, and community explanation. Clarify the leading-dot behavior and the cookie-prefix collision scenario; done means both pages accurately explain these cases, while the install-script ideas are separately scoped.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.