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: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
- name: Attach the jar to a GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "$GITHUB_REF_NAME" build/libs/Mapkeeper-*.jar --title "Mapkeeper $GITHUB_REF_NAME" --notes-file "docs/releases/$GITHUB_REF_NAME.md"
run: gh release create "$GITHUB_REF_NAME" build/libs/BlueMapAuth-*.jar --title "BlueMapAuth $GITHUB_REF_NAME" --notes-file "docs/releases/$GITHUB_REF_NAME.md"
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Mapkeeper
# BlueMapAuth

Registered in the owner's ops process (`~/Code/ops`). Area: `minecraft-plugins`. Created 2026-11-10 from the ops starter kit.

Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
# Mapkeeper
# BlueMapAuth

Mapkeeper for Paper: BlueMap's web map behind a sign-in, showing each player only the worlds and players they're allowed to see.
BlueMapAuth for Paper: BlueMap's web map behind a sign-in, showing each player only the worlds and players they're allowed to see.

**Status:** early, version 0.1.0. 24 HTTP and config tests pass, plus a bot test (25/25, and 8/8 without HouseRules and LuckPerms, 2026-11-11) on a throwaway Paper 26.1.2 server with the real BlueMap 5.29, LuckPerms 5.5, HouseRules and Latchkey, signing in through Latchkey's "Open the map" over HTTP. The hand-off page was checked in a real browser (Chromium, 2026-11-11, against made-up data on localhost; `BrowserDemo` in the test sources). The token leaves the address bar, the cookie is invisible to scripts, a reused link explains itself, and the page has no policy errors. On a copy of a real server on Paper 26.2 and 26.3 build 249 (2026-11-14) it loaded with no errors, switched off, so serving the map on 26.2 and 26.3 is still untested, as is running behind Caddy.
**Status:** early, version 0.2.0. 24 HTTP and config tests pass, plus a bot test (25/25, and 8/8 without Mayor and LuckPerms, 2026-11-11) on a throwaway Paper 26.1.2 server with the real BlueMap 5.29, LuckPerms 5.5, Mayor and WelcomeWagon, signing in through WelcomeWagon's "Open the map" over HTTP. The hand-off page was checked in a real browser (Chromium, 2026-11-11, against made-up data on localhost; `BrowserDemo` in the test sources). The token leaves the address bar, the cookie is invisible to scripts, a reused link explains itself, and the page has no policy errors. On a copy of a real server on Paper 26.2 and 26.3 build 249 (2026-11-14) it loaded with no errors, switched off, so serving the map on 26.2 and 26.3 is still untested, as is running behind Caddy.

## What it does

- Serves BlueMap's web map at its own address, such as `map.example.org`, and nothing of it to anyone who isn't signed in. BlueMap's own web server stays on 127.0.0.1, so Mapkeeper is the only way in.
- Signs a browser in with a one-time link from Latchkey's invite page ("Open the map"). The link works once, for a minute. The map then has its own cookie for its own address only, and it ends within 30 seconds of the Latchkey session ending.
- Serves BlueMap's web map at its own address, such as `map.example.org`, and nothing of it to anyone who isn't signed in. BlueMap's own web server stays on 127.0.0.1, so BlueMapAuth is the only way in.
- Signs a browser in with a one-time link from WelcomeWagon's invite page ("Open the map"). The link works once, for a minute. The map then has its own cookie for its own address only, and it ends within 30 seconds of the WelcomeWagon session ending.
- Lists only the maps of worlds the viewer may enter (`multiverse.access.<world>` by default). Any other map is "not found", the same as one that doesn't exist.
- Shows only the players the viewer may see. In game, that's chat's reach from HouseRules. A viewer who isn't in game sees only players who share a HouseRules circle with them.
- Fails closed. Without Latchkey nobody can sign in. Without BlueMap there are no maps. Without HouseRules the viewer sees only themselves. For a viewer who isn't in game, without LuckPerms there are no maps and no other players.
- Shows only the players the viewer may see. In game, that's chat's reach from Mayor. A viewer who isn't in game sees only players who share a Mayor circle with them.
- Fails closed. Without WelcomeWagon nobody can sign in. Without BlueMap there are no maps. Without Mayor the viewer sees only themselves. For a viewer who isn't in game, without LuckPerms there are no maps and no other players.

