Skip to content

Update dependency safety to v3

Tine Wittler requested to merge renovate/safety-3.x into master

This MR contains the following updates:

Package Type Update Change
safety dev-dependencies major ^1.9.0 -> ^3.0.0

Release Notes

pyupio/safety

v3.1.0

Compare Source

  • fix: ensure compatibility with Pydantic version 2.0 (#​509)
  • feat: introduce --headless flag to enable an alternative login mechanism that bypasses the need for a local web server. (#​508)

v3.0.1

Compare Source

  • fix: add back the license legacy cmd (#​498)
  • perf: unpin authlib and remove jwt

v3.0.0

Compare Source

Safety 3.0.0 major version release!
Main updates
  • Added scan command, which scans a project’s directory for all Python dependencies and includes many improvements over the check command, including automatic Python project scanning, native support for Poetry and Pipenv files, Python virtual environment folders, and more granular configuration options.
  • Added auth commands, enabling new browser-based authentication of Safety CLI.
  • An updated safety policy file schema to support new scan and system-scan commands. This policy file schema is a breaking change from the policy schema used for safety check. To migrate a Safety 2.x policy, see Migrating from Safety 2.x to Safety CLI 3.
  • Updated screen output to modern interactive interface, with new help interfaces.
  • Updated to new JSON output structure to support new scan command, other ecosystems, and other security findings.
  • Added a supporting safety-schemas project dependency, also published and maintained by Safety, which defines Safety vulnerability database file, Safety CLI policy file, and Safety CLI JSON output schemas as pydantic models, formalizing these into testable and versioned schemas.
New scan command:
  • New scan command: scans a Python project directory for Python dependencies and security vulnerabilities. Safety scan replaces safety check with a more powerful and easier to use command. The scan command:
  • Finds and scans Python dependency files and virtual environments inside the target directory without needing to specify file or environment locations.
  • Adds native scanning and reporting for Poetry and Pipenv manifest files, and Python virtual environment folders.
  • Adds configuration of scanning rules to;
    • exclude files and folders from the scan using Unix shell-style wildcards only
    • Include files to be scanned
    • Max folder depth setting
  • Reporting configuration rules
    • Reporting rules defining which types and specific vulnerabilities to include or ignore stay the same as safety 2.x, although now in a slightly different structure.
  • Failing rules
    • Adds ability to configure rules for when safety should return a non-zero (failing) exit code, which can be different from reporting rules under the report field.
  • Auto-updating rules
    • Adds ability to easily update insecure package versions in pip requirements files.
Other new commands:
  • Added auth command: manages Safety CLI’s authentication in development environments, allowing easy authentication via the browser.
    • auth login - adds ability to authenticate safety cli via the browser
    • auth register - adds ability to register for a Safety account via the CLI, and get scanning within minutes
    • auth status -
    • auth logout -
    • safety check command can still be used with the API key --key argument, and scan and system-scan commands should also be
  • Added configure command: configures safety cli using a config.ini file, either saved to the user settings or system settings. This can be used to configure safety’s authentication methods and global proxy details.
  • Added system-scan command (beta): Adds the system-scan command, which scans a machine for Python files and environments, reporting these to screen output. system-scan is an experimental beta feature that can scan an entire drive or machine for Python dependency files and Python virtual environments, reporting on packages found and their associated security vulnerabilities.
  • Added check-updates command: Check for version updates to Safety CLI, and supports screen and JSON format outputs. Can be used in organizations to test and rollout new version updates as recommended by Safety Cybersecurity.
New policy file schema for scan and system-scan commands
  • New policy file schema to support safety scan and safety system-scan. Adds scanning-settings root property, which contains settings to configure rules and settings for how safety traverses the directory and subdirectories being scanned, including “exclude” rules, “include” rules, the max directory depth to scan and which root directories safety system-scan should start from.
  • Adds report root property, which defines which vulnerability findings safety should auto-ignore (exclude) in its reporting. Supports excluding vulnerability IDs manually, as well as vulnerability groups to ignore based on CVSS severity score.
  • Adds new fail-scan-with-exit-code root property, which defines when safety should exit with a failing exit code. This separates safety’s reporting rules from its failing exit code rules, which is a departure from Safety 2.x which had combined rulesets for these. Failing exit codes can be configured based on CVSS severity score.
  • Note that the old safety check command still supports and relies on the policy schema from safety 2.3.5 and below, meaning no changes are required when migrating to safety 2.x to Safety 3.0.0 when only using the safety check command.
New global options and configurations
  • Added global --stage option, to set the development lifecycle stage for the scan and system-scan commands.
  • Added global --key option, to set a Safety API key for any command, including scan, system-scan and check.
Other
  • Safety now requires Python>=3.7. Python 3.7 doesn't have active security support from the Python foundation, and we recommend upgrading to at least Python >= 3.8 whenever possible. Safety’s 3.0.0 Docker image can still be used to scan and secure all Python projects, regardless of Python version. Refer to our Documentation for details.
  • Dropped support for the license command. This legacy command is being replaced by the scan command. Users relying on the license command should continue to use Safety 2.3.5 or 2.4.0b2 until Safety 3 adds license support in an upcoming 3.0.x release.
  • Add deprecation notice to safety check command, since this is now replaced by safety scan, a more comprehensive scanning command. The check command will continue receiving maintenance support until June 2024.
  • Add deprecation notice to safety alert command, which works in tandem with the safety check command. Safety alert functionality is replaced by Safety Platform. The alert command will continue receiving maintenance support until June 2024.
  • safety validate will assume 3.0 policy file version by default.
Small updates/ bug fixes

v2.3.5

Compare Source

  • Pinned packaging dependency to a compatible range.
  • Pinned the CI actions to the runner image with Python 3.6 support.

v2.3.4

Compare Source

  • Removed LegacyVersion use; this fixes the issue with packaging 22.0.
  • Fixed typos in the README.
  • Added Python 3.11 to the classifiers in the setup.cfg.

v2.3.3

Compare Source

  • Fixed recursive requirements issue when an unpinned package is found.

v2.3.2

Compare Source

  • Fixed #​423: Bare output includes extra line in non-screen output with no vulnerabilities.
  • Fixed #​422: ResourceWarning (unclosed socket) in safety v.2.3.1.
  • Fixed telemetry data missing when the CLI mode is used.
  • Fixed wrong database fetching when the KEY and the database arguments are used at the same time.
  • Added SAFETY_PURE_YAML env var, used for cases that require pure Python in the YAML parser.

v2.3.1

Compare Source

  • Add safety.alerts module to setup.cfg

v2.3.0

Compare Source

  • Safety can now create GitHub MRs and Issues for vulnerabilities directly, with the new safety alert subcommand.
  • Support for GitHub MR and Issue alerting has been added to the GitHub Action.

v2.2.1

Compare Source

  • Fixed the use of the SAFETY_COLOR environment variable
  • Fixed bug in the case of vulnerabilities without a CVE linked
  • Fixed GitHub version in the README

v2.2.0

Compare Source

  • Safety starts to use dparse to parse files, now Safety supports mainly Poetry and Pipenv lock files plus other files supported by dparse.
  • Added logic for custom integrations like pipenv check.
  • The --db flag is compatible remote sources too.
  • Added more logging
  • Upgrade dparse dependency to avoid a possible ReDos security issue
  • Removed Travis and Appveyor, the CI/CD was migrated to GitHub Actions

v2.1.1

Compare Source

  • Fix crash when running on systems without git present (Thanks @​andyjones)

v2.1.0

Compare Source

Summary:
  • Improved error messages & fixed issues with proxies
  • Fixed license command
  • Added the ability for scan outputs to be sent to pyup.io. This will only take effect if using an API key, the feature is enabled on your profile, and the --disable-audit-and-monitor is not set
  • Added the ability to have a Safety policy file set centrally on your pyup.io profile. This remote policy file will be used if there's no local policy file present, otherwise a warning will be issued.
Updated outputs:
  • Text & screen output: If a scan has been logged, this is now mentioned in the output.
  • JSON output: The JSON output now includes git metadata about the folder Safety was run in. It also includes a version field, and telemetry information that would be sent separately. There are no breaking changes in the output.
New inputs:
  • New command line flags
    • The --disable-audit-and-monitor flag can be set to disable sending a scan's result to pyup.io
    • The --project flag can be set to manually specify a project to associate these scans with. By default, it'll autodetect based on the current folder and git.

v2.0.0

Compare Source

Summary:
  • Compared to previous versions, Safety 2.0 will be a significant update that includes new features and refactors, resulting in breaking changes to some inputs and outputs.
Updated outputs:
  • Text & screen output: Upgraded the text and screen outputs, removing the old table style and adding new data and formats to vulnerabilities.
  • JSON output: New and updated JSON output (breaking change). Safety adds all the possible information in the JSON report. The structure of this JSON file has been improved.
  • Improved the support for exit codes. There are now custom exit codes with detailed information about the result. Examples include: VULNERABILITIES_FOUND and INVALID_API_KEY.
  • Added remediations (fix recommendations) sections to outputs. Now, Safety will suggest the steps to fix a detected vulnerability when an API key is used.
  • Added new summary meta-data data to the reports showing the Safety version used, the dependencies found, the timestamp, the target scanned, and more. These data are included in the text, screen, and JSON output for improved audit capabilities.
  • Added more info per vulnerability, including URLs to read more about a vulnerability and/or a package.

###New command line flags:

  • New command line flags
    • The --output flag replaces --bare, --text, --screen, and --json flags. In this new release, examples would be: --output json or --output bare.
    • The --continue-on-error flag suppresses non-zero exit codes to force pass CI/CD checks, if required.
    • The --debug flag allows for a more detailed output.
    • The --disable-telemetry flag has been added to disable telemetry data
    • The --policy-file flag to include a local security policy file. This file (called .safety-policy.yml, found in either the root directory where Safety is being run or in a custom location) is based on YAML 1.2 and allows for:
      • Ignoring individual vulnerabilities with optionally a note and an expiry date.
      • Filtering vulnerabilities by their CVSS severity. (CVSS data is only available for some paid accounts.)
Other
  • Dropped support for Python < 3.6
  • The free version of the Safety vulnerability database is downloaded from a public S3 bucket (via PyUp.io) and no longer from GitHub. This free database is only updated once a month and is not licensed for commercial use.
  • Telemetry data will be sent with every Safety call. These data are anonymous and not sensitive. This includes the Python version, the Safety command used (check/license/review), and the Safety options used (without their values). Users can disable this functionality by adding the --disable-telemetry flag.
  • Added validations to avoid the use of exclusive options.
  • Added announcements feature to receive informative or critical messages from the PyUp Safety team.
  • Increased test coverage.
  • Now Safety can be used as a dependency in your code
  • Added Safety as a Github Action
  • Improved the help text in the CLI
  • Added the --save-json flag

v1.10.3

Compare Source

  • Avoid 1.10.2post1 bug with pyup updates

v1.10.2

Compare Source

  • Provide CVSS values on full report for CVEs (requires a premium PyUp subscription)
  • Fixed used DB wrong info
  • Support line breaks on advisories

v1.10.1

Compare Source

  • Reduced Docker image and Binary size
  • Added bare and json outputs to license command

Configuration

📅 Schedule: At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this MR and you won't be reminded about this update again.


  • If you want to rebase/retry this MR, click this checkbox.

This MR has been generated by Renovate Bot.

Edited by Tine Wittler

Merge request reports