From 9796d363372b0d592c398bbc0fbc9864e6d06f10 Mon Sep 17 00:00:00 2001 From: Marco Rosa Date: Mon, 7 Mar 2022 16:58:06 +0100 Subject: [PATCH 01/18] prepare for tests on py3.10 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4a04a6b..1c56ab7c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: [3.6, 3.7, 3.8, 3.9, 3.10] services: postgres: From f187439c397b27dc3672adb186b706b0c3e7f922 Mon Sep 17 00:00:00 2001 From: Marco Rosa Date: Mon, 7 Mar 2022 16:58:27 +0100 Subject: [PATCH 02/18] make return values consistent --- credentialdigger/models/password_model.py | 9 ++++----- credentialdigger/models/path_model.py | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/credentialdigger/models/password_model.py b/credentialdigger/models/password_model.py index 89715316..0da2511d 100644 --- a/credentialdigger/models/password_model.py +++ b/credentialdigger/models/password_model.py @@ -69,11 +69,9 @@ def analyze(self, discovery): Returns ------- - discoveries: list of dict - The discoveries, with states updated according to - the model's predictions - n_false_positives: int - The number of false positives detected by the model + bool + True if the snippet is safe (i.e., there is no leak). + False otherwise """ # Preprocess the snippet data = self._pre_process([discovery['snippet']]) @@ -84,6 +82,7 @@ def analyze(self, discovery): # The model classified this snippet as a false positive # (i.e., spam) return True + return False def _pre_process(self, snippet): """ Compute encodings of snippets and format them to a standard diff --git a/credentialdigger/models/path_model.py b/credentialdigger/models/path_model.py index 92b7309f..30dce462 100644 --- a/credentialdigger/models/path_model.py +++ b/credentialdigger/models/path_model.py @@ -21,7 +21,8 @@ def analyze(self, discovery): Returns ------- bool - True if the discovery is classified as false positive (i.e., spam) + True if the discovery is classified as false positive (i.e., spam), + False otherwise """ return bool(self.fp_keywords.search(discovery['file_name'].lower())) From 16b360367879b6aa6a67d5496d8488b5b298fbb6 Mon Sep 17 00:00:00 2001 From: Marco Rosa Date: Mon, 7 Mar 2022 16:58:44 +0100 Subject: [PATCH 03/18] tf version bump --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index ed27a6ae..b125da7b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,11 +11,11 @@ python-dotenv pyyaml rich srsly>=2.4.0 -tensorflow==2.6.2; python_version >= "3.8" +tensorflow==2.8.0; python_version >= "3.8" tensorflow==2.4.*; python_version < "3.8" -tensorflow-estimator==2.6.0; python_version >= "3.8" +tensorflow-estimator==2.8.0; python_version >= "3.8" tensorflow-estimator==2.4.*; python_version < "3.8" -tensorflow-text==2.6.0; python_version >= "3.8" +tensorflow-text==2.8.1; python_version >= "3.8" tensorflow-text==2.4.*; python_version < "3.8" tf-models-official transformers From b4129ded7acc59f8dd2fa4542f6e899c06ab4c86 Mon Sep 17 00:00:00 2001 From: Marco Rosa Date: Mon, 7 Mar 2022 17:03:36 +0100 Subject: [PATCH 04/18] solve py version like in https://github.com/python/mypy/issues/12108 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1c56ab7c..f73dc6c8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9, 3.10] + python-version: [3.6, 3.7, 3.8, 3.9, "3.10"] services: postgres: From c429a5a977d73ad4f198f5c9d11a619894320fe8 Mon Sep 17 00:00:00 2001 From: Marco Rosa Date: Mon, 7 Mar 2022 17:09:37 +0100 Subject: [PATCH 05/18] make types consistent --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f73dc6c8..b839f890 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9, "3.10"] + python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] services: postgres: From 42274452d02b05d7279857c7a2832b980826221b Mon Sep 17 00:00:00 2001 From: Marco Rosa Date: Mon, 7 Mar 2022 17:32:45 +0100 Subject: [PATCH 06/18] update results --- tests/functional_tests/test_scans_postgres.py | 10 ++++++---- tests/functional_tests/test_scans_sqlite.py | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/functional_tests/test_scans_postgres.py b/tests/functional_tests/test_scans_postgres.py index df451e60..4bc530c1 100644 --- a/tests/functional_tests/test_scans_postgres.py +++ b/tests/functional_tests/test_scans_postgres.py @@ -7,6 +7,8 @@ from git import Repo as GitRepo from psycopg2 import connect +TOTAL_PW_DISCOVERIES = 11 + class TestScansPostgres(unittest.TestCase): dotenv = os.path.join(os.path.dirname(os.path.abspath(__file__)), ".env") @@ -35,7 +37,7 @@ def test_scan_github(self): cli.main(["", "scan", "--category", "password", "--dotenv", self.dotenv, "--force", self.repo_url]) - self.assertEqual(cm.exception.code, 9) + self.assertEqual(cm.exception.code, TOTAL_PW_DISCOVERIES) def test_scan_local(self): repo_path = tempfile.mkdtemp() @@ -46,9 +48,9 @@ def test_scan_local(self): "--models", "PathModel", "PasswordModel", "--category", "password", "--force", "--local", repo_path]) - # When using the models, we expect to be left with less than 9 - # discoveries to manually review - self.assertTrue(cm.exception.code < 9) + # When using the models, we expect to be left with less than + # TOTAL_PW_DISCOVERIES discoveries to manually review + self.assertTrue(cm.exception.code < TOTAL_PW_DISCOVERIES) shutil.rmtree(repo_path) diff --git a/tests/functional_tests/test_scans_sqlite.py b/tests/functional_tests/test_scans_sqlite.py index 52179ef9..34887e86 100644 --- a/tests/functional_tests/test_scans_sqlite.py +++ b/tests/functional_tests/test_scans_sqlite.py @@ -6,6 +6,8 @@ from credentialdigger.client_sqlite import SqliteClient from git import Repo as GitRepo +TOTAL_PW_DISCOVERIES = 11 + class TestScansSqlite(unittest.TestCase): repo_url = 'https://github.com/SAP/credential-digger-tests' @@ -27,7 +29,7 @@ def test_scan_github(self): cli.main(["", "scan", "--sqlite", self.db_path, "--category", "password", "--force", self.repo_url]) - self.assertEqual(cm.exception.code, 9) + self.assertEqual(cm.exception.code, TOTAL_PW_DISCOVERIES) def test_scan_local(self): repo_path = os.path.join(self.tmp_path, "tmp_repo") @@ -38,9 +40,9 @@ def test_scan_local(self): "--models", "PathModel", "PasswordModel", "--category", "password", "--force", "--local", repo_path]) - # When using the models, we expect to be left with less than 9 - # discoveries to manually review - self.assertTrue(cm.exception.code < 9) + # When using the models, we expect to be left with less than + # TOTAL_PW_DISCOVERIES discoveries to manually review + self.assertTrue(cm.exception.code < TOTAL_PW_DISCOVERIES) def test_scan_wiki(self): with self.assertRaises(SystemExit) as cm: From 62893430e542d2c6f447cc5efb4a7038b9063dda Mon Sep 17 00:00:00 2001 From: Marco Rosa Date: Mon, 7 Mar 2022 17:37:22 +0100 Subject: [PATCH 07/18] update regex of tests --- tests/functional_tests/test_rules.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional_tests/test_rules.yml b/tests/functional_tests/test_rules.yml index a6355c21..9891eac8 100644 --- a/tests/functional_tests/test_rules.yml +++ b/tests/functional_tests/test_rules.yml @@ -31,6 +31,6 @@ rules: category: token description: MailChimp API key - - regex: sshpass|password|pwd|passwd|pass + - regex: sshpass|password|pwd|passwd|pass[\W] category: password - description: password keywords \ No newline at end of file + description: password keywords From 36b8664b43b419dbffce3b899d105a0baa60fd6c Mon Sep 17 00:00:00 2001 From: Marco Rosa Date: Mon, 7 Mar 2022 18:34:42 +0100 Subject: [PATCH 08/18] python3.6 ended in 2021 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b839f890..cd4e8228 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] + python-version: ['3.7', '3.8', '3.9', '3.10'] services: postgres: From 0b48f066122383388b78bb0f8b69f7606c97dea7 Mon Sep 17 00:00:00 2001 From: Marco Rosa Date: Mon, 7 Mar 2022 18:45:23 +0100 Subject: [PATCH 09/18] set libhyperscan5 by default for python38 (as in new ubuntu versions) --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index b125da7b..dc7fecff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ Flask flask_jwt_extended GitPython -hyperscan==0.2.0; python_version >= "3.9" -hyperscan==0.1.5; python_version < "3.9" +hyperscan==0.2.0; python_version >= "3.8" +hyperscan==0.1.5; python_version < "3.8" numpy pandas psycopg2-binary From ff69538db446b0fbd65d9fc7cf0f47f8ea567072 Mon Sep 17 00:00:00 2001 From: Marco Rosa Date: Mon, 7 Mar 2022 18:47:40 +0100 Subject: [PATCH 10/18] deprecate models download forgotten in test setup --- .github/workflows/test.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cd4e8228..3a25017e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -62,14 +62,6 @@ jobs: run: | python setup.py install --user - - name: Download and link credentialdigger's models - env: - path_model: https://github.com/SAP/credential-digger/releases/download/PM-v1.0.1/path_model-1.0.1.tar.gz - snippet_model: https://github.com/SAP/credential-digger/releases/download/SM-v1.0.0/snippet_model-1.0.0.tar.gz - run: | - python -m credentialdigger download path_model - python -m credentialdigger download snippet_model - - name: Run unit tests run: | pytest tests/unit_tests @@ -85,7 +77,5 @@ jobs: POSTGRES_DB: credential_digger_tests DBHOST: localhost DBPORT: 5432 - path_model: https://github.com/SAP/credential-digger/releases/download/PM-v1.0.1/path_model-1.0.1.tar.gz - snippet_model: https://github.com/SAP/credential-digger/releases/download/SM-v1.0.0/snippet_model-1.0.0.tar.gz run: | pytest tests/functional_tests From 9e845ea21d0da34b192352f0018616858dd36800 Mon Sep 17 00:00:00 2001 From: Marco Rosa Date: Tue, 8 Mar 2022 10:09:18 +0100 Subject: [PATCH 11/18] update hyperscan calls in scanners for py38 --- credentialdigger/scanners/file_scanner.py | 2 +- credentialdigger/scanners/git_scanner.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/credentialdigger/scanners/file_scanner.py b/credentialdigger/scanners/file_scanner.py index 104c6aba..8ccf01cb 100644 --- a/credentialdigger/scanners/file_scanner.py +++ b/credentialdigger/scanners/file_scanner.py @@ -157,7 +157,7 @@ def scan_file(self, project_root, relative_path, **kwargs): for row in file_to_scan: rh = ResultHandler() self.stream.scan( - row if sys.version_info < (3, 9) else row.encode( + row if sys.version_info < (3, 8) else row.encode( 'utf-8'), match_event_handler=rh.handle_results, context=[row.strip(), relative_path, commit_id, diff --git a/credentialdigger/scanners/git_scanner.py b/credentialdigger/scanners/git_scanner.py index d3a79e13..7ec818ca 100644 --- a/credentialdigger/scanners/git_scanner.py +++ b/credentialdigger/scanners/git_scanner.py @@ -405,7 +405,7 @@ def _regex_check(self, printable_diff, filename, commit_hash): rh = ResultHandler() self.stream.scan( - row if sys.version_info < (3, 9) else row.encode('utf-8'), + row if sys.version_info < (3, 8) else row.encode('utf-8'), match_event_handler=rh.handle_results, context=[row, filename, commit_hash, line_number]) if rh.result: From bca8e8289275ea8a9ab7475bc5fd30d97465183a Mon Sep 17 00:00:00 2001 From: LorisOnori <39842022+LorisOnori@users.noreply.github.com> Date: Tue, 22 Mar 2022 02:15:57 -0700 Subject: [PATCH 12/18] bug_fix update functions (#224) * bug_fix update functions * Update client.py Code style * Update client.py Code style (2) * Update client.py Code style (3) Co-authored-by: LorisOnori --- credentialdigger/client.py | 5 +++-- credentialdigger/client_postgres.py | 8 ++++---- credentialdigger/client_sqlite.py | 10 +++++----- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/credentialdigger/client.py b/credentialdigger/client.py index e107b282..352d8d4d 100644 --- a/credentialdigger/client.py +++ b/credentialdigger/client.py @@ -1366,7 +1366,8 @@ def update_similar_snippets(self, # Compute similarity of target_embedding and embedding similarity = compute_similarity(target_embedding, embedding) - if similarity > threshold: - self.update_discovery(d['id'], state) + # Increase counter if similar and the update is successful + if (similarity > threshold and + self.update_discovery(d['id'], state)): n_updated_snippets += 1 return n_updated_snippets diff --git a/credentialdigger/client_postgres.py b/credentialdigger/client_postgres.py index 3b83d9b7..d88ecd95 100644 --- a/credentialdigger/client_postgres.py +++ b/credentialdigger/client_postgres.py @@ -508,7 +508,7 @@ def update_repo(self, url, last_scan): bool `True` if the update is successful, `False` otherwise """ - super().update_repo( + return super().update_repo( url=url, last_scan=last_scan, query='UPDATE repos SET last_scan=%s WHERE url=%s RETURNING true' ) @@ -528,7 +528,7 @@ def update_discovery(self, discovery_id, new_state): bool `True` if the update is successful, `False` otherwise """ - super().update_discovery( + return super().update_discovery( discovery_id=discovery_id, new_state=new_state, query='UPDATE discoveries SET state=%s WHERE id=%s RETURNING true') @@ -548,7 +548,7 @@ def update_discoveries(self, discoveries_ids, new_state): bool `True` if the update is successful, `False` otherwise """ - super().update_discoveries( + return super().update_discoveries( discoveries_ids=discoveries_ids, new_state=new_state, query='UPDATE discoveries SET state=%s WHERE id IN %s RETURNING true') @@ -581,6 +581,6 @@ def update_discovery_group(self, new_state, repo_url, file_name, snippet=None): if snippet is not None: query += ' and snippet=%s' query += ' RETURNING true' - super().update_discovery_group( + return super().update_discovery_group( new_state=new_state, repo_url=repo_url, file_name=file_name, snippet=snippet, query=query) diff --git a/credentialdigger/client_sqlite.py b/credentialdigger/client_sqlite.py index 691da16c..4035c72a 100644 --- a/credentialdigger/client_sqlite.py +++ b/credentialdigger/client_sqlite.py @@ -67,7 +67,7 @@ def query_check(self, query, *args): try: cursor.execute(query, args) self.db.commit() - return cursor.rowcount < 1 + return cursor.rowcount >= 1 except (TypeError, IndexError): """ A TypeError is raised if any of the required arguments is missing. """ @@ -544,7 +544,7 @@ def update_repo(self, url, last_scan): bool `True` if the update is successful, `False` otherwise """ - super().update_repo( + return super().update_repo( url=url, last_scan=last_scan, query='UPDATE repos SET last_scan=? WHERE url=?' ) @@ -564,7 +564,7 @@ def update_discovery(self, discovery_id, new_state): bool `True` if the update is successful, `False` otherwise """ - super().update_discovery( + return super().update_discovery( new_state=new_state, discovery_id=discovery_id, query='UPDATE discoveries SET state=? WHERE id=?' ) @@ -584,7 +584,7 @@ def update_discoveries(self, discoveries_ids, new_state): bool `True` if the update is successful, `False` otherwise """ - super().update_discoveries( + return super().update_discoveries( discoveries_ids=discoveries_ids, new_state=new_state, query='UPDATE discoveries SET state=? WHERE id IN(' @@ -617,6 +617,6 @@ def update_discovery_group(self, new_state, repo_url, file_name, snippet=None): query += ' and file_name=?' if snippet is not None: query += ' and snippet=?' - super().update_discovery_group( + return super().update_discovery_group( new_state=new_state, repo_url=repo_url, file_name=file_name, snippet=snippet, query=query) From 8b1e96626941840f66a4e34e924882c7acce4b61 Mon Sep 17 00:00:00 2001 From: LorisOnori <39842022+LorisOnori@users.noreply.github.com> Date: Thu, 24 Mar 2022 09:33:56 -0700 Subject: [PATCH 13/18] catch clone_repo exception (#225) * catch clone_repo exception * code style Co-authored-by: LorisOnori --- credentialdigger/client.py | 16 +++++++++++----- credentialdigger/scanners/git_scanner.py | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/credentialdigger/client.py b/credentialdigger/client.py index 352d8d4d..7e6770f9 100644 --- a/credentialdigger/client.py +++ b/credentialdigger/client.py @@ -7,6 +7,7 @@ from datetime import datetime, timezone import yaml +from git import GitCommandError from github import Github from rich.progress import Progress @@ -982,11 +983,16 @@ def scan_user(self, username, category=None, models=None, debug=False, # Get repo clone url without .git at the end repo_url = repo.clone_url[:-4] logger.info(f'{i}/{repos_num}) Scanning {repo.url}') - missing_ids[repo_url] = self._scan(repo_url, scanner, - models=models, - debug=debug, - similarity=similarity, - git_token=git_token) + try: + missing_ids[repo_url] = self._scan(repo_url, scanner, + models=models, + debug=debug, + similarity=similarity, + git_token=git_token) + except GitCommandError: + logger.warning(f'{i}/{repos_num} Ignore {repo_url} ' + '(it can not be cloned)') + return missing_ids def scan_wiki(self, repo_url, category=None, models=None, debug=False, diff --git a/credentialdigger/scanners/git_scanner.py b/credentialdigger/scanners/git_scanner.py index 7ec818ca..8ab299cd 100644 --- a/credentialdigger/scanners/git_scanner.py +++ b/credentialdigger/scanners/git_scanner.py @@ -100,6 +100,7 @@ def get_git_repo(self, repo_url, local_repo): GitRepo.clone_from(repo_url, project_path) repo = GitRepo(project_path) except GitCommandError as e: + logger.warning('Repo can not be cloned') shutil.rmtree(project_path) raise e From 5087052fdae402993efde70df206cfc9a266352e Mon Sep 17 00:00:00 2001 From: LorisOnori Date: Mon, 28 Mar 2022 15:36:19 +0200 Subject: [PATCH 14/18] password_model batch mode classify only new discoveries --- credentialdigger/models/password_model.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/credentialdigger/models/password_model.py b/credentialdigger/models/password_model.py index 0da2511d..000793df 100644 --- a/credentialdigger/models/password_model.py +++ b/credentialdigger/models/password_model.py @@ -47,16 +47,18 @@ def analyze_batch(self, discoveries): new_discoveries = [d for d in discoveries if d['state'] == 'new'] no_new_discoveries = [d for d in discoveries if d['state'] != 'new'] # Create a dataset with all the preprocessed (new) snippets - data = self._pre_process([d['snippet'] for d in new_discoveries]) - # data = self._preprocess_batch_data(snippets) - # Compute a prediction for each snippet - outputs = self.model.predict(data) - logits = outputs['logits'] - predictions = tf.argmax(logits, 1) - # Check predictions and set FP discoveries accordingly - for d, p in zip(new_discoveries, predictions): - if p == 0: - d['state'] = 'false_positive' + # process new_discoveries if not empty + if new_discoveries: + data = self._pre_process([d['snippet'] for d in new_discoveries]) + # data = self._preprocess_batch_data(snippets) + # Compute a prediction for each snippet + outputs = self.model.predict(data) + logits = outputs['logits'] + predictions = tf.argmax(logits, 1) + # Check predictions and set FP discoveries accordingly + for d, p in zip(new_discoveries, predictions): + if p == 0: + d['state'] = 'false_positive' return new_discoveries + no_new_discoveries def analyze(self, discovery): From c9f6672b95f00f73ac40c64578664773dfc660ee Mon Sep 17 00:00:00 2001 From: LorisOnori <39842022+LorisOnori@users.noreply.github.com> Date: Mon, 28 Mar 2022 06:39:16 -0700 Subject: [PATCH 15/18] Ignore file not found (#226) Co-authored-by: LorisOnori --- credentialdigger/scanners/file_scanner.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/credentialdigger/scanners/file_scanner.py b/credentialdigger/scanners/file_scanner.py index 8ccf01cb..dacfa049 100644 --- a/credentialdigger/scanners/file_scanner.py +++ b/credentialdigger/scanners/file_scanner.py @@ -169,6 +169,8 @@ def scan_file(self, project_root, relative_path, **kwargs): except UnicodeDecodeError: # Don't scan binary files pass + except FileNotFoundError: + logger.warning(f'Ignore {relative_path} (file not found)') return discoveries def _prune(self, rel_dir_root, dirs, files, max_depth=-1, ignore_list=[]): From f2a8685c6422dedb32496d58780d57ed6cbca113 Mon Sep 17 00:00:00 2001 From: LorisOnori Date: Tue, 29 Mar 2022 17:02:48 +0200 Subject: [PATCH 16/18] code style --- credentialdigger/models/password_model.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/credentialdigger/models/password_model.py b/credentialdigger/models/password_model.py index 000793df..d1325488 100644 --- a/credentialdigger/models/password_model.py +++ b/credentialdigger/models/password_model.py @@ -46,11 +46,10 @@ def analyze_batch(self, discoveries): # We have to classify only the "new" discoveries new_discoveries = [d for d in discoveries if d['state'] == 'new'] no_new_discoveries = [d for d in discoveries if d['state'] != 'new'] - # Create a dataset with all the preprocessed (new) snippets - # process new_discoveries if not empty + # Process new_discoveries if not empty if new_discoveries: + # Create a dataset with all the preprocessed (new) snippets data = self._pre_process([d['snippet'] for d in new_discoveries]) - # data = self._preprocess_batch_data(snippets) # Compute a prediction for each snippet outputs = self.model.predict(data) logits = outputs['logits'] From 4f25f49f0579db1c3e009119ecde989c7d76d790 Mon Sep 17 00:00:00 2001 From: Marco Rosa Date: Wed, 6 Apr 2022 16:59:00 +0200 Subject: [PATCH 17/18] increment version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9a0c1149..df501c9c 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ def requirements(): setuptools.setup( name='credentialdigger', - version='4.6.1', + version='4.7.0', author='SAP SE', maintainer='Marco Rosa, Slim Trabelsi', maintainer_email='marco.rosa@sap.com, slim.trabelsi@sap.com', From a7a8178a18778070f4742d7bdbbb556c782e76ad Mon Sep 17 00:00:00 2001 From: Marco Rosa Date: Fri, 8 Apr 2022 09:46:50 +0200 Subject: [PATCH 18/18] fix requirements for python3.7 --- requirements.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index dc7fecff..ea59d6b8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,13 +9,13 @@ psycopg2-binary PyGithub python-dotenv pyyaml -rich +rich~=12.2 srsly>=2.4.0 tensorflow==2.8.0; python_version >= "3.8" -tensorflow==2.4.*; python_version < "3.8" +tensorflow~=2.4; python_version < "3.8" tensorflow-estimator==2.8.0; python_version >= "3.8" -tensorflow-estimator==2.4.*; python_version < "3.8" +tensorflow-estimator~=2.4; python_version < "3.8" tensorflow-text==2.8.1; python_version >= "3.8" -tensorflow-text==2.4.*; python_version < "3.8" +tensorflow-text~=2.4; python_version < "3.8" tf-models-official transformers