-
Notifications
You must be signed in to change notification settings - Fork 936
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
Signed-off-by: Louis Chu <[email protected]>
- Loading branch information
Showing
20 changed files
with
598 additions
and
38 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
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
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,38 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { SavedObjectAttributes } from 'src/core/types'; | ||
|
||
/** | ||
* The scope of each credential is defined by the authentication type. | ||
* It is currently shared by default within the tenant. | ||
*/ | ||
export enum AuthType { | ||
SharedAuthType = 'shared', | ||
} | ||
|
||
/** | ||
* 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; | ||
authType: AuthType; | ||
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,35 @@ | ||
/* | ||
* 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.maybe( | ||
schema.arrayOf(schema.number(), { | ||
minSize: WRAPPING_KEY_SIZE, | ||
maxSize: WRAPPING_KEY_SIZE, | ||
}) | ||
), | ||
}), | ||
}); | ||
|
||
export type DataSourcePluginConfigType = TypeOf<typeof configSchema>; |
Oops, something went wrong.