Skip to content

Commit fedd4d2

Browse files
authored
Merge pull request #2821 from trycompai/main
[comp] Production Deploy
2 parents 8de936b + ff1f86d commit fedd4d2

4 files changed

Lines changed: 7 additions & 8 deletions

File tree

apps/api/.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@ SECURITY_HUB_ROLE_ASSUMER_ARN=
5858
SECURITY_HUB_GOVCLOUD_ROLE_ASSUMER_ARN=
5959
SECURITY_HUB_GOVCLOUD_ACCESS_KEY_ID=
6060
SECURITY_HUB_GOVCLOUD_SECRET_ACCESS_KEY=
61-
SECURITY_HUB_GOVCLOUD_SESSION_TOKEN=
61+
# Optional: only set when using temporary GovCloud credentials. Leave unset for long-lived IAM user keys.
62+
# SECURITY_HUB_GOVCLOUD_SESSION_TOKEN=

apps/api/src/cloud-security/aws-partition.utils.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,11 @@ describe('aws partition utils', () => {
5757
it('uses explicit GovCloud base credentials when configured', () => {
5858
process.env.SECURITY_HUB_GOVCLOUD_ACCESS_KEY_ID = 'AKIAGOV';
5959
process.env.SECURITY_HUB_GOVCLOUD_SECRET_ACCESS_KEY = 'secret';
60-
process.env.SECURITY_HUB_GOVCLOUD_SESSION_TOKEN = 'token';
60+
process.env.SECURITY_HUB_GOVCLOUD_SESSION_TOKEN = 'placeholder';
6161

6262
expect(getAwsBaseCredentials('aws-us-gov')).toEqual({
6363
accessKeyId: 'AKIAGOV',
6464
secretAccessKey: 'secret',
65-
sessionToken: 'token',
6665
});
6766
expect(getAwsBaseCredentials('aws')).toBeUndefined();
6867

apps/api/src/cloud-security/aws-partition.utils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export function getAwsBaseCredentials(
4141
return {
4242
accessKeyId,
4343
secretAccessKey,
44-
sessionToken: process.env.SECURITY_HUB_GOVCLOUD_SESSION_TOKEN,
4544
};
4645
}
4746

apps/api/src/evidence-forms/evidence-forms.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,16 @@ export class EvidenceFormsService {
196196
);
197197
}
198198

199-
const base64Pattern = /^[A-Za-z0-9+/]+={0,2}$/;
200-
if (!base64Pattern.test(normalized)) {
199+
const fileBuffer = Buffer.from(normalized, 'base64');
200+
201+
if (fileBuffer.toString('base64') !== normalized) {
201202
throw new BadRequestException(
202203
'Invalid file data. Expected base64 string.',
203204
);
204205
}
205206

206-
const fileBuffer = Buffer.from(normalized, 'base64');
207207
if (!fileBuffer.length) {
208-
throw new BadRequestException('File cannot be empty');
208+
throw new BadRequestException('File cannot be empty.');
209209
}
210210

211211
return fileBuffer;

0 commit comments

Comments
 (0)