Files
moloapp/src/runtime/static/path_guard.h
T

17 lines
547 B
C++
Raw Normal View History

// Spec: plans/01-runtime.md 6.7. Traversal guard: percent-decode, lexical
// normalize, reject NUL, backslash, and `..` escapes above root. Symlink
// policy is enforced by DiskProvider at open time.
#pragma once
#include <optional>
#include <string>
#include <string_view>
namespace molo::runtime::static_ {
// Returns the normalized in-root relative path (no leading slash), or
// nullopt when the request escapes or is malformed.
std::optional<std::string> NormalizeUrlPath(std::string_view target);
} // namespace molo::runtime::static_