Skip to content

Commit c34721f

Browse files
committed
docs: add missing RFC hyperlinks
Signed-off-by: Shane Utt <shaneutt@linux.com>
1 parent 867b929 commit c34721f

6 files changed

Lines changed: 33 additions & 10 deletions

File tree

core/src/config/validate/cluster/health_check.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ pub(super) fn validate_health_check_ssrf(
129129
// -----------------------------------------------------------------------------
130130

131131
/// Returns `true` for IP addresses that are SSRF-sensitive.
132+
///
133+
/// Note: [RFC 1918] private ranges (10/8, 172.16/12, 192.168/16)
134+
/// are intentionally not flagged; only loopback and cloud metadata
135+
/// addresses are considered sensitive.
136+
///
137+
/// [RFC 1918]: https://datatracker.ietf.org/doc/html/rfc1918
132138
fn is_ssrf_sensitive(ip: &IpAddr) -> bool {
133139
match ip {
134140
IpAddr::V4(v4) => v4.is_loopback() || *v4 == std::net::Ipv4Addr::new(169, 254, 169, 254),

core/src/config/validate/cluster/tls.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,18 @@ fn validate_sni_length(sni: &str, cluster_name: &str) -> Result<(), ProxyError>
8080
}
8181

8282
/// Validate each DNS label in the SNI hostname.
83+
///
84+
/// Wildcard validation follows [RFC 6125]: `*` is only valid as
85+
/// the complete leftmost label (e.g. `*.example.com`).
86+
///
87+
/// [RFC 6125]: https://datatracker.ietf.org/doc/html/rfc6125
8388
fn validate_sni_labels(sni: &str, cluster_name: &str) -> Result<(), ProxyError> {
8489
for (i, label) in sni.split('.').enumerate() {
8590
if label.is_empty() || label.len() > 63 {
8691
return Err(ProxyError::Config(format!(
8792
"cluster '{cluster_name}': sni has invalid label length"
8893
)));
8994
}
90-
// RFC 6125 (https://datatracker.ietf.org/doc/html/rfc6125):
91-
// wildcard `*` is only valid as the complete leftmost label
92-
// (e.g. `*.example.com`).
9395
if label.contains('*') {
9496
if label != "*" || i != 0 {
9597
return Err(ProxyError::Config(format!(

filter/src/builtins/tcp/traffic_management/sni_router.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ use crate::{
4444
/// Routes TCP connections by SNI hostname.
4545
///
4646
/// Performs exact-match lookup first, then longest-suffix
47-
/// wildcard match. Case-insensitive per RFC 4343.
47+
/// wildcard match. Case-insensitive per [RFC 4343].
48+
///
49+
/// [RFC 4343]: https://datatracker.ietf.org/doc/html/rfc4343
4850
///
4951
/// # Example
5052
///

protocol/src/http/pingora/handler/request_filter/validation.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// SPDX-License-Identifier: MIT
22
// Copyright (c) 2024 Shane Utt
33

4-
//! Host header validation and Max-Forwards handling per RFC 9110/9112.
4+
//! Host header validation and Max-Forwards handling per [RFC 9110]/[RFC 9112].
5+
//!
6+
//! [RFC 9110]: https://datatracker.ietf.org/doc/html/rfc9110
7+
//! [RFC 9112]: https://datatracker.ietf.org/doc/html/rfc9112
58
69
use pingora_proxy::Session;
710
use praxis_filter::Rejection;

protocol/src/http/pingora/handler/upstream_peer.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ fn client_cert_from_cached(cached: &praxis_tls::CachedClientCert) -> pingora_cor
120120
/// Derive an SNI hostname from an `address` string in `host:port` form.
121121
///
122122
/// Returns the host portion if it is a DNS name. Returns an empty string
123-
/// if the host is an IP address (IP-based SNI is not standard per RFC 6066).
123+
/// if the host is an IP address (IP-based SNI is not standard per [RFC 6066]).
124+
///
125+
/// [RFC 6066]: https://datatracker.ietf.org/doc/html/rfc6066
124126
fn derive_sni(address: &str) -> String {
125127
let host = address.rsplit_once(':').map_or(address, |(h, _)| h);
126128
if host.parse::<std::net::IpAddr>().is_ok() {

tls/src/sni.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ const CONTENT_TYPE_HANDSHAKE: u8 = 22;
4141
/// TLS `HandshakeType` for `ClientHello`.
4242
const HANDSHAKE_TYPE_CLIENT_HELLO: u8 = 1;
4343

44-
/// TLS extension type for Server Name Indication (RFC 6066).
44+
/// TLS extension type for Server Name Indication ([RFC 6066]).
45+
///
46+
/// [RFC 6066]: https://datatracker.ietf.org/doc/html/rfc6066
4547
const EXTENSION_TYPE_SNI: u16 = 0;
4648

4749
/// SNI `NameType` for DNS hostnames.
@@ -111,11 +113,15 @@ pub enum SniParseError {
111113
#[error("malformed TLS extension")]
112114
MalformedExtension,
113115

114-
/// The SNI hostname is empty (RFC 6066 requires a valid DNS name).
116+
/// The SNI hostname is empty ([RFC 6066] requires a valid DNS name).
117+
///
118+
/// [RFC 6066]: https://datatracker.ietf.org/doc/html/rfc6066
115119
#[error("SNI hostname must not be empty (RFC 6066)")]
116120
EmptyHostname,
117121

118-
/// The SNI hostname is an IP literal (rejected per RFC 6066 section 3).
122+
/// The SNI hostname is an IP literal (rejected per [RFC 6066 Section 3]).
123+
///
124+
/// [RFC 6066 Section 3]: https://datatracker.ietf.org/doc/html/rfc6066#section-3
119125
#[error("SNI must not be an IP address (RFC 6066)")]
120126
InvalidHostname,
121127
}
@@ -338,7 +344,9 @@ fn read_u24(data: &[u8], offset: usize) -> Result<u32, SniParseError> {
338344
// Validation
339345
// ---------------------------------------------------------------------------------
340346

341-
/// Reject IP address literals per RFC 6066 section 3.
347+
/// Reject IP address literals per [RFC 6066 Section 3].
348+
///
349+
/// [RFC 6066 Section 3]: https://datatracker.ietf.org/doc/html/rfc6066#section-3
342350
fn reject_ip_literal(hostname: &str) -> Result<(), SniParseError> {
343351
if hostname.parse::<std::net::IpAddr>().is_ok() {
344352
return Err(SniParseError::InvalidHostname);

0 commit comments

Comments
 (0)