-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #348 from Microsoft/tomlm/botconfig
update crypto algo based on security review
- Loading branch information
Showing
22 changed files
with
461 additions
and
162 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
libraries/botframework-config/lib/models/appInsightsService.d.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,13 @@ | ||
import { IAppInsightsService, ServiceTypes } from '../schema'; | ||
import { ConnectedService } from './connectedService'; | ||
export declare class AppInsightsService extends ConnectedService implements IAppInsightsService { | ||
readonly type: ServiceTypes; | ||
tenantId: string; | ||
subscriptionId: string; | ||
resourceGroup: string; | ||
instrumentationKey: string; | ||
constructor(source?: IAppInsightsService); | ||
toJSON(): IAppInsightsService; | ||
encrypt(secret: string): void; | ||
decrypt(secret: string): void; | ||
} |
37 changes: 37 additions & 0 deletions
37
libraries/botframework-config/lib/models/appInsightsService.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
libraries/botframework-config/lib/models/appInsightsService.js.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
libraries/botframework-config/lib/models/azureStorageService.d.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,13 @@ | ||
import { IAzureStorageService, ServiceTypes } from '../schema'; | ||
import { ConnectedService } from './connectedService'; | ||
export declare class AzureStorageService extends ConnectedService implements IAzureStorageService { | ||
readonly type: ServiceTypes; | ||
tenantId: string; | ||
subscriptionId: string; | ||
resourceGroup: string; | ||
connectionString: string; | ||
constructor(source?: IAzureStorageService); | ||
toJSON(): IAzureStorageService; | ||
encrypt(secret: string): void; | ||
decrypt(secret: string): void; | ||
} |
37 changes: 37 additions & 0 deletions
37
libraries/botframework-config/lib/models/azureStorageService.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
libraries/botframework-config/lib/models/azureStorageService.js.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
38 changes: 38 additions & 0 deletions
38
libraries/botframework-config/src/models/appInsightsService.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,38 @@ | ||
/** | ||
* Copyright(c) Microsoft Corporation.All rights reserved. | ||
* Licensed under the MIT License. | ||
*/ | ||
import { decryptString, encryptString } from '../encrypt'; | ||
import { IAppInsightsService, ServiceTypes } from '../schema'; | ||
import { ConnectedService } from './connectedService'; | ||
|
||
export class AppInsightsService extends ConnectedService implements IAppInsightsService { | ||
public readonly type = ServiceTypes.AppInsights; | ||
public tenantId = ''; | ||
public subscriptionId = ''; | ||
public resourceGroup = ''; | ||
public instrumentationKey = ''; | ||
|
||
constructor(source: IAppInsightsService = {} as IAppInsightsService) { | ||
super(source); | ||
const { tenantId = '', subscriptionId = '', resourceGroup = '', instrumentationKey = '' } = source; | ||
Object.assign(this, { tenantId, subscriptionId, resourceGroup, instrumentationKey }); | ||
} | ||
|
||
public toJSON(): IAppInsightsService { | ||
let { id, name, tenantId, subscriptionId, resourceGroup, instrumentationKey } = this; | ||
return { type: ServiceTypes.AppInsights, id, name, tenantId, subscriptionId, resourceGroup, instrumentationKey }; | ||
} | ||
|
||
// encrypt keys in service | ||
public encrypt(secret: string): void { | ||
if (this.instrumentationKey && this.instrumentationKey.length > 0) | ||
this.instrumentationKey = encryptString(this.instrumentationKey, secret); | ||
} | ||
|
||
// decrypt keys in service | ||
public decrypt(secret: string): void { | ||
if (this.instrumentationKey && this.instrumentationKey.length > 0) | ||
this.instrumentationKey = decryptString(this.instrumentationKey, secret); | ||
} | ||
} |
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
38 changes: 38 additions & 0 deletions
38
libraries/botframework-config/src/models/azureStorageService.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,38 @@ | ||
/** | ||
* Copyright(c) Microsoft Corporation.All rights reserved. | ||
* Licensed under the MIT License. | ||
*/ | ||
import { decryptString, encryptString } from '../encrypt'; | ||
import { IAzureStorageService, ServiceTypes } from '../schema'; | ||
import { ConnectedService } from './connectedService'; | ||
|
||
export class AzureStorageService extends ConnectedService implements IAzureStorageService { | ||
public readonly type = ServiceTypes.AzureStorage; | ||
public tenantId = ''; | ||
public subscriptionId = ''; | ||
public resourceGroup = ''; | ||
public connectionString = ''; | ||
|
||
constructor(source: IAzureStorageService = {} as IAzureStorageService) { | ||
super(source); | ||
const { tenantId = '', subscriptionId = '', resourceGroup = '', connectionString='' } = source; | ||
Object.assign(this, { tenantId, subscriptionId, resourceGroup, connectionString }); | ||
} | ||
|
||
public toJSON(): IAzureStorageService { | ||
let { id, name, tenantId, subscriptionId, resourceGroup, connectionString } = this; | ||
return { type: ServiceTypes.AzureStorage, id, name, tenantId, subscriptionId, resourceGroup, connectionString }; | ||
} | ||
|
||
// encrypt keys in service | ||
public encrypt(secret: string): void { | ||
if (this.connectionString && this.connectionString.length > 0) | ||
this.connectionString = encryptString(this.connectionString, secret); | ||
} | ||
|
||
// decrypt keys in service | ||
public decrypt(secret: string): void { | ||
if (this.connectionString && this.connectionString.length > 0) | ||
this.connectionString = decryptString(this.connectionString, secret); | ||
} | ||
} |
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
Oops, something went wrong.