Skip to Content
Documentation

Permissions

What each permission allows, who grants it, and how the network permissions name their hosts.

Nothing is allowed until a person allows it. Your manifest asks for each permission with a reason, 10 to 200 characters, in words the person granting it will read:

songstress.json
"permissions": {
  "network": { "reason": "Send your plays to Tunelog.", "hosts": ["api.tunelog.example"] },
  "listening.read": { "reason": "Know what you play, to send it to your profile." }
}

Every permission

PermissionAllowsUnlocksGranted by
networkRequests to the public hosts it names, over http or https. The address a name resolves to is checked when connecting and on every redirectnet.fetchThe admin
network.localRequests to targets on the user's own network, from server code onlynet.fetch to those targets, in the server entryThe admin, who confirms twice
library.readReading the catalogue and hearing when it changeslibrary.*; onPlaylistChange, onLibraryChange, onScanCompleteThe admin
users.readMembers' ids and display names, nothing elseusers.*The admin
listening.readOne member's plays, what they're playing now and what they likeonPlay, onScrobble, onFavorite; the client hooks; player.getState, queue.get; a scrobble providerThat member, for themselves, once the admin allows the extension
player.controlStarting, pausing, skipping and seeking the player of the device the code runs on, and adding to its queueplayer.play, pause, next, previous, seek; queue.addThe admin
providersAnswering beside Songstress's own sources. Each source joins switched off or lastproviders.*.registerThe admin
routesServing the extension's own signed-in routesroutes.registerThe admin
jobsScheduled and background workjobs.*The admin
storageKeeping the extension's own data, under a quotastorage.*Listed at install, no question asked
secretsKeeping the extension's own credentials, sealedsecrets.*; signIn.registerListed at install, no question asked

The permission each single call needs is in The host API.

Network hosts

network takes hosts: 1 to 20 public hosts, each by name (api.example.com) or as every host under a domain (*.example.com), with an optional port. Never an address, a scheme, a path, a bare * or a whole top-level domain. A server may also refuse a wildcard over a domain where anyone can have a name (*.github.io, *.co.uk): name the domain that is yours.

network.local may take targets: up to 20 on the user's own network, each an IPv4 address (192.168.1.20), a block (192.168.1.0/24) or a host name (nas.local), with an optional port. An address or a block must lie inside 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 or 127.0.0.0/8 (NETWORK_LOCAL_NOT_PRIVATE). Leave targets out, and the admin names them when granting.

net.fetch from client code reaches the public hosts of network and nowhere else, never a network.local target.

The rules

  • A permission your manifest needs and doesn't ask for is an error (PERMISSION_REQUIRED), and so is one it asks for and could never use (PERMISSION_UNUSED).
  • A call the manifest didn't ask for, or that nobody granted, fails with the code permission-denied.
  • When an update asks for a permission the installed version didn't have, the update waits until an admin accepts it. The version installed keeps running meanwhile.
  • A hook's event carries the id of the member it concerns whether or not the extension may read their name. users.read turns an id into a name.

On this page