Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
fatima99s committed Dec 1, 2023
1 parent 6e16236 commit e39df97
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ module.exports = {
'logRetentionDays' : require(__dirname + '/plugins/azure/postgresqlserver/logRetentionDays.js'),
'connectionThrottlingEnabled' : require(__dirname + '/plugins/azure/postgresqlserver/connectionThrottlingEnabled.js'),
'logDurationEnabled' : require(__dirname + '/plugins/azure/postgresqlserver/logDurationEnabled.js'),
'postgresqlCMKEncrypted' : require(__dirname + '/plugins/azure/postgresqlserver/postgresqlEncryptionAtRestWithCMK.js'),
'postgresqlCMKEncrypted' : require(__dirname + '/plugins/azure/postgresqlserver/postgresqlCMKEncrypted.js'),
'logDisconnectionsEnabled' : require(__dirname + '/plugins/azure/postgresqlserver/logDisconnectionsEnabled.js'),
'logConnectionsEnabled' : require(__dirname + '/plugins/azure/postgresqlserver/logConnectionsEnabled.js'),
'logCheckpointsEnabled' : require(__dirname + '/plugins/azure/postgresqlserver/logCheckpointsEnabled.js'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = {

for (let server of servers.data) {
if (!server.id) continue;
if (server.byokEnforcement && server.byokEnforcement == 'Enabled') {
if (server.byokEnforcement && server.byokEnforcement.toLowerCase() === 'enabled') {
helpers.addResult(results, 0, 'PostgreSQL server is encrypted using CMK', location, server.id);
} else {
helpers.addResult(results, 2, 'PostgreSQL server is not encrypted using CMK', location, server.id);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var expect = require('chai').expect;
var postgresqlEncryptionAtRestWithCMK = require('./postgresqlEncryptionAtRestWithCMK');
var postgresqlCMKEncrypted = require('./postgresqlCMKEncrypted');

const listPostgres = [
{
Expand Down Expand Up @@ -80,11 +80,11 @@ const createCache = (listPostgres) => {
};
};

describe('postgresqlEncryptionAtRestWithCMK', function() {
describe('postgresqlCMKEncrypted', function() {
describe('run', function() {
it('should give passing result if no servers', function(done) {
const cache = createCache({});
postgresqlEncryptionAtRestWithCMK.run(cache, {}, (err, results) => {
postgresqlCMKEncrypted.run(cache, {}, (err, results) => {
expect(results.length).to.equal(1);
expect(results[0].status).to.equal(0);
expect(results[0].message).to.include('No existing PostgreSQL Servers found');
Expand All @@ -95,7 +95,7 @@ describe('postgresqlEncryptionAtRestWithCMK', function() {

it('should give failing result if PostgreSQL Server is not encrypted using CMK', function(done) {
const cache = createCache([listPostgres[0]]);
postgresqlEncryptionAtRestWithCMK.run(cache, {}, (err, results) => {
postgresqlCMKEncrypted.run(cache, {}, (err, results) => {
expect(results.length).to.equal(1);
expect(results[0].status).to.equal(2);
expect(results[0].message).to.include('PostgreSQL server is not encrypted using CMK');
Expand All @@ -106,7 +106,7 @@ describe('postgresqlEncryptionAtRestWithCMK', function() {

it('should give passing result if PostgreSQL Server is encrypted using CMK', function(done) {
const cache = createCache([listPostgres[1]]);
postgresqlEncryptionAtRestWithCMK.run(cache, {}, (err, results) => {
postgresqlCMKEncrypted.run(cache, {}, (err, results) => {
expect(results.length).to.equal(1);
expect(results[0].status).to.equal(0);
expect(results[0].message).to.include('PostgreSQL server is encrypted using CMK');
Expand All @@ -116,7 +116,7 @@ describe('postgresqlEncryptionAtRestWithCMK', function() {
});
it('should give UnKnown result if unable to query postgreSQL Server', function(done) {
const cache = createCache(null);
postgresqlEncryptionAtRestWithCMK.run(cache, {}, (err, results) => {
postgresqlCMKEncrypted.run(cache, {}, (err, results) => {
expect(results.length).to.equal(1);
expect(results[0].status).to.equal(3);
expect(results[0].message).to.include('Unable to query for PostgreSQL Servers:');
Expand Down

0 comments on commit e39df97

Please sign in to comment.