@backstage/backend-defaults 0.3.0-next.3 → 0.3.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.
Files changed (72) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/auth/package.json +6 -0
  3. package/cache/package.json +1 -1
  4. package/config.d.ts +277 -0
  5. package/database/package.json +1 -1
  6. package/discovery/package.json +1 -1
  7. package/dist/auth.cjs.js +1025 -0
  8. package/dist/auth.cjs.js.map +1 -0
  9. package/dist/auth.d.ts +14 -0
  10. package/dist/cache.cjs.js.map +1 -1
  11. package/dist/cache.d.ts +31 -37
  12. package/dist/cjs/config-BDOwXIyo.cjs.js +64 -0
  13. package/dist/cjs/config-BDOwXIyo.cjs.js.map +1 -0
  14. package/dist/cjs/createConfigSecretEnumerator-DShyoWWL.cjs.js +33 -0
  15. package/dist/cjs/createConfigSecretEnumerator-DShyoWWL.cjs.js.map +1 -0
  16. package/dist/cjs/helpers-D2f1CG0o.cjs.js +53 -0
  17. package/dist/cjs/helpers-D2f1CG0o.cjs.js.map +1 -0
  18. package/dist/database.cjs.js +25 -26
  19. package/dist/database.cjs.js.map +1 -1
  20. package/dist/database.d.ts +7 -2
  21. package/dist/discovery.cjs.js +6 -6
  22. package/dist/discovery.cjs.js.map +1 -1
  23. package/dist/discovery.d.ts +9 -1
  24. package/dist/httpAuth.cjs.js +192 -0
  25. package/dist/httpAuth.cjs.js.map +1 -0
  26. package/dist/httpAuth.d.ts +15 -0
  27. package/dist/httpRouter.cjs.js +191 -0
  28. package/dist/httpRouter.cjs.js.map +1 -0
  29. package/dist/httpRouter.d.ts +55 -0
  30. package/dist/index.cjs.js +14 -8
  31. package/dist/index.cjs.js.map +1 -1
  32. package/dist/lifecycle.cjs.js.map +1 -1
  33. package/dist/lifecycle.d.ts +5 -1
  34. package/dist/logger.cjs.js +17 -0
  35. package/dist/logger.cjs.js.map +1 -0
  36. package/dist/logger.d.ts +14 -0
  37. package/dist/permissions.cjs.js.map +1 -1
  38. package/dist/permissions.d.ts +6 -0
  39. package/dist/rootConfig.cjs.js +3 -0
  40. package/dist/rootConfig.cjs.js.map +1 -1
  41. package/dist/rootConfig.d.ts +17 -2
  42. package/dist/rootHttpRouter.cjs.js +629 -0
  43. package/dist/rootHttpRouter.cjs.js.map +1 -0
  44. package/dist/rootHttpRouter.d.ts +283 -0
  45. package/dist/rootLifecycle.cjs.js.map +1 -1
  46. package/dist/rootLifecycle.d.ts +5 -1
  47. package/dist/rootLogger.cjs.js +143 -0
  48. package/dist/rootLogger.cjs.js.map +1 -0
  49. package/dist/rootLogger.d.ts +58 -0
  50. package/dist/scheduler.cjs.js +2 -3
  51. package/dist/scheduler.cjs.js.map +1 -1
  52. package/dist/scheduler.d.ts +5 -1
  53. package/dist/urlReader.cjs.js +68 -126
  54. package/dist/urlReader.cjs.js.map +1 -1
  55. package/dist/urlReader.d.ts +49 -43
  56. package/dist/userInfo.cjs.js +70 -0
  57. package/dist/userInfo.cjs.js.map +1 -0
  58. package/dist/userInfo.d.ts +14 -0
  59. package/httpAuth/package.json +6 -0
  60. package/httpRouter/package.json +6 -0
  61. package/lifecycle/package.json +1 -1
  62. package/logger/package.json +6 -0
  63. package/migrations/auth/20240327104803_public_keys.js +50 -0
  64. package/package.json +82 -12
  65. package/permissions/package.json +1 -1
  66. package/rootConfig/package.json +1 -1
  67. package/rootHttpRouter/package.json +6 -0
  68. package/rootLifecycle/package.json +1 -1
  69. package/rootLogger/package.json +6 -0
  70. package/scheduler/package.json +1 -1
  71. package/urlReader/package.json +1 -1
  72. package/userInfo/package.json +6 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # @backstage/backend-defaults
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 662dce8: **BREAKING**: The `workdir` argument have been removed from The `GerritUrlReader` constructor.
8
+
9
+ **BREAKING**: The Gerrit `readTree` implementation will now only use the Gitiles api. Support
10
+ for using git to clone the repo has been removed.
11
+
12
+ - 02103be: Deprecated and moved over core services to `@backstage/backend-defaults`
13
+
14
+ ### Patch Changes
15
+
16
+ - 1897169: Exposed `DefaultSchedulerService`
17
+ - b5bc997: Refactor cache manager inline types.
18
+ - e171620: Remove dependency with `@backstage/backend-commons` package.
19
+ - 6551b3d: Added core service factories and implementations from
20
+ `@backstage/backend-app-api`. They are now available as subpath exports, e.g.
21
+ `@backstage/backend-defaults/scheduler` is where the service factory and default
22
+ implementation of `coreServices.scheduler` now lives. They have been marked as
23
+ deprecated in their old locations.
24
+ - 8aab451: Internal minor refactors of the database connectors
25
+ - 0634fdc: Deprecated `dropDatabase`
26
+ - b2ee7f3: Moved over all URL reader functionality from `@backstage/backend-common` to `@backstage/backend-defaults/urlReader`. Please update your imports.
27
+ - 9539a0b: Added `@backstage/backend-defaults/auth`, `@backstage/backend-defaults/httpAuth`, and `@backstage/backend-defaults/userInfo` to house their respective backend service factories. You should now import these services from those new locations, instead of `@backstage/backend-app-api`.
28
+ - Updated dependencies
29
+ - @backstage/backend-app-api@0.7.6
30
+ - @backstage/backend-common@0.23.0
31
+ - @backstage/backend-plugin-api@0.6.19
32
+ - @backstage/plugin-auth-node@0.4.14
33
+ - @backstage/integration@1.12.0
34
+ - @backstage/plugin-events-node@0.3.5
35
+ - @backstage/plugin-permission-node@0.7.30
36
+ - @backstage/cli-common@0.1.14
37
+ - @backstage/config-loader@1.8.1
38
+ - @backstage/backend-dev-utils@0.1.4
39
+ - @backstage/config@1.2.0
40
+ - @backstage/errors@1.2.4
41
+ - @backstage/integration-aws-node@0.1.12
42
+ - @backstage/types@1.1.1
43
+
3
44
  ## 0.3.0-next.3
