l0.DependencyControl.FeedTrust¶
FeedTrust ¶
Owns DependencyControl's feed-trust model: the official trust lists (loaded from DepCtrl's own feed),
the merged trusted/blocked sets (official plus the user's config), the trust queries the resolver asks
per candidate, and the user-config mutations. Built and exposed by Updater as updater.feedTrust.
Constructor ¶
| param | type | description |
|---|---|---|
| config | ConfigView | The updater's config view; its c holds extraFeeds/trustedFeeds/blockedFeeds. |
| logger? | Logger | Logger for the trust/block confirmations. |
| feedLoader | FeedLoader | Loads DependencyControl's own feed for the official trust lists. |
Instance methods¶
getOfficialTrustedFeeds ¶
Returns the feed URLs DependencyControl officially trusts (its own feed URL plus the feeds it advertises).
Returns:
trustedFeedstable<string,boolean>
getOfficialBlockedFeeds ¶
Returns DependencyControl's official block list as raw {url, matchMode?, reason?} entries, exactly as
declared in its own feed.
Returns:
blockedFeedsBlockedFeedEntry[]
getTrustedFeeds ¶
Returns the merged trusted feed-URL set: the official feeds plus the user's own trusted feeds
(extraFeeds and trustedFeeds). Cached; invalidated when the user's lists change.
Returns:
trustedFeedstable<string,boolean>
getBlockedFeeds ¶
Returns a merged, normalized list of the "officially" blocked feeds (as per DependencyControls own feed), followed by the user's blocked feeds. Block overrides trust.
Returns:
blockedFeedsBlockedFeedEntry[] — The merged list of normalized block entries, each taggedisOfficialwhen it comes from the official feed.
isTrusted ¶
Reports whether a feed URL is in the merged trusted set (exact match).
| param | type | description |
|---|---|---|
| url? | string |
The feed URL to check. |
Returns:
trustedboolean— True when the feed URL is trusted, false otherwise.
isUserTrusted ¶
Reports whether a feed URL is trusted through one of the user's own lists (extraFeeds or trustedFeeds),
as opposed to DependencyControl's official set. A block does not factor into this.
| param | type | description |
|---|---|---|
| url? | string |
The feed URL to check. |
Returns:
userTrustedboolean— True when the feed URL is in one of the user's trust lists.
isOfficiallyTrusted ¶
Reports whether a feed URL is in DependencyControl's official trusted set (its own feed plus the feeds it advertises), as opposed to the user's own lists. A block does not factor into this.
| param | type | description |
|---|---|---|
| url? | string |
The feed URL to check. |
Returns:
officiallyTrustedboolean— True when the feed URL is officially trusted.
isBlocked ¶
Reports whether a feed URL is matched by any block entry (official or user).
| param | type | description |
|---|---|---|
| url? | string |
The feed URL to check. |
Returns:
blockedboolean— True when the feed URL is blocked, false otherwise.
getBlockingEntry ¶
Returns the block entry that matches a feed URL or nil if none does. Useful to get the reason for a block.
| param | type | description |
|---|---|---|
| url? | string |
The feed URL to check. |
Returns:
entryBlockedFeedEntry? — The first matching block entry, or nil.
getTrustStatus ¶
Classifies a feed URL's trust: a block overrides any trust, and official vs user trust are reported
independently (a feed in both is TrustedBoth).
| param | type | description |
|---|---|---|
| url? | string |
The feed URL to classify. |
Returns:
statusFeedTrustStatusblockingEntryBlockedFeedEntry? — The block entry that matched when the feed is blocked, else nil.
getFetchDecision ¶
Classifies whether a feed may be fetched, from its block/trust status and the fetchUntrustedFeeds
policy: a blocked feed is always denied, a trusted feed always allowed, and an untrusted feed follows
the policy (always → allow, never → deny, prompt → prompt); an unrecognized policy fails closed (deny).
It neither prompts nor mutates trust state.
| param | type | description |
|---|---|---|
| url? | string |
The feed URL to classify. |
Returns:
decisionFeedFetchDecision
shouldFetch ¶
Resolves whether a feed may be fetched now, asking through the prompter (see setPrompter) when the
policy is prompt. A prompt answer is remembered for the session so the same feed isn't asked twice;
with no prompter available (e.g. headless), a prompt policy denies — the safe default.
| param | type | description |
|---|---|---|
| url? | string |
The feed URL to check. |
Returns:
fetchboolean— True when the feed may be fetched.
setPrompter ¶
Sets the callback consulted for an untrusted feed under the prompt policy. It receives the feed URL
and this FeedTrust (so it may trust/block the feed) and returns whether to fetch it now.
| param | type | description |
|---|---|---|
| prompter? | fun(url: string, feedTrust: FeedTrust): boolean |
The prompter, or nil to remove it. |
trust ¶
Adds a feed URL to the user's trustedFeeds list in the DependencyControl config file (ignoring an exact duplicate).
| param | type | description |
|---|---|---|
| feedUrl | string |
The exact (case-sensitive) feed URL to trust. |
Returns:
addedboolean— True when the feed was added to the user'strustedFeeds, false when it was already present.
untrust ¶
Removes a feed URL from the user's trustedFeeds list in the DependencyControl config file.
Feeds trusted through the official list or extraFeeds are unaffected; block the feed to override those.
| param | type | description |
|---|---|---|
| feedUrl | string |
The exact (case-sensitive) feed URL to untrust. |
Returns:
removedboolean— True, when the feed was removed from the user'strustedFeeds, false when it wasn't present.
block ¶
Adds a new entry to the user's blockedFeeds in the DependencyControl config file,
unless a block with the same url and match mode is already present.
| param | type | description |
|---|---|---|
| feedUrl | string |
The feed URL or URL prefix to block. |
| opts? | { matchMode?: BlockedFeedMatchMode, reason?: string } |
The match mode (default prefix) and an optional reason. |
Returns:
addedboolean— False when an equivalent block (same url and match mode) was already present.
unblock ¶
Removes every entry from the user's blockedFeeds list in the DependencyControl config file,
whose url matches feedUrl. Does not affect the official block list.
| param | type | description |
|---|---|---|
| feedUrl | string |
The blocked url/prefix to remove. |
Returns:
removedboolean— True when a user block was removed, false when no user block matched.
addExtraFeed ¶
Adds a feed URL to the user's extraFeeds config (ignoring an exact duplicate) and persists it. Extra
feeds are trusted and act as discovery roots.
| param | type | description |
|---|---|---|
| feedUrl | string |
The exact (case-sensitive) feed URL to add. |
Returns:
addedboolean— False when the feed was already in the user'sextraFeeds.
removeExtraFeed ¶
Removes a feed URL from the user's extraFeeds config and persists it.
| param | type | description |
|---|---|---|
| feedUrl | string |
The exact (case-sensitive) feed URL to remove. |
Returns:
removedboolean— False when the feed was not in the user'sextraFeeds.
Class methods¶
urlMatchesPrefix ¶
Reports whether a URL is matched by any of the given prefixes. Case-insensitive to resist evasion attempts.
| param | type | description |
|---|---|---|
| url? | string |
The feed URL to check. |
| prefixes? | string[] |
The list of prefixes to match against. |
Returns:
matchesboolean— True when the feed URL matches any of the prefixes, false otherwise.
matchesBlockEntry ¶
Reports whether a URL is matched by a single block entry, per its match mode. All matches are case-insensitive to combat evasion attempts.
| param | type | description |
|---|---|---|
| url? | string |
The feed URL to check. |
| entry | BlockedFeedEntry | A normalized block entry. |
Returns:
matchesboolean— True when the feed URL is blocked, false otherwise.
Fields¶
| field | type | description |
|---|---|---|
| userTrustedFeeds | table<string,boolean> |
The user's own trusted feeds — the union of extraFeeds and trustedFeeds. Cached, invalidated on mutation. Read-only. |
| defaultFetchUntrustedFeeds | FetchUntrustedFeeds |
Enums¶
BlockedFeedMatchMode ¶
| member | value | description |
|---|---|---|
| Prefix | "prefix" |
matches any feed URL starting with this value (case-insensitive) |
| Exact | "exact" |
matches only this exact feed URL (case-insensitive) |
FeedTrustStatus ¶
| member | value | description |
|---|---|---|
| TrustedOfficial | "trusted-official" |
trusted only through DependencyControl's official set |
| TrustedUser | "trusted-user" |
trusted only through one of the user's own lists (extraFeeds or trustedFeeds) |
| TrustedBoth | "trusted-both" |
trusted through both the official set and one of the user's own lists |
| Untrusted | "untrusted" |
neither trusted nor blocked (the default) |
| Blocked | "blocked" |
matched by the block list, which overrides trust |
FeedFetchDecision ¶
| member | value | description |
|---|---|---|
| Allow | "allow" |
fetch without asking (trusted, or untrusted under fetchUntrustedFeeds = always) |
| Deny | "deny" |
never fetch (blocked, or untrusted under fetchUntrustedFeeds = never) |
| Prompt | "prompt" |
ask the user before fetching (untrusted under fetchUntrustedFeeds = prompt) |
Types¶
BlockedFeedEntry ¶
A normalized feed block entry: the URL/prefix to match, how to match it, and why.
| field | type | description |
|---|---|---|
| url | string |
The feed URL or URL prefix to match. |
| matchMode | BlockedFeedMatchMode | How url is matched against a candidate feed URL. |
| reason? | string |
Human-readable explanation of why the feed is blocked. |
| isOfficial? | boolean |
True for an entry from the official block list (read-only); false for a user block. |