Skip to content
Open
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
102 changes: 101 additions & 1 deletion src/resqui/plugins/openssfscorecard.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class OpenSSFScorecard(IndicatorPlugin):
name = "OpenSSF Scorecard"
id = "https://github.com/ossf/scorecard"
version = "v5.1.1"
version = "v5.4.0"
indicators = [
"has_ci_tests",
"human_code_review_requirement",
Expand Down Expand Up @@ -144,3 +144,103 @@ def has_published_package(self, url, branch_hash_or_tag):
evidence=evidence,
success=success,
)

def project_is_active(self, url, branch_hash_or_tag):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not clarify in the evidence what is being measured.
What does a score 5 mean? We should do a little better, I think.
Here, I think that if the project receives a commit in the last 90 days it receives 1/10.
We can lower the acceptance a bit, with an explanation in evidence.

results = self.execute(url, branch_hash_or_tag)
score = self.get_score(results, "Maintained")
if score >= 5:
output = "true"
evidence = f"Maintained score is 5 or higher ({score})."
success = True
else:
output = "false"
evidence = f"Maintained score is less than 5 ({score})."
success = False

return CheckResult(
process="Calculates the Maintained score.",
status_id="schema:CompletedActionStatus",
output=output,
evidence=evidence,
success=success,
)

def static_analysis_common_vulnerabilities(self, url, branch_hash_or_tag):
results = self.execute(url, branch_hash_or_tag)
score = self.get_score(results, "SAST")
if score >= 5:
output = "true"
evidence = f"SAST score is 5 or higher ({score})."
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please find out what the 5/10 means here. Evidence should clarify it.

success = True
else:
output = "false"
evidence = f"SAST score is less than 5 ({score})."
success = False

return CheckResult(
process="Calculates the SAST score.",
status_id="schema:CompletedActionStatus",
output=output,
evidence=evidence,
success=success,
)

def dependency_management(self, url, branch_hash_or_tag):
results = self.execute(url, branch_hash_or_tag)
score = self.get_score(results, "Dependency-Update-Tool")
if score >= 5:
output = "true"
evidence = f"Dependency-Update-Tool score is 5 or higher ({score})."
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

success = True
else:
output = "false"
evidence = f"Dependency-Update-Tool score is less than 5 ({score})."
success = False

return CheckResult(
process="Calculates the Dependency-Update-Tool score.",
status_id="schema:CompletedActionStatus",
output=output,
evidence=evidence,
success=success,
)

def no_critical_vulnerability(self, url, branch_hash_or_tag):
results = self.execute(url, branch_hash_or_tag)
score = self.get_score(results, "Vulnerabilities")
if score >= 5:
output = "true"
evidence = f"Vulnerabilities score is 5 or higher ({score})."
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

success = True
else:
output = "false"
evidence = f"Vulnerabilities score is less than 5 ({score})."
success = False

return CheckResult(
process="Calculates the Vulnerabilities score.",
status_id="schema:CompletedActionStatus",
output=output,
evidence=evidence,
success=success,
)

def uses_fuzzing(self, url, branch_hash_or_tag):
results = self.execute(url, branch_hash_or_tag)
score = self.get_score(results, "Fuzzing")
if score >= 5:
output = "true"
evidence = f"Fuzzing score is 5 or higher ({score})."
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

success = True
else:
output = "false"
evidence = f"Fuzzing score is less than 5 ({score})."
success = False

return CheckResult(
process="Calculates the Fuzzing score.",
status_id="schema:CompletedActionStatus",
output=output,
evidence=evidence,
success=success,
)
27 changes: 26 additions & 1 deletion src/resqui/plugins/rsfc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class RSFC(IndicatorPlugin):
name = "RSFC"
id = "https://w3id.org/everse/tools/rsfc"
version = "0.1.1"
version = "0.1.5"
image_url = f"docker.io/amonterodx/rsfc:{version}"
indicators = [
"persistent_and_unique_identifier",
Expand All @@ -26,6 +26,7 @@ class RSFC(IndicatorPlugin):
"software_has_tests",
"repository_workflows",
"archived_in_software_heritage",
"has_contribution_guidelines"
]

def __init__(self, context):
Expand Down Expand Up @@ -352,3 +353,27 @@ def archived_in_software_heritage(self, url, branch_hash_or_tag):
check_list.append(check_res)

return check_list

def has_contribution_guidelines(self, url, branch_hash_or_tag):
report = self.execute(url, branch_hash_or_tag)
checks = report["checks"]
check_list = []

for check in checks:
if "has_contribution_guidelines" in check["assessesIndicator"]["@id"]:
if check["output"] == "true":
success = True
else:
success = False

check_res = CheckResult(
process=check["process"],
status_id=check["status"]["@id"],
output=check["output"],
evidence=check["evidence"],
success=success,
)

check_list.append(check_res)

return check_list
Loading