anbaric-cloud-hosting 1.66.1 → 1.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anbaric-cloud-hosting",
3
- "version": "1.66.1",
3
+ "version": "1.68.0",
4
4
  "description": "Anbaric Cloud hosting service: Postgres-backed job persistence and queuing exposed over an HTTP API",
5
5
  "license": "MIT",
6
6
  "author": "chris@anbaric.ai",
@@ -18,18 +18,18 @@
18
18
  "@aws-sdk/client-s3": "^3.1110.0",
19
19
  "@aws-sdk/client-secrets-manager": "^3.700.0",
20
20
  "@aws-sdk/client-servicediscovery": "^3.1110.0",
21
- "anbaric-data-store": "^1.66.1",
22
- "anbaric-plugins": "^1.66.1",
23
- "anbaric-tsapi": "^1.66.1",
24
- "anbaric-web": "^1.66.1",
21
+ "anbaric-data-store": "^1.68.0",
22
+ "anbaric-plugins": "^1.68.0",
23
+ "anbaric-tsapi": "^1.68.0",
24
+ "anbaric-web": "^1.68.0",
25
25
  "esbuild": "^0.28.2",
26
26
  "pg": "^8.16.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^26.2.0",
30
30
  "@types/pg": "^8.15.0",
31
- "anbaric-impl-cloud": "^1.66.1",
32
- "anbaric-state-machine": "^1.66.1",
31
+ "anbaric-impl-cloud": "^1.68.0",
32
+ "anbaric-state-machine": "^1.68.0",
33
33
  "tsx": "^4.20.0",
34
34
  "typescript": "^7.0.2"
35
35
  },
@@ -1,14 +1,22 @@
1
1
  import {SecretStore, SystemActor} from "anbaric-tsapi";
2
+ import {deniesBuild} from "../../auth/TenantRole";
2
3
  import {Request} from "../Request";
3
4
  import {RequestHandler} from "../RequestHandler";
4
5
 
6
+ /* An app's secrets, owned by the app (the ambient app header). An app reads
7
+ its own values; a person - at the console, at the CLI - may set, replace,
8
+ list and delete them but never read one back, so a value that has reached
9
+ the store is only ever seen again by the app it was set for. Managing them
10
+ is a builder's job, where roles are in play. */
5
11
  class SecretsHandler implements RequestHandler {
6
12
 
7
13
  constructor(private storeFor : (appId : string) => SecretStore) {}
8
14
 
9
15
  async handle(request : Request) : Promise<void> {
10
16
  if (request.subresource) return request.notFound();
11
- // Secrets are owned by the calling app (the ambient app header).
17
+ if (deniesBuild(request.user?.tenantRole)) {
18
+ return request.reply(403, { error: "Your role in this tenant cannot manage secrets" });
19
+ }
12
20
  const store = this.storeFor(request.appId ?? "");
13
21
  if (request.id) return this.handleSecret(request, store, request.id);
14
22
  return this.handleCollection(request, store);
@@ -23,6 +31,9 @@ class SecretsHandler implements RequestHandler {
23
31
  return request.reply(204);
24
32
  }
25
33
  case "GET":
34
+ if (request.user) {
35
+ return request.reply(403, { error: "A secret's value cannot be read back; set a new value instead" });
36
+ }
26
37
  return request.reply(200, { value: await store.retrieve(name, SystemActor.actor) });
27
38
  case "DELETE":
28
39
  await store.delete(name, SystemActor.actor);