From 19cb53949876cae425e47b720e9be566e7a247db Mon Sep 17 00:00:00 2001 From: kmoy007 Date: Sat, 14 Nov 2026 21:52:51 -0800 Subject: [PATCH 1/2] bug-report-py 3.2.0: ids end in 6 or 12 hex; a non-admin lists features and their own reports Co-Authored-By: Claude Sonnet 5.5 --- CHANGELOG.md | 7 ++ docs/CENTRAL-STORE.md | 2 + e2e/test_contract.py | 2 +- packages/backend-node/src/models.js | 2 +- packages/backend-node/tests/bug-id.test.js | 9 ++ packages/backend-node/tests/router.test.js | 2 +- packages/backend-python/README.md | 18 ++- .../backend-python/bug_report/__init__.py | 2 +- .../backend-python/bug_report/blueprint.py | 25 +++- packages/backend-python/bug_report/models.py | 3 +- packages/backend-python/pyproject.toml | 2 +- .../backend-python/tests/test_blueprint.py | 7 +- packages/backend-python/tests/test_proxy.py | 20 ++- .../tests/test_proxy_forward.py | 2 +- .../backend-python/tests/test_spec_drift.py | 9 ++ .../backend-python/tests/test_visibility.py | 119 ++++++++++++++++++ packages/spec/openapi.yaml | 8 +- 17 files changed, 212 insertions(+), 27 deletions(-) create mode 100644 packages/backend-node/tests/bug-id.test.js create mode 100644 packages/backend-python/tests/test_visibility.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 7564103..7fff795 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this monorepo. +## backends v3.2.0 - 2026-11-15 (`bug-report-py` 3.2.0) + +What LeapHQ's move needs from the library (Ken's decisions 1 and 3). The report contract is unchanged. + +- **Ids may end in 12 hex.** `valid_bug_id`, the Node backend's check and the spec's pattern accept `bug-YYYYMMDD-HHMMSS-` plus 6 or 12 lowercase hex, and nothing else; new ids stay 6 hex. A drift test keeps the spec and both backends on one pattern. (The spec's example id was 7 hex, which the code always refused; it is 6 now.) +- **A non-admin lists features and their own reports.** `GET /bugs` is no longer a 403 for a caller who is not an admin: it returns reports with `kind=feature` and reports whose `actor_email` is the caller. Detail, screenshot and vote on anyone else's report are 403; PATCH stays admin-only. The open count a non-admin gets counts only what they see. Admins are unchanged. The person comes from `actor_identity`, as before. Python only: the Node backend still gates by `isAdmin` alone. + ## backends v3.1.0 - 2026-11-15 (`bug-report-py` 3.1.0) The proxy's core is a plain function. No contract change. diff --git a/docs/CENTRAL-STORE.md b/docs/CENTRAL-STORE.md index e50d7e7..8f282ee 100644 --- a/docs/CENTRAL-STORE.md +++ b/docs/CENTRAL-STORE.md @@ -43,6 +43,8 @@ LeapHQ Review ──(LeapHQ's own identity, a token)──► leaphq-reports (on - The service verifies the token with **PyJWT** (signature, issuer, audience and expiry: a decode-only check would make every trusted client id spoofable), then believes those headers only from identities on its `TRUSTED_APPS` list (client id → app name). The app name comes from the token, not the request. - **LeapHQ calls as its own identity** like every other app (it is `leaphq` in `TRUSTED_APPS`), not through a gateway route. - This replaces the near-identical `trusted_identity()` / `trusted_person()` / `is_admin()` copies in SV, PIV, seal and the fleet dashboard. `trusted_person()` moves into the library once, for each app's proxy to use behind its own gateway. +- **Who sees what (3.2.0).** Triage is `BUG_ADMINS` only. A person who is not an admin lists only reports with `kind=feature` and their own (`actor_email` equals the person from `X-Leap-Actor-Email`, any kind); detail, screenshot and vote on another person's report are 403. The open count they see counts only those. The person still comes from the trusted app's headers, so the trust model is unchanged. +- **Ids (3.2.0).** `bug-YYYYMMDD-HHMMSS-` plus 6 hex (new ids) or 12 hex (imported from LeapHQ); the store, the routes, the spec and the Node backend all accept exactly those two. - **Seal laptops.** Their outbox forwards to the seal viewer's proxy exactly as it does today, so nothing changes on a station. ## Store diff --git a/e2e/test_contract.py b/e2e/test_contract.py index e589bbe..b983787 100644 --- a/e2e/test_contract.py +++ b/e2e/test_contract.py @@ -21,7 +21,7 @@ TINY_PNG_B64 = base64.b64encode(TINY_PNG).decode() TINY_JPEG = bytes.fromhex("FFD8FFE000104A46494600010100000100010000FFD9") TINY_JPEG_B64 = base64.b64encode(TINY_JPEG).decode() -ID_RE = re.compile(r"^bug-\d{8}-\d{6}-[a-f0-9]{6}$") +ID_RE = re.compile(r"^bug-\d{8}-\d{6}-(?:[a-f0-9]{6}|[a-f0-9]{12})$") # ----- POST ---------------------------------------------------------- diff --git a/packages/backend-node/src/models.js b/packages/backend-node/src/models.js index d0af182..1993540 100644 --- a/packages/backend-node/src/models.js +++ b/packages/backend-node/src/models.js @@ -58,7 +58,7 @@ export function screenshotContentType(data) { return "image/png"; } -const BUG_ID_RE = /^bug-\d{8}-\d{6}-[a-f0-9]{6}$/; +const BUG_ID_RE = /^bug-\d{8}-\d{6}-(?:[a-f0-9]{6}|[a-f0-9]{12})$/; export function validBugId(id) { return typeof id === "string" && BUG_ID_RE.test(id); diff --git a/packages/backend-node/tests/bug-id.test.js b/packages/backend-node/tests/bug-id.test.js new file mode 100644 index 0000000..86d3983 --- /dev/null +++ b/packages/backend-node/tests/bug-id.test.js @@ -0,0 +1,9 @@ +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { validBugId } from "../src/index.js"; + +test("an id ends in 6 or 12 lowercase hex, and nothing else (3.2.0)", () => { + for (const n of [6, 12]) assert.equal(validBugId(`bug-20261115-101010-${"a1b2c3d4e5f6".slice(0, n)}`), true); + for (const n of [5, 7, 11, 13]) assert.equal(validBugId(`bug-20261115-101010-${"a1b2c3d4e5f60".slice(0, n)}`), false); + assert.equal(validBugId("bug-20261115-101010-A1B2C3"), false); +}); diff --git a/packages/backend-node/tests/router.test.js b/packages/backend-node/tests/router.test.js index 0bb8d37..b17125d 100644 --- a/packages/backend-node/tests/router.test.js +++ b/packages/backend-node/tests/router.test.js @@ -76,7 +76,7 @@ for (const [name, makeStore] of STORES) { }); assert.equal(r.status, 201); const { id } = await r.json(); - assert.match(id, /^bug-\d{8}-\d{6}-[a-f0-9]{6}$/); + assert.match(id, /^bug-\d{8}-\d{6}-(?:[a-f0-9]{6}|[a-f0-9]{12})$/); }); }); diff --git a/packages/backend-python/README.md b/packages/backend-python/README.md index d8bda58..a65096c 100644 --- a/packages/backend-python/README.md +++ b/packages/backend-python/README.md @@ -33,12 +33,20 @@ Routes mounted (under the prefix you pass): | Method | Path | Auth-gated | |--------|----------------------------|-----------------| | POST | /bugs | open | -| GET | /bugs | `is_admin` | -| GET | /bugs/{id} | open | +| GET | /bugs | everyone; a non-admin sees only what they may (3.2.0) | +| GET | /bugs/{id} | admin, a feature, or the caller's own (3.2.0) | | PATCH | /bugs/{id} | `is_admin` | -| GET | /bugs/{id}/screenshot | open | -| POST | /bugs/{id}/vote | signed in (3.0.0) | -| DELETE | /bugs/{id}/vote | signed in (3.0.0) | +| GET | /bugs/{id}/screenshot | admin, a feature, or the caller's own (3.2.0) | +| POST | /bugs/{id}/vote | signed in (3.0.0), on a report they may see | +| DELETE | /bugs/{id}/vote | signed in (3.0.0), on a report they may see | + +**What a non-admin sees (3.2.0).** A caller for whom `is_admin` is false gets, from the list, only reports with `kind=feature` +(so people can see and vote on them) and their own reports (`actor_email` equals the caller, any kind). Detail, screenshot and vote +on anyone else's report are 403; triage (PATCH) stays admin-only. A list with `status=open` therefore counts only what the caller can +see. The caller is the checked `actor_identity` when the app gave one (with `TrustedCallers`, the `X-Leap-Actor-*` headers), else the +request's own `actorEmail`, so without `actor_identity` this is advice, not a boundary. Admins see everything. + +**Ids.** New ids are `bug-YYYYMMDD-HHMMSS-` plus 6 lowercase hex; 12 hex is accepted too (reports imported from LeapHQ), and nothing else. ## Triage fields, votes and filters (3.0.0) diff --git a/packages/backend-python/bug_report/__init__.py b/packages/backend-python/bug_report/__init__.py index f9b631d..16b199c 100644 --- a/packages/backend-python/bug_report/__init__.py +++ b/packages/backend-python/bug_report/__init__.py @@ -44,7 +44,7 @@ valid_bug_id, ) -__version__ = "3.1.0" +__version__ = "3.2.0" from . import contract from .contract import ( diff --git a/packages/backend-python/bug_report/blueprint.py b/packages/backend-python/bug_report/blueprint.py index 0e235cc..1647cd8 100644 --- a/packages/backend-python/bug_report/blueprint.py +++ b/packages/backend-python/bug_report/blueprint.py @@ -259,8 +259,7 @@ def api_create(): @bp.route(url_prefix, methods=["GET"]) def api_list(): - if not is_admin(request): - abort(403) + admin = is_admin(request) status_filter = (request.args.get("status") or "").strip() or None if status_filter and status_filter not in BUG_STATUSES: return jsonify({"error": f"status must be one of {BUG_STATUSES}"}), 400 @@ -275,11 +274,27 @@ def api_list(): if wanted.get("priority") and wanted["priority"] not in contract.PRIORITIES: return jsonify({"error": f"priority must be one of {contract.PRIORITIES}"}), 400 bugs = list(store.list_bugs(status=status_filter, since_iso=_since_iso(days), **wanted)) + if not admin: + me = _caller_email(request) + bugs = [b for b in bugs if _visible(b, me)] counts = _vote_counts([b.id for b in bugs]) rows = [contract.with_kind({**b.to_summary(), "votes": counts.get(b.id, 0)}) for b in bugs] rows.sort(key=lambda r: r["addedAt"], reverse=True) return jsonify({"bugs": rows}) + def _caller_email(req) -> str: + """The caller's address, for what a non-admin may see: the checked identity when the app + gave one, else (as for filing) the request's own claim. "" is nobody.""" + return _voter(req).lower() + + def _visible(bug, me: str) -> bool: + """What a non-admin may see (3.2.0): every feature request, and the caller's own reports.""" + return (bug.effective_kind() == "feature" + or bool(me and (bug.actor_email or "").strip().lower() == me)) + + def _may_see(bug) -> bool: + return bool(is_admin(request)) or _visible(bug, _caller_email(request)) + def _vote_counts(ids): """Votes per report; a store that predates votes counts none.""" counter = getattr(store, "vote_counts", None) @@ -301,6 +316,8 @@ def api_get(bug_id: str): bug = store.get_bug(bug_id) except NotFound: return jsonify({"error": "not found"}), 404 + if not _may_see(bug): + abort(403) full = _detail(bug) full["canNotify"] = bool(notifier is not None and bug.actor_email) return jsonify(full) @@ -508,6 +525,8 @@ def _vote(bug_id: str, adding: bool): if not hasattr(store, "add_vote"): return jsonify({"error": "this store does not keep votes"}), 501 try: + if not _may_see(store.get_bug(bug_id)): + abort(403) (store.add_vote if adding else store.remove_vote)(bug_id, voter) except NotFound: return jsonify({"error": "not found"}), 404 @@ -528,6 +547,8 @@ def api_screenshot(bug_id: str): if not valid_bug_id(bug_id): abort(400) try: + if not _may_see(store.get_bug(bug_id)): + abort(403) data = store.get_screenshot(bug_id) except NotFound: abort(404) diff --git a/packages/backend-python/bug_report/models.py b/packages/backend-python/bug_report/models.py index ad7d594..d3ebbed 100644 --- a/packages/backend-python/bug_report/models.py +++ b/packages/backend-python/bug_report/models.py @@ -42,7 +42,7 @@ def screenshot_content_type(data: bytes) -> str: return "image/webp" return "image/png" -_BUG_ID_RE = re.compile(r"^bug-\d{8}-\d{6}-[a-f0-9]{6}$") +_BUG_ID_RE = re.compile(r"^bug-\d{8}-\d{6}-(?:[a-f0-9]{6}|[a-f0-9]{12})$") def new_bug_id() -> str: @@ -52,6 +52,7 @@ def new_bug_id() -> str: def valid_bug_id(bug_id: str) -> bool: + """New ids end in 6 hex; 12 hex is accepted too (3.2.0), for reports imported from LeapHQ.""" return bool(_BUG_ID_RE.match(bug_id or "")) diff --git a/packages/backend-python/pyproject.toml b/packages/backend-python/pyproject.toml index 7862339..9c432d6 100644 --- a/packages/backend-python/pyproject.toml +++ b/packages/backend-python/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "bug-report-py" -version = "3.1.0" +version = "3.2.0" description = "Flask blueprint + storage interface implementing the bug-report-widget API spec." readme = "README.md" license = { text = "MIT" } diff --git a/packages/backend-python/tests/test_blueprint.py b/packages/backend-python/tests/test_blueprint.py index c5a0345..3c0ca30 100644 --- a/packages/backend-python/tests/test_blueprint.py +++ b/packages/backend-python/tests/test_blueprint.py @@ -239,13 +239,14 @@ def test_screenshot_404_when_missing(client): # Auth gate # --------------------------------------------------------------------------- -def test_admin_gate_blocks_list_and_patch(store, admin_deny): - """`is_admin` returning False MUST 403 the admin routes; POST stays open.""" +def test_admin_gate_blocks_patch_and_filters_list(store, admin_deny): + """`is_admin` returning False MUST 403 PATCH; POST stays open; the list is filtered (3.2.0), not refused.""" app = Flask(__name__) app.register_blueprint(create_blueprint(store=store, is_admin=admin_deny)) c = app.test_client() bid = c.post("/bugs", json={"details": "anyone can file"}).get_json()["id"] - assert c.get("/bugs").status_code == 403 + assert c.get("/bugs").get_json() == {"bugs": []} # a bug filed by nobody is no one's to see + assert c.get(f"/bugs/{bid}").status_code == 403 assert c.patch(f"/bugs/{bid}", json={"status": "triaged"}).status_code == 403 diff --git a/packages/backend-python/tests/test_proxy.py b/packages/backend-python/tests/test_proxy.py index d891323..f1baddd 100644 --- a/packages/backend-python/tests/test_proxy.py +++ b/packages/backend-python/tests/test_proxy.py @@ -132,13 +132,21 @@ def test_every_route_goes_through_with_status_body_and_content_type_unchanged(fr assert big.status_code == 413 -def test_a_non_admin_person_gets_the_central_403_through_the_proxy(front): - bid = file(front) +def test_a_non_admin_person_sees_features_and_their_own_through_the_proxy(front): + """3.2.0: the list and the detail are filtered by the checked person; triage is still 403.""" + mine = file(front) # filed by the admin + feat = file(front, tags=["feature"]) front.person[0] = {"email": "someone@example.com", "name": ""} - r = front.c.get("/api/bugs") - assert r.status_code == 403 - assert front.c.patch(f"/api/bugs/{bid}", json={"area": "x"}).status_code == 403 - assert front.c.post(f"/api/bugs/{bid}/vote").status_code == 200 # voting is for anyone signed in + own = file(front) + ids = lambda r: {b["id"] for b in r.get_json()["bugs"]} # noqa: E731 + r = front.c.get("/api/bugs?days=1") + assert r.status_code == 200 and ids(r) == {feat, own} # not the admin's bug + assert front.c.get(f"/api/bugs/{mine}").status_code == 403 + assert front.c.get(f"/api/bugs/{own}").status_code == 200 + assert front.c.post(f"/api/bugs/{feat}/vote").get_json()["voted"] is True + assert front.c.patch(f"/api/bugs/{own}", json={"area": "x"}).status_code == 403 + front.person[0] = {"email": "admin@example.com", "name": ""} + assert ids(front.c.get("/api/bugs?days=1")) == {mine, feat, own} # admin unchanged def test_an_untrusted_app_is_a_502_on_every_route_not_a_403(front): diff --git a/packages/backend-python/tests/test_proxy_forward.py b/packages/backend-python/tests/test_proxy_forward.py index df3d86f..eeba286 100644 --- a/packages/backend-python/tests/test_proxy_forward.py +++ b/packages/backend-python/tests/test_proxy_forward.py @@ -108,7 +108,7 @@ def test_a_persons_403_and_401_pass_through(central): c = Caller(central[0].url) bid = c.file() c.person = {"email": "someone@example.com", "name": ""} - assert c("GET")[0] == 403 + assert c("GET", bid)[0] == 403 # someone else's bug (3.2.0: the list is filtered, not refused) c.person = {"email": "", "name": ""} assert c("POST", f"{bid}/vote")[0] == 401 diff --git a/packages/backend-python/tests/test_spec_drift.py b/packages/backend-python/tests/test_spec_drift.py index a293f90..f237080 100644 --- a/packages/backend-python/tests/test_spec_drift.py +++ b/packages/backend-python/tests/test_spec_drift.py @@ -128,3 +128,12 @@ def test_types_py_and_types_ts_name_every_v3_summary_field(): for f in fields: assert re.search(rf"^\s+{f}\??:", ts, re.M), f"types.ts BugSummary lacks {f}" assert re.search(rf"^\s+{f}:", py, re.M), f"types.py BugSummary lacks {f}" + + +def test_the_id_pattern_is_the_same_in_the_spec_the_python_model_and_the_node_model(): + """3.2.0: ids end in 6 or 12 hex. The three places that match an id must carry one pattern.""" + import re + from bug_report import models + spec = re.search(r"pattern: '(\^bug-[^']+)'", SPEC.read_text()).group(1) + node = re.search(r"BUG_ID_RE = /(.+)/;", (SPEC.parents[1] / "backend-node/src/models.js").read_text()).group(1) + assert models._BUG_ID_RE.pattern == spec == node diff --git a/packages/backend-python/tests/test_visibility.py b/packages/backend-python/tests/test_visibility.py new file mode 100644 index 0000000..589b400 --- /dev/null +++ b/packages/backend-python/tests/test_visibility.py @@ -0,0 +1,119 @@ +"""3.2.0: 12-hex ids (reports imported from LeapHQ) and what a non-admin may see: +every feature request plus their own reports; triage stays admin-only. Every store.""" +from __future__ import annotations + +import time + +import pytest +from flask import Flask + +from bug_report import create_blueprint, valid_bug_id +from bug_report.store import BugRecord + +from test_blueprint import TINY_PNG + +ADMIN, ANN, BOB = "admin@example.com", "ann@example.com", "bob@example.com" + + +def stamp(): + return time.strftime("%Y%m%d-%H%M%S", time.gmtime()) + + +def rec(bid, kind, email, **kw): + return BugRecord(id=bid, title=f"{kind} by {email}", details="d", tags=[kind], status="open", + added_by="web", actor_email=email, added_at=time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), + kind=kind, **kw) + + +@pytest.fixture +def world(any_store): + who = [ADMIN] + app = Flask(__name__) + app.register_blueprint(create_blueprint( + store=any_store, is_admin=lambda r: who[0] == ADMIN, + actor_identity=lambda r: {"email": who[0], "name": ""}), url_prefix="/api") + c = app.test_client() + c.who = who + ids = { + "feat_bob": f"bug-{stamp()}-aaaaaa", + "bug_ann": f"bug-{stamp()}-bbbbbbbbbbbb", # 12 hex: an imported id + "bug_bob": f"bug-{stamp()}-cccccccccccc", + } + any_store.put_bug(rec(ids["feat_bob"], "feature", BOB), TINY_PNG) + any_store.put_bug(rec(ids["bug_ann"], "bug", ANN), TINY_PNG) + any_store.put_bug(rec(ids["bug_bob"], "bug", BOB), TINY_PNG) + c.ids = ids + return c + + +def listed(c): + r = c.get("/api/bugs?days=1") + assert r.status_code == 200 + return {b["id"] for b in r.get_json()["bugs"]} + + +@pytest.mark.parametrize("suffix,ok", [("a1b2c3", True), ("a1b2c3d4e5f6", True), ("a1b2c3d", False), + ("a1b2c3d4e5f", False), ("a1b2c3d4e5f60", False), ("A1B2C3", False)]) +def test_id_is_six_or_twelve_hex_and_nothing_else(suffix, ok): + assert valid_bug_id(f"bug-20261115-101010-{suffix}") is ok + + +def test_a_12_hex_id_works_on_detail_patch_screenshot_and_listing(world): + c, bid = world, world.ids["bug_ann"] + assert bid in listed(c) + assert c.get(f"/api/bugs/{bid}").status_code == 200 + assert c.get(f"/api/bugs/{bid}/screenshot").data == TINY_PNG + assert c.patch(f"/api/bugs/{bid}", json={"status": "triaged"}).get_json()["status"] == "triaged" + + +@pytest.mark.parametrize("suffix", ["a1b2c3d", "a1b2c3d4e5f", "a1b2c3d4e5f60"]) +def test_7_11_13_hex_ids_are_refused(world, suffix): + bid = f"bug-20261115-101010-{suffix}" + assert world.get(f"/api/bugs/{bid}").status_code == 400 + assert world.get(f"/api/bugs/{bid}/screenshot").status_code == 400 + assert world.patch(f"/api/bugs/{bid}", json={"status": "triaged"}).status_code == 400 + + +def test_admin_sees_everything(world): + assert listed(world) == set(world.ids.values()) + for bid in world.ids.values(): + assert world.get(f"/api/bugs/{bid}").status_code == 200 + + +def test_a_non_admin_sees_features_and_their_own_and_no_one_elses(world): + c = world + c.who[0] = ANN + assert listed(c) == {c.ids["feat_bob"], c.ids["bug_ann"]} + assert c.get(f"/api/bugs/{c.ids['feat_bob']}").status_code == 200 # a feature + assert c.get(f"/api/bugs/{c.ids['bug_ann']}").status_code == 200 # her own + assert c.get(f"/api/bugs/{c.ids['bug_ann']}/screenshot").status_code == 200 + other = c.ids["bug_bob"] + assert c.get(f"/api/bugs/{other}").status_code == 403 + assert c.get(f"/api/bugs/{other}/screenshot").status_code == 403 + assert c.post(f"/api/bugs/{other}/vote").status_code == 403 + + +def test_the_open_count_of_a_non_admin_counts_only_what_they_see(world): + world.who[0] = ANN + r = world.get("/api/bugs?status=open&days=1") + assert len(r.get_json()["bugs"]) == 2 # not 3 + + +def test_triage_stays_admin_only_even_on_ones_own_report(world): + c = world + c.who[0] = ANN + assert c.patch(f"/api/bugs/{c.ids['bug_ann']}", json={"status": "triaged"}).status_code == 403 + + +def test_voting_on_a_visible_feature_works(world): + c = world + c.who[0] = ANN + fid = c.ids["feat_bob"] + assert c.post(f"/api/bugs/{fid}/vote").get_json() == {"votes": 1, "voted": True} + assert c.get("/api/bugs?days=1").get_json()["bugs"][0]["votes"] in (0, 1) + assert c.delete(f"/api/bugs/{fid}/vote").get_json()["voted"] is False + + +def test_nobody_signed_in_sees_only_features(world): + world.who[0] = "" + assert listed(world) == {world.ids["feat_bob"]} diff --git a/packages/spec/openapi.yaml b/packages/spec/openapi.yaml index 50b86b1..0bf9706 100644 --- a/packages/spec/openapi.yaml +++ b/packages/spec/openapi.yaml @@ -45,7 +45,7 @@ paths: properties: id: type: string - example: bug-20260516-181523-a3b91f2 + example: bug-20260516-181523-a3b91f app: type: string nullable: true @@ -69,7 +69,7 @@ paths: $ref: "#/components/schemas/Error" get: - summary: List bug reports (admin) + summary: List bug reports (an admin sees all; anyone else sees feature requests and their own) operationId: listBugs parameters: - in: query @@ -297,8 +297,8 @@ components: required: true schema: type: string - pattern: '^bug-\d{8}-\d{6}-[a-f0-9]{6}$' - example: bug-20260516-181523-a3b91f2 + pattern: '^bug-\d{8}-\d{6}-(?:[a-f0-9]{6}|[a-f0-9]{12})$' + example: bug-20260516-181523-a3b91f schemas: Status: From 9f0c697b4d7dbc04dd263738eeaa941d00908696 Mon Sep 17 00:00:00 2001 From: kmoy007 Date: Sat, 14 Nov 2026 22:03:14 -0800 Subject: [PATCH 2/2] bug-report-py 3.2.0 review: a hidden report is a 404, visibility never uses default_actor_email, Node documented as not ported Co-Authored-By: Claude Sonnet 5.5 --- CHANGELOG.md | 2 +- docs/CENTRAL-STORE.md | 2 +- e2e/conftest.py | 17 +++++-- e2e/test_contract.py | 2 +- e2e/test_v3.py | 21 ++++++++ packages/backend-node/README.md | 2 + packages/backend-node/tests/router.test.js | 4 +- packages/backend-python/README.md | 4 +- .../backend-python/bug_report/blueprint.py | 24 ++++++---- .../backend-python/tests/test_blueprint.py | 2 +- packages/backend-python/tests/test_proxy.py | 2 +- .../tests/test_proxy_forward.py | 4 +- .../backend-python/tests/test_visibility.py | 48 ++++++++++++++++--- packages/spec/openapi.yaml | 6 ++- 14 files changed, 106 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fff795..82ca369 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ All notable changes to this monorepo. What LeapHQ's move needs from the library (Ken's decisions 1 and 3). The report contract is unchanged. - **Ids may end in 12 hex.** `valid_bug_id`, the Node backend's check and the spec's pattern accept `bug-YYYYMMDD-HHMMSS-` plus 6 or 12 lowercase hex, and nothing else; new ids stay 6 hex. A drift test keeps the spec and both backends on one pattern. (The spec's example id was 7 hex, which the code always refused; it is 6 now.) -- **A non-admin lists features and their own reports.** `GET /bugs` is no longer a 403 for a caller who is not an admin: it returns reports with `kind=feature` and reports whose `actor_email` is the caller. Detail, screenshot and vote on anyone else's report are 403; PATCH stays admin-only. The open count a non-admin gets counts only what they see. Admins are unchanged. The person comes from `actor_identity`, as before. Python only: the Node backend still gates by `isAdmin` alone. +- **A non-admin lists features and their own reports.** `GET /bugs` is no longer a 403 for a caller who is not an admin: it returns reports with `kind=feature` and reports whose `actor_email` is the caller. Detail, screenshot and vote on anyone else's report are 404, the same answer as a missing id, and `default_actor_email` never makes a caller anyone; PATCH stays admin-only. The open count a non-admin gets counts only what they see. Admins are unchanged. The person comes from `actor_identity`, as before. Python only: the Node backend's list stays admin-only (documented, not ported). ## backends v3.1.0 - 2026-11-15 (`bug-report-py` 3.1.0) diff --git a/docs/CENTRAL-STORE.md b/docs/CENTRAL-STORE.md index 8f282ee..c08d7ad 100644 --- a/docs/CENTRAL-STORE.md +++ b/docs/CENTRAL-STORE.md @@ -43,7 +43,7 @@ LeapHQ Review ──(LeapHQ's own identity, a token)──► leaphq-reports (on - The service verifies the token with **PyJWT** (signature, issuer, audience and expiry: a decode-only check would make every trusted client id spoofable), then believes those headers only from identities on its `TRUSTED_APPS` list (client id → app name). The app name comes from the token, not the request. - **LeapHQ calls as its own identity** like every other app (it is `leaphq` in `TRUSTED_APPS`), not through a gateway route. - This replaces the near-identical `trusted_identity()` / `trusted_person()` / `is_admin()` copies in SV, PIV, seal and the fleet dashboard. `trusted_person()` moves into the library once, for each app's proxy to use behind its own gateway. -- **Who sees what (3.2.0).** Triage is `BUG_ADMINS` only. A person who is not an admin lists only reports with `kind=feature` and their own (`actor_email` equals the person from `X-Leap-Actor-Email`, any kind); detail, screenshot and vote on another person's report are 403. The open count they see counts only those. The person still comes from the trusted app's headers, so the trust model is unchanged. +- **Who sees what (3.2.0).** Triage is `BUG_ADMINS` only. A person who is not an admin lists only reports with `kind=feature` and their own (`actor_email` equals the person from `X-Leap-Actor-Email`, any kind); detail, screenshot and vote on another person's report are 404, as for a missing id. The open count they see counts only those. The person still comes from the trusted app's headers, so the trust model is unchanged. - **Ids (3.2.0).** `bug-YYYYMMDD-HHMMSS-` plus 6 hex (new ids) or 12 hex (imported from LeapHQ); the store, the routes, the spec and the Node backend all accept exactly those two. - **Seal laptops.** Their outbox forwards to the seal viewer's proxy exactly as it does today, so nothing changes on a station. diff --git a/e2e/conftest.py b/e2e/conftest.py index c3416e8..6ce171a 100644 --- a/e2e/conftest.py +++ b/e2e/conftest.py @@ -75,7 +75,7 @@ def _wait_alive(url: str, timeout: float = 10) -> None: app = Flask(__name__) app.register_blueprint(create_blueprint( store=store, - is_admin=lambda req: True, + is_admin={admin}, {hooks} )) app.run(host="127.0.0.1", port={port}, use_reloader=False) @@ -91,9 +91,9 @@ def _wait_alive(url: str, timeout: float = 10) -> None: app_stamp=lambda r: r.headers.get("X-Test-App") or None,""" -def _boot_python(tmp_path_factory, label, store_init, hooks=""): +def _boot_python(tmp_path_factory, label, store_init, hooks="", admin="lambda req: True"): port = _free_port() - script = PY_SERVER_SCRIPT.format(pkg=str(PY_PKG), store_init=store_init, hooks=hooks, port=port) + script = PY_SERVER_SCRIPT.format(pkg=str(PY_PKG), store_init=store_init, hooks=hooks, admin=admin, port=port) log = tmp_path_factory.mktemp(f"{label}-log") / "out.log" return port, script, log @@ -103,9 +103,9 @@ def python_server(tmp_path_factory): yield from _serve_python(tmp_path_factory, "py", FS_INIT.format(state=tmp_path_factory.mktemp("py-state"))) -def _serve_python(tmp_path_factory, label, store_init, hooks=""): +def _serve_python(tmp_path_factory, label, store_init, hooks="", admin="lambda req: True"): """Boot a Python backend subprocess; yield its /bugs URL; stop it.""" - port, script, log = _boot_python(tmp_path_factory, label, store_init, hooks) + port, script, log = _boot_python(tmp_path_factory, label, store_init, hooks, admin) with open(log, "w") as logf: proc = subprocess.Popen([sys.executable, "-c", script], stdout=logf, stderr=subprocess.STDOUT) base = f"http://127.0.0.1:{port}/bugs" @@ -142,6 +142,13 @@ def python_v3_server(tmp_path_factory): V3_HOOKS) +@pytest.fixture(scope="session") +def python_nonadmin_server(tmp_path_factory): + """Python only: the caller is `X-Test-User`, and is an admin only with `X-Test-Admin: yes` (3.2.0).""" + yield from _serve_python(tmp_path_factory, "pyna", FS_INIT.format(state=tmp_path_factory.mktemp("py-na-state")), + V3_HOOKS, admin='lambda r: r.headers.get("X-Test-Admin") == "yes"') + + @pytest.fixture(scope="session") def python_pg_v3_server(tmp_path_factory, pg_dsn, pg_schema_name): yield from _serve_python(tmp_path_factory, "pypgv3", diff --git a/e2e/test_contract.py b/e2e/test_contract.py index b983787..a2e481e 100644 --- a/e2e/test_contract.py +++ b/e2e/test_contract.py @@ -21,7 +21,7 @@ TINY_PNG_B64 = base64.b64encode(TINY_PNG).decode() TINY_JPEG = bytes.fromhex("FFD8FFE000104A46494600010100000100010000FFD9") TINY_JPEG_B64 = base64.b64encode(TINY_JPEG).decode() -ID_RE = re.compile(r"^bug-\d{8}-\d{6}-(?:[a-f0-9]{6}|[a-f0-9]{12})$") +from bug_report.models import _BUG_ID_RE as ID_RE # the library's own pattern, not a copy # ----- POST ---------------------------------------------------------- diff --git a/e2e/test_v3.py b/e2e/test_v3.py index b4cd54b..b313a40 100644 --- a/e2e/test_v3.py +++ b/e2e/test_v3.py @@ -128,3 +128,24 @@ def test_votes_one_per_person(v3_url): assert vote("a@example.com", "delete").json() == {"votes": 1, "voted": False} assert vote("").status_code == 401 assert requests.post(f"{v3_url}/bug-20200101-000000-aaaaaa/vote", headers=ME).status_code == 404 + + +def test_a_non_admin_sees_features_and_their_own_and_nothing_else_of_others(python_nonadmin_server): + """PYTHON ONLY: the Node backend still gates its list by `isAdmin` alone (documented, not ported), so + this case has no Node twin and uses its own server rather than the three-backend `v3_url`.""" + url, m = python_nonadmin_server, mark() + ann, bob = {"X-Test-User": "ann@example.com"}, {"X-Test-User": "bob@example.com"} + + def mk(who, **kw): + r = requests.post(url, json={"details": f"{m} x", **kw}, headers=who) + assert r.status_code == 201, r.text + return r.json()["id"] + + own, other, feat = mk(ann), mk(bob), mk(bob, kind="feature", tags=["feature"]) + rows = requests.get(f"{url}?days=1", headers=ann).json()["bugs"] + assert {r["id"] for r in rows if m in r["title"]} == {own, feat} + assert requests.get(f"{url}/{other}", headers=ann).status_code == 404 + assert requests.get(f"{url}/{other}/screenshot", headers=ann).status_code == 404 + assert requests.get(f"{url}/{own}", headers=ann).status_code == 200 + admin = {**ann, "X-Test-Admin": "yes"} + assert {r["id"] for r in requests.get(f"{url}?days=1", headers=admin).json()["bugs"] if m in r["title"]} == {own, other, feat} diff --git a/packages/backend-node/README.md b/packages/backend-node/README.md index 7d9734c..75d5cc6 100644 --- a/packages/backend-node/README.md +++ b/packages/backend-node/README.md @@ -53,6 +53,8 @@ In practice the leap-timesheet migration plan is to lift `createBugsRouter` and | PATCH | /:id | `isAdmin` | | GET | /:id/screenshot | open | +**Not ported (backends 3.2.0).** The Python backend lets a non-admin list feature requests and their own reports, and answers 404 for a report they may not see. The Node backend does not: its list stays admin-only through `isAdmin`, and detail and screenshot stay open. Only the 6-or-12-hex id rule is shared. + ## Stores | Class | Purpose | diff --git a/packages/backend-node/tests/router.test.js b/packages/backend-node/tests/router.test.js index b17125d..96bb1be 100644 --- a/packages/backend-node/tests/router.test.js +++ b/packages/backend-node/tests/router.test.js @@ -9,7 +9,7 @@ import { tmpdir } from "node:os"; import path from "node:path"; import express from "express"; -import { createBugsRouter, InMemoryStore, FilesystemStore } from "../src/index.js"; +import { createBugsRouter, InMemoryStore, FilesystemStore, validBugId } from "../src/index.js"; // 1x1 transparent PNG. const TINY_PNG = Buffer.from( @@ -76,7 +76,7 @@ for (const [name, makeStore] of STORES) { }); assert.equal(r.status, 201); const { id } = await r.json(); - assert.match(id, /^bug-\d{8}-\d{6}-(?:[a-f0-9]{6}|[a-f0-9]{12})$/); + assert.ok(validBugId(id), id); }); }); diff --git a/packages/backend-python/README.md b/packages/backend-python/README.md index a65096c..4c24f3b 100644 --- a/packages/backend-python/README.md +++ b/packages/backend-python/README.md @@ -42,9 +42,9 @@ Routes mounted (under the prefix you pass): **What a non-admin sees (3.2.0).** A caller for whom `is_admin` is false gets, from the list, only reports with `kind=feature` (so people can see and vote on them) and their own reports (`actor_email` equals the caller, any kind). Detail, screenshot and vote -on anyone else's report are 403; triage (PATCH) stays admin-only. A list with `status=open` therefore counts only what the caller can +on anyone else's report are 404, the same answer as a missing id (nothing leaks); triage (PATCH) stays admin-only. A list with `status=open` therefore counts only what the caller can see. The caller is the checked `actor_identity` when the app gave one (with `TrustedCallers`, the `X-Leap-Actor-*` headers), else the -request's own `actorEmail`, so without `actor_identity` this is advice, not a boundary. Admins see everything. +request's own `actorEmail` (never `default_actor_email`), so without `actor_identity` this is advice, not a boundary. Admins see everything. **Ids.** New ids are `bug-YYYYMMDD-HHMMSS-` plus 6 lowercase hex; 12 hex is accepted too (reports imported from LeapHQ), and nothing else. diff --git a/packages/backend-python/bug_report/blueprint.py b/packages/backend-python/bug_report/blueprint.py index 1647cd8..0bec388 100644 --- a/packages/backend-python/bug_report/blueprint.py +++ b/packages/backend-python/bug_report/blueprint.py @@ -284,8 +284,12 @@ def api_list(): def _caller_email(req) -> str: """The caller's address, for what a non-admin may see: the checked identity when the app - gave one, else (as for filing) the request's own claim. "" is nobody.""" - return _voter(req).lower() + gave one, else the request's own claim. Never `default_actor_email`: that is who an unsigned + filing is credited to, and it must not make everyone that person when they ask what they may see.""" + if actor_identity is not None: + return _identity(req)[0].lower() + body = req.get_json(silent=True) if req.is_json else None + return str((body or {}).get("actorEmail") or req.args.get("actorEmail") or "").strip()[:200].lower() def _visible(bug, me: str) -> bool: """What a non-admin may see (3.2.0): every feature request, and the caller's own reports.""" @@ -295,6 +299,12 @@ def _visible(bug, me: str) -> bool: def _may_see(bug) -> bool: return bool(is_admin(request)) or _visible(bug, _caller_email(request)) + def _seen(bug): + """The report, or NotFound: one a caller may not see answers exactly as a missing one does.""" + if not _may_see(bug): + raise NotFound() + return bug + def _vote_counts(ids): """Votes per report; a store that predates votes counts none.""" counter = getattr(store, "vote_counts", None) @@ -313,11 +323,9 @@ def api_get(bug_id: str): if not valid_bug_id(bug_id): return jsonify({"error": "invalid id"}), 400 try: - bug = store.get_bug(bug_id) + bug = _seen(store.get_bug(bug_id)) except NotFound: return jsonify({"error": "not found"}), 404 - if not _may_see(bug): - abort(403) full = _detail(bug) full["canNotify"] = bool(notifier is not None and bug.actor_email) return jsonify(full) @@ -525,8 +533,7 @@ def _vote(bug_id: str, adding: bool): if not hasattr(store, "add_vote"): return jsonify({"error": "this store does not keep votes"}), 501 try: - if not _may_see(store.get_bug(bug_id)): - abort(403) + _seen(store.get_bug(bug_id)) (store.add_vote if adding else store.remove_vote)(bug_id, voter) except NotFound: return jsonify({"error": "not found"}), 404 @@ -547,8 +554,7 @@ def api_screenshot(bug_id: str): if not valid_bug_id(bug_id): abort(400) try: - if not _may_see(store.get_bug(bug_id)): - abort(403) + _seen(store.get_bug(bug_id)) data = store.get_screenshot(bug_id) except NotFound: abort(404) diff --git a/packages/backend-python/tests/test_blueprint.py b/packages/backend-python/tests/test_blueprint.py index 3c0ca30..c0fd2b2 100644 --- a/packages/backend-python/tests/test_blueprint.py +++ b/packages/backend-python/tests/test_blueprint.py @@ -246,7 +246,7 @@ def test_admin_gate_blocks_patch_and_filters_list(store, admin_deny): c = app.test_client() bid = c.post("/bugs", json={"details": "anyone can file"}).get_json()["id"] assert c.get("/bugs").get_json() == {"bugs": []} # a bug filed by nobody is no one's to see - assert c.get(f"/bugs/{bid}").status_code == 403 + assert c.get(f"/bugs/{bid}").status_code == 404 assert c.patch(f"/bugs/{bid}", json={"status": "triaged"}).status_code == 403 diff --git a/packages/backend-python/tests/test_proxy.py b/packages/backend-python/tests/test_proxy.py index f1baddd..c366845 100644 --- a/packages/backend-python/tests/test_proxy.py +++ b/packages/backend-python/tests/test_proxy.py @@ -141,7 +141,7 @@ def test_a_non_admin_person_sees_features_and_their_own_through_the_proxy(front) ids = lambda r: {b["id"] for b in r.get_json()["bugs"]} # noqa: E731 r = front.c.get("/api/bugs?days=1") assert r.status_code == 200 and ids(r) == {feat, own} # not the admin's bug - assert front.c.get(f"/api/bugs/{mine}").status_code == 403 + assert front.c.get(f"/api/bugs/{mine}").status_code == 404 assert front.c.get(f"/api/bugs/{own}").status_code == 200 assert front.c.post(f"/api/bugs/{feat}/vote").get_json()["voted"] is True assert front.c.patch(f"/api/bugs/{own}", json={"area": "x"}).status_code == 403 diff --git a/packages/backend-python/tests/test_proxy_forward.py b/packages/backend-python/tests/test_proxy_forward.py index eeba286..e0715e0 100644 --- a/packages/backend-python/tests/test_proxy_forward.py +++ b/packages/backend-python/tests/test_proxy_forward.py @@ -104,11 +104,11 @@ def test_a_refusal_of_the_app_is_a_502_with_a_generic_body_and_the_real_one_is_l assert c("POST", body=b'{"details": "x"}')[0] == 502 -def test_a_persons_403_and_401_pass_through(central): +def test_a_persons_404_for_a_hidden_report_and_401_pass_through(central): c = Caller(central[0].url) bid = c.file() c.person = {"email": "someone@example.com", "name": ""} - assert c("GET", bid)[0] == 403 # someone else's bug (3.2.0: the list is filtered, not refused) + assert c("GET", bid)[0] == 404 # someone else's bug (3.2.0: the list is filtered, not refused) c.person = {"email": "", "name": ""} assert c("POST", f"{bid}/vote")[0] == 401 diff --git a/packages/backend-python/tests/test_visibility.py b/packages/backend-python/tests/test_visibility.py index 589b400..85897bb 100644 --- a/packages/backend-python/tests/test_visibility.py +++ b/packages/backend-python/tests/test_visibility.py @@ -19,9 +19,9 @@ def stamp(): return time.strftime("%Y%m%d-%H%M%S", time.gmtime()) -def rec(bid, kind, email, **kw): +def rec(bid, kind, email, added_by="web", **kw): return BugRecord(id=bid, title=f"{kind} by {email}", details="d", tags=[kind], status="open", - added_by="web", actor_email=email, added_at=time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), + added_by=added_by, actor_email=email, added_at=time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), kind=kind, **kw) @@ -38,10 +38,12 @@ def world(any_store): "feat_bob": f"bug-{stamp()}-aaaaaa", "bug_ann": f"bug-{stamp()}-bbbbbbbbbbbb", # 12 hex: an imported id "bug_bob": f"bug-{stamp()}-cccccccccccc", + "agent": f"bug-{stamp()}-dddddd", } any_store.put_bug(rec(ids["feat_bob"], "feature", BOB), TINY_PNG) any_store.put_bug(rec(ids["bug_ann"], "bug", ANN), TINY_PNG) any_store.put_bug(rec(ids["bug_bob"], "bug", BOB), TINY_PNG) + any_store.put_bug(rec(ids["agent"], "bug", "", added_by="agent"), TINY_PNG) # no actor: nobody's own c.ids = ids return c @@ -88,15 +90,17 @@ def test_a_non_admin_sees_features_and_their_own_and_no_one_elses(world): assert c.get(f"/api/bugs/{c.ids['bug_ann']}").status_code == 200 # her own assert c.get(f"/api/bugs/{c.ids['bug_ann']}/screenshot").status_code == 200 other = c.ids["bug_bob"] - assert c.get(f"/api/bugs/{other}").status_code == 403 - assert c.get(f"/api/bugs/{other}/screenshot").status_code == 403 - assert c.post(f"/api/bugs/{other}/vote").status_code == 403 + for call in (lambda i: c.get(f"/api/bugs/{i}"), lambda i: c.get(f"/api/bugs/{i}/screenshot"), + lambda i: c.post(f"/api/bugs/{i}/vote"), lambda i: c.delete(f"/api/bugs/{i}/vote")): + hidden, missing = call(other), call("bug-20200101-000000-ffffff") + assert hidden.status_code == missing.status_code == 404 + assert hidden.data == missing.data and hidden.content_type == missing.content_type # no existence leak def test_the_open_count_of_a_non_admin_counts_only_what_they_see(world): world.who[0] = ANN r = world.get("/api/bugs?status=open&days=1") - assert len(r.get_json()["bugs"]) == 2 # not 3 + assert len(r.get_json()["bugs"]) == 2 # not 4 def test_triage_stays_admin_only_even_on_ones_own_report(world): @@ -110,10 +114,40 @@ def test_voting_on_a_visible_feature_works(world): c.who[0] = ANN fid = c.ids["feat_bob"] assert c.post(f"/api/bugs/{fid}/vote").get_json() == {"votes": 1, "voted": True} - assert c.get("/api/bugs?days=1").get_json()["bugs"][0]["votes"] in (0, 1) + assert {b["id"]: b["votes"] for b in c.get("/api/bugs?days=1").get_json()["bugs"]}[fid] == 1 + c.who[0] = ANN.upper() # the same person, other case: still one vote + assert c.post(f"/api/bugs/{fid}/vote").get_json()["votes"] == 1 + c.who[0] = ANN assert c.delete(f"/api/bugs/{fid}/vote").get_json()["voted"] is False +def test_the_caller_is_matched_ignoring_case_and_spaces(world): + world.who[0] = " ANN@Example.COM " + assert world.ids["bug_ann"] in listed(world) + assert world.get(f"/api/bugs/{world.ids['bug_ann']}").status_code == 200 + + +def test_a_report_filed_under_a_mixed_case_address_is_its_filers(world, any_store): + bid = f"bug-{stamp()}-eeeeee" + any_store.put_bug(rec(bid, "bug", "Ann@Example.COM"), TINY_PNG) + world.who[0] = ANN + assert bid in listed(world) + world.who[0] = BOB + assert bid not in listed(world) + + +def test_the_app_default_actor_is_not_a_caller_nobody_sees_its_reports(any_store): + """default_actor_email credits an unsigned filing; it must not make an anonymous asker that person.""" + app = Flask(__name__) + app.register_blueprint(create_blueprint(store=any_store, is_admin=lambda r: False, + default_actor_email="owner@example.com")) + c = app.test_client() + bid = c.post("/bugs", json={"details": "filed with no one signed in"}).get_json()["id"] + assert any_store.get_bug(bid).actor_email == "owner@example.com" + assert c.get("/bugs").get_json() == {"bugs": []} + assert c.get(f"/bugs/{bid}").status_code == 404 + + def test_nobody_signed_in_sees_only_features(world): world.who[0] = "" assert listed(world) == {world.ids["feat_bob"]} diff --git a/packages/spec/openapi.yaml b/packages/spec/openapi.yaml index 0bf9706..8f4430b 100644 --- a/packages/spec/openapi.yaml +++ b/packages/spec/openapi.yaml @@ -69,7 +69,7 @@ paths: $ref: "#/components/schemas/Error" get: - summary: List bug reports (an admin sees all; anyone else sees feature requests and their own) + summary: List bug reports (admin; the Python backend, 3.2.0, lets anyone else list feature requests and their own - the Node backend is admin-only) operationId: listBugs parameters: - in: query @@ -533,7 +533,9 @@ components: application/json: schema: { $ref: "#/components/schemas/Error" } NotFound: - description: No bug with this ID + description: | + No bug with this ID. The Python backend (3.2.0) answers the same 404, with the same body, for a report the caller may + not see (a non-admin asking for someone else's report) on detail, screenshot and vote, so a hidden report cannot be told from a missing one. content: application/json: schema: { $ref: "#/components/schemas/Error" }