Commit Graph
3 Commits
  • fix(security): require a 2FA code to replace the stored TOTP secret
    The confirmation gate in updateSetting only covered the true -> false
    transition, so a settings save that kept twoFactorEnable=true while
    carrying a non-blank twoFactorToken silently rebound the authenticator.
    preserveRedactedSecrets restores the stored secret only when the
    submitted one is blank, so a non-blank value went straight through
    without any branch asking for a code.
    
    Not reachable pre-auth or cross-site (CSRFMiddleware rejects unsafe
    methods without the session token), but it matters after a session
    hijack or with an admin API token, which sets api_authed and
    short-circuits the CSRF check: the attacker gains persistence and locks
    the legitimate operator out of their own authenticator.
    
    Now a code is required whenever 2FA is currently on and the submitted
    secret differs from the stored one. Enabling from off is untouched, as
    no code exists yet to verify, and a blank secret still means
    "unchanged", so the panel's normal save path is unaffected.
    
    Reported by @n0ctal (GHSA-xqqw-jqqv-99h6).
  • feat(api): scoped, optionally expiring API tokens (#6201)
    * security(api): add scoped expiring API tokens
    
    * security(api): make scoped token lifecycle enforceable
    
    ---------
    
    Co-authored-by: n0ctal <293235942+n0ctal@users.noreply.github.com>
  • feat(sub): auto-detect subscription format by User-Agent (Updated) (#5826)
    * feat(settings): add subscription format controls
    
    * feat(sub): auto-detect subscription formats
    
    * fix(xray): validate balancer regexes before save
    
    * Revert "fix(xray): validate balancer regexes before save"
    
    This reverts commit 8a208ce71b7b3daed5d05607091203382d675e07.
    
    * doc(endpoints): align indent spaces
    
    * doc(settings): improve error message formatting in validateSubUserAgentRegex
    
    - Use NewErrorf with proper formatting instead of NewError with string concatenation
    - Add comment explaining the rationale for returning original pattern value
    - This preserves the intentional design where empty input is stored as empty
      in the DB and inherited as the runtime default at read time
    
    ---------
    
    Co-authored-by: Tomilla <5007859+Tomilla@users.noreply.github.com>
    Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>