Skip to content

Commit

Permalink
Uses security.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Nov 1, 2024
1 parent 66684d7 commit ab8b8e7
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 13 deletions.
6 changes: 3 additions & 3 deletions github_app_geo_project/module/audit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import urllib.parse
from typing import Any, cast

import c2cciutils.security
import github
import security_md
import yaml
from pydantic import BaseModel

Expand Down Expand Up @@ -108,7 +108,7 @@ def _process_outdated(
try:
security_file = repo.get_contents("SECURITY.md")
assert isinstance(security_file, github.ContentFile.ContentFile)
security = c2cciutils.security.Security(security_file.decoded_content.decode("utf-8"))
security = security_md.Security(security_file.decoded_content.decode("utf-8"))

error_message = audit_utils.outdated_versions(security)
_process_error(context, _OUTDATED, issue_check, error_message)
Expand Down Expand Up @@ -445,7 +445,7 @@ async def process(
versions = []
if security_file is not None:
assert isinstance(security_file, github.ContentFile.ContentFile)
security = c2cciutils.security.Security(security_file.decoded_content.decode("utf-8"))
security = security_md.Security(security_file.decoded_content.decode("utf-8"))

versions = module_utils.get_stabilization_versions(security)
else:
Expand Down
4 changes: 2 additions & 2 deletions github_app_geo_project/module/audit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from typing import NamedTuple

import apt_repo
import c2cciutils.security
import debian_inspector.version
import security_md
import yaml # nosec

from github_app_geo_project import models, utils
Expand Down Expand Up @@ -605,7 +605,7 @@ async def _npm_audit_fix(


def outdated_versions(
security: c2cciutils.security.Security,
security: security_md.Security,
) -> list[str | models.OutputData]:
"""
Check that the versions from the SECURITY.md are not outdated.
Expand Down
6 changes: 3 additions & 3 deletions github_app_geo_project/module/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import subprocess # nosec
from typing import Any, Union, cast

import c2cciutils.security
import github
import html_sanitizer
import markdownify
import security_md
from ansi2html import Ansi2HTMLConverter

from github_app_geo_project import configuration, models, module
Expand Down Expand Up @@ -796,7 +796,7 @@ def git_clone(github_project: configuration.GithubProject, branch: str) -> bool:
return True


def get_stabilization_versions(security: c2cciutils.security.Security) -> list[str]:
def get_stabilization_versions(security: security_md.Security) -> list[str]:
"""Get the stabilization versions."""
version_index = security.version_index
supported_until_index = security.support_until_index
Expand All @@ -819,7 +819,7 @@ def get_stabilization_versions(security: c2cciutils.security.Security) -> list[s
return [v for v in versions if v not in alternate_tags]


def get_alternate_versions(security: c2cciutils.security.Security, branch: str) -> list[str]:
def get_alternate_versions(security: security_md.Security, branch: str) -> list[str]:
"""Get the stabilization versions."""
alternate_index = security.alternate_tag_index
version_index = security.version_index
Expand Down
5 changes: 2 additions & 3 deletions github_app_geo_project/module/versions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
from typing import Any

import c2cciutils.configuration
import c2cciutils.security
import github
import requests
import security_md
import toml
import yaml
from pydantic import BaseModel

from github_app_geo_project import module, utils
Expand Down Expand Up @@ -181,7 +180,7 @@ async def process(
raise
if security_file is not None:
assert isinstance(security_file, github.ContentFile.ContentFile)
security = c2cciutils.security.Security(security_file.decoded_content.decode("utf-8"))
security = security_md.Security(security_file.decoded_content.decode("utf-8"))

stabilization_versions = module_utils.get_stabilization_versions(security)
else:
Expand Down
18 changes: 17 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ delete-old-workflow-runs = "github_app_geo_project.module.delete_old_workflow_ru
[tool.poetry.dependencies]
python = ">=3.10,<3.13"
c2cwsgiutils = { version = "6.0.8", extras = ["standard", "debug", "dev"] }
c2cciutils = "1.6.23"
"security.md" = "0.2.3"
pyramid-mako = "1.1.0"
jsonmerge = "1.9.2"
pygithub = "2.4.0"
markdown = "3.7"
pygments = "2.18.0"
html-sanitizer = "2.4.4"
ansi2html = "1.9.2"
c2cciutils = "1.6.23"
apt-repo = "0.5"
debian-inspector = "31.1.0"
codespell = "2.3.0"
Expand Down

0 comments on commit ab8b8e7

Please sign in to comment.