Skip to content

Commit 390dfd0

Browse files
committed
feat: update bucket IP filter logging to display current mode and safely clone IP ranges
1 parent 2f74f16 commit 390dfd0

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

storage/enableBucketIpFilter.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ function main(bucketName = 'my-bucket', filterMode = 'Enabled') {
4040
};
4141

4242
// Add a new IP range to publicNetworkSource
43-
const updatedIpRanges =
44-
existingIpFilter.publicNetworkSource?.allowedIpCidrRanges || [];
43+
const updatedIpRanges = [
44+
...(existingIpFilter.publicNetworkSource?.allowedIpCidrRanges || []),
45+
];
4546
if (!updatedIpRanges.includes('8.8.8.8/32')) {
4647
updatedIpRanges.push('8.8.8.8/32');
4748
}
@@ -59,7 +60,7 @@ function main(bucketName = 'my-bucket', filterMode = 'Enabled') {
5960
ipFilter: updatedIpFilter,
6061
});
6162

62-
console.log(`IP Filter enabled for bucket ${bucketName}.`);
63+
console.log(`IP Filter mode set to ${updatedMetadata.ipFilter.mode} for bucket ${bucketName}.`);
6364
console.log(JSON.stringify(updatedMetadata.ipFilter, null, 2));
6465
}
6566

storage/system-test/buckets.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ it('should enable the bucket IP filter', () => {
146146
const output = execSync(
147147
`node enableBucketIpFilter.js ${bucketName} Disabled`
148148
);
149-
assert.include(output, `IP Filter enabled for bucket ${bucketName}.`);
149+
assert.include(output, `IP Filter mode set to Disabled for bucket ${bucketName}.`);
150150
assert.include(output, '8.8.8.8/32');
151151
});
152152

0 commit comments

Comments
 (0)