Skip to content

Commit e7a512b

Browse files
authored
server: disable always on http auth for docker (#1089)
1 parent 9478edc commit e7a512b

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

docker-entrypoint.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ SQLD_NODE="${SQLD_NODE:-primary}"
77
SQLD_DB_PATH="${SQLD_DB_PATH:-iku.db}"
88
SQLD_HTTP_LISTEN_ADDR="${SQLD_HTTP_LISTEN_ADDR:-"0.0.0.0:8080"}"
99

10-
SQLD_HTTP_AUTH="${SQLD_HTTP_AUTH:-"always"}"
11-
1210
if [ "$1" = '/bin/sqld' ]; then
1311
# We are running the server.
1412
declare -a server_args=()

libsql-server/src/auth/parsers.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use tonic::metadata::MetadataMap;
66

77
pub fn parse_http_basic_auth_arg(arg: &str) -> Result<Option<String>> {
88
if arg == "always" {
9-
return Ok(None);
9+
return Ok(Some("always".to_string()));
1010
}
1111

1212
let Some((scheme, param)) = arg.split_once(':') else {
@@ -71,6 +71,8 @@ mod tests {
7171

7272
use crate::auth::{parse_http_auth_header, AuthError};
7373

74+
use super::parse_http_basic_auth_arg;
75+
7476
#[test]
7577
fn parse_http_auth_header_returns_auth_header_param_when_valid() {
7678
assert_eq!(
@@ -111,4 +113,10 @@ mod tests {
111113
AuthError::HttpAuthHeaderUnsupportedScheme
112114
)
113115
}
116+
117+
#[test]
118+
fn parse_http_auth_arg_always() {
119+
let out = parse_http_basic_auth_arg("always").unwrap();
120+
assert_eq!(out, Some("always".to_string()));
121+
}
114122
}

0 commit comments

Comments
 (0)