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
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ Closes #

- [ ] Each new or changed entry's package was reviewed, mirrored as a release asset of this repository, and its `sha256` and `size` match
- [ ] `permissions` and `hosts` match the package's manifest
- [ ] `author`, `homepage`, `category`, icon and screenshots describe the extension accurately
- [ ] A removed package is listed in `revoked`
- [ ] No secrets, credentials or personal data in the diff
20 changes: 19 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ env:

jobs:
# Signs the catalog with a throwaway key, which runs the same checks Tarn applies to the index,
# and checks every package against its entry. No secret is used.
# checks every package and the store fields against its entry, and builds the store website from
# the fixtures. No secret is used.
check:
runs-on: ubuntu-24.04
permissions:
Expand All @@ -45,6 +46,23 @@ jobs:
umask 077
tarn/target/release/filter-bundle keygen | sed -n 's/^FILTER_SIGNING_KEY=//p' > "$RUNNER_TEMP/throwaway.key"
tarn/target/release/filter-bundle catalog --kind extension --in index.json --key "$RUNNER_TEMP/throwaway.key" --out out
- name: The store checks refuse bad entries
run: python3 -I -m unittest discover -s catalog/site
- name: Every entry's store fields are valid
run: python3 -I catalog/site/store.py check catalog/catalog.json --root catalog
- name: The store website builds from the fixtures
run: |
python3 -I catalog/site/store.py check catalog/site/fixtures/catalog.json --root catalog/site/fixtures
now="$(date -u +%s)"
jq --argjson now "$now" '{kind, version: $now, created: $now, extensions, revoked}' catalog/site/fixtures/catalog.json > fixture-index.json
tarn/target/release/filter-bundle catalog --kind extension --in fixture-index.json --key "$RUNNER_TEMP/throwaway.key" --out fixture-signed
python3 -I catalog/site/store.py build --index fixture-signed/index.json --sig fixture-signed/index.sig --root catalog/site/fixtures --out fixture-site
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: fixture-site
path: fixture-site/
if-no-files-found: error
retention-days: 7
- name: Every package matches its entry
run: |
jq -r '.extensions[] | [.id, .url, .sha256, (.size | tostring)] | @tsv' catalog/catalog.json |
Expand Down
35 changes: 34 additions & 1 deletion .github/workflows/sign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Sign catalog
on:
push:
branches: [main]
paths: [catalog.json]
paths: [catalog.json, "assets/**", "site/**"]
schedule:
- cron: "23 5 * * 1"
workflow_dispatch:
Expand Down Expand Up @@ -119,6 +119,39 @@ jobs:
fi
gh release upload catalog --repo "$REPO" --clobber signed/index.json signed/index.sig

# The store website is built from the files the sign job produced; only deploy can write to Pages.
site:
needs: publish
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: signed
path: signed
- name: Build the store website
run: python3 -I site/store.py build --index signed/index.json --sig signed/index.sig --root . --out _site
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: _site/

deploy:
needs: site
runs-on: ubuntu-24.04
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
permissions:
pages: write
id-token: write
steps:
- id: deploy
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1

# GitHub turns off scheduled workflows after 60 days without a commit; Tarn refuses an index older
# than 30 days. Enabling the workflow again through the API keeps the weekly signing on.
keepalive:
Expand Down
82 changes: 80 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,88 @@ only `main` may use; the maintainer keeps an offline copy.
"size": 12345,
"permissions": ["storage"],
"optional_permissions": [],
"hosts": ["*://*.example.com/*"]
"hosts": ["*://*.example.com/*"],
"author": "Example Author",
"homepage": "https://example.com/",
"category": "productivity",
"icon": "assets/example/icon.png",
"screenshots": ["assets/example/main.png"]
}
```

`id` uses lowercase letters, digits and `-` (at most 64). `permissions` and `hosts` must match
the manifest; Tarn shows them in its consent sheet.
4. Open a pull request. Once it is merged into `main`, the workflow signs and publishes the new index.

The last five fields are for the store website only; Tarn ignores them.

| Field | Rule |
|---|---|
| `author` | Who publishes the extension |
| `homepage` | An `https` URL with a lowercase ASCII host (punycode for other scripts) and no user, password or port |
| `category` | One of the categories below |
| `icon` | Exactly `assets/<id>/icon.png`: a square PNG, 128 to 512 px, at most 256 KiB |
| `screenshots` | 0 to 5 paths `assets/<id>/<name>.png` or `.jpg` (`<name>` in lowercase letters, digits, `-` and `_`), each a complete file of at most 1 MiB and 2560 × 2560 px |

Images must be complete PNG or JPEG files without metadata: no Exif, XMP, IPTC or comments, and at
most 4 KiB of PNG text chunks. Export them again without metadata if the check refuses one.

`name` (at most 64 characters), `description` (300), `author` (80), `version` (64) and `homepage`
(300) are one line of visible text without control or invisible characters and with at most two
combining marks on a character; Tarn rejects an index above 256 KiB.
`hosts` lists every match pattern the package asks for, required or optional, word for word as Tarn
reads it: `<all_urls>`, `<scheme>://<host><path>` (scheme `*`, `http`, `https`, `ws`, `wss` or `ftp`;
host `*`, `*.<domain>`, `<domain>` or an IP literal, with an optional port; no user or password)
`file:///<path>`, `data:…` or `urn:…`. The store shows them as the sites the extension may ask for.

| `category` | Shown as |
|---|---|
| `privacy-security` | Privacy & Security |
| `productivity` | Productivity |
| `reading` | Reading |
| `appearance` | Appearance |
| `accessibility` | Accessibility |
| `developer` | Developer Tools |
| `shopping` | Shopping |
| `social` | Social & Communication |
| `other` | Other |