## Install or build

Needs Paper 26.1 or newer and Java 25. BlueMap, LuckPerms, HouseRules (0.4 or newer, for circles while away) and Latchkey (0.4 or newer, for the hand-off) are all optional.
Needs Paper 26.1 or newer and Java 25. BlueMap, LuckPerms, Mayor (0.4 or newer, for circles while away) and WelcomeWagon (0.4 or newer, for the hand-off) are all optional.

```
./gradlew build
```

The jar is `build/libs/Mapkeeper-<version>.jar`. In `plugins/Mapkeeper/config.yml`, set `enabled: true` and `public-url`. Point your HTTPS proxy at `127.0.0.1:8180`, and set BlueMap's web server to `ip: "127.0.0.1"`. In Latchkey, set `page.map-address` to the same address.
The jar is `build/libs/BlueMapAuth-<version>.jar`. In `plugins/BlueMapAuth/config.yml`, set `enabled: true` and `public-url`. Point your HTTPS proxy at `127.0.0.1:8180`, and set BlueMap's web server to `ip: "127.0.0.1"`. In WelcomeWagon, set `page.map-address` to the same address.

## Bot test

`test/live/mapkeeper.mjs` builds a throwaway server in a temp folder, runs bots and browser requests against it, and deletes it. The settings it needs are at the top of the file. `MK_TEST_MISSING=1` runs it without HouseRules and LuckPerms, to check those paths fail closed. It needs Node 22 or newer, and `npm ci` in `test/live` first.
`test/live/bluemapauth.mjs` builds a throwaway server in a temp folder, runs bots and browser requests against it, and deletes it. The settings it needs are at the top of the file. `MK_TEST_MISSING=1` runs it without Mayor and LuckPerms, to check those paths fail closed. It needs Node 22 or newer, and `npm ci` in `test/live` first.

## Commands

- `/mapkeeper status`: whether the map is served, what's wrong with the config, and which plugins it found. Needs `mapkeeper.admin`.
- `/mapkeeper reload`: re-reads `config.yml`.
- `/bluemapauth status`: whether the map is served, what's wrong with the config, and which plugins it found. Needs `bluemapauth.admin`.
- `/bluemapauth reload`: re-reads `config.yml`.

## License

Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group = "com.extantape"
version = "0.1.0"
version = "0.2.0"

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(25))
Expand All @@ -21,7 +21,7 @@ val blueMapApi = "de.bluecolored:bluemap-api:2.7.8"
val luckPermsApi = "net.luckperms:api:5.4"

