@@ -58,18 +58,23 @@ void FilteringSourceAccessor::checkAccess(const CanonPath & path)
5858struct AllowListSourceAccessorImpl : AllowListSourceAccessor
5959{
6060 std::set<CanonPath> allowedPrefixes;
61+ std::unordered_set<CanonPath> allowedPaths;
6162
6263 AllowListSourceAccessorImpl (
6364 ref<SourceAccessor> next,
6465 std::set<CanonPath> && allowedPrefixes,
66+ std::unordered_set<CanonPath> && allowedPaths,
6567 MakeNotAllowedError && makeNotAllowedError)
6668 : AllowListSourceAccessor(SourcePath(next), std::move(makeNotAllowedError))
6769 , allowedPrefixes(std::move(allowedPrefixes))
70+ , allowedPaths(std::move(allowedPaths))
6871 { }
6972
7073 bool isAllowed (const CanonPath & path) override
7174 {
72- return path.isAllowed (allowedPrefixes);
75+ return
76+ allowedPaths.contains (path)
77+ || path.isAllowed (allowedPrefixes);
7378 }
7479
7580 void allowPrefix (CanonPath prefix) override
@@ -81,9 +86,14 @@ struct AllowListSourceAccessorImpl : AllowListSourceAccessor
8186ref<AllowListSourceAccessor> AllowListSourceAccessor::create (
8287 ref<SourceAccessor> next,
8388 std::set<CanonPath> && allowedPrefixes,
89+ std::unordered_set<CanonPath> && allowedPaths,
8490 MakeNotAllowedError && makeNotAllowedError)
8591{
86- return make_ref<AllowListSourceAccessorImpl>(next, std::move (allowedPrefixes), std::move (makeNotAllowedError));
92+ return make_ref<AllowListSourceAccessorImpl>(
93+ next,
94+ std::move (allowedPrefixes),
95+ std::move (allowedPaths),
96+ std::move (makeNotAllowedError));
8797}
8898
8999bool CachingFilteringSourceAccessor::isAllowed (const CanonPath & path)
0 commit comments