Skip to content

Commit 79ff588

Browse files
committed
WIP
1 parent 20a7d76 commit 79ff588

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

DESIGN.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,19 @@ The Stack is updated to be more familiar to modern JavaScript developers, includ
2121
* GraphQL SDL
2222
* graphql-codegen to generate TypeScript interfaces
2323

24-
## Catalog
24+
## Catalog Server
2525

26-
The catalog is a standalone backend service with a GraphQL API that is accessed by the site's frontend server.
26+
The catalog server is a standalone backend service with a GraphQL API that is accessed by the site's frontend server.
27+
28+
## Access Control
29+
30+
The server is intended to eventually have a public-facing GraphQL service. It also has admin functionality such as HTTP endpoints for updating the packages in the catalog that need to be reachable by scheduling services (such as [Google Cloud Scheduler](https://cloud.google.com/scheduler) or [Google Cloud Tasks](https://cloud.google.com/tasks)). These admin endpoints are attractive for denial-of-service attacks because they initiate expensive bulk I/O and database operations.
31+
32+
The admin endpoints must have restricted access control and not be public. For now, the easiest way to do this without a third service (a separate admin service) is to restrict access to the whole catalog server service which also implements the admin endpoints. Later, the catalog server can be refactored to contain only a public API and the admin endpoints moved to a separate service.
33+
34+
Access control to the catalog service can be implemented in Google Cloud Run by setting up a service account to make requests and limiting the service to non-public visibility, [as documented here](https://cloud.google.com/run/docs/authenticating/service-to-service).
35+
36+
As the article says, this should be environment agnostic, so it works outside of Google Cloud - though each environment will have it's own way of setting the access control of the catalog service.
2737

2838
### Custom Elements Manifest
2939

packages/catalog-server/src/lib/server/routes/update-packages.ts

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ const maxImportDuration = Temporal.Duration.from({minutes: 5});
99

1010
export const makeUpdatePackagesRoute =
1111
(catalog: Catalog) => async (context: Koa.Context) => {
12+
// TODO (justinfagnani): DO_NOT_LAUNCH check that the request is from one
13+
// of our service accounts
14+
1215
const startInstant = Temporal.Now.instant();
1316
// If the `force` query parameter is present we force updating of all
1417
// packages by setting the `notUpdatedSince` parameter to `startInstant` so

0 commit comments

Comments
 (0)