Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "feat: verify whether the reported repository can be linked back to the artifact" #912

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading