diff options
author | lhinds <lhinds@redhat.com> | 2017-11-16 17:03:43 +0000 |
---|---|---|
committer | lhinds <lhinds@redhat.com> | 2017-11-16 17:03:43 +0000 |
commit | 21eba438574c13ecd49119ab9a7df882e517f566 (patch) | |
tree | a924ff83757897f24525b66467fd49efadacb590 /anteater/src/project_scan.py | |
parent | 8365245c9dc2f8e2ff2adf8aa84162e420747132 (diff) |
Implements full path for hash checks of binaries
Previously the hash check would work only against the filename,
and not using the relative path.
This change uses the whole relative path to allow indentical
filenames in different folder locations within the same repo.
Also updated the generate-sha256.py script to introduce the same
changes.
JIRA: RELENG-303
Change-Id: I3a59e015b708eb5a966690b9839e5e15ac5b64c7
Signed-off-by: lhinds <lhinds@redhat.com>
Diffstat (limited to 'anteater/src/project_scan.py')
-rw-r--r-- | anteater/src/project_scan.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/anteater/src/project_scan.py b/anteater/src/project_scan.py index 3a04a83..b80b73f 100644 --- a/anteater/src/project_scan.py +++ b/anteater/src/project_scan.py @@ -93,9 +93,10 @@ def scan_file(project_dir, project, binary_list, file_audit_list, # Check if Binary is whitelisted hashlist = get_lists.GetLists() - binary_hash = hashlist.binary_hash(project, full_path) + split_path = full_path.split(project + '/', 1)[-1] + binary_hash = hashlist.binary_hash(project, split_path) - if is_binary(full_path) and not binary_list.search(full_path): + if is_binary(full_path): with open(full_path, 'rb') as afile: buf = afile.read() hasher.update(buf) |