dependencies {
// All optional at run time: each is used only when its plugin is installed, and Mapkeeper fails closed without it.
// All optional at run time: each is used only when its plugin is installed, and BlueMapAuth fails closed without it.
compileOnly(paperApi)
compileOnly(blueMapApi)
compileOnly(luckPermsApi)
Expand Down Expand Up @@ -49,7 +49,7 @@ tasks.test {
}

tasks.jar {
archiveBaseName.set("Mapkeeper")
archiveBaseName.set("BlueMapAuth")
}

// Prints the test classpath, for running test/java's BrowserDemo by hand.
Expand Down
4 changes: 4 additions & 0 deletions docs/decisions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ Dated decisions for this repo, newest last.
## 2026-11-14

- **First release and going public.** The owner approved release tags for the staged jars (Helm chat, 2026-11-14, "Go (Recommended)"), under the standing yes of 2026-11-07 for a private Minecraft plugin repo to go public at its first release. Before going public: a history audit (no secrets, private terms, server addresses or player data; only noreply commit emails; no build output), the leak check in CI, an MIT LICENSE and a README status line.

## 2026-11-14

- **Name (owner, D194):** Mapkeeper is renamed BlueMapAuth, so people looking for BlueMap add-ons find it. The owner: "yes… BlueMapAuth". Released as 0.2.0. The owner asked that no old names be kept, so there's no alias, old permission or folder copy.
28 changes: 14 additions & 14 deletions docs/design.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# Mapkeeper design (2026-11-10)
# BlueMapAuth design (2026-11-10)

Mapkeeper puts BlueMap's web map behind a sign-in and shows each signed-in player only what they may see. Owner decisions: D40 (the name, its own agnostic plugin), D41 (players on the map follow chat's reach rules; anyone Mapkeeper can't check stays hidden), D54 (a viewer who isn't in game sees only players in their circles), D43 (its own address, `map.<domain>`, with its own host-only cookie from a one-time hand-off; never a cookie on the whole domain).
BlueMapAuth puts BlueMap's web map behind a sign-in and shows each signed-in player only what they may see. Owner decisions: D40 (the name, its own agnostic plugin), D41 (players on the map follow chat's reach rules; anyone BlueMapAuth can't check stays hidden), D54 (a viewer who isn't in game sees only players in their circles), D43 (its own address, `map.<domain>`, with its own host-only cookie from a one-time hand-off; never a cookie on the whole domain).

## Pieces

```
browser ──https──▶ Caddy (map.<domain>) ──▶ Mapkeeper (127.0.0.1:8180) ──▶ BlueMap's web server (127.0.0.1:8100)
browser ──https──▶ Caddy (map.<domain>) ──▶ BlueMapAuth (127.0.0.1:8180) ──▶ BlueMap's web server (127.0.0.1:8100)
│ in-process, by name:
├─ Latchkey: hand-off tokens, session still valid?
├─ WelcomeWagon: hand-off tokens, session still valid?
├─ BlueMap API: which world each map shows
├─ LuckPerms: may this player enter that world? (offline too)
└─ HouseRules: may the viewer reach that player?
└─ Mayor: may the viewer reach that player?
```

- **Mapkeeper is the only way in.** BlueMap's own web server listens on 127.0.0.1 only. Mapkeeper also listens on 127.0.0.1 only, behind the same Caddy as the invite page.
- **No hard dependencies** (D2). Latchkey, LuckPerms and HouseRules are each read by name. Without one, the part that needs it fails closed: no Latchkey means nobody can sign in; no permissions check means no maps; no HouseRules means no other players on the map.
- **BlueMapAuth is the only way in.** BlueMap's own web server listens on 127.0.0.1 only. BlueMapAuth also listens on 127.0.0.1 only, behind the same Caddy as the invite page.
- **No hard dependencies** (D2). WelcomeWagon, LuckPerms and Mayor are each read by name. Without one, the part that needs it fails closed: no WelcomeWagon means nobody can sign in; no permissions check means no maps; no Mayor means no other players on the map.

## Signing in (D43)

1. On the invite page's welcome view, a signed-in player clicks **Open the map**.
2. Latchkey makes a one-time token for that player and that session: random, single use, good for 60 seconds, audience `map`. It redirects to `https://map.<domain>/handoff#<token>` (after `#`, so it never reaches a log).
3. The page posts the token to Mapkeeper, which asks Latchkey to redeem it (in-process). Latchkey answers with the player and the session it came from, once.
4. Mapkeeper sets its own cookie on `map.<domain>` only: HttpOnly, Secure, SameSite=Strict, no Domain attribute. It lasts no longer than the Latchkey session, and ends when that session ends: Mapkeeper asks Latchkey whether it's still valid (cached for 30 seconds), so a sign-out, a revoke or a whitelist removal reaches the map within 30 seconds.
2. WelcomeWagon makes a one-time token for that player and that session: random, single use, good for 60 seconds, audience `map`. It redirects to `https://map.<domain>/handoff#<token>` (after `#`, so it never reaches a log).
3. The page posts the token to BlueMapAuth, which asks WelcomeWagon to redeem it (in-process). WelcomeWagon answers with the player and the session it came from, once.
4. BlueMapAuth sets its own cookie on `map.<domain>` only: HttpOnly, Secure, SameSite=Strict, no Domain attribute. It lasts no longer than the WelcomeWagon session, and ends when that session ends: BlueMapAuth asks WelcomeWagon whether it's still valid (cached for 30 seconds), so a sign-out, a revoke or a whitelist removal reaches the map within 30 seconds.

