Skip to content

Commit f3a44cf

Browse files
jonfroehlichclaude
andcommitted
Stop exposing grant funding_amount in the public REST API (#1268)
The /api/v1/ grants payload no longer includes funding_amount. The value is still stored on the Grant model and shown to editors in /admin and in the sponsor funding totals; it is simply not serialized over the public API -- extending the same "already-public data only" principle that already keeps personal email out. Bump to 2.27.1. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y9JS9XZfD86FdDLJiJFSBk
1 parent 578d643 commit f3a44cf

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

docs/API.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ sub-resources are keyed by `short_name`:
8484
### Grants — `GET /api/v1/grants/`
8585

8686
Filters: `?project=<short_name>`, `?sponsor=<sponsor short_name>`. Each grant
87-
includes its `sponsor`, `funding_amount`, `grant_id`, `grant_url`, and the
88-
`projects` it funds.
87+
includes its `sponsor`, `grant_id`, `grant_url`, and the `projects` it funds.
88+
Funding amounts are intentionally **not** exposed by the API.
8989

9090
### People — `GET /api/v1/people/`
9191

makeabilitylab/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@
8686
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
8787

8888
# Makeability Lab Global Variables, including Makeability Lab version
89-
ML_WEBSITE_VERSION = "2.27.0" # Keep this updated with each release and also change the short description below
90-
ML_WEBSITE_VERSION_DESCRIPTION = "Adds a public, read-only REST API (#1268) at /api/v1/ so external sites can treat the Makeability Lab website as the source of truth for already-public content instead of duplicating it. Endpoints cover publications (filterable by project, author, year, and venue type -- e.g. ?author=jonfroehlich&page_size=5 for a 'recent publications' widget), publicly-visible projects, grants, and people, plus project sub-resources for a project's publications, grants, people, and leadership (PIs/Co-PIs/leads) -- the exact data Project Sidewalk needs to render its funding, team, and papers from one place. Built on the already-bundled Django REST Framework: read-only (GET only), no auth and no throttle since the data is already public, paginated with a tunable page_size (max 100), absolute media/page URLs in every payload, and cross-origin requests enabled on /api/ only (via a tiny in-repo CORS middleware) so a browser-side widget can fetch it directly. Personal email is deliberately not exposed. Full reference: docs/API.md."
89+
ML_WEBSITE_VERSION = "2.27.1" # Keep this updated with each release and also change the short description below
90+
ML_WEBSITE_VERSION_DESCRIPTION = "Stops the public REST API (#1268) from exposing grant funding amounts: the /api/v1/ grants payload no longer includes the funding_amount field. The amount is still stored on the model and visible to editors in /admin (and in the sponsor funding totals) -- it is simply not served over the API. Personal email was already excluded; this extends that same 'already-public data only' principle to keep dollar figures out of the public API. Full reference: docs/API.md."
9191
DATE_MAKEABILITYLAB_FORMED = datetime.date(2012, 1, 1) # Date Makeability Lab was formed
9292
MAX_BANNERS = 7 # Maximum number of banners on a page
9393

website/api/serializers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ class Meta:
178178
"title",
179179
"sponsor",
180180
"grant_id",
181-
"funding_amount",
182181
"grant_url",
183182
"start_date",
184183
"end_date",

website/tests/test_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ def test_project_grants_subresource(self):
172172
self.assertEqual(body["count"], 1)
173173
grant = body["results"][0]
174174
self.assertEqual(grant["sponsor"]["short_name"], "NSF")
175-
self.assertEqual(grant["funding_amount"], 500000)
175+
# Funding amounts are intentionally not exposed by the public API.
176+
self.assertNotIn("funding_amount", grant)
176177

177178
def test_project_people_subresource(self):
178179
resp = self.client.get("/api/v1/projects/projectsidewalk/people/")

0 commit comments

Comments
 (0)