Skip to content

Commit 19b8cdc

Browse files
Vijay IyengarVijay Iyengar
authored andcommitted
fix: Replace MD5 with SHA-256 for secure token hashing
- Fix CodeQL security alert #1: weak cryptographic hashing - Changed from MD5 to SHA-256 for hashing configuration tokens - MD5 is vulnerable to collision attacks and shouldn't be used for sensitive data - SHA-256 is a strong cryptographic hash function suitable for this use case
1 parent d4d5353 commit 19b8cdc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mcp_gitlab/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def get_client(self, config: 'GitLabConfig') -> 'GitLabClient':
311311
# Generate a hash of the current configuration
312312
import hashlib
313313
config_str = f"{config.url}:{config.private_token or ''}:{config.oauth_token or ''}"
314-
config_hash = hashlib.md5(config_str.encode()).hexdigest()
314+
config_hash = hashlib.sha256(config_str.encode()).hexdigest()
315315

316316
# Create new client if configuration changed or no client exists
317317
if self._client is None or self._config_hash != config_hash:

0 commit comments

Comments
 (0)