Skip to content

Commit 6b998d1

Browse files
committed
Vendor in latest safety==3.3.1
1 parent 9bb520b commit 6b998d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+17231
-1037
lines changed

pipenv/patched/pip/LICENSE-HEADER

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-License-Identifier: MIT
2+
SPDX-FileCopyrightText: 2021 Taneli Hukkinen
3+
Licensed to PSF under a Contributor Agreement.

pipenv/patched/safety/LICENSE

-11
This file was deleted.

pipenv/patched/safety/MIT.txt

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
MIT License
2+
3+
Copyright (c) 2016 Safety CLI Cybersecurity Inc
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
6+
associated documentation files (the "Software"), to deal in the Software without restriction, including
7+
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
9+
following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all copies or substantial
12+
portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15+
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
16+
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
18+
USE OR OTHER DEALINGS IN THE SOFTWARE.

pipenv/patched/safety/NOTICE.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Package Licenses
2+
3+
| Name | Version | License |
4+
|------|---------|----------|
5+
| annotated-types | 0.7.0 | MIT License |
6+
| authlib | 1.4.0 | BSD-3-Clause |
7+
| certifi | 2024.12.14 | MPL-2.0 |
8+
| cffi | 1.17.1 | MIT |
9+
| charset-normalizer | 3.4.1 | MIT |
10+
| click | 8.1.8 | BSD License |
11+
| cryptography | 44.0.0 | Apache-2.0 OR BSD-3-Clause |
12+
| dparse | 0.6.4 | MIT license |
13+
| filelock | 3.16.1 | Unlicense |
14+
| idna | 3.10 | BSD License |
15+
| jinja2 | 3.1.5 | BSD License |
16+
| joblib | 1.4.2 | BSD 3-Clause |
17+
| markdown-it-py | 3.0.0 | MIT License |
18+
| markupsafe | 3.0.2 | BSD License |
19+
| marshmallow | 3.23.3 | MIT License |
20+
| mdurl | 0.1.2 | MIT License |
21+
| nltk | 3.9.1 | Apache License, Version 2.0 |
22+
| packaging | 24.2 | Apache Software License |
23+
| psutil | 6.1.1 | BSD-3-Clause |
24+
| pycparser | 2.22 | BSD-3-Clause |
25+
| pydantic | 2.9.2 | MIT |
26+
| pydantic-core | 2.23.4 | MIT |
27+
| pygments | 2.18.0 | BSD-2-Clause |
28+
| regex | 2024.11.6 | Apache Software License |
29+
| requests | 2.32.3 | Apache-2.0 |
30+
| rich | 13.9.4 | MIT |
31+
| ruamel-yaml | 0.18.8 | MIT license |
32+
| ruamel-yaml-clib | 0.2.12 | MIT |
33+
| safety | 3.3.0 | MIT |
34+
| safety-schemas | 0.0.11 | MIT |
35+
| setuptools | 75.8.0 | MIT License |
36+
| shellingham | 1.5.4 | ISC License |
37+
| tqdm | 4.67.1 | MPL-2.0 AND MIT |
38+
| typer | 0.15.1 | MIT License |
39+
| typing-extensions | 4.12.2 | Python Software Foundation License |
40+
| urllib3 | 2.3.0 | MIT License |

pipenv/patched/safety/VERSION

-1
This file was deleted.

pipenv/patched/safety/__init__.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
# -*- coding: utf-8 -*-
22

3-
__author__ = """pyup.io"""
4-
__email__ = '[email protected]'
5-
6-
import os
7-
8-
ROOT = os.path.dirname(os.path.abspath(__file__))
9-
10-
with open(os.path.join(ROOT, 'VERSION')) as version_file:
11-
VERSION = version_file.read().strip()
3+
__author__ = """safetycli.com"""
4+
__email__ = '[email protected]'

pipenv/patched/safety/__main__.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
"""Allow safety to be executable through `python -m safety`."""
2-
from __future__ import absolute_import
3-
42
from pipenv.patched.safety.cli import cli
53

