Skip to content

security(dav): align authorization-path decoding with RFC 3986 single-decode semantics #1344

Description

@seonghobae

Problem

_normalize_dav_authorization_path() currently decodes the same string repeatedly until stable, bounded by 100 rounds. PR #1341 proposes changing only that bound to 4 and labels the existing 100-round bound a MEDIUM DoS vulnerability.

Fresh source review does not support that numeric-only remedy as a root-cause security fix:

  • the 100-round loop was itself the repository's prior bounded DoS mitigation for the former unbounded loop;
  • 🛡️ Sentinel: [MEDIUM] percent-decoding 루프 제한을 통한 DoS 취약점 수정 #1341 adds no regression or resource-bound test demonstrating a 100-round exploit or proving 4 as the correct boundary;
  • RFC 3986 §2.4 states implementations must not percent-encode or decode the same string more than once, while §7.3 requires security checks after decoding the relevant component;
  • CWE-174 treats double decoding as a weakness class. A smaller repeated-decoding count still preserves the same semantic ambiguity.

Required bounded slice

Design and test an authorization-path boundary that distinguishes framework/request-target decoding from application decoding and rejects ambiguous nested encodings instead of relying on an arbitrary recursive-unquote count. Preserve rejection of traversal (./..) and Windows separators, owner-scope isolation, and ordinary encoded path behavior.

Use TDD at the authorization boundary with at least:

  • raw, singly encoded, and nested-encoded traversal attempts;
  • percent-encoded percent signs that are legitimate data versus ambiguous second-pass encodings;
  • mixed slash/backslash inputs;
  • malformed percent triplets and hostile Unicode/control characters;
  • a bounded long-input/resource test;
  • route-level evidence that accounts for Starlette/FastAPI decoding before the path parameter reaches the helper.

Do not weaken fail-closed owner scoping or replace the issue with another arbitrary decode-round constant.

Primary references

Berners-Lee, T., Fielding, R., & Masinter, L. (2005). Uniform Resource Identifier (URI): Generic Syntax (RFC 3986), §§2.4, 7.3. RFC Editor. https://doi.org/10.17487/RFC3986

MITRE. (2025). CWE-174: Double Decoding of the Same Data (CWE 4.19/4.20 lineage). Common Weakness Enumeration.

Related: #1341.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: apiAPI, protocol, event, or external contractarea: authAuthentication, authorization, identity, or tenant isolationarea: ci-cdCI, GitHub Actions, checks, release, or supply chainarea: securitySecurity boundary, hardening, or vulnerability preventionbugSomething isn't workingpriority: highHigh-priority or P1 workstatus: triagedOpen issue has an organization taxonomy assignmenttype: securitySecurity vulnerability or security-specific remediation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions