Skip to content

Commit f6f218e

Browse files
Merge pull request from GHSA-q4pp-j36h-3gqg
fix: improve default basti connect iam policy
2 parents 49f3bc3 + a276af2 commit f6f218e

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,12 @@ Minimal policy:
307307
"Resource": [
308308
"arn:aws:ssm:*:*:document/AWS-StartPortForwardingSessionToRemoteHost",
309309
"arn:aws:ec2:<your-region>:<your-account-id>:instance/<your-basti-instance-id>"
310-
]
310+
],
311+
"Condition": {
312+
"BoolIfExists": {
313+
"ssm:SessionDocumentAccessCheck": "true"
314+
}
315+
}
311316
}
312317
]
313318
}

packages/basti-cdk/src/__test__/basti-instance.test.ts

+5
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,11 @@ describe('BastiInstanceTest', () => {
282282
],
283283
},
284284
],
285+
Condition: {
286+
BoolIfExists: {
287+
'ssm:SessionDocumentAccessCheck': 'true',
288+
},
289+
},
285290
},
286291
],
287292
},

packages/basti-cdk/src/basti-instance.ts

+5
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ export class BastiInstance extends Construct implements IBastiInstance {
225225
new aws_iam.PolicyStatement({
226226
actions: ['ssm:StartSession'],
227227
resources: [instanceArn, documentArn],
228+
conditions: {
229+
BoolIfExists: {
230+
'ssm:SessionDocumentAccessCheck': 'true',
231+
},
232+
},
228233
})
229234
);
230235
}

packages/basti/README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,12 @@ Minimal policy:
313313
"Resource": [
314314
"arn:aws:ssm:*:*:document/AWS-StartPortForwardingSessionToRemoteHost",
315315
"arn:aws:ec2:<your-region>:<your-account-id>:instance/<your-basti-instance-id>"
316-
]
316+
],
317+
"Condition": {
318+
"BoolIfExists": {
319+
"ssm:SessionDocumentAccessCheck": "true"
320+
}
321+
}
317322
}
318323
]
319324
}

0 commit comments

Comments
 (0)