Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #252 from JupiterOne/243-bucket-public
Browse files Browse the repository at this point in the history
Fixes #243 - Always assign boolean value to `public` property on `google_storage_bucket`
  • Loading branch information
austinkelleher authored Jun 23, 2021
2 parents 5a8b4ba + 03427f3 commit 58b2941
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ and this project adheres to

## [Unreleased]

## 0.43.1 - 2021-06-23

### Fixed

- [#243](https://github.com/JupiterOne/graph-google-cloud/issues/243) - Always
assign boolean value to `public` property on `google_storage_bucket`

## 0.43.0 - 2021-06-22

### Changed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jupiterone/graph-google-cloud",
"version": "0.43.0",
"version": "0.43.1",
"description": "A graph conversion tool for https://cloud.google.com/",
"license": "MPL-2.0",
"main": "dist/index.js",
Expand Down
51 changes: 51 additions & 0 deletions src/steps/storage/__snapshots__/converters.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -287,3 +287,54 @@ Object {
"webLink": "https://console.cloud.google.com/storage/browser/customer-managed-encryption-key-bucket-1234;tab=objects?forceOnBucketsSortingFiltering=false&project=j1-gc-integration-dev-v2",
}
`;

exports[`#createCloudStorageBucketEntity should set "public" to "false" if "isPublic" is "undefined" 1`] = `
Object {
"_class": Array [
"DataStore",
],
"_key": "bucket:customer-managed-encryption-key-bucket-1234",
"_rawData": Array [
Object {
"name": "default",
"rawData": Object {
"encryption": Object {
"defaultKmsKeyName": "projects/j1-gc-integration-dev-v2/locations/us/keyRings/j1-gc-integration-dev-v2-bucket-ring/cryptoKeys/j1-gc-integration-dev-v2-bucket-key",
},
"etag": "CAE=",
"iamConfiguration": undefined,
"id": "customer-managed-encryption-key-bucket-1234",
"kind": "storage#bucket",
"location": "US",
"locationType": "multi-region",
"metageneration": "1",
"name": "customer-managed-encryption-key-bucket-1234",
"projectNumber": "1234",
"selfLink": "https://www.googleapis.com/storage/v1/b/customer-managed-encryption-key-bucket-1234",
"storageClass": "STANDARD",
"timeCreated": "2020-07-28T19:06:14.033Z",
"updated": "2020-07-28T19:06:14.033Z",
},
},
],
"_type": "google_storage_bucket",
"classification": null,
"createdOn": 1595963174033,
"displayName": "customer-managed-encryption-key-bucket-1234",
"encrypted": true,
"encryptionKeyRef": "projects/j1-gc-integration-dev-v2/locations/us/keyRings/j1-gc-integration-dev-v2-bucket-ring/cryptoKeys/j1-gc-integration-dev-v2-bucket-key",
"etag": "CAE=",
"id": "customer-managed-encryption-key-bucket-1234",
"kmsKeyName": "projects/j1-gc-integration-dev-v2/locations/us/keyRings/j1-gc-integration-dev-v2-bucket-ring/cryptoKeys/j1-gc-integration-dev-v2-bucket-key",
"location": "US",
"name": "customer-managed-encryption-key-bucket-1234",
"public": false,
"retentionDate": undefined,
"retentionPeriod": undefined,
"retentionPolicyEnabled": undefined,
"storageClass": "STANDARD",
"uniformBucketLevelAccess": false,
"updatedOn": 1595963174033,
"webLink": "https://console.cloud.google.com/storage/browser/customer-managed-encryption-key-bucket-1234;tab=objects?forceOnBucketsSortingFiltering=false&project=j1-gc-integration-dev-v2",
}
`;
12 changes: 12 additions & 0 deletions src/steps/storage/converters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,16 @@ describe('#createCloudStorageBucketEntity', () => {
}),
).toMatchSnapshot();
});

test('should set "public" to "false" if "isPublic" is "undefined"', () => {
expect(
createCloudStorageBucketEntity({
data: getMockStorageBucket({
iamConfiguration: undefined,
}),
projectId: DEFAULT_INTEGRATION_CONFIG_PROJECT_ID,
isPublic: undefined,
}),
).toMatchSnapshot();
});
});
2 changes: 1 addition & 1 deletion src/steps/storage/converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function createCloudStorageBucketEntity({
retentionPolicyEnabled: data.retentionPolicy?.isLocked,
retentionPeriod: data.retentionPolicy?.retentionPeriod,
retentionDate: data.retentionPolicy?.effectiveTime,
public: isPublic,
public: isPublic || false,
// Rely on the value of the classification tag
classification: null,
etag: data.etag,
Expand Down

0 comments on commit 58b2941

Please sign in to comment.