mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
fix: actors.assert should return false if webfinger cannot resolve to an id
This commit is contained in:
@@ -20,8 +20,13 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
ids = [ids];
|
ids = [ids];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Existance in failure cache is automatic assertion failure
|
||||||
|
if (ids.some(id => failedWebfingerCache.has(id))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Filter out uids if passed in
|
// Filter out uids if passed in
|
||||||
ids = ids.filter(id => !utils.isNumber(id) && !failedWebfingerCache.has(id));
|
ids = ids.filter(id => !utils.isNumber(id));
|
||||||
|
|
||||||
// Translate webfinger handles to uris
|
// Translate webfinger handles to uris
|
||||||
ids = (await Promise.all(ids.map(async (id) => {
|
ids = (await Promise.all(ids.map(async (id) => {
|
||||||
@@ -38,7 +43,12 @@ Actors.assert = async (ids, options = {}) => {
|
|||||||
failedWebfingerCache.set(originalId, true);
|
failedWebfingerCache.set(originalId, true);
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}))).filter(Boolean);
|
})));
|
||||||
|
|
||||||
|
// Webfinger failures = assertion failure
|
||||||
|
if (!ids.every(Boolean)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Filter out loopback uris
|
// Filter out loopback uris
|
||||||
ids = ids.filter((uri) => {
|
ids = ids.filter((uri) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user