diff --git a/container/src/root/common/utility.hh b/container/src/root/common/utility.hh index c43642e..9bb107e 100644 --- a/container/src/root/common/utility.hh +++ b/container/src/root/common/utility.hh @@ -300,6 +300,20 @@ class PluggablePath //! \return NPI reference auto& parse() { + // Invalid characters + const std::regex regex{"[a-zA-Z0-9/_\\-\\.]+"}; + const std::string msg{"invalid characters in path"}; + + if (!m_path.repo().empty()) + throw_ex_if( + !std::regex_match(m_path.repo(), regex), msg); + + if (!m_path.custom().empty()) + throw_ex_if( + !std::regex_match(m_path.custom(), regex), msg); + + throw_ex_if(!std::regex_match(m_pseudo, regex), msg); + // Parse out pseudo tag auto pos = m_pseudo.find('/'); throw_ex_if(!pos, "no pseudo tag");