This changelog follows the keep a changelog format. This project adheres to Semantic Versioning.
Unreleased
2.0.0 - 2026-09-08
Added
- Accept a single string or
URIstruct as:allowed_redirect_uris. - Add the
SafeRedirect.uri_source/0,SafeRedirect.allowed_redirect_uris/0, andSafeRedirect.opts/0types.
Changed
- Raise
ArgumentErrorif invalid options are passed as:allowed_redirect_uris. - Raise
ArgumentErrorif an unsupported option key is passed. - Raise
ArgumentErrorif an allowed redirect URI has no scheme or host. - Raise
ArgumentErrorif an allowed redirect URI has a path, query string, fragment, or userinfo. - Raise
ArgumentErrorif the host of an allowed redirect URI has a trailing dot. - Raise
ArgumentErrorif an allowed redirect URI cannot be parsed. - Always set the response content type to
text/htmlwhen redirecting aPlug.Conn.
Fixed
- Accept percent-encoded paths.
/caf%C3%A9and/some%20pathwere previously rejected, so a redirect target containing a space or a non-ASCII character could not be expressed. - Accept paths with a trailing slash (
/some/path/) or repeated slashes (/some//path), which were previously rejected. - Compare the host case-insensitively, per RFC 3986.
SafeRedirect.valid_url?/2raisedFunctionClauseErrorfornil. It now returnsfalse, matchingSafeRedirect.resolve_url/3.SafeRedirect.redirect/4raisedUndefinedFunctionErrorin applications that depend on Plug but not on Phoenix. It now usesPlug.Conndirectly instead ofPhoenix.Controller.- Refuse a percent-encoded default value that resolves to a protocol-relative
URL, such as
/%2F%2Fevil.exampleor/%5Cevil.example. - Accept
URIstructs for the URL and the default value inSafeRedirect.redirect/4. - Raise
ArgumentErrorinstead ofCaseClauseErrorif the resolved URL cannot be redirected to.
1.0.2 - 2026-07-30
Security
- Do not accept protocol-relative URLs with a path.
1.0.1 - 2025-10-10
Fixed
- Type specification of
SafeRedirect.resolve_url/3didn't allownilas default value.
1.0.0 - 2025-10-10
Initial release