4. Add the icon and screenshots under `assets/<id>/`.
5. Open a pull request. The **Check** workflow validates every entry. Once it is merged into `main`,
the workflow signs and publishes the new index and rebuilds the store website.

## Store website

[extensions.tarnbrowser.com](https://extensions.tarnbrowser.com) lists the catalog with categories,
search and an **Install in Tarn** button per extension, which links to
`https://extensions.tarnbrowser.com/install/<id>`. Tarn recognises that link when you click it and
opens its own consent sheet for the extension from its verified catalog copy; the website has no
other channel into the browser.

After every signing run, the **Sign catalog** workflow builds the site from the index it just
signed and deploys it to GitHub Pages. `site/store.py` (Python 3, standard library only) checks the
store fields and writes plain HTML, the stylesheet and a small search script; `/index.json` and
`/index.sig` are the signed files, byte for byte, and `/search.json` lists id, name, description,
author and category. The pages load nothing from other sites: the Geist and Funnel Display fonts
are served from `site/static/fonts/` under the SIL Open Font License, whose text sits next to them.

GitHub Pages cannot send response headers, so each page sets its Content Security Policy in a
`<meta>` tag. Browsers ignore `frame-ancestors` there, so another site can frame the store; that
gives it nothing, because Tarn acts only on an install link the user opens in a top-level tab and
never on one inside a frame.

Build it locally from a signed index:

```sh
python3 -I -m unittest discover -s site
python3 -I site/store.py check catalog.json
python3 -I site/store.py build --index index.json --sig index.sig --root . --out _site
python3 -m http.server --bind 127.0.0.1 --directory _site
```

`site/fixtures/` holds a catalog of fictional extensions that the **Check** workflow signs with a
throwaway key and builds as a preview (the `fixture-site` artifact). It is never published.

## Trademarks

"Tarn" and the Tarn logo (`site/static/mark.svg`) are trademarks of Quavon UG
(haftungsbeschränkt) that this repository's licence does not cover; see [`TRADEMARKS.md`](TRADEMARKS.md).
10 changes: 10 additions & 0 deletions TRADEMARKS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Trademarks

"Tarn" and the Tarn logo (`site/static/mark.svg`) are trademarks of Quavon UG
(haftungsbeschränkt). The licence of this repository ([`LICENSE`](LICENSE)) covers the code, not
these marks: as section 7(e) of the GNU General Public License version 3 allows, it grants no rights
under trademark law.

The rules for using them are Tarn's trademark policy:
[tarn-browser `TRADEMARKS.md`](https://github.com/Quavon-dev/tarn-browser/blob/main/TRADEMARKS.md).
A copy of this repository needs its own name and logo instead of `site/static/mark.svg`.
5 changes: 5 additions & 0 deletions site/fixtures/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Store fixtures

Fictional extensions used only to test the store: `check.yml` validates this catalog, signs it with a
throwaway key and builds a preview site from it. None of it is published to
`extensions.tarnbrowser.com`, and the package URLs and hashes point at nothing.
Binary file added site/fixtures/assets/quiet-reader/dark.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/fixtures/assets/quiet-reader/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/fixtures/assets/quiet-reader/light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/fixtures/assets/tab-tidy/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/fixtures/assets/tracker-lens/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/fixtures/assets/tracker-lens/panel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions site/fixtures/catalog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"kind": "tarn-extension-catalog",
"extensions": [
{
"id": "quiet-reader",
"name": "Quiet Reader",
"description": "Turns cluttered articles into a calm, readable page with your choice of font and width.",
"version": "1.2.0",
"url": "https://github.com/Quavon-dev/tarn-extensions/releases/download/quiet-reader-1.2.0/quiet-reader.zip",
"sha256": "1111111111111111111111111111111111111111111111111111111111111111",
"size": 48213,
"permissions": ["activeTab", "storage"],
"optional_permissions": [],
"hosts": [],
"author": "Fixture Labs",
"homepage": "https://example.com/quiet-reader",
"category": "reading",
"icon": "assets/quiet-reader/icon.png",
"screenshots": ["assets/quiet-reader/light.png", "assets/quiet-reader/dark.jpg"]
},
{
"id": "tracker-lens",
"name": "Tracker Lens",
"description": "Shows which trackers a page tried to load and blocks the ones you pick.",
"version": "0.9.1",
"url": "https://github.com/Quavon-dev/tarn-extensions/releases/download/tracker-lens-0.9.1/tracker-lens.zip",
"sha256": "2222222222222222222222222222222222222222222222222222222222222222",
"size": 91540,
"permissions": ["declarativeNetRequest", "storage"],
"optional_permissions": [],
"hosts": ["*://*/*"],
"author": "Fixture Labs",
"homepage": "https://example.com/tracker-lens",
"category": "privacy-security",
"icon": "assets/tracker-lens/icon.png",
"screenshots": ["assets/tracker-lens/panel.png"]
},
{
"id": "tab-tidy",
"name": "Tab Tidy",
"description": "Groups open tabs by site and closes duplicates with one click.",
"version": "2.0.0",
"url": "https://github.com/Quavon-dev/tarn-extensions/releases/download/tab-tidy-2.0.0/tab-tidy.zip",
"sha256": "3333333333333333333333333333333333333333333333333333333333333333",
"size": 20480,
"permissions": ["storage"],
"optional_permissions": ["activeTab"],
"hosts": ["*://*.example.org/*"],
"author": "Example <Tools> & Co",
"homepage": "https://example.org/tab-tidy",
"category": "productivity",
"icon": "assets/tab-tidy/icon.png",
"screenshots": []
}
],
"revoked": []
}
93 changes: 93 additions & 0 deletions site/static/fonts/FunnelDisplay-OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright 2024 The Funnel Project Authors (https://github.com/Dicotype/Funnel)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Loading