Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Security check
run: node scripts/security-check.mjs
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
Expand Down
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ An entry looks like this:
| `wago` | one source | Wago Addons project id. Users need their own Wago key, which Wago only gives to Patreon supporters, so prefer a GitHub source where one exists. |
| `wowi` | one source | WoWInterface file id. |
| `tukui` | one source | TukUI slug (`elvui`, `tukui`). |
| `curse` | no | CurseForge project id. Link only, never downloaded. An entry with only `curse` is a link-only entry so people know where the addon lives. |
| `curse` | no | CurseForge project id. Release builds can install from it unless `curse_locked` says the author opted out; other builds treat it as a link. |
| `asset_hint` | no | substring that picks the right zip when a release has several and no `release.json`, e.g. `"-forever"`. |
| `forever` | no | `true` if the author ships a Forever build (interface 16001), `false` if not yet, leave out if unsure. Be honest: `true` suppresses the "not for Forever" warning. |
| `desc`, `category`, `url` | no | shown in Browse |
| `notice` | no | one short line (160 chars) shown in amber on the installed row. For "remove this once X is fixed" situations. |
| `added` | no | `YYYY-MM-DD` the entry was added. Kept for the record and for sorting later. |
| `icon` | no | https image for Browse, on GitHub, `media.forgecdn.net`, Wago or WoWInterface. Other hosts are refused. Leave it out to use the GitHub avatar. |

Set `group_required_dependencies: true` only when the download bundles the
first folder's required dependencies, as Questie does with QuestieDB. Keep those
Expand All @@ -61,7 +62,7 @@ Rules:

## Code changes

Rust core in `src-tauri/`, plain HTML/JS in `ui/`. `cargo test` must pass. Keep the promises in the README: no accounts, no ads, no analytics, no server of ours in the loop, and no CurseForge API key in the exe.
Rust core in `src-tauri/`, plain HTML/JS in `ui/`. `cargo test` must pass. Keep the promises in the README: no accounts, no ads, no analytics, no server of ours in the loop, and the CurseForge API key stays out of the repo and goes only to api.curseforge.com.

Headless mode is the quickest way to test without the window:

Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Either one updates itself when a new build is out. The Windows files are not cod
![AddonForge showing installed addons with update status](docs/screenshot.png)

- **Light.** A single exe on top of the WebView2 that Windows already has. No bundled browser.
- **Private.** No account, no ads, no analytics, no server of ours in the loop. The app talks only to the sites addons are published on (GitHub, Wago, WoWInterface, TukUI, CurseForge), the same way your browser would.
- **Private.** No account, no ads, no analytics, no server of ours in the loop. The app talks only to the sites addons are published on (GitHub, Wago, WoWInterface, TukUI, CurseForge), plus this project's GitHub repo for the catalogue and updates. The full list is under [Privacy](#code-signing-policy).
- **Honest.** If an addon's author only allows downloads through CurseForge's own app, AddonForge says so and gives you the link instead of pretending.

