Skip to content

Commit 0da77e9

Browse files
chore: rename repo_verification_check to scm_authenticity_check
Signed-off-by: Mohammad Abdollahpour <[email protected]>
1 parent c7c6a4c commit 0da77e9

File tree

9 files changed

+28
-28
lines changed

9 files changed

+28
-28
lines changed

docs/source/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ the requirements that are currently supported by Macaron.
8989
* - ``mcn_provenance_derived_commit_1``
9090
- **Provenance derived commit** - Check if the analysis target's commit matches the commit in the provenance.
9191
- If there is no commit, this check will fail.
92-
* - ``mcn_repo_verification_1``
93-
- **Source version controlled** - Check if every change to the source is tracked in a version control system.
94-
- If the claimed source repository provenance made by a package is not verified, this check will fail. If no claim of a source repository could be found or the build system is not supported, the result of the check will be "unknown".
92+
* - ``mcn_scm_authenticity_check_1``
93+
- **Source repo authenticity** - Check whether the claims of a source repository provenance made by a package can be corroborated.
94+
- If the source code repository contains conflicting evidence regarding its claim of provenance, this check will fail. If no source repository or corroborating evidence is found, or if the build system is unsupported, the check will return UNKNOWN as the result. This check currently supports only Maven artifacts.
9595

9696
****************************************************************************************
9797
Macaron checks that report integrity issues but do not map to SLSA requirements directly

docs/source/pages/developers_guide/apidoc/macaron.slsa_analyzer.checks.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ macaron.slsa\_analyzer.checks.provenance\_witness\_l1\_check module
121121
:undoc-members:
122122
:show-inheritance:
123123

124-
macaron.slsa\_analyzer.checks.repo\_verification\_check module
125-
--------------------------------------------------------------
124+
macaron.slsa\_analyzer.checks.scm\_authenticity\_check module
125+
-------------------------------------------------------------
126126

127-
.. automodule:: macaron.slsa_analyzer.checks.repo_verification_check
127+
.. automodule:: macaron.slsa_analyzer.checks.scm_authenticity_check
128128
:members:
129129
:undoc-members:
130130
:show-inheritance:

src/macaron/slsa_analyzer/checks/repo_verification_check.py renamed to src/macaron/slsa_analyzer/checks/scm_authenticity_check.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
logger: logging.Logger = logging.getLogger(__name__)
2020

2121

22-
class RepoVerificationFacts(CheckFacts):
23-
"""The ORM mapping for justifications in repo verification check."""
22+
class ScmAuthenticityFacts(CheckFacts):
23+
"""The ORM mapping for justifications in scm authenticity check."""
2424

25-
__tablename__ = "_repo_verification_check"
25+
__tablename__ = "_scm_authenticity_check"
2626

2727
#: The primary key.
2828
id: Mapped[int] = mapped_column(ForeignKey("_check_facts.id"), primary_key=True) # noqa: A003
@@ -50,19 +50,19 @@ class RepoVerificationFacts(CheckFacts):
5050
build_tool: Mapped[str] = mapped_column(String, nullable=False, info={"justification": JustificationType.TEXT})
5151

5252
__mapper_args__ = {
53-
"polymorphic_identity": "_repo_verification_check",
53+
"polymorphic_identity": __tablename__,
5454
}
5555

5656

57-
class RepoVerificationCheck(BaseCheck):
58-
"""Check whether the claims of a source repository provenance made by a package can be independently verified."""
57+
class ScmAuthenticityCheck(BaseCheck):
58+
"""Check whether the claims of a source repository provenance made by a package can be corroborated."""
5959