4
45
 
5
46
  ### Patch Changes
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@backstage/backend-defaults",
3
+ "version": "0.3.0",
4
+ "main": "../dist/auth.cjs.js",
5
+ "types": "../dist/auth.d.ts"
6
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-defaults",
3
- "version": "0.3.0-next.3",
3
+ "version": "0.3.0",
4
4
  "main": "../dist/cache.cjs.js",
5
5
  "types": "../dist/cache.d.ts"
6
6
  }
package/config.d.ts CHANGED
@@ -15,6 +15,283 @@
15
15
  */
16
16
 
17
17
  export interface Config {
18
+ backend?: {
19
+ /**
20
+ * Options used by the default auth, httpAuth and userInfo services.
21
+ */
22
+ auth?: {
23
+ /**
24
+ * This disables the otherwise default auth policy, which requires all
25
+ * requests to be authenticated with either user or service credentials.
26
+ *
27
+ * Disabling this check means that the backend will no longer block
28
+ * unauthenticated requests, but instead allow them to pass through to
29
+ * plugins.
30
+ *
31
+ * If permissions are enabled, unauthenticated requests will be treated
32
+ * exactly as such, leaving it to the permission policy to determine what
33
+ * permissions should be allowed for an unauthenticated identity. Note
34
+ * that this will also apply to service-to-service calls between plugins
35
+ * unless you configure credentials for service calls.
36
+ */
37
+ dangerouslyDisableDefaultAuthPolicy?: boolean;
38
+
39
+ /** Controls how to store keys for plugin-to-plugin auth */
40
+ pluginKeyStore?:
41
+ | { type: 'database' }
42
+ | {
43
+ type: 'static';
44
+ static: {
45
+ /**
46
+ * Must be declared at least once and the first one will be used for signing.
47
+ */
48
+ keys: Array<{
49
+ /**
50
+ * Path to the public key file in the SPKI format. Should be an absolute path.
51
+ */
52
+ publicKeyFile: string;
53
+ /**
54
+ * Path to the matching private key file in the PKCS#8 format. Should be an absolute path.
55
+ *
56
+ * The first array entry must specify a private key file, the rest must not.
57
+ */
58
+ privateKeyFile?: string;
59
+ /**
60
+ * ID to uniquely identify this key within the JWK set.
61
+ */
62
+ keyId: string;
63
+ /**
64
+ * JWS "alg" (Algorithm) Header Parameter value. Defaults to ES256.
65
+ * Must match the algorithm used to generate the keys in the provided files
66
+ */
67
+ algorithm?: string;
68
+ }>;
69
+ };
70
+ };
71
+
72
+ /**
73
+ * Configures methods of external access, ie ways for callers outside of
74
+ * the Backstage ecosystem to get authorized for access to APIs that do
75
+ * not permit unauthorized access.
76
+ */
77
+ externalAccess: Array<
78
+ | {
79
+ /**
80
+ * This is the legacy service-to-service access method, where a set
81
+ * of static keys were shared among plugins and used for symmetric
82
+ * signing and verification. These correspond to the old
83
+ * `backend.auth.keys` set and retain their behavior for backwards
84
+ * compatibility. Please migrate to other access methods when
85
+ * possible.
86
+ *
87
+ * Callers generate JWT tokens with the following payload:
88
+ *
89
+ * ```json
90
+ * {
91
+ * "sub": "backstage-plugin",
92
+ * "exp": <epoch seconds one hour in the future>
93
+ * }
94
+ * ```
95
+ *
96
+ * And sign them with HS256, using the base64 decoded secret. The
97
+ * tokens are then passed along with requests in the Authorization
98
+ * header:
99
+ *
100
+ * ```
101
+ * Authorization: Bearer eyJhbGciOiJIUzI...
102
+ * ```
103
+ */
104
+ type: 'legacy';
105
+ options: {
106
+ /**
107
+ * Any set of base64 encoded random bytes to be used as both the
108
+ * signing and verification key. Should be sufficiently long so as
109
+ * not to be easy to guess by brute force.
110
+ *
111
+ * Can be generated eg using
112
+ *
113
+ * ```sh
114
+ * node -p 'require("crypto").randomBytes(24).toString("base64")'
115
+ * ```
116
+ *
117
+ * @visibility secret
118
+ */
119
+ secret: string;
120
+
121
+ /**
122
+ * Sets the subject of the principal, when matching this token.
123
+ * Useful for debugging and tracking purposes.
124
+ */
125
+ subject: string;
126
+ };
127
+ /**
128
+ * Restricts what types of access that are permitted for this access
129
+ * method. If no access restrictions are given, it'll have unlimited
130
+ * access. This access restriction applies for the framework level;
131
+ * individual plugins may have their own access control mechanisms
132
+ * on top of this.
133
+ */
134
+ accessRestrictions?: Array<{
135
+ /**
136
+ * Permit access to make requests to this plugin.
137
+ *
138
+ * Can be further refined by setting additional fields below.
139
+ */
140
+ plugin: string;
141
+ /**
142
+ * If given, this method is limited to only performing actions
143
+ * with these named permissions in this plugin.
144
+ *
145
+ * Note that this only applies where permissions checks are
146
+ * enabled in the first place. Endpoints that are not protected by
147
+ * the permissions system at all, are not affected by this
148
+ * setting.
149
+ */
150
+ permission?: string | Array<string>;
151
+ /**
152
+ * If given, this method is limited to only performing actions
153
+ * whose permissions have these attributes.
154
+ *
155
+ * Note that this only applies where permissions checks are
156
+ * enabled in the first place. Endpoints that are not protected by
157
+ * the permissions system at all, are not affected by this
158
+ * setting.
159
+ */
160
+ permissionAttribute?: {
161
+ /**
162
+ * One of more of 'create', 'read', 'update', or 'delete'.
163
+ */
164
+ action?: string | Array<string>;
165
+ };
166
+ }>;
167
+ }
168
+ | {
169
+ /**
170
+ * This access method consists of random static tokens that can be
171
+ * handed out to callers.
172
+ *
173
+ * The tokens are then passed along verbatim with requests in the
174
+ * Authorization header:
175
+ *
176
+ * ```
177
+ * Authorization: Bearer eZv5o+fW3KnR3kVabMW4ZcDNLPl8nmMW
178
+ * ```
179
+ */
180
+ type: 'static';
181
+ options: {
182
+ /**
183
+ * A raw token that can be any string, but for security reasons
184
+ * should be sufficiently long so as not to be easy to guess by
185
+ * brute force.
186
+ *
187
+ * Can be generated eg using
188
+ *
189
+ * ```sh
190
+ * node -p 'require("crypto").randomBytes(24).toString("base64")'
191
+ * ```
192
+ *
193
+ * Since the tokens can be any string, you are free to add
194
+ * additional identifying data to them if you like. For example,
195
+ * adding a `freben-local-dev-` prefix for debugging purposes to a
196
+ * token that you know will be handed out for use as a personal
197
+ * access token during development.
198
+ *
199
+ * @visibility secret
200
+ */
201
+ token: string;
202
+
203
+ /**
204
+ * Sets the subject of the principal, when matching this token.
205
+ * Useful for debugging and tracking purposes.
206
+ */
207
+ subject: string;
208
+ };
209
+ /**
210
+ * Restricts what types of access that are permitted for this access
211
+ * method. If no access restrictions are given, it'll have unlimited
212
+ * access. This access restriction applies for the framework level;
213
+ * individual plugins may have their own access control mechanisms
214
+ * on top of this.
215
+ */
216
+ accessRestrictions?: Array<{
217
+ /**
218
+ * Permit access to make requests to this plugin.
219
+ *
220
+ * Can be further refined by setting additional fields below.
221
+ */
222
+ plugin: string;
223
+ /**
224
+ * If given, this method is limited to only performing actions
225
+ * with these named permissions in this plugin.
226
+ *
227
+ * Note that this only applies where permissions checks are
228
+ * enabled in the first place. Endpoints that are not protected by
229
+ * the permissions system at all, are not affected by this
230
+ * setting.
231
+ */
232
+ permission?: string | Array<string>;
233
+ /**
234
+ * If given, this method is limited to only performing actions
235
+ * whose permissions have these attributes.
236
+ *
237
+ * Note that this only applies where permissions checks are
238
+ * enabled in the first place. Endpoints that are not protected by
239
+ * the permissions system at all, are not affected by this
240
+ * setting.
241
+ */
242
+ permissionAttribute?: {
243
+ /**
244
+ * One of more of 'create', 'read', 'update', or 'delete'.
245
+ */
246
+ action?: string | Array<string>;
247
+ };
248
+ }>;
249
+ }
250
+ | {
251
+ /**
252
+ * This access method consists of a JWKS endpoint that can be used to
253
+ * verify JWT tokens.
254
+ *
255
+ * Callers generate JWT tokens via 3rd party tooling
256
+ * and pass them in the Authorization header:
257
+ *
258
+ * ```
259
+ * Authorization: Bearer eZv5o+fW3KnR3kVabMW4ZcDNLPl8nmMW
260
+ * ```
261
+ */
262
+ type: 'jwks';
263
+ options: {
264
+ /**
265
+ * The full URL of the JWKS endpoint.
266
+ */
267
+ url: string;
268
+ /**
269
+ * Sets the algorithm(s) that should be used to verify the JWT tokens.
270
+ * The passed JWTs must have been signed using one of the listed algorithms.
271
+ */
272
+ algorithm?: string | string[];
273
+ /**
274
+ * Sets the issuer(s) that should be used to verify the JWT tokens.
275
+ * Passed JWTs must have an `iss` claim which matches one of the specified issuers.
276
+ */
277
+ issuer?: string | string[];
278
+ /**
279
+ * Sets the audience(s) that should be used to verify the JWT tokens.
280
+ * The passed JWTs must have an "aud" claim that matches one of the audiences specified,
281
+ * or have no audience specified.
282
+ */
283
+ audience?: string | string[];
284
+ /**
285
+ * Sets an optional subject prefix. Passes the subject to called plugins.
286
+ * Useful for debugging and tracking purposes.
287
+ */
288
+ subjectPrefix?: string;
289
+ };
290
+ }
291
+ >;
292
+ };
293
+ };
294
+
18
295
  /**
19
296
  * Options used by the default discovery service.
20
297
  */
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-defaults",
3
- "version": "0.3.0-next.3",
3
+ "version": "0.3.0",
4
4
  "main": "../dist/database.cjs.js",
5
5
  "types": "../dist/database.d.ts"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-defaults",
3
- "version": "0.3.0-next.3",
3
+ "version": "0.3.0",
4
4
  "main": "../dist/discovery.cjs.js",
5
5
  "types": "../dist/discovery.d.ts"
6
6
  }