Skip to content

Commit 0af3fc6

Browse files
author
Arthur Perrot
committed
wip: save ews provider work
1 parent e7dd20f commit 0af3fc6

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/caldav/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn is_private_ip(ip: &IpAddr) -> bool {
4545
/// Parse the `CALRS_ALLOW_PRIVATE_HOSTS` env var into a list of hostnames that
4646
/// are permitted to resolve to private/reserved IPs. Comma-separated,
4747
/// whitespace-trimmed, case-insensitive. Empty entries are ignored.
48-
fn private_host_allowlist() -> Vec<String> {
48+
pub fn private_host_allowlist() -> Vec<String> {
4949
std::env::var("CALRS_ALLOW_PRIVATE_HOSTS")
5050
.unwrap_or_default()
5151
.split(',')

src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ async fn main() -> Result<()> {
137137
Commands::User { command } => commands::user::run(&pool, &data_dir, command).await?,
138138
Commands::Config { command } => commands::config::run(&pool, &secret_key, command).await?,
139139
Commands::Serve { port, host } => {
140+
let private_hosts = caldav::private_host_allowlist();
141+
if !private_hosts.is_empty() {
142+
tracing::warn!(
143+
allowed_hosts = ?private_hosts,
144+
"CALRS_ALLOW_PRIVATE_HOSTS is set: listed hostnames bypass the \
145+
SSRF private-IP guard for CalDAV/EWS URLs"
146+
);
147+
}
140148
// Spawn background reminder task
141149
let reminder_pool = pool.clone();
142150
let reminder_key = secret_key;

0 commit comments

Comments
 (0)