Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nabla-c0d3 committed Nov 24, 2024
1 parent 521375b commit 2853f0e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion tests/test_store_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_online(self):
fetched_store = store_fetcher.fetch(certs_repo)
assert fetched_store
assert 100 < len(fetched_store.trusted_certificates)
assert 6 < len(fetched_store.blocked_certificates)
assert 0 == len(fetched_store.blocked_certificates)


class TestMicrosoftStoreFetcher:
Expand Down
8 changes: 2 additions & 6 deletions trust_stores_observatory/store_fetcher/apple_store_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from urllib.request import urlopen
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from datetime import datetime
from datetime import UTC, datetime

from cryptography.hazmat.primitives import hashes

Expand Down Expand Up @@ -43,11 +43,7 @@ def fetch(self, certs_repo: RootCertificatesRepository, should_update_repo: bool
validated_trusted_certs = RootRecordsValidator.validate_with_repository(certs_repo, parsed_trusted_certs)

return TrustStore(
PlatformEnum.APPLE,
os_version,
trust_store_url,
datetime.utcnow().date(),
validated_trusted_certs
PlatformEnum.APPLE, os_version, trust_store_url, datetime.now(UTC).date(), validated_trusted_certs
)

@staticmethod
Expand Down
6 changes: 3 additions & 3 deletions trust_stores_observatory/store_fetcher/google_aosp_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import os
import stat
from datetime import datetime
from datetime import UTC, datetime

from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
Expand All @@ -24,7 +24,7 @@ class AospTrustStoreFetcher(StoreFetcherInterface):
_REPO_URL = "https://android.googlesource.com/platform/system/ca-certificates"

_GIT_CMD = 'git clone --branch master {repo_url} "{local_path}"'
_GIT_FIND_TAG_CMD = "git tag --sort='version:refname' -l android-1[0-9]*"
_GIT_FIND_TAG_CMD = 'git tag --sort="version:refname" -l android-1[0-9]*'
_GIT_CHECKOUT_TAG_CMD = "git checkout tags/{tag}"

def fetch(self, certs_repo: RootCertificatesRepository, should_update_repo: bool = True) -> TrustStore:
Expand Down Expand Up @@ -78,6 +78,6 @@ def fetch(self, certs_repo: RootCertificatesRepository, should_update_repo: bool
# Finally generate the records
trusted_cert_records = RootRecordsValidator.validate_with_repository(certs_repo, cert_records)

date_fetched = datetime.utcnow().date()
date_fetched = datetime.now(UTC).date()
version = last_tag.split("android-")[1]
return TrustStore(PlatformEnum.GOOGLE_AOSP, version, self._REPO_URL, date_fetched, trusted_cert_records)
4 changes: 2 additions & 2 deletions trust_stores_observatory/store_fetcher/microsoft_fetcher.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
from datetime import UTC, datetime
from typing import Tuple, List
from urllib.request import urlopen

Expand Down Expand Up @@ -32,7 +32,7 @@ def fetch(self, certs_repo: RootCertificatesRepository, should_update_repo: bool
trusted_root_records = RootRecordsValidator.validate_with_repository(certs_repo, scraped_trusted_root_records)
blocked_root_records = RootRecordsValidator.validate_with_repository(certs_repo, scraped_blocked_root_records)

date_fetched = datetime.utcnow().date()
date_fetched = datetime.now(UTC).date()
return TrustStore(
PlatformEnum.MICROSOFT_WINDOWS,
None,
Expand Down
4 changes: 2 additions & 2 deletions trust_stores_observatory/store_fetcher/mozilla_fetcher.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from abc import ABC
from datetime import datetime
from datetime import UTC, datetime
from enum import Enum
from typing import List
from urllib.request import urlopen
Expand Down Expand Up @@ -89,7 +89,7 @@ def fetch(self, certs_repo: RootCertificatesRepository, should_update_repo: bool
PlatformEnum.MOZILLA_NSS,
os_version,
self._PAGE_URL,
datetime.utcnow().date(),
datetime.now(UTC).date(),
trusted_certificates,
blocked_certificates,
)
Expand Down

0 comments on commit 2853f0e

Please sign in to comment.