Skip to content

Commit a1d4108

Browse files
committed
change insecure_basic_auth default to true
- Bump version to 1.25.0 - Change default from false to true for backward compatibility - Update documentation and NEWS.md with prominent notice - Users wanting strict HTTPS-only auth must now explicitly set false
1 parent e2bbdf7 commit a1d4108

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

NEWS.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# NEWS
22

3+
1.25.0 - 2025-07-24
4+
-------------------
5+
6+
** IMPORTANT CHANGE **
7+
8+
- change: `insecure_basic_auth` now defaults to `true` instead of `false`
9+
10+
This restores backward compatibility with pre-1.24.0 behavior where basic auth
11+
was allowed over HTTP connections. If you need strict HTTPS-only basic auth:
12+
- Set globally: `application:set_env(hackney, insecure_basic_auth, false)`
13+
- Or per-request: `{insecure_basic_auth, false}` in options
14+
315
1.24.1 - 2025-05-26
416
-------------------
517

@@ -18,12 +30,6 @@
1830
- fix: controlling_process error handling in happy eyeballs and connection pool return
1931
- improvement: update GitHub Actions to ubuntu-22.04 and bump certifi/mimerl dependencies
2032

21-
** Breaking Change **
22-
23-
The new `insecure_basic_auth` application variable defaults to `false` for security.
24-
If your application relies on insecure basic auth over HTTP, you must explicitly set
25-
`application:set_env(hackney, insecure_basic_auth, true)` to maintain previous behavior.
26-
2733
1.23.0 - 2025-02-25
2834
-------------------
2935

src/hackney.app.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{application, hackney,
55
[
66
{description, "simple HTTP client"},
7-
{vsn, "1.24.1"},
7+
{vsn, "1.25.0"},
88
{registered, [hackney_pool]},
99
{applications, [kernel,
1010
stdlib,

src/hackney.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ request(Method, URL, Headers, Body) ->
239239
%% redirection even on POST</li>
240240
%% <li>`{basic_auth, {binary, binary}}`: HTTP basic auth username and password.
241241
%% Only allowed over HTTPS unless {insecure_basic_auth, true} is also set.</li>
242-
%% <li>`{insecure_basic_auth, boolean}': false by default. When true, allows
242+
%% <li>`{insecure_basic_auth, boolean}': true by default. When true, allows
243243
%% basic auth over unencrypted HTTP connections (security risk).
244-
%% Can also be set globally via application:set_env(hackney, insecure_basic_auth, true).</li>
244+
%% Can also be set globally via application:set_env(hackney, insecure_basic_auth, false).</li>
245245
%% <li>`{proxy, proxy_options()}': to connect via a proxy.</li>
246246
%% <li>`insecure': to perform "insecure" SSL connections and
247247
%% transfers without checking the certificate</li>

src/hackney_request.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ perform(Client0, {Method0, Path0, Headers0, Body0}) ->
4343
maybe_add_cookies(Cookies, [{<<"User-Agent">>, default_ua()}]);
4444
{User, Pwd} ->
4545
%% Security: Check if basic auth over HTTP is allowed
46-
AllowInsecureAuth = proplists:get_value(insecure_basic_auth, Options, hackney_app:get_app_env(insecure_basic_auth, false)),
46+
AllowInsecureAuth = proplists:get_value(insecure_basic_auth, Options, hackney_app:get_app_env(insecure_basic_auth, true)),
4747
case {Client0#client.transport, AllowInsecureAuth} of
4848
{hackney_ssl, _} ->
4949
%% HTTPS connection - always safe

0 commit comments

Comments
 (0)