Skip to content

Commit

Permalink
Merge pull request #101 from advanced-security/dep-update
Browse files Browse the repository at this point in the history
Update and Vendor Dependencies
  • Loading branch information
GeekMasher authored Feb 22, 2024
2 parents c2a9d1f + 46e5f7b commit 81058c0
Show file tree
Hide file tree
Showing 41 changed files with 1,912 additions and 598 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ verify_ssl = true

[packages]
pyyaml = "*"
ghastoolkit = "==0.11.3"
ghastoolkit = "==0.11.9"
semantic-version = "*"

[dev-packages]
Expand Down
613 changes: 124 additions & 489 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vendor/bin/normalizer
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/python/3.10.13/bin/python
#!/home/codespace/.local/share/virtualenvs/policy-as-code-tZI3uR7_/bin/python
# -*- coding: utf-8 -*-
import re
import sys
Expand Down
2 changes: 1 addition & 1 deletion vendor/certifi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .core import contents, where

__all__ = ["contents", "where"]
__version__ = "2023.11.17"
__version__ = "2024.02.02"
92 changes: 64 additions & 28 deletions vendor/certifi/cacert.pem
Original file line number Diff line number Diff line change
Expand Up @@ -245,34 +245,6 @@ mJlglFwjz1onl14LBQaTNx47aTbrqZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK
4SVhM7JZG+Ju1zdXtg2pEto=
-----END CERTIFICATE-----

# Issuer: O=SECOM Trust.net OU=Security Communication RootCA1
# Subject: O=SECOM Trust.net OU=Security Communication RootCA1
# Label: "Security Communication Root CA"
# Serial: 0
# MD5 Fingerprint: f1:bc:63:6a:54:e0:b5:27:f5:cd:e7:1a:e3:4d:6e:4a
# SHA1 Fingerprint: 36:b1:2b:49:f9:81:9e:d7:4c:9e:bc:38:0f:c6:56:8f:5d:ac:b2:f7
# SHA256 Fingerprint: e7:5e:72:ed:9f:56:0e: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K3TGXX8npN6o7WWWXlDLJs58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJU
JRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ6rBK+1YWc26sTfcioU+tHXot
RSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAiFL39vmwLAw==
-----END CERTIFICATE-----

# Issuer: CN=XRamp Global Certification Authority O=XRamp Security Services Inc OU=www.xrampsecurity.com
# Subject: CN=XRamp Global Certification Authority O=XRamp Security Services Inc OU=www.xrampsecurity.com
# Label: "XRamp Global CA Root"
Expand Down Expand Up @@ -4776,3 +4748,67 @@ lklyALKrdVwPaFsdZcJfMw8eD/A7hvWwTruc9+olBdytoptLFwG+Qt81IR2tq670
v64fG9PiO/yzcnMcmyiQiRM9HcEARwmWmjgb3bHPDcK0RPOWlc4yOo80nOAXx17O
rg3bhzjlP1v9mxnhMUF6cKojawHhRUzNlM47ni3niAIi9G7oyOzWPPO5std3eqx7
-----END CERTIFICATE-----

