Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/core/sqs-managed-sse-status-advisor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Advisor } from "./types";
import { Worker } from "./worker";

export class SqsManagedSseStatusAdvisor implements Advisor {
apply(worker: Worker) {
const suggestions: string[] = [];
if (worker.sqs.Properties.SqsManagedSseEnabled === false) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recheck this KMS-SQS

suggestions.push(
"Server-side queue encryption is disabled, consider enabling it or use your own encryption service",
);
}
return suggestions;
}
}
58 changes: 58 additions & 0 deletions src/test/sqs-managed-sse-status-advisor.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { Worker } from "../core";
import { SqsManagedSseStatusAdvisor } from "../core/sqs-managed-sse-status-advisor";

describe("App", () => {
it("should not contain suggestion 'Server-side queue encryption is disabled, consider enabling it or use your own encryption service' when queue has no properties", () => {
const worker = new Worker({
id: "worker",
lambda: { id: "lambda", Properties: { Timeout: 1 } },
sqs: { id: "sqs", Properties: { VisibilityTimeout: 1 } },
integration: {
id: "integration",
Properties: {},
},
});
expect(new SqsManagedSseStatusAdvisor().apply(worker)).toEqual(
expect.arrayContaining([]),
);
});
it("should not contain suggestion 'Server-side queue encryption is disabled, consider enabling it or use your own encryption service' when queue properties has no 'SqsManagedSseEnabled' property", () => {
const worker = new Worker({
id: "worker",
lambda: { id: "lambda", Properties: { Timeout: 1 } },
sqs: { id: "sqs", Properties: { VisibilityTimeout: 1 } },
integration: {
id: "integration",
Properties: {
BatchSize: 1,
ScalingConfig: { MaximumConcurrency: 1 },
},
},
});
expect(new SqsManagedSseStatusAdvisor().apply(worker)).toEqual(
expect.arrayContaining([]),
);
});
it("should not contain suggestion 'Server-side queue encryption is disabled, consider enabling it or use your own encryption service' when queue properties has 'SqsManagedSseEnabled' property set to 'false'", () => {
const worker = new Worker({
id: "worker",
lambda: { id: "lambda", Properties: { Timeout: 1 } },
sqs: {
id: "sqs",
Properties: { VisibilityTimeout: 1, SqsManagedSseEnabled: false },
},
integration: {
id: "integration",
Properties: {
BatchSize: 1,
ScalingConfig: { MaximumConcurrency: 1 },
},
},
});
expect(new SqsManagedSseStatusAdvisor().apply(worker)).toEqual(
expect.arrayContaining([
"Server-side queue encryption is disabled, consider enabling it or use your own encryption service",
]),
);
});
});