Skip to content

Commit 37b324c

Browse files
authored
fix: Remaining CodeQL issues (#4898)
* Fix remaining codeQL issues * Rephrase suppression message in storage
1 parent cef226d commit 37b324c

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

libraries/botbuilder-azure/tests/cosmosDbPartitionedStorage.test.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ const getSettings = (test = null) => {
3939
databaseId: 'CosmosPartitionedStorageTestDb',
4040
containerId: `CosmosPartitionedStorageTestContainer-${testId}`,
4141
cosmosClientOptions: {
42-
agent: new https.Agent({ rejectUnauthorized: false }), // rejectUnauthorized disables the SSL verification for the locally-hosted Emulator
42+
// rejectUnauthorized disables the SSL verification for the locally-hosted Emulator
43+
agent: new https.Agent({ rejectUnauthorized: false }), // CodeQL [SM03616] Used only in tests with local cosmosdb emulator
4344
},
4445
};
4546
};
@@ -53,7 +54,7 @@ const checkEmulator = async () => {
5354
} else {
5455
try {
5556
const agent = new https.Agent({
56-
rejectUnauthorized: false,
57+
rejectUnauthorized: false, // CodeQL [SM03616] Used only in tests with local cosmosdb emulator
5758
});
5859
await fetch(emulatorEndpoint, { agent });
5960
canConnectToEmulator = true;
@@ -84,7 +85,7 @@ const cleanup = async () => {
8485
const client = new CosmosClient({
8586
endpoint: settings.cosmosDbEndpoint,
8687
key: settings.authKey,
87-
agent: new https.Agent({ rejectUnauthorized: false }),
88+
agent: new https.Agent({ rejectUnauthorized: false }), // CodeQL [SM03616] Used only in tests with local cosmosdb emulator
8889
});
8990
try {
9091
await client.database(settings.databaseId).delete();
@@ -111,7 +112,7 @@ const prep = async function () {
111112
const client = new CosmosClient({
112113
endpoint: settings.cosmosDbEndpoint,
113114
key: settings.authKey,
114-
agent: new https.Agent({ rejectUnauthorized: false }),
115+
agent: new https.Agent({ rejectUnauthorized: false }), // CodeQL [SM03616] Used only in tests with local cosmosdb emulator
115116
});
116117

117118
// This throws if the db is already created. We want to always create it if it doesn't exist,
@@ -190,7 +191,7 @@ describe('CosmosDbPartitionedStorage', function () {
190191

191192
const settingsWithClientOptions = getSettings(this.test);
192193
settingsWithClientOptions.cosmosClientOptions = {
193-
agent: new https.Agent({ rejectUnauthorized: false }),
194+
agent: new https.Agent({ rejectUnauthorized: false }), // CodeQL [SM03616] Used only in tests with local cosmosdb emulator
194195
connectionPolicy: { requestTimeout: 999 },
195196
userAgentSuffix: 'test',
196197
};
@@ -209,7 +210,7 @@ describe('CosmosDbPartitionedStorage', function () {
209210

210211
const settingsWithClientOptions = getSettings(this.test);
211212
settingsWithClientOptions.cosmosClientOptions = {
212-
agent: new https.Agent({ rejectUnauthorized: false }),
213+
agent: new https.Agent({ rejectUnauthorized: false }), // CodeQL [SM03616] Used only in tests with local cosmosdb emulator
213214
connectionPolicy: { requestTimeout: 999 },
214215
};
215216

@@ -340,7 +341,7 @@ describe('CosmosDbPartitionedStorage', function () {
340341
const dbCreateClient = new CosmosClient({
341342
endpoint: settingsWithNewDb.cosmosDbEndpoint,
342343
key: settingsWithNewDb.authKey,
343-
agent: new https.Agent({ rejectUnauthorized: false }),
344+
agent: new https.Agent({ rejectUnauthorized: false }), // CodeQL [SM03616] Used only in tests with local cosmosdb emulator
344345
});
345346
try {
346347
await dbCreateClient.database(newDb).delete();

libraries/botbuilder-core/src/storage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,6 @@ export function calculateChangeHash(item: StoreItem): string {
133133

134134
const result = stringify(rest);
135135
const hash = createHash('sha256', { encoding: 'utf-8' });
136-
const hashed = hash.update(result).digest('hex');
136+
const hashed = hash.update(result).digest('hex'); // CodeQL [SM01511] Hash is for change detection only (non-secret, non-auth use); not used for passwords or credentials.
137137
return hashed;
138138
}

libraries/botframework-connector/src/auth/jwtTokenProviderFactory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ export class JwtTokenProviderFactory implements IJwtTokenProviderFactory {
3131
createAzureServiceTokenProvider(appId: string): DefaultAzureCredential {
3232
ok(appId?.trim(), 'jwtTokenProviderFactory.createAzureServiceTokenProvider(): missing appId.');
3333

34-
return new DefaultAzureCredential({ managedIdentityClientId: appId });
34+
return new DefaultAzureCredential({ managedIdentityClientId: appId }); // CodeQL [SM05138] Changing this would break retro-compatibility
3535
}
3636
}

0 commit comments

Comments
 (0)