# Issuer: CN=Telekom Security TLS ECC Root 2020 O=Deutsche Telekom Security GmbH
# Subject: CN=Telekom Security TLS ECC Root 2020 O=Deutsche Telekom Security GmbH
# Label: "Telekom Security TLS ECC Root 2020"
# Serial: 72082518505882327255703894282316633856
# MD5 Fingerprint: c1:ab:fe:6a:10:2c:03:8d:bc:1c:22:32:c0:85:a7:fd
# SHA1 Fingerprint: c0:f8:96:c5:a9:3b:01:06:21:07:da:18:42:48:bc:e9:9d:88:d5:ec
# SHA256 Fingerprint: 57:8a:f4:de:d0:85:3f:4e:59:98:db:4a:ea:f9:cb:ea:8d:94:5f:60:b6:20:a3:8d:1a:3c:13:b2:bc:7b:a8:e1
-----BEGIN CERTIFICATE-----
MIICQjCCAcmgAwIBAgIQNjqWjMlcsljN0AFdxeVXADAKBggqhkjOPQQDAzBjMQsw
CQYDVQQGEwJERTEnMCUGA1UECgweRGV1dHNjaGUgVGVsZWtvbSBTZWN1cml0eSBH
bWJIMSswKQYDVQQDDCJUZWxla29tIFNlY3VyaXR5IFRMUyBFQ0MgUm9vdCAyMDIw
MB4XDTIwMDgyNTA3NDgyMFoXDTQ1MDgyNTIzNTk1OVowYzELMAkGA1UEBhMCREUx
JzAlBgNVBAoMHkRldXRzY2hlIFRlbGVrb20gU2VjdXJpdHkgR21iSDErMCkGA1UE
AwwiVGVsZWtvbSBTZWN1cml0eSBUTFMgRUNDIFJvb3QgMjAyMDB2MBAGByqGSM49
AgEGBSuBBAAiA2IABM6//leov9Wq9xCazbzREaK9Z0LMkOsVGJDZos0MKiXrPk/O
tdKPD/M12kOLAoC+b1EkHQ9rK8qfwm9QMuU3ILYg/4gND21Ju9sGpIeQkpT0CdDP
f8iAC8GXs7s1J8nCG6NCMEAwHQYDVR0OBBYEFONyzG6VmUex5rNhTNHLq+O6zd6f
MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMAoGCCqGSM49BAMDA2cA
MGQCMHVSi7ekEE+uShCLsoRbQuHmKjYC2qBuGT8lv9pZMo7k+5Dck2TOrbRBR2Di
z6fLHgIwN0GMZt9Ba9aDAEH9L1r3ULRn0SyocddDypwnJJGDSA3PzfdUga/sf+Rn
27iQ7t0l
-----END CERTIFICATE-----

# Issuer: CN=Telekom Security TLS RSA Root 2023 O=Deutsche Telekom Security GmbH
# Subject: CN=Telekom Security TLS RSA Root 2023 O=Deutsche Telekom Security GmbH
# Label: "Telekom Security TLS RSA Root 2023"
# Serial: 44676229530606711399881795178081572759
# MD5 Fingerprint: bf:5b:eb:54:40:cd:48:71:c4:20:8d:7d:de:0a:42:f2
# SHA1 Fingerprint: 54:d3:ac:b3:bd:57:56:f6:85:9d:ce:e5:c3:21:e2:d4:ad:83:d0:93
# SHA256 Fingerprint: ef:c6:5c:ad:bb:59:ad:b6:ef:e8:4d:a2:23:11:b3:56:24:b7:1b:3b:1e:a0:da:8b:66:55:17:4e:c8:97:86:46
-----BEGIN CERTIFICATE-----
MIIFszCCA5ugAwIBAg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y+TS/qanIA7AgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtqeX
gj10hZv3PJ+TmpV5dVKMbUcwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS2
p5eCPXSFm/c8n5OalXl1UoxtRzANBgkqhkiG9w0BAQwFAAOCAgEAqMxhpr51nhVQ
pGv7qHBFfLp+sVr8WyP6Cnf4mHGCDG3gXkaqk/QeoMPhk9tLrbKmXauw1GLLXrtm
9S3ul0A8Yute1hTWjOKWi0FpkzXmuZlrYrShF2Y0pmtjxrlO8iLpWA1WQdH6DErw
M807u20hOq6OcrXDSvvpfeWxm4bu4uB9tPcy/SKE8YXJN3nptT+/XOR0so8RYgDd
GGah2XsjX/GO1WfoVNpbOms2b/mBsTNHM3dA+VKq3dSDz4V4mZqTuXNnQkYRIer+
CqkbGmVps4+uFrb2S1ayLfmlyOw7YqPta9BO1UAJpB+Y1zqlklkg5LB9zVtzaL1t
xKITDmcZuI1CfmwMmm6gJC3VRRvcxAIU/oVbZZfKTpBQCHpCNfnqwmbU+AGuHrS+
w6jv/naaoqYfRvaE7fzbzsQCzndILIyy7MMAo+wsVRjBfhnu4S/yrYObnqsZ38aK
L4x35bcF7DvB7L6Gs4a8wPfc5+pbrrLMtTWGS9DiP7bY+A4A7l3j941Y/8+LN+lj
X273CXE2whJdV/LItM3z7gLfEdxquVeEHVlNjM7IDiPCtyaaEBRx/pOyiriA8A4Q
ntOoUAw3gi/q4Iqd4Sw5/7W0cwDk90imc6y/st53BIe0o82bNSQ3+pCTE4FCxpgm
dTdmQRCsu/WU48IxK63nI1bMNSWSs1A=
-----END CERTIFICATE-----
6 changes: 6 additions & 0 deletions vendor/certifi/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
This module returns the installation location of cacert.pem or its contents.
"""
import sys
import atexit

def exit_cacert_ctx() -> None:
_CACERT_CTX.__exit__(None, None, None) # type: ignore[union-attr]


if sys.version_info >= (3, 11):
Expand Down Expand Up @@ -35,6 +39,7 @@ def where() -> str:
# we will also store that at the global level as well.
_CACERT_CTX = as_file(files("certifi").joinpath("cacert.pem"))
_CACERT_PATH = str(_CACERT_CTX.__enter__())
atexit.register(exit_cacert_ctx)

return _CACERT_PATH

Expand Down Expand Up @@ -70,6 +75,7 @@ def where() -> str:
# we will also store that at the global level as well.
_CACERT_CTX = get_path("certifi", "cacert.pem")
_CACERT_PATH = str(_CACERT_CTX.__enter__())
atexit.register(exit_cacert_ctx)

return _CACERT_PATH

Expand Down
3 changes: 2 additions & 1 deletion vendor/ghastoolkit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""GitHub Advanced Security Toolkit."""