64

+46-7
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,72 @@
1+
import logging
12
import sys
23
import json
3-
from typing import Any
4+
from typing import Any, IO
45
import pipenv.vendor.click as click
56

67
from dataclasses import dataclass
78

9+
from pipenv.patched.safety.constants import CONTEXT_COMMAND_TYPE
10+
811
from . import github
912
from pipenv.patched.safety.util import SafetyPolicyFile
13+
from pipenv.patched.safety.scan.constants import CLI_ALERT_COMMAND_HELP
14+
15+
LOG = logging.getLogger(__name__)
16+
17+
18+
def get_safety_cli_legacy_group():
19+
from pipenv.patched.safety.cli_util import SafetyCLILegacyGroup
20+
return SafetyCLILegacyGroup
21+
22+
def get_context_settings():
23+
from pipenv.patched.safety.cli_util import CommandType
24+
return {CONTEXT_COMMAND_TYPE: CommandType.UTILITY}
1025

1126
@dataclass
1227
class Alert:
28+
"""
29+
Data class for storing alert details.
30+
31+
Attributes:
32+
report (Any): The report data.
33+
key (str): The API key for the safetycli.com vulnerability database.
34+
policy (Any): The policy data.
35+
requirements_files (Any): The requirements files data.
36+
"""
1337
report: Any
1438
key: str
1539
policy: Any = None
1640
requirements_files: Any = None
1741

18-
@click.group(help="Send alerts based on the results of a Safety scan.")
19-
@click.option('--check-report', help='JSON output of Safety Check to work with.', type=click.File('r'), default=sys.stdin)
20-
@click.option("--policy-file", type=SafetyPolicyFile(), default='.safety-policy.yml',
21-
help="Define the policy file to be used")
42+
@click.group(cls=get_safety_cli_legacy_group(), help=CLI_ALERT_COMMAND_HELP,
43+
deprecated=True, context_settings=get_context_settings())
44+
@click.option('--check-report', help='JSON output of Safety Check to work with.', type=click.File('r'), default=sys.stdin, required=True)
2245
@click.option("--key", envvar="SAFETY_API_KEY",
23-
help="API Key for pyup.io's vulnerability database. Can be set as SAFETY_API_KEY "
46+
help="API Key for safetycli.com's vulnerability database. Can be set as SAFETY_API_KEY "
2447
"environment variable.", required=True)
48+
@click.option("--policy-file", type=SafetyPolicyFile(), default='.safety-policy.yml',
49+
help="Define the policy file to be used")
2550
@click.pass_context
26-
def alert(ctx, check_report, policy_file, key):
51+
def alert(ctx: click.Context, check_report: IO[str], policy_file: SafetyPolicyFile, key: str) -> None:
52+
"""
53+
Command for processing the Safety Check JSON report.
54+
55+
Args:
56+
ctx (click.Context): The Click context object.
57+
check_report (IO[str]): The file containing the JSON report.
58+
policy_file (SafetyPolicyFile): The policy file to be used.
59+
key (str): The API key for the safetycli.com vulnerability database.
60+
"""
61+
LOG.info('alert started')
62+
LOG.info(f'check_report is using stdin: {check_report == sys.stdin}')
63+
2764
with check_report:
2865
# TODO: This breaks --help for subcommands
2966
try:
3067
safety_report = json.load(check_report)
3168
except json.decoder.JSONDecodeError as e:
69+
LOG.info('Error in the JSON report.')
3270
click.secho("Error decoding input JSON: {}".format(e.msg), fg='red')
3371
sys.exit(1)
3472

@@ -38,5 +76,6 @@ def alert(ctx, check_report, policy_file, key):
3876

3977
ctx.obj = Alert(report=safety_report, policy=policy_file if policy_file else {}, key=key)
4078

79+
# Adding subcommands for GitHub integration
4180
alert.add_command(github.github_pr)
4281
alert.add_command(github.github_issue)

0 commit comments

Comments
 (0)