forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add encrypt/decrypt module on data source plugin (opensearch-project#…
…2120) Signed-off-by: Louis Chu <clingzhi@amazon.com> 1. Add encrypt/decrypt module with UT 2. Add client factory wrapper for encrypt credential 3. Add encryption config support 4. Bugfix on Jest interpret Buffer Signed-off-by: Kristen Tian <tyarong@amazon.com>
- Loading branch information
1 parent
0019d2d
commit 72d9b1a
Showing
19 changed files
with
570 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/plugins/credential_management/public/components/text_content/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export * as localizedContent from '../text_content/text_content'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export * as Credential from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { SavedObjectAttributes } from 'src/core/types'; | ||
|
||
/** | ||
* Each credential's materials type. For the time being, only username/password pairs are supported. | ||
*/ | ||
export enum CredentialMaterialsType { | ||
UsernamePasswordType = 'username_password', | ||
} | ||
|
||
export interface CredentialSavedObjectAttributes extends SavedObjectAttributes { | ||
title: string; | ||
credentialMaterials: CredentialMaterials; | ||
description?: string; | ||
} | ||
|
||
export interface CredentialMaterials extends SavedObjectAttributes { | ||
credentialMaterialsType: CredentialMaterialsType; | ||
credentialMaterialsContent: UsernamePasswordTypedContent; | ||
} | ||
|
||
export interface UsernamePasswordTypedContent extends SavedObjectAttributes { | ||
username: string; | ||
password: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { schema, TypeOf } from '@osd/config-schema'; | ||
|
||
const KEY_NAME_MIN_LENGTH: number = 1; | ||
const KEY_NAME_MAX_LENGTH: number = 100; | ||
// Wrapping key size shoule be 32 bytes, as used in envelope encryption algorithms. | ||
const WRAPPING_KEY_SIZE: number = 32; | ||
|
||
export const configSchema = schema.object({ | ||
enabled: schema.boolean({ defaultValue: false }), | ||
encryption: schema.object({ | ||
wrappingKeyName: schema.string({ | ||
minLength: KEY_NAME_MIN_LENGTH, | ||
maxLength: KEY_NAME_MAX_LENGTH, | ||
defaultValue: 'changeme', | ||
}), | ||
wrappingKeyNamespace: schema.string({ | ||
minLength: KEY_NAME_MIN_LENGTH, | ||
maxLength: KEY_NAME_MAX_LENGTH, | ||
defaultValue: 'changeme', | ||
}), | ||
wrappingKey: schema.arrayOf(schema.number(), { | ||
minSize: WRAPPING_KEY_SIZE, | ||
maxSize: WRAPPING_KEY_SIZE, | ||
defaultValue: new Array(32).fill(0), | ||
}), | ||
}), | ||
}); | ||
|
||
export type DataSourcePluginConfigType = TypeOf<typeof configSchema>; |
Oops, something went wrong.