@squiz/job-runner-lib 2.5.0 → 2.6.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 (32) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/lib/domains/job/S3Repository/S3RepositoryBase.d.ts +6 -0
  3. package/lib/domains/job/constants/RetryConfig.constants.d.ts +4 -0
  4. package/lib/domains/job/constants/RuntimeImage.constants.d.ts +11 -0
  5. package/lib/domains/job/index.d.ts +1 -0
  6. package/lib/domains/job/manifest/JobManifestTypes.d.ts +12 -0
  7. package/lib/domains/manifest/index.d.ts +1 -0
  8. package/lib/domains/manifest/services/ManifestServiceForDev.d.ts +2 -2
  9. package/lib/domains/manifest/utils/validateRuntimeImage.d.ts +5 -0
  10. package/lib/domains/manifest/utils/validateRuntimeImage.spec.d.ts +5 -0
  11. package/lib/index.js +9 -9
  12. package/lib/index.js.map +4 -4
  13. package/package.json +3 -3
  14. package/src/domains/job/S3Repository/S3RepositoryBase.ts +19 -0
  15. package/src/domains/job/constants/RetryConfig.constants.ts +5 -0
  16. package/src/domains/job/constants/RuntimeImage.constants.ts +22 -0
  17. package/src/domains/job/index.ts +1 -0
  18. package/src/domains/job/manifest/JobManifestTypes.ts +14 -0
  19. package/src/domains/job/manifest/mocks/JobManifest.mock.ts +2 -0
  20. package/src/domains/job/manifest/mocks/JobManifestDto.mock.ts +4 -0
  21. package/src/domains/job/manifest/mocks/JobManifestRecord.mock.ts +2 -0
  22. package/src/domains/job/manifest/mocks/JobManifestRequest.mock.ts +2 -0
  23. package/src/domains/job/repository/JobManifestRepository/JobManifestRepository.spec.ts +33 -1
  24. package/src/domains/job/repository/JobManifestRepository/JobManifestRepository.ts +9 -0
  25. package/src/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.spec.ts +53 -0
  26. package/src/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.ts +24 -0
  27. package/src/domains/job/services/JobManifestService/JobManifestService.spec.ts +1 -0
  28. package/src/domains/manifest/index.ts +1 -0
  29. package/src/domains/manifest/services/ManifestServiceForDev.spec.ts +1 -1
  30. package/src/domains/manifest/services/ManifestServiceForDev.ts +3 -3
  31. package/src/domains/manifest/utils/validateRuntimeImage.spec.ts +40 -0
  32. package/src/domains/manifest/utils/validateRuntimeImage.ts +33 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## 2.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 093f15c: Updated @squiz/dx-json-schema-lib package version
8
+
9
+ ## 2.5.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 61edb6e: Fix S3 key validation vulnerabilities
14
+
3
15
  ## 2.5.0
4
16
 
5
17
  ### Minor Changes
@@ -13,6 +13,12 @@ export declare class S3RepositoryBase {
13
13
  protected s3Client: S3Client;
14
14
  protected bucketName: string;
15
15
  constructor(s3Client: S3Client, bucketName: string);
16
+ /**
17
+ * Validates S3 key to prevent malicious input
18
+ * @param {string} key The S3 object key to validate
19
+ * @private
20
+ */
21
+ private validateS3Key;
16
22
  /**
17
23
  * Save object into S3.
18
24
  * @param {string} key The S3 object key.
@@ -13,6 +13,10 @@ export declare const RETRY_DELAYS_SECONDS: ReadonlyArray<number>;
13
13
  * Maximum number of retry attempts for container start failures.
14
14
  */
15
15
  export declare const MAX_RETRY_ATTEMPTS: number;
16
+ /**
17
+ * After a job has attempted to be started this number of times alerts will start to be sent.
18
+ */
19
+ export declare const ALERT_AFTER_ATTEMPTS = 2;
16
20
  /**
17
21
  * Get the delay in seconds for a given retry attempt.
18
22
  * @param retryAttempt - The current retry attempt (0-indexed)
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * @license
3
+ * Copyright Squiz Australia Pty Ltd. All Rights Reserved.
4
+ */
5
+ export declare const SUPPORTED_RUNTIME_IMAGES: readonly ["node:20", "node:24"];
6
+ export declare const LEGACY_RUNTIME_IMAGE = "node:20";
7
+ export declare const RECOMMENDED_RUNTIME_IMAGE = "node:24";
8
+ export declare const DEPRECATED_RUNTIME_IMAGES: readonly string[];
9
+ export declare const getRuntimeImageOrDefault: (image: string | null | undefined) => string;
10
+ export declare const isSupportedRuntimeImage: (image: string) => boolean;
11
+ export declare const isDeprecatedRuntimeImage: (image: string) => boolean;
@@ -4,6 +4,7 @@ export * from './constants/InjectTokens';
4
4
  export * from './constants/JobExecutionStatus.constants';
5
5
  export * from './constants/Repository.constants';
6
6
  export * from './constants/RetryConfig.constants';
7
+ export * from './constants/RuntimeImage.constants';
7
8
  export * from './services';
8
9
  export * from './utils';
9
10
  export * from './model/Base';
@@ -49,6 +49,12 @@ export interface JobManifest {
49
49
  * @memberof JobManifest
50
50
  */
51
51
  concurrency: number;
52
+ /**
53
+ * The runtime image the job should execute against (e.g. `node:20`, `node:24`).
54
+ * @type {string}
55
+ * @memberof JobManifest
56
+ */
57
+ image: string;
52
58
  /**
53
59
  * The DynamoDB record type ('job').
54
60
  * @type {EntityType}
@@ -112,6 +118,12 @@ export interface JobManifestRecord {
112
118
  * @memberof JobManifestRecord
113
119
  */
114
120
  concurrency: number;
121
+ /**
122
+ * The runtime image the job should execute against (e.g. `node:20`, `node:24`).
123
+ * @type {string}
124
+ * @memberof JobManifestRecord
125
+ */
126
+ image: string;
115
127
  }
116
128
  export type JobManifestDto = Record<keyof JobManifestRecord, AttributeValue>;
117
129
  /**
@@ -2,6 +2,7 @@ export * from './services/ManifestServiceForDev';
2
2
  export * from './services/JobFunctionService';
3
3
  export * from './utils/getAndAssertJobManifestVersion';
4
4
  export * from './utils/isValidManifestVersion';
5
+ export * from './utils/validateRuntimeImage';
5
6
  export * from './ManifestModel';
6
7
  export * from '../job/manifest/JobManifestV1';
7
8
  export * from './errors/ManifestValidationError';
@@ -1,6 +1,6 @@
1
- import { JobManifestModel } from '../ManifestModel';
2
- import { JobManifestV1 } from '../../job/manifest/JobManifestV1';
3
1
  import { JsonValidationService } from '@squiz/dx-json-schema-lib';
2
+ import { JobManifestV1 } from '../../job/manifest/JobManifestV1';
3
+ import { JobManifestModel } from '../ManifestModel';
4
4
  export declare class ManifestServiceForDev {
5
5
  protected jobValidationService: JsonValidationService;
6
6
  protected getJobManifest(manifestModel: JobManifestModel, manifestPath: string): JobManifestV1;
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * @license
3
+ * Copyright Squiz Australia Pty Ltd. All Rights Reserved.
4
+ */
5
+ export declare const validateAndDefaultRuntimeImage: (image: string | null | undefined) => string;
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * @license
3
+ * Copyright Squiz Australia Pty Ltd. All Rights Reserved.
4
+ */
5
+ export {};