## What each viewer gets

Expand All @@ -34,17 +34,17 @@ browser ──https──▶ Caddy (map.<domain>) ──▶ Mapkeeper (127.0.0.1
| the web app (`/`, `/assets/...`, `/lang/...`) | passed through | the sign-in page instead of the app |

- **Which worlds:** the same permission the server uses, `multiverse.access.<world>`, read through LuckPerms so it works while the player is offline. Can't read it: no map.
- **Which players:** with the viewer online in game, HouseRules' `mayReach(viewer, target)`, exactly chat's rule. With the viewer not in game (D54): only players who share a HouseRules circle with them. If HouseRules can't answer, nobody.
- **Which players:** with the viewer online in game, Mayor' `mayReach(viewer, target)`, exactly chat's rule. With the viewer not in game (D54): only players who share a Mayor circle with them. If Mayor can't answer, nobody.
- Every answer carries `Cache-Control: private, no-store` for live data, the same security headers as the invite page, and no CORS.

## Changes in other plugins

- **Latchkey:** a hand-off service (make a token for the welcome view's link, redeem it once, say whether a session is still valid) and the "Open the map" link, shown only when a map address is set.
- **HouseRules:** `sharesCircle(UUID viewer, UUID target)` for a viewer who isn't in game (D54), by circles only.
- **WelcomeWagon:** a hand-off service (make a token for the welcome view's link, redeem it once, say whether a session is still valid) and the "Open the map" link, shown only when a map address is set.
- **Mayor:** `sharesCircle(UUID viewer, UUID target)` for a viewer who isn't in game (D54), by circles only.

## Tests

Bots and HTTP, on throwaway servers with BlueMap, LuckPerms, HouseRules and Latchkey:
Bots and HTTP, on throwaway servers with BlueMap, LuckPerms, Mayor and WelcomeWagon:

- an unsigned visitor gets nothing: not the map list, not a tile, not players.json;
- a kid account never receives an adult world's map list entry, tiles or markers, and never an adult player in players.json;
Expand Down
14 changes: 14 additions & 0 deletions docs/releases/v0.2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
A new name (D194), so people looking for BlueMap add-ons find it. Nothing else changed in how it works.

## Installing over the previous version

With the server stopped:
1. Rename its plugin folder to `plugins/BlueMapAuth`.
2. Grant `bluemapauth.admin` in place of its old permission.
3. Swap in `BlueMapAuth-0.2.0.jar`.

Anyone signed in to the map signs in once more through Latchkey, because the map's cookie has a new name.

## Tested

Unit and HTTP tests pass. It finds WelcomeWagon and Mayor by their new names, so install it together with WelcomeWagon 0.6.0 and Mayor 0.5.0.
16 changes: 8 additions & 8 deletions docs/test-audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@ Kept by this repo's owning session, per `~/Code/CLAUDE.md`, "Test self-audits".
| --- | --- |
| Nothing of the map for a visitor who isn't signed in, and BlueMap is never asked | `aVisitorWhoIsntSignedInGetsNothingOfTheMap` |
| Hand-off: once, host-only Strict cookie, only from the map's own origin, rate limited | `aHandOffSetsAHostOnlyStrictCookieOnce`, `handOffsFromElsewhereOrMalformedAreRefused`, `handOffTriesAreRateLimited` |
| The token leaves the address bar; strict CSP on Mapkeeper's own pages | `theHandOffPageMovesTheTokenOutOfTheAddressBarUnderAStrictPolicy` |
| The token leaves the address bar; strict CSP on BlueMapAuth's own pages | `theHandOffPageMovesTheTokenOutOfTheAddressBarUnderAStrictPolicy` |
| A kid away from the game sees only their worlds' maps and their circle (D54) | `anAwayKidSeesOnlyTheirWorldsMapsAndTheirCircle` |
| A world the viewer can't enter: list entry, tiles, markers and players all absent, with the same 404 as a missing map | `anAdultWorldsMapIsNotThereForAKidAtAll` |
| In game, chat's reach decides (D41) | `anAdultSeesBothWorldsAndThePlayersTheyMayReach` (the reach rules themselves are HouseRules' tests) |
| In game, chat's reach decides (D41) | `anAdultSeesBothWorldsAndThePlayersTheyMayReach` (the reach rules themselves are Mayor' tests) |
| Odd BlueMap data shows nobody; a broken BlueMap shows an empty error | `oddPlayerListsShowNobody`, `aBrokenBlueMapGivesAnEmptyErrorWithNoDetails` |
| Map access ends within 30 s of Latchkey's session, and after a day at most | `signingOutOfLatchkeyEndsTheMapWithin30Seconds`, `aMapSessionLastsADayAtMost` |
| Map access ends within 30 s of WelcomeWagon's session, and after a day at most | `signingOutOfWelcomeWagonEndsTheMapWithin30Seconds`, `aMapSessionLastsADayAtMost` |
| Cookies and auth headers never reach BlueMap; its headers don't come back | `cookiesAndOtherHeadersNeverReachBlueMapAndItsHeadersDontComeBack` |
| Odd paths and methods refused; planted duplicate cookies count as none | `oddPathsAndMethodsAreRefused`, `twoMapCookiesCountAsNone`, `aMadeUpOrForeignCookieIsNoSession` |
| Unsafe config never starts: bind, BlueMap address, URLs, proxies, permission, limits | `SetupTest` (8 tests) |

Gaps, with why:
- **LiveAccess** (the calls into Latchkey, HouseRules, BlueMap and LuckPerms) is covered by the bot test, `test/live/mapkeeper.mjs`, 25/25 on 2026-11-11 with real plugins. It covers:
- **LiveAccess** (the calls into WelcomeWagon, Mayor, BlueMap and LuckPerms) is covered by the bot test, `test/live/bluemapauth.mjs`, 25/25 on 2026-11-11 with real plugins. It covers:
- an away kid sees only their circle (D54), and in game, chat's reach (D41);
- an adults-only world's map is absent for a kid;
- losing a circle or a world reaches the map within 30 seconds;
- signing out of Latchkey, or removal from the whitelist, ends map access within 30 seconds.
- signing out of WelcomeWagon, or removal from the whitelist, ends map access within 30 seconds.

The fail-closed paths have their own run, `MK_TEST_MISSING=1`, which passed 8/8 on 2026-11-11 without HouseRules or LuckPerms:
The fail-closed paths have their own run, `MK_TEST_MISSING=1`, which passed 8/8 on 2026-11-11 without Mayor or LuckPerms:
- an away viewer gets no maps and no players;
- an operator in game sees only themselves;
- `/mapkeeper status` names what's missing.
- `/bluemapauth status` names what's missing.

Without Latchkey there's no way to make a hand-off token, and a made-up one is refused (`handOffsFromElsewhereOrMalformedAreRefused`).
Without WelcomeWagon there's no way to make a hand-off token, and a made-up one is refused (`handOffsFromElsewhereOrMalformedAreRefused`).
- The hand-off page's script ran in a real browser on 2026-11-11 (`BrowserDemo`, made-up data). It signed in and landed on the map, the token left the address bar, the cookie wasn't readable by scripts, `settings.json` listed only the allowed map, the other map was 404, a reused link showed its message in a `role=status` line, and the console showed no policy errors. This was a manual check, not automated.
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = "Mapkeeper"
rootProject.name = "BlueMapAuth"
Loading
Loading