Skip to content

Commit

Permalink
Revert "feat: verify whether the reported repository can be linked ba…
Browse files Browse the repository at this point in the history
…ck to th…"

This reverts commit 3854a85.
  • Loading branch information
mabdollahpour-ol authored Oct 28, 2024
1 parent 3854a85 commit dd23324
Show file tree
Hide file tree
Showing 17 changed files with 1 addition and 946 deletions.
20 changes: 1 addition & 19 deletions src/macaron/artifact/maven.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.

"""This module declares types and utilities for Maven artifacts."""
import re

from collections.abc import Sequence

from packageurl import PackageURL
Expand Down Expand Up @@ -140,21 +140,3 @@ def create_maven_purl_from_artifact_filename(
)

return None


def is_valid_maven_group_id(group_id: str) -> bool:
"""Check if the provided string is a valid maven group id.
Parameters
----------
group_id : str
The group id to check.
Returns
-------
bool
True if the group id is valid, False otherwise
"""
# Should match strings like org.example.foo, org.example-2.foo.bar_1.
pattern = r"^[a-zA-Z][a-zA-Z0-9-]*\.([a-zA-Z][a-zA-Z0-9-]*\.)*[a-zA-Z][a-zA-Z0-9-]*[a-zA-Z0-9]$"
return re.match(pattern, group_id) is not None
37 changes: 0 additions & 37 deletions src/macaron/repo_finder/repo_finder_deps_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
import json
import logging
from enum import StrEnum
from typing import Any
from urllib.parse import quote as encode

from packageurl import PackageURL

from macaron.json_tools import json_extract
from macaron.repo_finder.repo_finder_base import BaseRepoFinder
from macaron.repo_finder.repo_validator import find_valid_repository_url
from macaron.slsa_analyzer.git_url import clean_url
from macaron.util import send_get_http_raw

logger: logging.Logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -73,41 +71,6 @@ def find_repo(self, purl: PackageURL) -> str:

return ""

@staticmethod
def get_project_info(project_url: str) -> dict[str, Any] | None:
"""Retrieve project information from deps.dev.
Parameters
----------
project_url : str
The URL of the project.
Returns
-------
dict[str, Any] | None
The project information or None if the information could not be retrieved.
"""
clean_repo_url = clean_url(project_url)
if clean_repo_url is None or clean_repo_url.hostname is None:
logger.debug("Invalid project url format: %s", project_url)
return None

project_key = clean_repo_url.hostname + clean_repo_url.path

request_url = f"https://api.deps.dev/v3alpha/projects/{encode(project_key, safe='')}"
response = send_get_http_raw(request_url)
if not (response and response.text):
logger.debug("Failed to retrieve additional repo info for: %s", project_url)
return None

try:
response_json: dict = json.loads(response.text)
except ValueError as error:
logger.debug("Failed to parse response from deps.dev: %s", error)
return None

return response_json

def _create_urls(self, purl: PackageURL) -> list[str]:
"""
Create the urls to search for the metadata relating to the passed artifact.
Expand Down
4 changes: 0 additions & 4 deletions src/macaron/repo_verifier/__init__.py

This file was deleted.

75 changes: 0 additions & 75 deletions src/macaron/repo_verifier/repo_verifier.py

This file was deleted.

139 changes: 0 additions & 139 deletions src/macaron/repo_verifier/repo_verifier_base.py

This file was deleted.

Loading

0 comments on commit dd23324

Please sign in to comment.