__name__ = "ghastoolkit"
__title__ = "GHAS Toolkit"

__version__ = "0.11.3"
__version__ = "0.11.9"

__description__ = "GitHub Advanced Security Python Toolkit"
__summary__ = """\
Expand Down
1 change: 1 addition & 0 deletions vendor/ghastoolkit/codeql/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""CodeQL CLI for ghastoolkit."""

import logging
from argparse import Namespace
from ghastoolkit.codeql.cli import CodeQL
Expand Down
1 change: 1 addition & 0 deletions vendor/ghastoolkit/codeql/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This is the CodeQL CLI Module."""

import os
import csv
import json
Expand Down
1 change: 1 addition & 0 deletions vendor/ghastoolkit/codeql/packs/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""GitHub CodeQL Packs CLI."""

import os
import logging
from argparse import Namespace
Expand Down
1 change: 1 addition & 0 deletions vendor/ghastoolkit/codeql/results.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""CodeQL Results."""

from dataclasses import dataclass, field
from typing import Optional

Expand Down
1 change: 1 addition & 0 deletions vendor/ghastoolkit/octokit/advisories.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""GitHub Security Advisories API."""

from typing import Dict, Optional
from ghastoolkit.octokit.github import GitHub, Repository
from ghastoolkit.octokit.octokit import RestRequest
Expand Down
1 change: 1 addition & 0 deletions vendor/ghastoolkit/octokit/codescanning.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""GitHub Code Scanning API Module."""

from dataclasses import dataclass
import json
import logging
Expand Down
1 change: 1 addition & 0 deletions vendor/ghastoolkit/octokit/dependabot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Dependabot API."""

import logging
from typing import Optional

Expand Down
1 change: 1 addition & 0 deletions vendor/ghastoolkit/octokit/dependencygraph.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Dependency Graph Octokit."""

import logging
from typing import Any, Dict
import urllib.parse
Expand Down
21 changes: 19 additions & 2 deletions vendor/ghastoolkit/octokit/github.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""GitHub and Repository APIs."""

import logging
import os
from typing import Dict, Optional, Tuple
Expand All @@ -21,6 +22,13 @@ class GitHub:

repository: Repository = Repository("GeekMasher", "ghastoolkit")
"""Repository"""

owner: Optional[str] = None
"""Owner / Organisation"""

enterprise: Optional[str] = None
"""Enterprise Name"""

token: Optional[str] = None
"""GitHub Access Token"""

Expand All @@ -32,8 +40,8 @@ class GitHub:
api_graphql: str = "https://api.github.com/graphql"
"""GraphQL API URL"""

enterprise: Optional[str] = None
server_version: Optional[Version] = None
"""GitHub Enterprise Server Version"""

github_app: bool = False
"""GitHub App setting"""
Expand All @@ -51,10 +59,14 @@ def init(
retrieve_metadata: bool = True,
) -> None:
"""Initialise a GitHub class using a number of properties."""
if repository:
if repository and "/" in repository:
GitHub.repository = Repository.parseRepository(repository)
GitHub.owner = GitHub.repository.owner
elif repository or owner:
GitHub.owner = owner or repository
elif owner and repo:
GitHub.repository = Repository(owner, repo)
GitHub.owner = owner

if GitHub.repository:
if reference:
Expand Down Expand Up @@ -106,6 +118,11 @@ def display() -> str:
"""Display the GitHub Settings."""
return f"GitHub('{GitHub.repository.display()}', '{GitHub.instance}')"

