flake8-secure-coding-standard 1.4.1__tar.gz → 1.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flake8_secure_coding_standard-1.5.0/.github/dependabot.yml +13 -0
- flake8_secure_coding_standard-1.5.0/.github/workflows/ci.yml +68 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/.github/workflows/codeql-analysis.yml +5 -5
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/.github/workflows/draft_release.yml +7 -5
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/.github/workflows/format.yml +10 -6
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/.github/workflows/publish_release.yml +11 -12
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/.github/workflows/pull_request.yml +8 -6
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/.pre-commit-config.yaml +10 -28
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/CHANGELOG.md +34 -1
- {flake8-secure-coding-standard-1.4.1/flake8_secure_coding_standard.egg-info → flake8_secure_coding_standard-1.5.0}/PKG-INFO +8 -5
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0/flake8_secure_coding_standard.egg-info}/PKG-INFO +8 -5
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/flake8_secure_coding_standard.egg-info/SOURCES.txt +2 -0
- flake8_secure_coding_standard-1.5.0/flake8_secure_coding_standard.egg-info/scm_file_list.json +42 -0
- flake8_secure_coding_standard-1.5.0/flake8_secure_coding_standard.egg-info/scm_version.json +8 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/flake8_secure_coding_standard.py +51 -63
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/pyproject.toml +12 -20
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/setup.cfg +5 -3
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/os_chmod_test.py +2 -2
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/os_mkdir_mkfifo_mknod_test.py +3 -3
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/os_open_test.py +3 -3
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/plugin_options_test.py +5 -5
- flake8-secure-coding-standard-1.4.1/.github/dependabot.yml +0 -12
- flake8-secure-coding-standard-1.4.1/.github/workflows/ci.yml +0 -78
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/.codespell.allow +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/.editorconfig +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/.gitignore +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/.yamllint +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/LICENSE +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/MANIFEST.in +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/README.md +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/flake8_secure_coding_standard.egg-info/dependency_links.txt +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/flake8_secure_coding_standard.egg-info/entry_points.txt +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/flake8_secure_coding_standard.egg-info/not-zip-safe +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/flake8_secure_coding_standard.egg-info/requires.txt +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/flake8_secure_coding_standard.egg-info/top_level.txt +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/misc/license_header.txt +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/setup.py +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/assert_test.py +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/builtin_open_test.py +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/eval_exec_test.py +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/jsonpickle_decode_test.py +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/marshal_load_test.py +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/os_realpath_test.py +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/pdb_test.py +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/pickle_load_test.py +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/shell_exec_test.py +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/shelve_open_test.py +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/shlex_quote_test.py +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/tempfile_mktemp_test.py +0 -0
- {flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/yaml_load_test.py +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
name: CI
|
|
4
|
+
|
|
5
|
+
on: # yamllint disable-line rule:truthy
|
|
6
|
+
pull_request:
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
- develop
|
|
11
|
+
- v*
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
concurrency:
|
|
17
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
18
|
+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
standard:
|
|
22
|
+
strategy:
|
|
23
|
+
fail-fast: false
|
|
24
|
+
matrix:
|
|
25
|
+
runs-on: [ubuntu-latest, windows-latest, macos-latest]
|
|
26
|
+
# NB: always quote the versions, otherwise YAML turns 3.10 into 3.1
|
|
27
|
+
python: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.15']
|
|
28
|
+
|
|
29
|
+
name: "🐍 ${{ matrix.python }} • ${{ matrix.runs-on }}"
|
|
30
|
+
runs-on: ${{ matrix.runs-on }}
|
|
31
|
+
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v7
|
|
34
|
+
with:
|
|
35
|
+
fetch-depth: 0 # full history and tags for SCM versioning to work
|
|
36
|
+
|
|
37
|
+
- name: Setup Python ${{ matrix.python }}
|
|
38
|
+
uses: actions/setup-python@v7
|
|
39
|
+
with:
|
|
40
|
+
python-version: ${{ matrix.python }}
|
|
41
|
+
cache: 'pip'
|
|
42
|
+
cache-dependency-path: '**/setup.cfg'
|
|
43
|
+
|
|
44
|
+
- name: Setup annotations on Linux
|
|
45
|
+
if: runner.os == 'Linux'
|
|
46
|
+
run: python -m pip install pytest-github-actions-annotate-failures
|
|
47
|
+
|
|
48
|
+
- name: Build and install package
|
|
49
|
+
run: python -m pip install -e .[test]
|
|
50
|
+
|
|
51
|
+
- name: Run tests
|
|
52
|
+
run: python -m pytest -v --cov=flake8_secure_coding_standard --cov-report=term --cov-report=lcov:coverage.lcov
|
|
53
|
+
|
|
54
|
+
- name: Coveralls.io
|
|
55
|
+
uses: coverallsapp/github-action@v2
|
|
56
|
+
with:
|
|
57
|
+
file: coverage.lcov
|
|
58
|
+
flag-name: python-${{ matrix.python }}-${{ matrix.runs-on }}
|
|
59
|
+
parallel: true
|
|
60
|
+
|
|
61
|
+
finish:
|
|
62
|
+
needs: standard
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
steps:
|
|
65
|
+
- name: Coveralls Finished
|
|
66
|
+
uses: coverallsapp/github-action@v2
|
|
67
|
+
with:
|
|
68
|
+
parallel-finished: true
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
name: "CodeQL"
|
|
16
16
|
|
|
17
|
-
on:
|
|
17
|
+
on: # yamllint disable-line rule:truthy
|
|
18
18
|
push:
|
|
19
19
|
branches: [main]
|
|
20
20
|
pull_request:
|
|
@@ -42,11 +42,11 @@ jobs:
|
|
|
42
42
|
|
|
43
43
|
steps:
|
|
44
44
|
- name: Checkout repository
|
|
45
|
-
uses: actions/checkout@
|
|
45
|
+
uses: actions/checkout@v7
|
|
46
46
|
|
|
47
47
|
# Initializes the CodeQL tools for scanning.
|
|
48
48
|
- name: Initialize CodeQL
|
|
49
|
-
uses: github/codeql-action/init@
|
|
49
|
+
uses: github/codeql-action/init@v4
|
|
50
50
|
with:
|
|
51
51
|
languages: ${{ matrix.language }}
|
|
52
52
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
@@ -55,7 +55,7 @@ jobs:
|
|
|
55
55
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
56
56
|
|
|
57
57
|
- name: Autobuild
|
|
58
|
-
uses: github/codeql-action/autobuild@
|
|
58
|
+
uses: github/codeql-action/autobuild@v4
|
|
59
59
|
|
|
60
60
|
- name: Perform CodeQL Analysis
|
|
61
|
-
uses: github/codeql-action/analyze@
|
|
61
|
+
uses: github/codeql-action/analyze@v4
|
|
@@ -14,23 +14,25 @@ jobs:
|
|
|
14
14
|
name: "Draft a new release"
|
|
15
15
|
runs-on: ubuntu-latest
|
|
16
16
|
steps:
|
|
17
|
-
- uses: actions/checkout@
|
|
17
|
+
- uses: actions/checkout@v7
|
|
18
18
|
|
|
19
19
|
- name: Setup Python
|
|
20
|
-
uses: actions/setup-python@
|
|
20
|
+
uses: actions/setup-python@v7
|
|
21
21
|
with:
|
|
22
22
|
python-version: '3.11'
|
|
23
23
|
cache: 'pip'
|
|
24
24
|
cache-dependency-path: '**/setup.cfg'
|
|
25
25
|
|
|
26
26
|
- name: Update CHANGELOG
|
|
27
|
+
env:
|
|
28
|
+
RELEASE_TAG: ${{ github.event.inputs.tag }}
|
|
27
29
|
run: |
|
|
28
30
|
python3 -m pip install mdformat-gfm 'git+https://github.com/Takishima/keepachangelog@v1.0.1'
|
|
29
|
-
python3 -m keepachangelog release "${
|
|
31
|
+
python3 -m keepachangelog release "${RELEASE_TAG}"
|
|
30
32
|
python3 -m mdformat CHANGELOG.md
|
|
31
33
|
|
|
32
34
|
- name: Commit changes
|
|
33
|
-
uses: stefanzweifel/git-auto-commit-action@
|
|
35
|
+
uses: stefanzweifel/git-auto-commit-action@v7
|
|
34
36
|
id: make-commit
|
|
35
37
|
with:
|
|
36
38
|
branch: release/${{ github.event.inputs.tag }}
|
|
@@ -41,7 +43,7 @@ jobs:
|
|
|
41
43
|
|
|
42
44
|
# yamllint disable rule:line-length
|
|
43
45
|
- name: Create pull request
|
|
44
|
-
uses: thomaseizinger/create-pull-request@1.
|
|
46
|
+
uses: thomaseizinger/create-pull-request@1.4.0
|
|
45
47
|
env:
|
|
46
48
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
47
49
|
with:
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
name: Format
|
|
4
4
|
|
|
5
|
-
on:
|
|
5
|
+
on: # yamllint disable-line rule:truthy
|
|
6
6
|
pull_request:
|
|
7
7
|
push:
|
|
8
8
|
branches:
|
|
@@ -18,7 +18,7 @@ jobs:
|
|
|
18
18
|
&& (startsWith(github.event.pull_request.head.ref, 'release/')
|
|
19
19
|
|| startsWith(github.event.pull_request.head.ref, 'hotfix/'))
|
|
20
20
|
steps:
|
|
21
|
-
- uses: actions/checkout@
|
|
21
|
+
- uses: actions/checkout@v7
|
|
22
22
|
- name: Installing parse-changelog
|
|
23
23
|
env:
|
|
24
24
|
target: x86_64-unknown-linux-musl
|
|
@@ -28,19 +28,23 @@ jobs:
|
|
|
28
28
|
curl -LsSf "${source_url}/${parse_changelog_tag}/parse-changelog-${target}.tar.gz" | tar xzf -
|
|
29
29
|
- name: Extract version from branch name (for release branches)
|
|
30
30
|
if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'release/')
|
|
31
|
+
env:
|
|
32
|
+
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
|
|
31
33
|
run: |
|
|
32
|
-
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
|
|
33
34
|
VERSION=${BRANCH_NAME#release/}
|
|
35
|
+
# CHANGELOG headings are parsed without the leading "v"
|
|
36
|
+
VERSION=${VERSION#v}
|
|
34
37
|
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
|
|
35
|
-
git tag v${RELEASE_VERSION}
|
|
36
38
|
|
|
37
39
|
- name: Extract version from branch name (for hotfix branches)
|
|
38
40
|
if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'hotfix/')
|
|
41
|
+
env:
|
|
42
|
+
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
|
|
39
43
|
run: |
|
|
40
|
-
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
|
|
41
44
|
VERSION=${BRANCH_NAME#hotfix/}
|
|
45
|
+
# CHANGELOG headings are parsed without the leading "v"
|
|
46
|
+
VERSION=${VERSION#v}
|
|
42
47
|
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
|
|
43
|
-
git tag v${RELEASE_VERSION}
|
|
44
48
|
|
|
45
49
|
- name: Calling parse-changelog
|
|
46
50
|
run: ./parse-changelog CHANGELOG.md "${RELEASE_VERSION}"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
name: "Publish new release"
|
|
4
4
|
|
|
5
|
-
on:
|
|
5
|
+
on: # yamllint disable-line rule:truthy
|
|
6
6
|
push:
|
|
7
7
|
tags:
|
|
8
8
|
- v[0-9]+.*
|
|
@@ -23,12 +23,9 @@ jobs:
|
|
|
23
23
|
|| startsWith(github.event.pull_request.head.ref, 'hotfix/')))
|
|
24
24
|
|
|
25
25
|
steps:
|
|
26
|
-
- uses: actions/checkout@
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
run: |
|
|
30
|
-
git fetch --prune --unshallow
|
|
31
|
-
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
26
|
+
- uses: actions/checkout@v7
|
|
27
|
+
with:
|
|
28
|
+
fetch-depth: 0 # full history and tags for SCM versioning to work
|
|
32
29
|
|
|
33
30
|
- name: Extract version from tag name
|
|
34
31
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
|
@@ -39,15 +36,17 @@ jobs:
|
|
|
39
36
|
|
|
40
37
|
- name: Extract version from branch name (for release branches)
|
|
41
38
|
if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'release/')
|
|
39
|
+
env:
|
|
40
|
+
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
|
|
42
41
|
run: |
|
|
43
|
-
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
|
|
44
42
|
VERSION=${BRANCH_NAME#release/v}
|
|
45
43
|
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
|
|
46
44
|
|
|
47
45
|
- name: Extract version from branch name (for hotfix branches)
|
|
48
46
|
if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'hotfix/')
|
|
47
|
+
env:
|
|
48
|
+
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
|
|
49
49
|
run: |
|
|
50
|
-
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
|
|
51
50
|
VERSION=${BRANCH_NAME#hotfix/}
|
|
52
51
|
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
|
|
53
52
|
|
|
@@ -70,7 +69,7 @@ jobs:
|
|
|
70
69
|
python3 -m pip install twine --prefer-binary
|
|
71
70
|
python3 -m twine check dist/*
|
|
72
71
|
|
|
73
|
-
# Code below inspired from this action:
|
|
72
|
+
# Code below inspired from this action: # yamllint disable-line rule:truthy
|
|
74
73
|
# - uses: taiki-e/create-gh-release-action@v1
|
|
75
74
|
# with:
|
|
76
75
|
# title: flake8-secure-coding-standard $tag
|
|
@@ -99,11 +98,11 @@ jobs:
|
|
|
99
98
|
dist/*
|
|
100
99
|
|
|
101
100
|
- name: Setup Python for Pypi upload
|
|
102
|
-
uses: actions/setup-python@
|
|
101
|
+
uses: actions/setup-python@v7
|
|
103
102
|
|
|
104
103
|
- name: Publish standard package
|
|
105
104
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
106
105
|
with:
|
|
107
106
|
user: __token__
|
|
108
107
|
password: ${{ secrets.pypi_password }}
|
|
109
|
-
|
|
108
|
+
packages-dir: dist/
|
|
@@ -13,14 +13,14 @@ jobs:
|
|
|
13
13
|
(github.event.pull_request.title == '[pre-commit.ci] pre-commit autoupdate') &&
|
|
14
14
|
(github.event.action == 'opened')
|
|
15
15
|
steps:
|
|
16
|
-
- uses: actions/checkout@
|
|
16
|
+
- uses: actions/checkout@v7
|
|
17
17
|
with:
|
|
18
18
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
19
19
|
fetch-depth: 0
|
|
20
20
|
token: ${{ secrets.PRE_COMMIT_CI_CHANGELOG }}
|
|
21
21
|
|
|
22
22
|
- name: Setup Python
|
|
23
|
-
uses: actions/setup-python@
|
|
23
|
+
uses: actions/setup-python@v7
|
|
24
24
|
with:
|
|
25
25
|
python-version: '3.11'
|
|
26
26
|
cache: 'pip'
|
|
@@ -31,12 +31,14 @@ jobs:
|
|
|
31
31
|
python3 -m pip install 'git+https://github.com/Takishima/pre-commit-changelog-auto-update@v1.0.0'
|
|
32
32
|
|
|
33
33
|
- name: Run Python script
|
|
34
|
+
env:
|
|
35
|
+
PR_BODY: ${{ github.event.pull_request.body }}
|
|
34
36
|
run: |
|
|
35
|
-
python3 -m update_changelog --pr-body "${
|
|
37
|
+
python3 -m update_changelog --pr-body "${PR_BODY}"
|
|
36
38
|
|
|
37
39
|
- name: Commit changes
|
|
38
40
|
id: commit
|
|
39
|
-
uses: EndBug/add-and-commit@
|
|
41
|
+
uses: EndBug/add-and-commit@v11
|
|
40
42
|
with:
|
|
41
43
|
author_name: github-actions[bot]
|
|
42
44
|
author_email: noreply@github.com
|
|
@@ -48,7 +50,7 @@ jobs:
|
|
|
48
50
|
name: CHANGELOG enforcer
|
|
49
51
|
if: '!cancelled()'
|
|
50
52
|
steps:
|
|
51
|
-
- uses: actions/checkout@
|
|
53
|
+
- uses: actions/checkout@v7
|
|
52
54
|
with:
|
|
53
55
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
54
56
|
fetch-depth: 0
|
|
@@ -56,4 +58,4 @@ jobs:
|
|
|
56
58
|
- uses: dangoslen/changelog-enforcer@v3
|
|
57
59
|
with:
|
|
58
60
|
changeLogPath: 'CHANGELOG.md'
|
|
59
|
-
skipLabels: 'Skip-Changelog'
|
|
61
|
+
skipLabels: 'Skip-Changelog,dependencies'
|
{flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/.pre-commit-config.yaml
RENAMED
|
@@ -6,7 +6,7 @@ repos:
|
|
|
6
6
|
- id: check-useless-excludes
|
|
7
7
|
|
|
8
8
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
9
|
-
rev:
|
|
9
|
+
rev: v6.0.0
|
|
10
10
|
hooks:
|
|
11
11
|
- id: check-added-large-files
|
|
12
12
|
- id: check-case-conflict
|
|
@@ -20,7 +20,7 @@ repos:
|
|
|
20
20
|
- id: trailing-whitespace
|
|
21
21
|
|
|
22
22
|
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
|
23
|
-
rev: v1.5.
|
|
23
|
+
rev: v1.5.6
|
|
24
24
|
hooks:
|
|
25
25
|
- id: insert-license
|
|
26
26
|
files: \.py$
|
|
@@ -29,45 +29,27 @@ repos:
|
|
|
29
29
|
- misc/license_header.txt
|
|
30
30
|
- id: remove-tabs
|
|
31
31
|
|
|
32
|
-
- repo: https://github.com/PyCQA/doc8/
|
|
33
|
-
rev: v1.1.1
|
|
34
|
-
hooks:
|
|
35
|
-
- id: doc8
|
|
36
|
-
require_serial: false
|
|
37
|
-
additional_dependencies: [tomli]
|
|
38
|
-
|
|
39
32
|
- repo: https://github.com/codespell-project/codespell
|
|
40
|
-
rev: v2.
|
|
33
|
+
rev: v2.4.3
|
|
41
34
|
hooks:
|
|
42
35
|
- id: codespell
|
|
43
|
-
files: .*\.(py|txt|cmake|md|rst|sh|ps1|hpp|tpp|cpp|cc)$
|
|
44
36
|
args: [-I, .codespell.allow]
|
|
45
37
|
|
|
46
38
|
- repo: https://github.com/adrienverge/yamllint.git
|
|
47
|
-
rev: v1.
|
|
39
|
+
rev: v1.38.0
|
|
48
40
|
hooks:
|
|
49
41
|
- id: yamllint
|
|
50
42
|
|
|
51
|
-
- repo: https://github.com/asottile/blacken-docs
|
|
52
|
-
rev: 1.16.0
|
|
53
|
-
hooks:
|
|
54
|
-
- id: blacken-docs
|
|
55
|
-
args: [-S, -l, '120']
|
|
56
|
-
additional_dependencies: [black==23.3.0]
|
|
57
|
-
|
|
58
43
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
59
|
-
rev: v0.
|
|
44
|
+
rev: v0.17.5
|
|
60
45
|
hooks:
|
|
61
|
-
- id: ruff-
|
|
62
|
-
name: ruff (format)
|
|
63
|
-
args: [--preview]
|
|
64
|
-
|
|
65
|
-
- id: ruff
|
|
46
|
+
- id: ruff-check
|
|
66
47
|
name: ruff (fix)
|
|
67
|
-
alias: ruff-fix
|
|
68
48
|
args:
|
|
69
49
|
- --fix
|
|
70
50
|
- --exit-non-zero-on-fix
|
|
71
|
-
- --
|
|
51
|
+
- --output-format=full
|
|
72
52
|
- --show-fixes
|
|
73
|
-
|
|
53
|
+
|
|
54
|
+
- id: ruff-format
|
|
55
|
+
name: ruff (format)
|
|
@@ -7,6 +7,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [v1.5.0] - 2026-11-21
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Drop support for Python 3.8 and 3.9 (both end-of-life); Python 3.10 is now the minimum version
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Support for Python 3.14 (removed usage of `ast.Str` and `ast.Num`)
|
|
19
|
+
|
|
20
|
+
### Repository
|
|
21
|
+
|
|
22
|
+
- Update `action/setup-python` GitHub Action to v7
|
|
23
|
+
- Update `action/checkout` GitHub Action to v7
|
|
24
|
+
- Update GitHub Action `thomaseizinger/create-pull-request` to v1.4.0
|
|
25
|
+
- Update GitHub Action `stefanzweifel/git-auto-commit-action` to v7
|
|
26
|
+
- Update GitHub Action `EndBug/add-and-commit` to v11
|
|
27
|
+
- Update GitHub Action `github/codeql-action` to v4
|
|
28
|
+
- Run CI for Python 3.10 to 3.15 on all platforms (Python 3.8 and 3.9 are not available on `ubuntu-latest` anymore)
|
|
29
|
+
- Upload coverage data using the `coverallsapp/github-action` GitHub Action
|
|
30
|
+
- Group Dependabot updates into a single pull request and do not require a CHANGELOG entry for them
|
|
31
|
+
- Pass GitHub event data to workflow scripts through environment variables
|
|
32
|
+
- Fix the CHANGELOG parsing check on release pull requests (strip the leading `v` from the version)
|
|
33
|
+
- Update `adrienverge/yamllint.git` hook to v1.38.0
|
|
34
|
+
- Update `astral-sh/ruff-pre-commit` hook to v0.17.5
|
|
35
|
+
- Update `codespell-project/codespell` hook to v2.4.3
|
|
36
|
+
- Update `Lucas-C/pre-commit-hooks` hook to v1.5.6
|
|
37
|
+
- Update `pre-commit/pre-commit-hooks` hook to v6.0.0
|
|
38
|
+
- Remove the `doc8` and `blacken-docs` hooks (no reStructuredText files or Python code blocks to check)
|
|
39
|
+
- Rename the `ruff` hook to `ruff-check` and run it before `ruff-format`
|
|
40
|
+
- Move the ruff linter settings to the `lint` section, target Python 3.10 and drop removed rules
|
|
41
|
+
|
|
10
42
|
## [v1.4.1] - 2024-01-07
|
|
11
43
|
|
|
12
44
|
### Changed
|
|
@@ -142,7 +174,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
142
174
|
|
|
143
175
|
Initial release
|
|
144
176
|
|
|
145
|
-
[unreleased]: https://github.com/Takishima/flake8-secure-coding-standard/compare/v1.
|
|
177
|
+
[unreleased]: https://github.com/Takishima/flake8-secure-coding-standard/compare/v1.5.0...HEAD
|
|
146
178
|
[v1.0.0]: https://github.com/Takishima/flake8-secure-coding-standard/compare/c18cc7130a40405bd92e49b22675e8ddbe0bc8cd...v1.0.0
|
|
147
179
|
[v1.0.1]: https://github.com/Takishima/flake8-secure-coding-standard/compare/v1.0.0...v1.0.1
|
|
148
180
|
[v1.1.0]: https://github.com/Takishima/flake8-secure-coding-standard/compare/v1.0.1...v1.1.0
|
|
@@ -152,3 +184,4 @@ Initial release
|
|
|
152
184
|
[v1.3.0]: https://github.com/Takishima/flake8-secure-coding-standard/compare/v1.2.2...v1.3.0
|
|
153
185
|
[v1.4.0]: https://github.com/Takishima/flake8-secure-coding-standard/compare/v1.3.0...v1.4.0
|
|
154
186
|
[v1.4.1]: https://github.com/Takishima/flake8-secure-coding-standard/compare/v1.4.0...v1.4.1
|
|
187
|
+
[v1.5.0]: https://github.com/Takishima/flake8-secure-coding-standard/compare/v1.4.1...v1.5.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: flake8-secure-coding-standard
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: Flake8 plugin adding some checks to make Python code adhere to more secure coding standard
|
|
5
5
|
Home-page: https://github.com/Takishima/flake8-secure-coding-standard
|
|
6
6
|
Author: Damien Nguyen
|
|
@@ -9,11 +9,13 @@ License: Apache2
|
|
|
9
9
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
14
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
-
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
18
|
+
Requires-Python: >=3.10
|
|
17
19
|
Description-Content-Type: text/markdown
|
|
18
20
|
License-File: LICENSE
|
|
19
21
|
Requires-Dist: flake8<8.0,>=3.7
|
|
@@ -22,6 +24,7 @@ Requires-Dist: mock; extra == "test"
|
|
|
22
24
|
Requires-Dist: pytest; extra == "test"
|
|
23
25
|
Requires-Dist: pytest-cov; extra == "test"
|
|
24
26
|
Requires-Dist: pytest-mock; extra == "test"
|
|
27
|
+
Dynamic: license-file
|
|
25
28
|
|
|
26
29
|
# Flake8 Secure Coding Standard Plugin
|
|
27
30
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: flake8-secure-coding-standard
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: Flake8 plugin adding some checks to make Python code adhere to more secure coding standard
|
|
5
5
|
Home-page: https://github.com/Takishima/flake8-secure-coding-standard
|
|
6
6
|
Author: Damien Nguyen
|
|
@@ -9,11 +9,13 @@ License: Apache2
|
|
|
9
9
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
14
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
-
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
18
|
+
Requires-Python: >=3.10
|
|
17
19
|
Description-Content-Type: text/markdown
|
|
18
20
|
License-File: LICENSE
|
|
19
21
|
Requires-Dist: flake8<8.0,>=3.7
|
|
@@ -22,6 +24,7 @@ Requires-Dist: mock; extra == "test"
|
|
|
22
24
|
Requires-Dist: pytest; extra == "test"
|
|
23
25
|
Requires-Dist: pytest-cov; extra == "test"
|
|
24
26
|
Requires-Dist: pytest-mock; extra == "test"
|
|
27
|
+
Dynamic: license-file
|
|
25
28
|
|
|
26
29
|
# Flake8 Secure Coding Standard Plugin
|
|
27
30
|
|
|
@@ -24,6 +24,8 @@ flake8_secure_coding_standard.egg-info/dependency_links.txt
|
|
|
24
24
|
flake8_secure_coding_standard.egg-info/entry_points.txt
|
|
25
25
|
flake8_secure_coding_standard.egg-info/not-zip-safe
|
|
26
26
|
flake8_secure_coding_standard.egg-info/requires.txt
|
|
27
|
+
flake8_secure_coding_standard.egg-info/scm_file_list.json
|
|
28
|
+
flake8_secure_coding_standard.egg-info/scm_version.json
|
|
27
29
|
flake8_secure_coding_standard.egg-info/top_level.txt
|
|
28
30
|
misc/license_header.txt
|
|
29
31
|
tests/assert_test.py
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": [
|
|
3
|
+
".codespell.allow",
|
|
4
|
+
".editorconfig",
|
|
5
|
+
".github/dependabot.yml",
|
|
6
|
+
".github/workflows/ci.yml",
|
|
7
|
+
".github/workflows/codeql-analysis.yml",
|
|
8
|
+
".github/workflows/draft_release.yml",
|
|
9
|
+
".github/workflows/format.yml",
|
|
10
|
+
".github/workflows/publish_release.yml",
|
|
11
|
+
".github/workflows/pull_request.yml",
|
|
12
|
+
".gitignore",
|
|
13
|
+
".pre-commit-config.yaml",
|
|
14
|
+
".yamllint",
|
|
15
|
+
"CHANGELOG.md",
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"MANIFEST.in",
|
|
18
|
+
"README.md",
|
|
19
|
+
"flake8_secure_coding_standard.py",
|
|
20
|
+
"misc/license_header.txt",
|
|
21
|
+
"pyproject.toml",
|
|
22
|
+
"setup.cfg",
|
|
23
|
+
"setup.py",
|
|
24
|
+
"tests/assert_test.py",
|
|
25
|
+
"tests/builtin_open_test.py",
|
|
26
|
+
"tests/eval_exec_test.py",
|
|
27
|
+
"tests/jsonpickle_decode_test.py",
|
|
28
|
+
"tests/marshal_load_test.py",
|
|
29
|
+
"tests/os_chmod_test.py",
|
|
30
|
+
"tests/os_mkdir_mkfifo_mknod_test.py",
|
|
31
|
+
"tests/os_open_test.py",
|
|
32
|
+
"tests/os_realpath_test.py",
|
|
33
|
+
"tests/pdb_test.py",
|
|
34
|
+
"tests/pickle_load_test.py",
|
|
35
|
+
"tests/plugin_options_test.py",
|
|
36
|
+
"tests/shell_exec_test.py",
|
|
37
|
+
"tests/shelve_open_test.py",
|
|
38
|
+
"tests/shlex_quote_test.py",
|
|
39
|
+
"tests/tempfile_mktemp_test.py",
|
|
40
|
+
"tests/yaml_load_test.py"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -21,18 +21,20 @@ import importlib.metadata
|
|
|
21
21
|
import operator
|
|
22
22
|
import platform
|
|
23
23
|
import stat
|
|
24
|
-
from typing import TYPE_CHECKING, Any, AnyStr, ClassVar
|
|
24
|
+
from typing import TYPE_CHECKING, Any, AnyStr, ClassVar
|
|
25
25
|
|
|
26
26
|
if TYPE_CHECKING: # pragma: no cover
|
|
27
|
+
from collections.abc import Generator
|
|
28
|
+
|
|
27
29
|
import flake8.options.manager
|
|
28
30
|
|
|
29
|
-
ast_Constant = ast.Constant #
|
|
31
|
+
ast_Constant = ast.Constant # ruff: ignore[mixed-case-variable-in-global-scope]
|
|
30
32
|
|
|
31
33
|
_use_optparse = tuple(int(s) for s in importlib.metadata.version('flake8').split('.')) < (3, 8, 0)
|
|
32
34
|
|
|
33
35
|
|
|
34
36
|
if _use_optparse: # pragma: no cover
|
|
35
|
-
import optparse #
|
|
37
|
+
import optparse # ruff: ignore[unused-import] pylint: disable=deprecated-module, unused-import
|
|
36
38
|
else:
|
|
37
39
|
import argparse
|
|
38
40
|
|
|
@@ -73,7 +75,7 @@ SCS119 = 'SCS119 Avoid using `os.chmod` with unsafe file permissions (W ^ X for
|
|
|
73
75
|
# Helper functions
|
|
74
76
|
|
|
75
77
|
|
|
76
|
-
def _read_octal_mode_option(name, value, default): #
|
|
78
|
+
def _read_octal_mode_option(name, value, default): # ruff: ignore[complex-structure]
|
|
77
79
|
"""
|
|
78
80
|
Read an integer or list of integer configuration option.
|
|
79
81
|
|
|
@@ -187,8 +189,6 @@ def _is_builtin_open_for_writing(node: ast.Call) -> bool:
|
|
|
187
189
|
return True # variable -> to be on the safe side, flag as inappropriate
|
|
188
190
|
if isinstance(node.args[1], ast_Constant):
|
|
189
191
|
mode = node.args[1].value
|
|
190
|
-
if isinstance(node.args[1], ast.Str):
|
|
191
|
-
mode = node.args[1].s
|
|
192
192
|
else:
|
|
193
193
|
for keyword in node.keywords:
|
|
194
194
|
if keyword.arg == 'mode':
|
|
@@ -216,11 +216,8 @@ def _get_mode_arg(node, args_idx):
|
|
|
216
216
|
if keyword.arg == 'mode':
|
|
217
217
|
node_intern = keyword.value
|
|
218
218
|
break
|
|
219
|
-
if node_intern:
|
|
220
|
-
|
|
221
|
-
mode = node_intern.value
|
|
222
|
-
elif isinstance(node_intern, ast.Num): # pragma: no cover
|
|
223
|
-
mode = node_intern.n
|
|
219
|
+
if node_intern and isinstance(node_intern, ast_Constant):
|
|
220
|
+
mode = node_intern.value
|
|
224
221
|
return mode
|
|
225
222
|
|
|
226
223
|
|
|
@@ -234,7 +231,7 @@ def _is_allowed_mode(node, allowed_modes, args_idx):
|
|
|
234
231
|
|
|
235
232
|
|
|
236
233
|
def _is_shell_true_call(node: ast.Call) -> bool:
|
|
237
|
-
|
|
234
|
+
n_args_max = 8
|
|
238
235
|
if not (isinstance(node.func, ast.Attribute) and isinstance(node.func.value, ast.Name)):
|
|
239
236
|
return False
|
|
240
237
|
|
|
@@ -245,21 +242,18 @@ def _is_shell_true_call(node: ast.Call) -> bool:
|
|
|
245
242
|
if keyword.arg == 'shell' and isinstance(keyword.value, ast_Constant) and bool(keyword.value.value):
|
|
246
243
|
return True
|
|
247
244
|
if (
|
|
248
|
-
len(node.args) >
|
|
249
|
-
and isinstance(node.args[
|
|
250
|
-
and bool(node.args[
|
|
245
|
+
len(node.args) > n_args_max
|
|
246
|
+
and isinstance(node.args[n_args_max], ast_Constant)
|
|
247
|
+
and bool(node.args[n_args_max].value)
|
|
251
248
|
):
|
|
252
249
|
return True
|
|
253
250
|
if node.func.attr in {'getoutput', 'getstatusoutput'}:
|
|
254
251
|
return True
|
|
255
252
|
|
|
256
253
|
# asyncio module
|
|
257
|
-
|
|
254
|
+
return (node.func.value.id == 'asyncio' and node.func.attr == 'create_subprocess_shell') or (
|
|
258
255
|
node.func.value.id == 'loop' and node.func.attr == 'subprocess_shell'
|
|
259
|
-
)
|
|
260
|
-
return True
|
|
261
|
-
|
|
262
|
-
return False
|
|
256
|
+
)
|
|
263
257
|
|
|
264
258
|
|
|
265
259
|
def _is_pdb_call(node: ast.Call) -> bool:
|
|
@@ -267,11 +261,10 @@ def _is_pdb_call(node: ast.Call) -> bool:
|
|
|
267
261
|
# Cover:
|
|
268
262
|
# * pdb.func().
|
|
269
263
|
return True
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
return False
|
|
264
|
+
|
|
265
|
+
# Cover:
|
|
266
|
+
# * Pdb().
|
|
267
|
+
return isinstance(node.func, ast.Name) and node.func.id == 'Pdb'
|
|
275
268
|
|
|
276
269
|
|
|
277
270
|
def _is_mktemp_call(node: ast.Call) -> bool:
|
|
@@ -280,17 +273,16 @@ def _is_mktemp_call(node: ast.Call) -> bool:
|
|
|
280
273
|
# * tempfile.mktemp().
|
|
281
274
|
# * xxxx.mktemp().
|
|
282
275
|
return True
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
return False
|
|
276
|
+
|
|
277
|
+
# Cover:
|
|
278
|
+
# * mktemp().
|
|
279
|
+
return isinstance(node.func, ast.Name) and node.func.id == 'mktemp'
|
|
288
280
|
|
|
289
281
|
|
|
290
282
|
def _is_yaml_unsafe_call(node: ast.Call) -> bool:
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
283
|
+
n_args_max = 2
|
|
284
|
+
safe_loaders = ('BaseLoader', 'SafeLoader')
|
|
285
|
+
unsafe_loaders = ('Loader', 'UnsafeLoader', 'FullLoader')
|
|
294
286
|
if isinstance(node.func, ast.Attribute) and isinstance(node.func.value, ast.Name) and node.func.value.id == 'yaml':
|
|
295
287
|
if node.func.attr in {'unsafe_load', 'full_load'}:
|
|
296
288
|
# Cover:
|
|
@@ -300,25 +292,25 @@ def _is_yaml_unsafe_call(node: ast.Call) -> bool:
|
|
|
300
292
|
if node.func.attr == 'load':
|
|
301
293
|
for keyword in node.keywords:
|
|
302
294
|
if keyword.arg == 'Loader' and isinstance(keyword.value, ast.Name):
|
|
303
|
-
if keyword.value.id in
|
|
295
|
+
if keyword.value.id in unsafe_loaders:
|
|
304
296
|
# Cover:
|
|
305
297
|
# * yaml.load(x, Loader=Loader).
|
|
306
298
|
# * yaml.load(x, Loader=UnsafeLoader).
|
|
307
299
|
# * yaml.load(x, Loader=FullLoader).
|
|
308
300
|
return True
|
|
309
|
-
if keyword.value.id in
|
|
301
|
+
if keyword.value.id in safe_loaders:
|
|
310
302
|
# Cover:
|
|
311
303
|
# * yaml.load(x, Loader=BaseLoader).
|
|
312
304
|
# * yaml.load(x, Loader=SafeLoader).
|
|
313
305
|
return False
|
|
314
306
|
|
|
315
307
|
if (
|
|
316
|
-
len(node.args) <
|
|
317
|
-
or (isinstance(node.args[1], ast.Name) and node.args[1].id in
|
|
308
|
+
len(node.args) < n_args_max # ruff: ignore[too-many-boolean-expressions]
|
|
309
|
+
or (isinstance(node.args[1], ast.Name) and node.args[1].id in unsafe_loaders)
|
|
318
310
|
or (
|
|
319
311
|
isinstance(node.args[1], ast.Attribute)
|
|
320
312
|
and node.args[1].value.id == 'yaml'
|
|
321
|
-
and node.args[1].attr in
|
|
313
|
+
and node.args[1].attr in unsafe_loaders
|
|
322
314
|
)
|
|
323
315
|
):
|
|
324
316
|
# Cover:
|
|
@@ -330,13 +322,10 @@ def _is_yaml_unsafe_call(node: ast.Call) -> bool:
|
|
|
330
322
|
# * yaml.load(x, yaml.UnsafeLoader).
|
|
331
323
|
# * yaml.load(x, yaml.FullLoader).
|
|
332
324
|
return True
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
# * full_load(...).
|
|
338
|
-
return True
|
|
339
|
-
return False
|
|
325
|
+
# Cover:
|
|
326
|
+
# * unsafe_load(...).
|
|
327
|
+
# * full_load(...).
|
|
328
|
+
return isinstance(node.func, ast.Name) and node.func.id in {'unsafe_load', 'full_load'}
|
|
340
329
|
|
|
341
330
|
|
|
342
331
|
# ==============================================================================
|
|
@@ -409,24 +398,23 @@ def _chmod_has_wx_for_go(node):
|
|
|
409
398
|
# On Windows, only stat.S_IREAD and stat.S_IWRITE can be used, all other bits are ignored
|
|
410
399
|
return False
|
|
411
400
|
|
|
401
|
+
if len(node.args) > 1:
|
|
402
|
+
mode_node = node.args[1]
|
|
403
|
+
else:
|
|
404
|
+
mode_node = next((keyword.value for keyword in node.keywords if keyword.arg == 'mode'), None)
|
|
405
|
+
|
|
406
|
+
if mode_node is None:
|
|
407
|
+
# NB: this would be from invalid code such as `os.chmod("file.txt")`
|
|
408
|
+
msg = 'Unable to extract `mode` argument from function call!'
|
|
409
|
+
raise RuntimeError(msg)
|
|
410
|
+
|
|
412
411
|
try:
|
|
413
|
-
modes =
|
|
414
|
-
if len(node.args) > 1:
|
|
415
|
-
modes = _chmod_get_mode(node.args[1])
|
|
416
|
-
elif node.keywords:
|
|
417
|
-
for keyword in node.keywords:
|
|
418
|
-
if keyword.arg == 'mode':
|
|
419
|
-
modes = _chmod_get_mode(keyword.value)
|
|
420
|
-
break
|
|
412
|
+
modes = _chmod_get_mode(mode_node)
|
|
421
413
|
except ValueError:
|
|
422
414
|
return False
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
msg = 'Unable to extract `mode` argument from function call!'
|
|
427
|
-
raise RuntimeError(msg)
|
|
428
|
-
# pylint: disable=no-member
|
|
429
|
-
return bool(modes & (stat.S_IWGRP | stat.S_IXGRP | stat.S_IWOTH | stat.S_IXOTH))
|
|
415
|
+
|
|
416
|
+
# pylint: disable=no-member
|
|
417
|
+
return bool(modes & (stat.S_IWGRP | stat.S_IXGRP | stat.S_IWOTH | stat.S_IXOTH))
|
|
430
418
|
|
|
431
419
|
|
|
432
420
|
# ==============================================================================
|
|
@@ -465,7 +453,7 @@ class Visitor(ast.NodeVisitor):
|
|
|
465
453
|
self.errors: list[tuple[int, int, str]] = []
|
|
466
454
|
self._from_imports: dict[str, str] = {}
|
|
467
455
|
|
|
468
|
-
def visit_Call(self, node: ast.Call) -> None: #
|
|
456
|
+
def visit_Call(self, node: ast.Call) -> None: # ruff: ignore[complex-structure, too-many-branches]
|
|
469
457
|
"""Visitor method called for ast.Call nodes."""
|
|
470
458
|
if _is_pdb_call(node):
|
|
471
459
|
self.errors.append((node.lineno, node.col_offset, SCS107))
|
|
@@ -536,7 +524,7 @@ class Visitor(ast.NodeVisitor):
|
|
|
536
524
|
|
|
537
525
|
self.generic_visit(node)
|
|
538
526
|
|
|
539
|
-
def visit_ImportFrom(self, node: ast.ImportFrom) -> None: #
|
|
527
|
+
def visit_ImportFrom(self, node: ast.ImportFrom) -> None: # ruff: ignore[complex-structure]
|
|
540
528
|
"""Visitor method called for ast.ImportFrom nodes."""
|
|
541
529
|
for alias in node.names:
|
|
542
530
|
if (node.module is None and alias.name == 'pdb') or node.module == 'pdb':
|
|
@@ -692,7 +680,7 @@ class Plugin: # pylint: disable=R0903
|
|
|
692
680
|
class OctalModeAction(argparse.Action):
|
|
693
681
|
"""Action class for octal mode options."""
|
|
694
682
|
|
|
695
|
-
def __call__(self, parser, namespace, values, option_string=None): #
|
|
683
|
+
def __call__(self, parser, namespace, values, option_string=None): # ruff: ignore[unused-method-argument]
|
|
696
684
|
setattr(namespace, self.dest, _read_octal_mode_option(self.dest, values, _DEFAULT_MAX_MODE))
|
|
697
685
|
|
|
698
686
|
action = {'action': OctalModeAction}
|
|
@@ -6,8 +6,10 @@ build-backend = "setuptools.build_meta"
|
|
|
6
6
|
|
|
7
7
|
[tool.ruff]
|
|
8
8
|
line-length = 120
|
|
9
|
-
target-version = '
|
|
9
|
+
target-version = 'py310'
|
|
10
|
+
preview = true
|
|
10
11
|
|
|
12
|
+
[tool.ruff.lint]
|
|
11
13
|
select = ['F', # pyflakes
|
|
12
14
|
'E', # pycodestyle
|
|
13
15
|
'W', # pycodestyle
|
|
@@ -19,7 +21,6 @@ select = ['F', # pyflakes
|
|
|
19
21
|
'YTT', # flake-2020
|
|
20
22
|
'ANN', # flake8-annotations
|
|
21
23
|
'ASYNC', # flake8-async
|
|
22
|
-
'TRIO', # flake8-trio
|
|
23
24
|
'S', # flake8-bandit
|
|
24
25
|
'BLE', # flake8-blind-except
|
|
25
26
|
'FBT', # flake8-boolean-trap
|
|
@@ -43,7 +44,7 @@ select = ['F', # pyflakes
|
|
|
43
44
|
'SLOT', # flake8-slots
|
|
44
45
|
'SIM', # flake8-simplify
|
|
45
46
|
'TID', # flake8-tidy-imports
|
|
46
|
-
'
|
|
47
|
+
'TC', # flake8-type-checking
|
|
47
48
|
'INT', # flake8-gettext
|
|
48
49
|
'ARG', # flake8-unused-arguments
|
|
49
50
|
'PTH', # flake8-use-pathlib
|
|
@@ -60,11 +61,9 @@ select = ['F', # pyflakes
|
|
|
60
61
|
'RUF', # ruff-specific rules
|
|
61
62
|
]
|
|
62
63
|
|
|
63
|
-
ignore = ['
|
|
64
|
-
'D203', # one-blank-line-before-class
|
|
64
|
+
ignore = ['D203', # one-blank-line-before-class
|
|
65
65
|
'D212', # multi-line-summary-first-line
|
|
66
|
-
|
|
67
|
-
# Ignore rulues below are actually to prevent conflicts between formatting and linting (with fixing)
|
|
66
|
+
# Ignore rules below are actually to prevent conflicts between formatting and linting (with fixing)
|
|
68
67
|
# cf. https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
|
|
69
68
|
'COM812', # missing-trailing-comma
|
|
70
69
|
'COM819', # prohibited-trailing-comma
|
|
@@ -88,42 +87,35 @@ indent-style = "space"
|
|
|
88
87
|
line-ending = 'lf'
|
|
89
88
|
skip-magic-trailing-comma = false
|
|
90
89
|
|
|
91
|
-
[tool.ruff.per-file-ignores]
|
|
92
|
-
|
|
90
|
+
[tool.ruff.lint.per-file-ignores]
|
|
93
91
|
'tests/*.py' = ['S101', 'SLF001', 'PLR0913', 'PLR2004', 'D']
|
|
94
92
|
|
|
95
|
-
[tool.ruff.flake8-annotations]
|
|
93
|
+
[tool.ruff.lint.flake8-annotations]
|
|
96
94
|
allow-star-arg-any = true
|
|
97
95
|
ignore-fully-untyped = true
|
|
98
96
|
mypy-init-return = true
|
|
99
97
|
suppress-dummy-args = true
|
|
100
98
|
suppress-none-returning = true
|
|
101
99
|
|
|
102
|
-
[tool.ruff.flake8-quotes]
|
|
100
|
+
[tool.ruff.lint.flake8-quotes]
|
|
103
101
|
docstring-quotes = 'double'
|
|
104
102
|
inline-quotes = 'single'
|
|
105
103
|
multiline-quotes = 'single'
|
|
106
104
|
|
|
107
|
-
[tool.ruff.isort]
|
|
105
|
+
[tool.ruff.lint.isort]
|
|
108
106
|
combine-as-imports = true
|
|
109
107
|
section-order = ["future", "standard-library", "first-party", "third-party", "local-folder"]
|
|
110
108
|
split-on-trailing-comma = false
|
|
111
109
|
|
|
112
|
-
[tool.ruff.pep8-naming]
|
|
110
|
+
[tool.ruff.lint.pep8-naming]
|
|
113
111
|
ignore-names = ['visit_Assert', 'visit_Call', 'visit_Import', 'visit_ImportFrom', 'visit_With']
|
|
114
112
|
|
|
115
|
-
[tool.ruff.pydocstyle]
|
|
113
|
+
[tool.ruff.lint.pydocstyle]
|
|
116
114
|
convention = 'google'
|
|
117
115
|
|
|
118
116
|
|
|
119
117
|
# ==============================================================================
|
|
120
118
|
|
|
121
|
-
[tool.black]
|
|
122
|
-
line-length = 120
|
|
123
|
-
target-version = ['py38','py39','py310']
|
|
124
|
-
skip-string-normalization = true
|
|
125
|
-
|
|
126
|
-
|
|
127
119
|
[tool.check-manifest]
|
|
128
120
|
ignore = [
|
|
129
121
|
'PKG-INFO',
|
|
@@ -12,15 +12,17 @@ classifiers =
|
|
|
12
12
|
License :: OSI Approved :: Apache Software License
|
|
13
13
|
Programming Language :: Python :: 3
|
|
14
14
|
Programming Language :: Python :: 3 :: Only
|
|
15
|
-
Programming Language :: Python :: 3.8
|
|
16
|
-
Programming Language :: Python :: 3.9
|
|
17
15
|
Programming Language :: Python :: 3.10
|
|
18
16
|
Programming Language :: Python :: 3.11
|
|
17
|
+
Programming Language :: Python :: 3.12
|
|
18
|
+
Programming Language :: Python :: 3.13
|
|
19
|
+
Programming Language :: Python :: 3.14
|
|
20
|
+
Programming Language :: Python :: 3.15
|
|
19
21
|
|
|
20
22
|
[options]
|
|
21
23
|
zip_safe = False
|
|
22
24
|
py_modules = flake8_secure_coding_standard
|
|
23
|
-
python_requires = >=3.
|
|
25
|
+
python_requires = >=3.10
|
|
24
26
|
setup_requires =
|
|
25
27
|
setuptools_scm[toml]
|
|
26
28
|
install_requires =
|
{flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/os_chmod_test.py
RENAMED
|
@@ -119,9 +119,9 @@ def test_chmod_get_mode_binop(s, expected):
|
|
|
119
119
|
'S_IREAD | S_IWRITE',
|
|
120
120
|
'S_IRUSR | S_IWUSR | S_IXUSR',
|
|
121
121
|
],
|
|
122
|
-
ids=lambda s: s
|
|
122
|
+
ids=lambda s: s or '<empty>',
|
|
123
123
|
)
|
|
124
|
-
def test_chmod(mocker, platform, enabled_platform, fname, arg_type, forbidden, s): #
|
|
124
|
+
def test_chmod(mocker, platform, enabled_platform, fname, arg_type, forbidden, s): # ruff: ignore[too-many-positional-arguments]
|
|
125
125
|
mocker.patch('platform.system', return_value=platform)
|
|
126
126
|
|
|
127
127
|
if s:
|
|
@@ -132,14 +132,14 @@ def test_os_function_ok(mocker, platform, function, option, s):
|
|
|
132
132
|
@pytest.mark.parametrize(
|
|
133
133
|
('function', 's'), [(function, s) for function, tests in _os_function_strings.items() for s in tests]
|
|
134
134
|
)
|
|
135
|
-
def test_os_function_call(mocker, platform, enabled_platform, function, option, s): #
|
|
136
|
-
|
|
135
|
+
def test_os_function_call(mocker, platform, enabled_platform, function, option, s): # ruff: ignore[too-many-positional-arguments]
|
|
136
|
+
msg_map = {'mkdir': flake8_scs.SCS116, 'mkfifo': flake8_scs.SCS117, 'mknod': flake8_scs.SCS118}
|
|
137
137
|
|
|
138
138
|
configure_plugin(function, option)
|
|
139
139
|
mocker.patch('platform.system', return_value=platform)
|
|
140
140
|
|
|
141
141
|
flake8_warnings = results(s)
|
|
142
142
|
if enabled_platform and option == 'True':
|
|
143
|
-
assert flake8_warnings == {'1:0: ' + flake8_scs.Visitor.format_mode_msg(
|
|
143
|
+
assert flake8_warnings == {'1:0: ' + flake8_scs.Visitor.format_mode_msg(msg_map[function])}
|
|
144
144
|
else:
|
|
145
145
|
assert flake8_warnings == set()
|
{flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/os_open_test.py
RENAMED
|
@@ -36,9 +36,9 @@ def configure_plugin(arg):
|
|
|
36
36
|
)
|
|
37
37
|
flake8_scs.Plugin.parse_options(
|
|
38
38
|
OptionValue(
|
|
39
|
-
False, #
|
|
40
|
-
False, #
|
|
41
|
-
False, #
|
|
39
|
+
False, # ruff: ignore[boolean-positional-value-in-call]
|
|
40
|
+
False, # ruff: ignore[boolean-positional-value-in-call]
|
|
41
|
+
False, # ruff: ignore[boolean-positional-value-in-call]
|
|
42
42
|
mode,
|
|
43
43
|
)
|
|
44
44
|
)
|
|
@@ -54,13 +54,13 @@ _default_modes = list(range(flake8_scs._DEFAULT_MAX_MODE + 1))
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
def _id_func(arg):
|
|
57
|
-
|
|
57
|
+
max_len = 4
|
|
58
58
|
if arg == _default_modes:
|
|
59
59
|
return 'default_modes'
|
|
60
|
-
if isinstance(arg, list) and len(arg) >
|
|
60
|
+
if isinstance(arg, list) and len(arg) > max_len:
|
|
61
61
|
return '[{}...{}]'.format(
|
|
62
|
-
','.join(str(val) for val in arg[:
|
|
63
|
-
','.join(str(val) for val in arg[-
|
|
62
|
+
','.join(str(val) for val in arg[:max_len]),
|
|
63
|
+
','.join(str(val) for val in arg[-max_len:]),
|
|
64
64
|
)
|
|
65
65
|
return str(arg)
|
|
66
66
|
|
|
@@ -99,7 +99,7 @@ def test_read_octal_mode_option(arg, expected):
|
|
|
99
99
|
|
|
100
100
|
@pytest.mark.parametrize('arg', ['', ',', ',,', 'nope', 'asd', 'a,', '493, a'])
|
|
101
101
|
def test_read_octal_mode_option_invalid(arg):
|
|
102
|
-
with pytest.raises(ValueError, match='^(Invalid value for|Calculated empty value for|Unable to convert).*'):
|
|
102
|
+
with pytest.raises(ValueError, match=r'^(Invalid value for|Calculated empty value for|Unable to convert).*'):
|
|
103
103
|
flake8_scs._read_octal_mode_option('test', arg, _default_modes)
|
|
104
104
|
|
|
105
105
|
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
|
|
3
|
-
version: 2
|
|
4
|
-
updates:
|
|
5
|
-
- package-ecosystem: "github-actions"
|
|
6
|
-
directory: "/"
|
|
7
|
-
schedule:
|
|
8
|
-
interval: "weekly"
|
|
9
|
-
ignore:
|
|
10
|
-
# Optional: Official actions have moving tags like v1;
|
|
11
|
-
# if you use those, you don't need updates.
|
|
12
|
-
- dependency-name: "actions/*"
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
|
|
3
|
-
name: CI
|
|
4
|
-
|
|
5
|
-
on:
|
|
6
|
-
pull_request:
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- main
|
|
10
|
-
- develop
|
|
11
|
-
- v*
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
standard:
|
|
15
|
-
strategy:
|
|
16
|
-
fail-fast: false
|
|
17
|
-
matrix:
|
|
18
|
-
runs-on: [ubuntu-latest, windows-latest, macos-latest]
|
|
19
|
-
python:
|
|
20
|
-
- 3.8
|
|
21
|
-
- 3.9
|
|
22
|
-
- '3.10'
|
|
23
|
-
- '3.11'
|
|
24
|
-
|
|
25
|
-
name: "🐍 ${{ matrix.python }} • ${{ matrix.runs-on }} • x64 ${{ matrix.args }}"
|
|
26
|
-
runs-on: ${{ matrix.runs-on }}
|
|
27
|
-
if: >-
|
|
28
|
-
(github.event_name != 'pull_request'
|
|
29
|
-
|| (github.event_name == 'pull_request' && github.event.pull_request.merged != true))
|
|
30
|
-
|
|
31
|
-
steps:
|
|
32
|
-
- uses: actions/checkout@v3
|
|
33
|
-
|
|
34
|
-
- name: Get history and tags for SCM versioning to work
|
|
35
|
-
run: |
|
|
36
|
-
git fetch --prune --unshallow
|
|
37
|
-
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
|
38
|
-
|
|
39
|
-
- name: Setup Python ${{ matrix.python }}
|
|
40
|
-
uses: actions/setup-python@v3
|
|
41
|
-
with:
|
|
42
|
-
python-version: ${{ matrix.python }}
|
|
43
|
-
architecture: 'x64'
|
|
44
|
-
cache: 'pip'
|
|
45
|
-
cache-dependency-path: '**/setup.cfg'
|
|
46
|
-
|
|
47
|
-
- name: Prepare env
|
|
48
|
-
run: |
|
|
49
|
-
python -m pip install -U wheel coveralls
|
|
50
|
-
|
|
51
|
-
- name: Setup annotations on Linux
|
|
52
|
-
if: runner.os == 'Linux'
|
|
53
|
-
run: python -m pip install pytest-github-actions-annotate-failures
|
|
54
|
-
|
|
55
|
-
- name: Build and install package
|
|
56
|
-
run: python -m pip install -e .[test]
|
|
57
|
-
|
|
58
|
-
- name: Run tests
|
|
59
|
-
run: python -m pytest -v --cov=flake8_secure_coding_standard
|
|
60
|
-
|
|
61
|
-
- name: Coveralls.io
|
|
62
|
-
run: coveralls --service=github
|
|
63
|
-
env:
|
|
64
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
65
|
-
COVERALLS_FLAG_NAME: python-${{ matrix.python }}-${{ matrix.runs-on }}-x64
|
|
66
|
-
COVERALLS_PARALLEL: true
|
|
67
|
-
|
|
68
|
-
finish:
|
|
69
|
-
needs: standard
|
|
70
|
-
runs-on: ubuntu-latest
|
|
71
|
-
container: python:3-slim
|
|
72
|
-
steps:
|
|
73
|
-
- name: Coveralls Finished
|
|
74
|
-
run: |
|
|
75
|
-
pip3 install --upgrade coveralls
|
|
76
|
-
coveralls --finish
|
|
77
|
-
env:
|
|
78
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
{flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/.codespell.allow
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/misc/license_header.txt
RENAMED
|
File without changes
|
|
File without changes
|
{flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/assert_test.py
RENAMED
|
File without changes
|
|
File without changes
|
{flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/eval_exec_test.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/pdb_test.py
RENAMED
|
File without changes
|
|
File without changes
|
{flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/shell_exec_test.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flake8-secure-coding-standard-1.4.1 → flake8_secure_coding_standard-1.5.0}/tests/yaml_load_test.py
RENAMED
|
File without changes
|