Skip to content

phx.gen.auth should provide a way to generate /.well-known/change-password URL #6853

Open

Description

@hauleth

This well-known URL is used by password managers to detect the path for password changes to allow automated password changes in case of credentials leakage.

https://w3c.github.io/webappsec-change-password-url/

The problem I potentially see is how to handle situations, when there is more than one phx.gen.auth call, but I think that there should be some way to define the default there.

Activity

  1. SteffenDE commented on Sep 25, 2026

    @SteffenDE
    Member

    I think we can generate one on the first run and log an error if we find a duplicate route

  2. rhcarvalho commented on Oct 14, 2026

    @rhcarvalho
    Collaborator

    (sorry for the accidental early submission)

    phx.gen.auth should provide a way to generate /.well-known/change-password URL

    This could be done in user-land with something like:

    # lib/my_app_web/controllers/redirect_controller.ex
    defmodule MyAppWeb.RedirectController do
      use MyAppWeb, :controller
    
      def init(opts), do: opts
    
      def call(conn, to: to) do
        redirect(conn, to: to)
      end
    end
    
    # lib/my_app_web/router.ex
      scope "/", MyAppWeb do
        pipe_through :browser
    
        get "/", PageController, :home
    
        get "/.well-known/change-password", RedirectController, to: "/users/settings"
      end

    @hauleth what did you imagine that Phoenix would do natively or that would be generated as part of mix phx.gen.auth?

  3. hauleth commented on Oct 14, 2026

    @hauleth
    ContributorAuthor

    I know it can be done in the userland. That is not the point. The point is that mix phx.gen.auth should do that by default to promote good behaviours from the users.

  4. rhcarvalho commented on Oct 14, 2026

    @rhcarvalho
    Collaborator

    The point is that mix phx.gen.auth should do that by default to promote good behaviours from the users.

    Got it!

    AFAICT serving /.well-known/ out of the box has no precedent. Do you know of any other web framework that does that?

    In my experience, most mainstream web frameworks do not expose these URLs. Because /.well-known/ paths are domain-wide, the correct layer to configure them will depend on the deployment environment. E.g. if the app is served on a subpath of a domain, has a separate user-facing identity strategy (while concurrently using phx.gen.auth for an internal part of the app -- I've done that myself before), etc.

    I feel expecting users to understand and edit/remove an incorrectly-configured /.well-known/change-password is a higher ask than educating users to add that when relevant? Though again the Phoenix docs don't often talk about industry-wide practices, keeping the scope to Phoenix-specific concerns.

    Potential places if we go the documentation way:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions