Skip to main content

qubit_redact/http/
url_path_policy.rs

1// =============================================================================
2//    Copyright (c) 2025 - 2026 Haixing Hu.
3//
4//    SPDX-License-Identifier: Apache-2.0
5//
6//    Licensed under the Apache License, Version 2.0.
7// =============================================================================
8//! Policy for rendering URL paths in HTTP diagnostics.
9
10/// Controls whether complete URL paths remain visible after redaction.
11///
12/// This policy does not affect URL userinfo, fragments, or recognized
13/// sensitive query values. The standard policy preserves paths for diagnostic
14/// usefulness; strict policies should select [`Self::Redact`] when paths may
15/// contain opaque identifiers or credentials.
16#[must_use]
17#[non_exhaustive]
18#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
19pub enum UrlPathPolicy {
20    /// Preserves the complete URL path.
21    #[default]
22    Preserve,
23    /// Replaces a non-root URL path with a fixed redaction marker.
24    Redact,
25}