## How it finds addons
Expand All @@ -33,9 +33,9 @@ On top of that there is a **catalogue**: [`catalog/forever.json`](catalog/foreve
- Pin an addon to hold it at its current version. Ignore one to hide it.
- Optional pre-release toggle for authors who only ship Forever builds as betas.
- Export your addon list to a small file, import it on another PC or send it to a friend.
- Refuses any zip that contains an executable. Addons are Lua, XML and media, nothing else.
- Refuses any zip containing a known executable or script type, or a file that starts like a Windows or macOS program or a script. Addons are Lua, XML and media, and AddonForge never runs anything from a zip.
- Updates itself: a banner appears when a new build is out, one click swaps the exe.
- "Report a problem" builds a diagnostics report you can read, then opens a GitHub issue or an email. Nothing leaves your PC until you press send.
- "Report a problem" builds a diagnostics report and opens a GitHub issue form or an email with it filled in. The GitHub form gets the report in its URL, so GitHub receives the text when the page opens, though nothing is posted until you submit. Email leaves when you press send. "Copy diagnostics" shows the report without sending anything.
- Keeps a small local log next to its settings file, never uploaded.

## How it's built
Expand All @@ -50,7 +50,7 @@ Honest version: AddonForge is designed, tested and decided by one person with a
| Wago Addons | Link only | Wago gives updater keys to its Patreon supporters only, so AddonForge no longer installs from Wago. Entries that live only there link to their Wago page. |
| WoWInterface | No | Public JSON API. |
| TukUI | No | ElvUI / Tukui. |
| CurseForge | Built in | Search all Forever addons on CurseForge and install the ones whose authors allow third-party downloads (about seven in ten of the popular ones). The API key ships inside release builds, is only ever sent to api.curseforge.com, and nothing from CurseForge is written to disk. Opted-out addons are link only. |
| CurseForge | Built in | Search all Forever addons on CurseForge and install the ones whose authors allow third-party downloads (about seven in ten of the popular ones). The API key ships inside release builds and is only ever sent to api.curseforge.com. API responses aren't cached on disk; the only CurseForge data AddonForge keeps is the project id and version name of what you installed, in its settings and log. Opted-out addons are link only. |

## Build

Expand Down Expand Up @@ -106,9 +106,11 @@ AddonForge does not collect or send personal data and has no telemetry, accounts
- api.curseforge.com and edge.forgecdn.net: CurseForge addon lookups and downloads (only for addons whose authors allow third-party downloads).
- api.mmoui.com: WoWInterface addon lookups and the download hosts it returns.
- api.tukui.org: TukUI addon lookups and the download hosts it returns.
- addons.wago.io: only for addons first installed from Wago before build 25.
- media.forgecdn.net, wago.io hosts, www.wowinterface.com and cdn-wow.mmoui.com: only for the preview image, when the first screenshot in a GitHub-hosted addon's README lives there.

These requests reveal your IP address and the addon names or IDs being checked, as with any web request. The CurseForge API key is sent only to api.curseforge.com.
Every request is HTTPS, and a site can redirect it to another host (GitHub's downloads do). At launch the app reads the catalogue, download totals and its own update manifest from this repo, then checks your installed addons for updates; there's no setting to turn that off.

These requests reveal your IP address, your AddonForge version (in the User-Agent) and the addon names or IDs being checked, as with any web request. GitHub counts downloads of release files, so the update manifest's counter gives the maintainer a rough, anonymous count of launches. The CurseForge API key is sent only to api.curseforge.com.

**Scope of signing**
Only AddonForge's own release builds are signed, and only from source in this repository. Addons installed through AddonForge are made by their own authors and are not signed by this project.
Expand Down
3 changes: 3 additions & 0 deletions scripts/test-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ assert.equal(run("installSources(catalog[3]).length"), 0, 'Wago-only is link onl
assert.match(element('browse-list').innerHTML, /<select class="src-pick"[^>]*><option value="github">GitHub/);
assert.match(element('browse-list').innerHTML, /link only/);
assert.doesNotMatch(element('browse-list').innerHTML, /Wago key/);
run(`renderImportPlan([{ name: 'List <b>', key: 'x', installed: false, installable: true, source: { kind: 'github', id: 'a/<img src=x>' }, why: '' }])`);
assert.match(element('import-plan').innerHTML, /a\/&lt;img src=x&gt;/, 'An imported source is shown as text');
assert.doesNotMatch(element('import-plan').innerHTML, /<img/, 'An imported list cannot add markup');
run(`settings = null; catalog = [];`);
run(`packages = []; renderInstalled()`);
assert.equal(String(element('stat-updates').textContent), '0');
Expand Down
13 changes: 13 additions & 0 deletions scripts/validate-catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ const folderOwner = new Map();
const idRe = /^[a-z0-9]+(-[a-z0-9]+)*$/;
const repoRe = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
const dateRe = /^\d{4}-\d{2}-\d{2}$/;
// Same hosts as allowed_image_host in src-tauri/src/icons.rs.
function allowedImageHost(value) {
try {
const url = new URL(value);
if (url.protocol !== "https:" || url.username || url.password) return false;
const host = url.hostname;
return host === "github.com" || host.endsWith(".githubusercontent.com") || host === "media.forgecdn.net"
|| host === "addons.wago.io" || host.endsWith(".wago.io") || host === "www.wowinterface.com" || host === "cdn-wow.mmoui.com";
} catch {
return false;
}
}
const knownKeys = new Set(["id", "name", "desc", "category", "github", "wago", "wowi", "tukui", "curse", "asset_hint", "folders", "group_required_dependencies", "curse_locked", "url", "forever", "icon", "notice", "added", "github_moved_from"]);

for (const [i, a] of (cat.addons || []).entries()) {
Expand Down Expand Up @@ -51,6 +63,7 @@ for (const [i, a] of (cat.addons || []).entries()) {
if (a.tukui !== undefined && typeof a.tukui !== "string") problems.push(`${where}: "tukui" must be a slug`);
if (a.asset_hint !== undefined && typeof a.asset_hint !== "string") problems.push(`${where}: "asset_hint" must be a string`);
if (a.url !== undefined && !/^https?:\/\//.test(a.url)) problems.push(`${where}: "url" must start with http(s)://`);
if (a.icon !== undefined && (typeof a.icon !== "string" || !allowedImageHost(a.icon))) problems.push(`${where}: "icon" must be an https URL on GitHub, CurseForge's media host, Wago or WoWInterface`);
if (a.notice !== undefined && (typeof a.notice !== "string" || a.notice.length > 160)) problems.push(`${where}: "notice" must be a short string (160 chars max)`);
if (a.added !== undefined && !dateRe.test(a.added)) problems.push(`${where}: "added" must be YYYY-MM-DD`);
if (a.forever !== undefined && a.forever !== null && typeof a.forever !== "boolean") problems.push(`${where}: "forever" must be true, false or null`);
Expand Down
4 changes: 2 additions & 2 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src-tauri/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub struct CatalogEntry {
#[serde(default)]
pub forever: Option<bool>,
/// Optional https icon for the Browse list (else the GitHub avatar is used).
/// Only fetched from the hosts in `icons::allowed_image_host`.
#[serde(default)]
pub icon: Option<String>,
/// A short line shown on the installed row, e.g. "beta workaround, remove
Expand Down
35 changes: 29 additions & 6 deletions src-tauri/src/icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ pub fn local_icon(install: &Path, texture: &str) -> Option<String> {

/// Fetch an https image (GitHub avatar or a catalogue `icon` URL), cached for 30 days.
pub async fn remote_icon(client: &reqwest::Client, url: &str) -> Option<String> {
if !url.starts_with("https://") {
// The catalogue is fetched live, so its `icon` field gets the same limit as README images.
if !allowed_image_host(url) {
return None;
}
let cache = cache_dir().join(format!("{}.png", key(url)));
Expand Down Expand Up @@ -142,11 +143,13 @@ const README_TTL: Duration = Duration::from_secs(24 * 3600);
/// Hosts an image may come from for the preview. The app promises to talk
/// only to the addon sites, so anything else in a README is ignored.
fn allowed_image_host(url: &str) -> bool {
let rest = match url.strip_prefix("https://") {
Some(r) => r,
None => return false,
};
let host = rest.split('/').next().unwrap_or("").to_ascii_lowercase();
// A real URL parse: `https://evil.example?.wago.io/a.png` has the host evil.example.
let Ok(parsed) = reqwest::Url::parse(url) else { return false };
if parsed.scheme() != "https" || !parsed.username().is_empty() || parsed.password().is_some() {
return false;
}
let Some(host) = parsed.host_str() else { return false };
let host = host.to_ascii_lowercase();
host == "github.com"
|| host.ends_with(".githubusercontent.com")
|| host == "media.forgecdn.net"
Expand Down Expand Up @@ -544,6 +547,26 @@ pub async fn preview_image(client: &reqwest::Client, url: &str) -> Option<String
mod tests {
use super::*;

#[test]
fn image_hosts_are_read_from_the_parsed_url() {
assert!(allowed_image_host("https://github.com/owner.png?size=64"));
assert!(allowed_image_host("https://avatars.githubusercontent.com/u/1"));
assert!(allowed_image_host("https://media.forgecdn.net/a.png"));
for url in [
"https://evil.example/a.png",
"http://github.com/owner.png",
"https://evil.example?.githubusercontent.com/a.png",
"https://evil.example#.wago.io/a.png",
"https://evil.example\\.wago.io/a.png",
"https://github.com@evil.example/a.png",
"https://user:pass@github.com/a.png",
"https://github.com.evil.example/a.png",
"not a url",
] {
assert!(!allowed_image_host(url), "{url}");
}
}

#[test]
fn release_notes_are_plain_and_short() {
let md = "## 1.2.0\n- **Fixed** the [map](https://x.y) bug\n* Added `thing`\n```lua\ncode\n```\n<img src=x>\nPlain line";
Expand Down
20 changes: 20 additions & 0 deletions src-tauri/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const FORBIDDEN_EXT: &[&str] = &[
"exe", "dll", "sys", "scr", "com", "pif", "cpl", "msi", "msp", "bat", "cmd", "ps1", "psm1",
"vbs", "vbe", "js", "jse", "wsf", "wsh", "hta", "jar", "py", "sh", "lnk", "reg", "inf",
"ocx", "drv", "app", "dmg", "apk", "command", "dylib", "so", "pkg", "scpt", "tool", "terminal",
"pyw", "mjs", "cjs", "url", "chm", "msc", "msix", "msixbundle", "appx", "appxbundle", "wsc", "ws",
"psd1", "application", "gadget", "iso", "img", "vhd", "vhdx",
];

/// macOS bundles are directories; refuse folders with these extensions.
Expand Down Expand Up @@ -658,6 +660,24 @@ mod tests {
let _ = fs::remove_dir_all(&root);
}

#[test]
fn safety_scan_refuses_other_runnable_file_types() {
let root = std::env::temp_dir().join(format!("af-types-{}", unique()));
let addon = root.join("Evil");
fs::create_dir_all(&addon).unwrap();
fs::write(addon.join("Evil.toc"), "## Interface: 16001\n").unwrap();
fs::write(addon.join("notes.lua"), "-- fine\n").unwrap();
assert!(safety_scan(&root).is_ok());
for name in ["run.pyw", "open.url", "help.chm", "console.msc", "pack.msix", "disk.iso", "SHOUT.MJS"] {
let file = addon.join(name);
fs::write(&file, "text, no magic bytes").unwrap();
let err = safety_scan(&root).unwrap_err().to_string();
assert!(err.contains("executable file"), "{name}: {err}");
fs::remove_file(&file).unwrap();
}
let _ = fs::remove_dir_all(&root);
}

#[test]
fn safety_scan_refuses_shebang_and_app_bundle() {
let root = std::env::temp_dir().join(format!("af-mac-{}", unique()));
Expand Down
Loading