fix: sha256 instead of sha1 for metric_id

fix: allowlist added to tox

Change-Id: I7d99515c07f2b01394d869d437327ab27ffa4a44
This commit is contained in:
Hasan Acar 2024-03-06 07:57:05 +00:00
parent 1ea4e21eb2
commit 46f0cc38ee
4 changed files with 4 additions and 4 deletions

View File

@ -132,7 +132,7 @@ class MetricCassandraRepository(abstract_repository.AbstractCassandraRepository)
dim_names.append(name)
hash_string = '%s\0%s\0%s\0%s' % (region, tenant_id, metric_name, '\0'.join(dim_list))
metric_id = hashlib.sha1(hash_string.encode('utf8')).hexdigest()
metric_id = hashlib.sha256(hash_string.encode('utf8')).hexdigest()
# TODO(brtknr): If database per tenant becomes the default and the
# only option, recording tenant_id will be redundant.

View File

@ -128,7 +128,7 @@ def main():
hash_string = '%s\0%s\0%s\0%s' % (row.region, row.tenant_id,
row.metric_name,
'\0'.join(row.dimensions))
# metric_id = hashlib.sha1(hash_string.encode('utf8')).hexdigest()
# metric_id = hashlib.sha256(hash_string.encode('utf8')).hexdigest()
# id_bytes = bytearray.fromhex(metric_id)
LOG.info("Recreated hash for metric id: {}".format(hash_string))

View File

@ -143,7 +143,7 @@ def main():
hash_string = '%s\0%s\0%s\0%s' % (row.region, row.tenant_id,
row.metric_name,
'\0'.join(row.dimensions))
metric_id = hashlib.sha1(hash_string.encode('utf8')).hexdigest()
metric_id = hashlib.sha256(hash_string.encode('utf8')).hexdigest()
id_bytes = bytearray.fromhex(metric_id)
LOG.info("Recreated hash for metric id: {}".format(hash_string))

View File

@ -14,7 +14,7 @@ passenv = http_proxy
no_proxy
NO_PROXY
usedevelop = True
whitelist_externals = bash
allowlist_externals = bash
find
rm
install_command = pip install {opts} {packages}