@staticmethod
def getOrganization() -> str:
"""Get the Organization."""
return GitHub.owner or GitHub.repository.owner

@staticmethod
def getMetaInformation() -> Dict:
"""Get the GitHub Meta Information."""
Expand Down
35 changes: 30 additions & 5 deletions vendor/ghastoolkit/octokit/repository.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import os
import re
import shutil
import logging
import tempfile
import subprocess
from dataclasses import dataclass
Expand All @@ -25,6 +26,9 @@ class Repository:
branch: Optional[str] = None
"""Branch / Tab name"""

path: Optional[str] = None
"""Path inside the repository"""

__prinfo__: Optional[dict] = None

sha: Optional[str] = None
Expand Down Expand Up @@ -231,12 +235,33 @@ def display(self) -> str:

@staticmethod
def parseRepository(name: str) -> "Repository":
"""Parse the repository name."""
"""Parse the repository name into a Repository object.
Samples:
- owner/repo
- owner/repo@branch
- owner/repo:relative/path/in/repo
- owner/repo/relative/path/in/repo
- owner/repo:relative/path/in/repo@branch
"""
ref = None
branch = None
path = None

# validate the repository name
regex = re.compile(
r"^[a-zA-Z0-9-_\.]+/[a-zA-Z0-9-_\.]+((:|/)[a-zA-Z0-9-_/\.]+)?(@[a-zA-Z0-9-_/]+)?$"
)
if not regex.match(name):
raise SyntaxError(f"Invalid repository name: '{name}'")

if "@" in name:
name, branch = name.split("@", 1)
ref = f"refs/heads/{branch}"

owner, repo = name.split("/", 1)
return Repository(owner, repo, reference=ref, branch=branch)
if ":" in name:
name, path = name.split(":", 1)
if name.count("/") > 1:
owner, repo, path = name.split("/", 2)
else:
owner, repo = name.split("/", 1)
return Repository(owner, repo, reference=ref, branch=branch, path=path)
2 changes: 1 addition & 1 deletion vendor/ghastoolkit/secretscanning/secretalerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def commit_sha(self) -> Optional[str]:
if self._sha is None:
for loc in self.locations:
if loc.get("type") == "commit":
self._sha = loc.get("details", {}).get("blob_sha")
self._sha = loc.get("details", {}).get("commit_sha")
break
return self._sha

Expand Down
20 changes: 10 additions & 10 deletions vendor/ghastoolkit/supplychain/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Supply Chain Toolkit CLI."""

from argparse import Namespace
import logging

Expand Down Expand Up @@ -54,18 +55,17 @@ def runOrgAudit(arguments):


class SupplyChainCLI(CommandLine):
def set_modes(self):
"""Return a list of supplychain modes."""
self.modes.extend(["org-audit"])

def arguments(self):
"""CLI for Supply Chain Toolkit."""
parser = self.parser.add_argument_group("supplychain")
parser.add_argument(
"--licenses",
default="GPL-*,AGPL-*,LGPL-*",
help="License(s) to check for (default: 'GPL-*,AGPL-*,LGPL-*')",
)
if self.subparser:
self.addModes(["org-audit"])

parser = self.parser.add_argument_group("supplychain")
parser.add_argument(
"--licenses",
default="GPL-*,AGPL-*,LGPL-*",
help="License(s) to check for (default: 'GPL-*,AGPL-*,LGPL-*')",
)

def run(self, arguments: Namespace):
"""Run Supply Chain Toolkit."""
Expand Down
3 changes: 3 additions & 0 deletions vendor/ghastoolkit/supplychain/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ def __str__(self) -> str:
def __repr__(self) -> str:
return self.getPurl()

def __hash__(self) -> int:
return hash(self.getPurl())


class Dependencies(list[Dependency]):
"""List of Dependencies."""
Expand Down
8 changes: 5 additions & 3 deletions vendor/ghastoolkit/utils/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ def default_logger(self):
"""Setup default logger."""
arguments = self.parse_args()
logging.basicConfig(
level=logging.DEBUG
if arguments.debug or os.environ.get("DEBUG")
else logging.INFO,
level=(
logging.DEBUG
if arguments.debug or os.environ.get("DEBUG")
else logging.INFO
),
format="%(message)s",
)

Expand Down
Loading

0 comments on commit 81058c0

Please sign in to comment.