6060
def __init__(self) -> None:
6161
"""Initialize a check instance."""
62-
check_id = "mcn_repo_verification_1"
62+
check_id = "mcn_scm_authenticity_1"
6363
description = (
6464
"Check whether the claims of a source repository provenance"
65-
" made by a package can be independently verified."
65+
" made by a package can be corroborated."
6666
" At this moment, this check only supports Maven packages"
6767
" and returns UNKNOWN for others."
6868
)
@@ -106,7 +106,7 @@ def run_check(self, ctx: AnalyzeContext) -> CheckResultData:
106106
result_tables: list[CheckFacts] = []
107107
for verification_result in ctx.dynamic_data.get("repo_verification", []):
108108
result_tables.append(
109-
RepoVerificationFacts(
109+
ScmAuthenticityFacts(
110110
repo_link=repo_link,
111111
reason=verification_result.reason,
112112
status=verification_result.status.value,
@@ -126,4 +126,4 @@ def run_check(self, ctx: AnalyzeContext) -> CheckResultData:
126126
return CheckResultData(result_tables=result_tables, result_type=result_type)
127127

128128

129-
registry.register(RepoVerificationCheck())
129+
registry.register(ScmAuthenticityCheck())

tests/integration/cases/repo_verification/config.ini renamed to tests/integration/cases/scm_authenticity/config.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
[analysis.checks]
55
exclude =
6-
include = mcn_repo_verification_1
6+
include = mcn_scm_authenticity_1

tests/integration/cases/repo_verification/policy_fail_1.dl renamed to tests/integration/cases/scm_authenticity/policy_fail_1.dl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "prelude.dl"
55

66
Policy("test_policy", component_id, "") :-
7-
check_failed(component_id, "mcn_repo_verification_1").
7+
check_failed(component_id, "mcn_scm_authenticity_1").
88

99
apply_policy_to("test_policy", component_id) :-
1010
is_component(component_id, "pkg:maven/com.alibaba.ververica/[email protected]").

tests/integration/cases/repo_verification/policy_pass_1.dl renamed to tests/integration/cases/scm_authenticity/policy_pass_1.dl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "prelude.dl"
55

66
Policy("test_policy", component_id, "") :-
7-
check_passed(component_id, "mcn_repo_verification_1").
7+
check_passed(component_id, "mcn_scm_authenticity_1").
88

99
apply_policy_to("test_policy", component_id) :-
1010
is_component(component_id, "pkg:maven/org.antlr/[email protected]").

tests/integration/cases/repo_verification/policy_pass_2.dl renamed to tests/integration/cases/scm_authenticity/policy_pass_2.dl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "prelude.dl"
55

66
Policy("test_policy", component_id, "") :-
7-
check_passed(component_id, "mcn_repo_verification_1").
7+
check_passed(component_id, "mcn_scm_authenticity_1").
88

99
apply_policy_to("test_policy", component_id) :-
1010
is_component(component_id, "pkg:maven/org.neo4j/[email protected]").

tests/integration/cases/repo_verification/test.yaml renamed to tests/integration/cases/scm_authenticity/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
33

44
description: |
5-
Integration tests for mcn_repo_verification_1 check.
5+
Integration tests for mcn_scm_authenticity_1 check.
66
77
tags:
88
- macaron-python-package

tests/slsa_analyzer/checks/test_repo_verification_check.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from macaron.repo_verifier.repo_verifier_base import RepositoryVerificationResult, RepositoryVerificationStatus
99
from macaron.slsa_analyzer.build_tool.base_build_tool import BaseBuildTool
1010
from macaron.slsa_analyzer.checks.check_result import CheckResultType
11-
from macaron.slsa_analyzer.checks.repo_verification_check import RepoVerificationCheck
11+
from macaron.slsa_analyzer.checks.scm_authenticity_check import ScmAuthenticityCheck
1212
from macaron.slsa_analyzer.package_registry import PyPIRegistry
1313
from macaron.slsa_analyzer.package_registry.maven_central_registry import MavenCentralRegistry
1414
from macaron.slsa_analyzer.specs.package_registry_spec import PackageRegistryInfo
@@ -19,7 +19,7 @@
1919

2020
def test_repo_verification_pass(maven_tool: BaseBuildTool, macaron_path: Path) -> None:
2121
"""Test that the check passes when the repository is verified."""
22-
check = RepoVerificationCheck()
22+
check = ScmAuthenticityCheck()
2323

2424
ctx = MockAnalyzeContext(macaron_path=macaron_path, output_dir="", purl="pkg:maven/test/test")
2525
maven_registry = MavenCentralRegistry()
@@ -37,7 +37,7 @@ def test_repo_verification_pass(maven_tool: BaseBuildTool, macaron_path: Path) -
3737

3838
def test_repo_verification_fail(maven_tool: BaseBuildTool, macaron_path: Path) -> None:
3939
"""Test that the check fails when the repository verification is failed."""
40-
check = RepoVerificationCheck()
40+
check = ScmAuthenticityCheck()
4141

4242
ctx = MockAnalyzeContext(macaron_path=macaron_path, output_dir="", purl="pkg:maven/test/test")
4343
maven_registry = MavenCentralRegistry()
@@ -53,9 +53,9 @@ def test_repo_verification_fail(maven_tool: BaseBuildTool, macaron_path: Path) -
5353
assert check.run_check(ctx).result_type == CheckResultType.FAILED
5454

5555

56-
def test_repo_verification_unknown_for_unknown_repo_verification(maven_tool: BaseBuildTool, macaron_path: Path) -> None:
56+
def test_check_unknown_for_unknown_repo_verification(maven_tool: BaseBuildTool, macaron_path: Path) -> None:
5757
"""Test that the check returns unknown when the repository verification is unknown."""
58-
check = RepoVerificationCheck()
58+
check = ScmAuthenticityCheck()
5959

6060
ctx = MockAnalyzeContext(macaron_path=macaron_path, output_dir="", purl="pkg:maven/test/test")
6161
maven_registry = MavenCentralRegistry()
@@ -71,9 +71,9 @@ def test_repo_verification_unknown_for_unknown_repo_verification(maven_tool: Bas
7171
assert check.run_check(ctx).result_type == CheckResultType.UNKNOWN
7272

7373

74-
def test_repo_verification_unknown_for_unsupported_build_tools(pip_tool: BaseBuildTool, macaron_path: Path) -> None:
74+
def test_check_unknown_for_unsupported_build_tools(pip_tool: BaseBuildTool, macaron_path: Path) -> None:
7575
"""Test that the check returns unknown for unsupported build tools."""
76-
check = RepoVerificationCheck()
76+
check = ScmAuthenticityCheck()
7777

7878
ctx = MockAnalyzeContext(macaron_path=macaron_path, output_dir="", purl="pkg:pypi/test/test")
7979
pypi_registry = PyPIRegistry()

0 commit comments

Comments
 (0)