@fjall/deploy-core 2.22.0 → 2.22.1

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/dist/.minified CHANGED
@@ -1 +1 @@
1
- 174 files minified at 2026-06-30T11:38:21.686Z
1
+ 174 files minified at 2026-06-30T21:20:24.926Z
@@ -27,9 +27,9 @@ export interface AwsProvider {
27
27
  * Assume the SAME identity but with an inline session policy that scopes it
28
28
  * down to exactly the SSM / Secrets Manager parameters a build needs to read
29
29
  * (least privilege). Returns a provider bound to the scoped session. When a
30
- * provider cannot narrow its own session (the worker's pre-assumed OIDC
31
- * credentials), this is absent and the caller falls back to the unscoped
32
- * provider — see `resolveBuildSecrets`.
30
+ * provider has no way to re-mint a narrowed session no SSO/OIDC role to
31
+ * re-assume (CLI), or no re-mint hook injected (worker) this is absent and
32
+ * the caller falls back to the unscoped provider — see `resolveBuildSecrets`.
33
33
  */
34
34
  assumeScopedBuildSecretSession?(inlinePolicy: string, sessionName: string): Promise<AwsProvider>;
35
35
  }
@@ -1,4 +1,4 @@
1
- import type { AwsCredentials } from "../types/credentials.js";
1
+ import type { AwsCredentials, ScopedBuildSecretSessionMinter } from "../types/credentials.js";
2
2
  import type { AwsProvider, AwsProviderCredentials, AwsSdkClientConstructor } from "./AwsProvider.js";
3
3
  /**
4
4
  * Minimal AWS provider for pre-assumed credentials.
@@ -11,7 +11,14 @@ export declare class SimpleAwsProvider implements AwsProvider {
11
11
  private readonly region;
12
12
  private readonly accountId;
13
13
  private readonly clientCache;
14
- constructor(awsCredentials: AwsCredentials);
14
+ /**
15
+ * Present only when a re-mint hook is injected (the worker). Absent for a bare
16
+ * provider — including the scoped child this very method returns, so a scoped
17
+ * session cannot re-scope itself. deploy-core's `resolveBuildSecrets` reads the
18
+ * field's presence to decide whether to narrow the build-secret read.
19
+ */
20
+ assumeScopedBuildSecretSession?: AwsProvider["assumeScopedBuildSecretSession"];
21
+ constructor(awsCredentials: AwsCredentials, scopedSessionMinter?: ScopedBuildSecretSessionMinter);
15
22
  getClient<T>(ClientClass: AwsSdkClientConstructor<T>): T;
16
23
  getRegion(): string;
17
24
  getAccountId(): string;
@@ -1 +1 @@
1
- import{STSClient as r,AssumeRoleCommand as i}from"@aws-sdk/client-sts";import{NodeHttpHandler as d}from"@smithy/node-http-handler";import{composeSdkAbortSignal as a}from"./organisations/types.js";const o=3e4;class A{credentials;region;accountId;clientCache=new Map;constructor(e){this.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken},this.region=e.region,this.accountId=e.accountId}getClient(e){const n=e.name,t=this.clientCache.get(n);if(t!==void 0)return t;const c={region:this.region,credentials:this.credentials,requestHandler:new d({requestTimeout:o})},s=new e(c);return this.clientCache.set(n,s),s}getRegion(){return this.region}getAccountId(){return this.accountId}getCredentials(){return this.credentials}exportToEnv(){process.env.AWS_ACCESS_KEY_ID=this.credentials.accessKeyId,process.env.AWS_SECRET_ACCESS_KEY=this.credentials.secretAccessKey,process.env.AWS_REGION=this.region,this.credentials.sessionToken?process.env.AWS_SESSION_TOKEN=this.credentials.sessionToken:delete process.env.AWS_SESSION_TOKEN}async assumeRole(e,n){const s=(await this.getClient(r).send(new i({RoleArn:e,RoleSessionName:n}),{abortSignal:a(void 0,o)})).Credentials;if(!s?.AccessKeyId||!s?.SecretAccessKey)throw new Error(`AssumeRole for ${e} returned incomplete credentials`);return{accessKeyId:s.AccessKeyId,secretAccessKey:s.SecretAccessKey,sessionToken:s.SessionToken}}}export{A as SimpleAwsProvider};
1
+ import{STSClient as r,AssumeRoleCommand as d}from"@aws-sdk/client-sts";import{NodeHttpHandler as a}from"@smithy/node-http-handler";import{composeSdkAbortSignal as S}from"./organisations/types.js";const o=3e4;class i{credentials;region;accountId;clientCache=new Map;assumeScopedBuildSecretSession;constructor(e,n){this.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken},this.region=e.region,this.accountId=e.accountId,n!==void 0&&(this.assumeScopedBuildSecretSession=async(t,c)=>{const s=await n(t,c);return new i(s)})}getClient(e){const n=e.name,t=this.clientCache.get(n);if(t!==void 0)return t;const c={region:this.region,credentials:this.credentials,requestHandler:new a({requestTimeout:o})},s=new e(c);return this.clientCache.set(n,s),s}getRegion(){return this.region}getAccountId(){return this.accountId}getCredentials(){return this.credentials}exportToEnv(){process.env.AWS_ACCESS_KEY_ID=this.credentials.accessKeyId,process.env.AWS_SECRET_ACCESS_KEY=this.credentials.secretAccessKey,process.env.AWS_REGION=this.region,this.credentials.sessionToken?process.env.AWS_SESSION_TOKEN=this.credentials.sessionToken:delete process.env.AWS_SESSION_TOKEN}async assumeRole(e,n){const s=(await this.getClient(r).send(new d({RoleArn:e,RoleSessionName:n}),{abortSignal:S(void 0,o)})).Credentials;if(!s?.AccessKeyId||!s?.SecretAccessKey)throw new Error(`AssumeRole for ${e} returned incomplete credentials`);return{accessKeyId:s.AccessKeyId,secretAccessKey:s.SecretAccessKey,sessionToken:s.SessionToken}}}export{i as SimpleAwsProvider};
@@ -15,7 +15,7 @@ export { DeploymentEventSchema, DEPLOYMENT_EVENT_TYPES, DEPLOYMENT_EVENT_RESOURC
15
15
  export type { DeploymentEvent, DeploymentEventType, DeploymentEventResourceCategory, DeploymentEventCascadePhase, DeploymentEventCascadeAccountStatus } from "./types/index.js";
16
16
  export { DeployEventSchema, StepProgressSchema, DeployResourceSchema, PlanChangeSchema, PlanPropertyChangeSchema, ChangeCountsSchema, DEPLOY_EVENT_CONTRACT, DEPLOY_EVENT_CONTRACT_MAJOR, DEPLOY_EVENT_CONTRACT_MINOR, SUPPORTED_CONTRACT_MARKERS, DEPLOY_EVENT_ID_MAX, DEPLOY_EVENT_NAME_MAX, DEPLOY_EVENT_MESSAGE_MAX, DEPLOY_EVENT_STATUS_REASON_MAX, DEPLOY_EVENT_ERROR_MESSAGE_MAX, DEPLOY_EVENT_TRAIL_DETAIL_MAX, DEPLOY_EVENT_OUTPUT_MAX, DEPLOY_EVENT_ARN_MAX, DEPLOY_EVENT_URL_MAX, STEP_COMPLETE_STATUSES, LOG_LEVELS, STACK_CLEANUP_PHASES, CASCADE_ACCOUNT_PHASES, DEPLOY_RESULTS, DETECTION_PHASES, PHASE_STATUSES, BUILDERS, CASCADE_OUTCOME_RESULTS, PLAN_ACTIONS, REPLACEMENT_MODES, APPROVAL_KINDS, APPROVAL_DECISIONS, ALL_PROGRESS_KINDS, createDeployEmitter, parseDeployEvent, parseDeployContractVersion } from "./types/index.js";
17
17
  export type { DeployEvent, ProgressKind, StepProgress, DeployResource, PlanChange, PlanPropertyChange, ChangeCounts, PlanAction, ReplacementMode, ApprovalKind, ApprovalDecision, DeployRunResult, DeployEmitter, CreateDeployEmitterOptions, ParsedDeployEvent, StackCleanupPhase, CascadeAccountPhase, LogLevel } from "./types/index.js";
18
- export type { AwsCredentials, DeployIdentity, DeployCallbacks, StepCompleteStatus, StackCleanupQuarantineDetail, StackCleanupRetainedBucketsDetail, ProgressEvent, ProgressEventType, ResourceEvent, AwsAuthResult, CascadeDeploymentResult, CascadePhase, BuildPushStartEvent, BuildPushProgressEvent, BuildPushCompleteEvent, TaskDefRegisteredEvent, ECSCompleteEvent, MigrationsStartEvent, MigrationsCompleteEvent, TrailMigrationPhase, TrailMigrationStatus, TrailMigrationPhaseEvent, ApiClientInterface, EntitlementsData, DeployParams, DeployOptions, DeploymentType, DeployResult, DestroyParams, DestroyOptions, DestroyResult, ApprovalGate, ApprovalRequest, GateResolution, OrgConfig, ProviderAccount, RootAccessManagementMode, SSOSession, Entitlements } from "./types/index.js";
18
+ export type { AwsCredentials, DeployIdentity, ScopedBuildSecretSessionMinter, DeployCallbacks, StepCompleteStatus, StackCleanupQuarantineDetail, StackCleanupRetainedBucketsDetail, ProgressEvent, ProgressEventType, ResourceEvent, AwsAuthResult, CascadeDeploymentResult, CascadePhase, BuildPushStartEvent, BuildPushProgressEvent, BuildPushCompleteEvent, TaskDefRegisteredEvent, ECSCompleteEvent, MigrationsStartEvent, MigrationsCompleteEvent, TrailMigrationPhase, TrailMigrationStatus, TrailMigrationPhaseEvent, ApiClientInterface, EntitlementsData, DeployParams, DeployOptions, DeploymentType, DeployResult, DestroyParams, DestroyOptions, DestroyResult, ApprovalGate, ApprovalRequest, GateResolution, OrgConfig, ProviderAccount, RootAccessManagementMode, SSOSession, Entitlements } from "./types/index.js";
19
19
  export type { AwsProvider, AwsProviderCredentials, AwsSdkClientConstructor } from "./aws/index.js";
20
20
  export { SimpleAwsProvider } from "./aws/index.js";
21
21
  export { checkTargetReadiness, describeTargetReadinessReason, buildTargetUnreadyAdvisory, buildTargetSetUnreadyAdvisory, probeAccountStackExists } from "./aws/index.js";
@@ -1 +1 @@
1
- import{SimpleAwsProvider as d}from"../aws/SimpleAwsProvider.js";import{CdkService as f}from"../services/infrastructure/CdkService.js";import{CdkArgumentBuilder as v}from"../services/infrastructure/CdkArgumentBuilder.js";import{CdkProcessManager as p}from"../services/infrastructure/CdkProcessManager.js";import{CloudFormationService as g}from"../services/infrastructure/CloudFormationService.js";import{EcsService as w}from"../services/infrastructure/EcsService.js";import{EcsServiceResolver as u}from"../services/infrastructure/EcsServiceResolver.js";import{EcrImageInspectorService as k}from"../services/infrastructure/EcrImageInspectorService.js";import{ApplicationStackService as b}from"../services/application/ApplicationStackService.js";import{TemplateHashService as y}from"../services/supporting/TemplateHashService.js";import{FrameworkRegistry as A}from"./builders/frameworkRegistry.js";function T(e){const r=new d(e.awsCredentials);r.exportToEnv();const t=new v,i=new p(t,e.abortSignal),n=new f({processManager:i,...e.abortSignal!==void 0?{abortSignal:e.abortSignal}:{},...e.callbacks.onFailureAnalysis!==void 0?{onFailureAnalysis:e.callbacks.onFailureAnalysis}:{}}),o=new g(r),c=new w(r),s=new u(o),a=new k(r),l=new b(n,o,r),m=new y,S=A.createDefault();return{awsProvider:r,cdkService:n,cfnService:o,ecsService:c,ecsResolver:s,ecrImageInspector:a,stackService:l,hashService:m,frameworkRegistry:S,...e.abortSignal!==void 0?{abortSignal:e.abortSignal}:{},dispose(){i.dispose()}}}export{T as createDeployServices};
1
+ import{SimpleAwsProvider as d}from"../aws/SimpleAwsProvider.js";import{CdkService as f}from"../services/infrastructure/CdkService.js";import{CdkArgumentBuilder as v}from"../services/infrastructure/CdkArgumentBuilder.js";import{CdkProcessManager as p}from"../services/infrastructure/CdkProcessManager.js";import{CloudFormationService as g}from"../services/infrastructure/CloudFormationService.js";import{EcsService as w}from"../services/infrastructure/EcsService.js";import{EcsServiceResolver as u}from"../services/infrastructure/EcsServiceResolver.js";import{EcrImageInspectorService as k}from"../services/infrastructure/EcrImageInspectorService.js";import{ApplicationStackService as b}from"../services/application/ApplicationStackService.js";import{TemplateHashService as y}from"../services/supporting/TemplateHashService.js";import{FrameworkRegistry as A}from"./builders/frameworkRegistry.js";function T(e){const r=new d(e.awsCredentials,e.mintScopedBuildSecretSession);r.exportToEnv();const t=new v,i=new p(t,e.abortSignal),n=new f({processManager:i,...e.abortSignal!==void 0?{abortSignal:e.abortSignal}:{},...e.callbacks.onFailureAnalysis!==void 0?{onFailureAnalysis:e.callbacks.onFailureAnalysis}:{}}),o=new g(r),c=new w(r),s=new u(o),a=new k(r),l=new b(n,o,r),S=new y,m=A.createDefault();return{awsProvider:r,cdkService:n,cfnService:o,ecsService:c,ecsResolver:s,ecrImageInspector:a,stackService:l,hashService:S,frameworkRegistry:m,...e.abortSignal!==void 0?{abortSignal:e.abortSignal}:{},dispose(){i.dispose()}}}export{T as createDeployServices};
@@ -12,6 +12,20 @@ export interface AwsCredentials {
12
12
  region: string;
13
13
  accountId: string;
14
14
  }
15
+ /**
16
+ * Re-mints a least-privilege child session for reading build-time secrets,
17
+ * narrowed by an inline session policy. deploy-core builds the policy via
18
+ * `buildBuildSecretSessionPolicy` and passes a session name; the consumer (the
19
+ * worker) re-runs its web-identity assume with the inline policy and returns the
20
+ * scoped credentials.
21
+ *
22
+ * A consumer that cannot re-mint (no web-identity token to re-assume with) omits
23
+ * this — deploy-core then reads build-secrets under the unscoped identity.
24
+ *
25
+ * CLI: omits this — `AwsContext.assumeScopedBuildSecretSession` self-scopes.
26
+ * Worker: supplies this so build-secret reads run under a scoped session.
27
+ */
28
+ export type ScopedBuildSecretSessionMinter = (inlinePolicy: string, sessionName: string) => Promise<AwsCredentials>;
15
29
  /**
16
30
  * Pre-fetched organisation identity for org deployments.
17
31
  *
@@ -1,6 +1,6 @@
1
1
  export { DeploymentEventSchema, DEPLOYMENT_EVENT_TYPES, DEPLOYMENT_EVENT_RESOURCE_CATEGORIES, DEPLOYMENT_EVENT_STATUS_REASON_MAX, DEPLOYMENT_EVENT_ERROR_MESSAGE_MAX, DEPLOYMENT_EVENT_TRAIL_DETAIL_MAX, CASCADE_PHASES, CASCADE_ACCOUNT_STATUSES, toCascadePhase } from "./deploymentEventSchema.js";
2
2
  export type { DeploymentEvent, DeploymentEventType, DeploymentEventResourceCategory, DeploymentEventCascadePhase, DeploymentEventCascadeAccountStatus } from "./deploymentEventSchema.js";
3
- export type { AwsCredentials, DeployIdentity } from "./credentials.js";
3
+ export type { AwsCredentials, DeployIdentity, ScopedBuildSecretSessionMinter } from "./credentials.js";
4
4
  export type { DeployCallbacks, StepCompleteStatus, StackCleanupPhase, CascadeAccountPhase, LogLevel, StackCleanupQuarantineDetail, StackCleanupRetainedBucketsDetail } from "./callbacks.js";
5
5
  export { isQuarantineDetail, isRetainedBucketsDetail } from "./callbacks.js";
6
6
  export { DeployEventSchema, StepProgressSchema, DeployResourceSchema, PlanChangeSchema, PlanPropertyChangeSchema, ChangeCountsSchema, DEPLOY_EVENT_CONTRACT, DEPLOY_EVENT_CONTRACT_MAJOR, DEPLOY_EVENT_CONTRACT_MINOR, SUPPORTED_CONTRACT_MARKERS, DEPLOY_EVENT_ID_MAX, DEPLOY_EVENT_NAME_MAX, DEPLOY_EVENT_MESSAGE_MAX, DEPLOY_EVENT_STATUS_REASON_MAX, DEPLOY_EVENT_ERROR_MESSAGE_MAX, DEPLOY_EVENT_TRAIL_DETAIL_MAX, DEPLOY_EVENT_OUTPUT_MAX, DEPLOY_EVENT_ARN_MAX, DEPLOY_EVENT_URL_MAX, STEP_COMPLETE_STATUSES, LOG_LEVELS, STACK_CLEANUP_PHASES, CASCADE_ACCOUNT_PHASES, DEPLOY_RESULTS, DETECTION_PHASES, PHASE_STATUSES, BUILDERS, CASCADE_OUTCOME_RESULTS, PLAN_ACTIONS, REPLACEMENT_MODES, APPROVAL_KINDS, APPROVAL_DECISIONS, ALL_PROGRESS_KINDS } from "./deployEvent.js";
@@ -1,5 +1,5 @@
1
1
  import type { Result } from "@fjall/generator";
2
- import type { AwsCredentials, DeployIdentity } from "./credentials.js";
2
+ import type { AwsCredentials, DeployIdentity, ScopedBuildSecretSessionMinter } from "./credentials.js";
3
3
  import type { DeployCallbacks } from "./callbacks.js";
4
4
  import type { ApiClientInterface } from "./apiClient.js";
5
5
  import type { OrgConfig } from "./config/orgConfig.js";
@@ -15,6 +15,14 @@ export interface DeployParams {
15
15
  workingDirectory: string;
16
16
  /** AWS credentials for the deployment. deploy-core never resolves these itself. */
17
17
  awsCredentials: AwsCredentials;
18
+ /**
19
+ * Optional re-mint hook the worker supplies so build-secret reads run under a
20
+ * least-privilege child session (the inline policy narrows the worker's deploy
21
+ * role to exactly this app's SSM/SM/KMS). The CLI omits it — its `AwsContext`
22
+ * self-scopes via `assumeScopedBuildSecretSession`. When omitted, build-secret
23
+ * reads fall back to the unscoped identity (see `resolveBuildSecrets`).
24
+ */
25
+ mintScopedBuildSecretSession?: ScopedBuildSecretSessionMinter;
18
26
  /** Typed callbacks for progress events. CLI and worker implement differently. */
19
27
  callbacks: DeployCallbacks;
20
28
  /** Deployment options */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fjall/deploy-core",
3
- "version": "2.22.0",
3
+ "version": "2.22.1",
4
4
  "description": "Shared deployment engine for Fjall — used by CLI and webapp worker",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -81,8 +81,8 @@
81
81
  "@aws-sdk/client-ssm": "^3.1038.0",
82
82
  "@aws-sdk/client-sso-admin": "^3.1038.0",
83
83
  "@aws-sdk/client-sts": "^3.1038.0",
84
- "@fjall/generator": "^2.22.0",
85
- "@fjall/util": "^2.22.0",
84
+ "@fjall/generator": "^2.22.1",
85
+ "@fjall/util": "^2.22.1",
86
86
  "@smithy/node-http-handler": "^4.6.1",
87
87
  "aws-cdk": "^2.1128.1",
88
88
  "tsx": "^4.21.0",
@@ -93,5 +93,5 @@
93
93
  "typescript": "^6.0.3",
94
94
  "vitest": "^4.1.5"
95
95
  },
96
- "gitHead": "448c771d258e87f0535ae7698f11438e0f7c57b1"
96
+ "gitHead": "ec04f1739f19e4b5212899df7f733ee0d1f06ec3"
97
97
  }