12typedef std::function<RestrictedPathError(
const CanonPath & path)> MakeNotAllowedError;
19struct FilteringSourceAccessor : SourceAccessor
23 MakeNotAllowedError makeNotAllowedError;
25 FilteringSourceAccessor(
const SourcePath & src, MakeNotAllowedError && makeNotAllowedError)
28 , makeNotAllowedError(std::move(makeNotAllowedError))
30 displayPrefix.clear();
45 std::string showPath(
const CanonPath & path)
override;
72 std::set<CanonPath> && allowedPrefixes,
73 MakeNotAllowedError && makeNotAllowedError);
75 using FilteringSourceAccessor::FilteringSourceAccessor;
83 std::map<CanonPath, bool> cache;
85 using FilteringSourceAccessor::FilteringSourceAccessor;
89 virtual bool isAllowedUncached(
const CanonPath & path) = 0;
Definition canon-path.hh:41
std::optional< SourceAccessor::Stat > maybeLstat() const
std::optional< std::filesystem::path > getPhysicalPath() const
std::string readFile() const
std::string readLink() const
SourceAccessor::DirEntries readDirectory() const
Definition filtering-source-accessor.hh:64
virtual void allowPrefix(CanonPath prefix)=0
Definition filtering-source-accessor.hh:82
bool isAllowed(const CanonPath &path) override
Definition filtering-source-accessor.cc:89
virtual bool isAllowed(const CanonPath &path)=0
void checkAccess(const CanonPath &path)
Definition filtering-source-accessor.cc:50
Definition source-path.hh:22