securelint 1.0.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.
- securelint-1.0.0/.gitattributes +3 -0
- securelint-1.0.0/.github/workflows/ci.yml +112 -0
- securelint-1.0.0/.github/workflows/release.yml +116 -0
- securelint-1.0.0/.gitignore +16 -0
- securelint-1.0.0/CHANGELOG.md +248 -0
- securelint-1.0.0/LICENSE +21 -0
- securelint-1.0.0/PKG-INFO +701 -0
- securelint-1.0.0/README.md +664 -0
- securelint-1.0.0/SECURITY.md +33 -0
- securelint-1.0.0/action.yml +208 -0
- securelint-1.0.0/benchmarks/compare_bandit.py +237 -0
- securelint-1.0.0/benchmarks/real_projects.py +68 -0
- securelint-1.0.0/benchmarks/scan_speed.py +71 -0
- securelint-1.0.0/docs/real-projects.md +94 -0
- securelint-1.0.0/docs/releasing.md +78 -0
- securelint-1.0.0/docs/threat-model.md +179 -0
- securelint-1.0.0/pyproject.toml +104 -0
- securelint-1.0.0/src/securelint/__init__.py +3 -0
- securelint-1.0.0/src/securelint/__main__.py +5 -0
- securelint-1.0.0/src/securelint/baseline.py +139 -0
- securelint-1.0.0/src/securelint/cache.py +103 -0
- securelint-1.0.0/src/securelint/changes.py +250 -0
- securelint-1.0.0/src/securelint/cli.py +434 -0
- securelint-1.0.0/src/securelint/config.py +304 -0
- securelint-1.0.0/src/securelint/context.py +127 -0
- securelint-1.0.0/src/securelint/dataflow.py +242 -0
- securelint-1.0.0/src/securelint/discovery.py +81 -0
- securelint-1.0.0/src/securelint/engine.py +213 -0
- securelint-1.0.0/src/securelint/explain.py +167 -0
- securelint-1.0.0/src/securelint/fingerprint.py +100 -0
- securelint-1.0.0/src/securelint/github_report.py +133 -0
- securelint-1.0.0/src/securelint/html_report.py +310 -0
- securelint-1.0.0/src/securelint/model.py +84 -0
- securelint-1.0.0/src/securelint/parsing.py +73 -0
- securelint-1.0.0/src/securelint/policy.py +57 -0
- securelint-1.0.0/src/securelint/prompt.py +132 -0
- securelint-1.0.0/src/securelint/providers.py +249 -0
- securelint-1.0.0/src/securelint/py.typed +0 -0
- securelint-1.0.0/src/securelint/report.py +172 -0
- securelint-1.0.0/src/securelint/rules/__init__.py +16 -0
- securelint-1.0.0/src/securelint/rules/_helpers.py +67 -0
- securelint-1.0.0/src/securelint/rules/_sources.py +121 -0
- securelint-1.0.0/src/securelint/rules/code_execution.py +66 -0
- securelint-1.0.0/src/securelint/rules/deserialization.py +112 -0
- securelint-1.0.0/src/securelint/rules/hardcoded_secrets.py +169 -0
- securelint-1.0.0/src/securelint/rules/shell_injection.py +112 -0
- securelint-1.0.0/src/securelint/rules/sql_injection.py +168 -0
- securelint-1.0.0/src/securelint/sarif_report.py +183 -0
- securelint-1.0.0/src/securelint/suppressions.py +169 -0
- securelint-1.0.0/src/securelint/trivy.py +308 -0
- securelint-1.0.0/tests/corpus/README.md +44 -0
- securelint-1.0.0/tests/corpus/code_execution.py +55 -0
- securelint-1.0.0/tests/corpus/deserialization.py +91 -0
- securelint-1.0.0/tests/corpus/hardcoded_secrets.py +57 -0
- securelint-1.0.0/tests/corpus/safe_app.py +49 -0
- securelint-1.0.0/tests/corpus/shell_injection.py +94 -0
- securelint-1.0.0/tests/corpus/sql_injection.py +95 -0
- securelint-1.0.0/tests/corpus/vulnerable_app.py +44 -0
- securelint-1.0.0/tests/test_action.py +516 -0
- securelint-1.0.0/tests/test_answers.py +201 -0
- securelint-1.0.0/tests/test_baseline.py +416 -0
- securelint-1.0.0/tests/test_benchmark.py +39 -0
- securelint-1.0.0/tests/test_cache.py +205 -0
- securelint-1.0.0/tests/test_changes.py +408 -0
- securelint-1.0.0/tests/test_cli.py +241 -0
- securelint-1.0.0/tests/test_compare_bandit.py +136 -0
- securelint-1.0.0/tests/test_config.py +141 -0
- securelint-1.0.0/tests/test_context.py +77 -0
- securelint-1.0.0/tests/test_corpus.py +84 -0
- securelint-1.0.0/tests/test_dataflow.py +262 -0
- securelint-1.0.0/tests/test_discovery.py +123 -0
- securelint-1.0.0/tests/test_engine.py +218 -0
- securelint-1.0.0/tests/test_explain.py +237 -0
- securelint-1.0.0/tests/test_fingerprint.py +182 -0
- securelint-1.0.0/tests/test_github_report.py +260 -0
- securelint-1.0.0/tests/test_html_report.py +202 -0
- securelint-1.0.0/tests/test_model.py +83 -0
- securelint-1.0.0/tests/test_parsing.py +123 -0
- securelint-1.0.0/tests/test_policy.py +328 -0
- securelint-1.0.0/tests/test_prompt.py +222 -0
- securelint-1.0.0/tests/test_providers.py +600 -0
- securelint-1.0.0/tests/test_real_projects.py +46 -0
- securelint-1.0.0/tests/test_release.py +162 -0
- securelint-1.0.0/tests/test_report.py +166 -0
- securelint-1.0.0/tests/test_rule_code_execution.py +83 -0
- securelint-1.0.0/tests/test_rule_deserialization.py +108 -0
- securelint-1.0.0/tests/test_rule_hardcoded_secrets.py +135 -0
- securelint-1.0.0/tests/test_rule_shell_injection.py +110 -0
- securelint-1.0.0/tests/test_rule_sources.py +192 -0
- securelint-1.0.0/tests/test_rule_sql_injection.py +99 -0
- securelint-1.0.0/tests/test_rules_follow_variables.py +328 -0
- securelint-1.0.0/tests/test_sarif_report.py +302 -0
- securelint-1.0.0/tests/test_settings_in_a_scan.py +176 -0
- securelint-1.0.0/tests/test_suppressions.py +347 -0
- securelint-1.0.0/tests/test_threat_model.py +45 -0
- securelint-1.0.0/tests/test_trivy.py +491 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
# The workflow only reads the repository; it never needs to write to it.
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
# A newer push to the same branch or pull request replaces the older run.
|
|
13
|
+
concurrency:
|
|
14
|
+
group: ci-${{ github.ref }}
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
checks:
|
|
19
|
+
name: Checks (Python ${{ matrix.python-version }})
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
timeout-minutes: 10
|
|
22
|
+
strategy:
|
|
23
|
+
fail-fast: false
|
|
24
|
+
matrix:
|
|
25
|
+
# The oldest supported version and the newest released one.
|
|
26
|
+
python-version: ["3.11", "3.14"]
|
|
27
|
+
steps:
|
|
28
|
+
# Actions are pinned to a full commit SHA: a tag can be moved to
|
|
29
|
+
# different code, a commit cannot.
|
|
30
|
+
- name: Check out the repository
|
|
31
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
32
|
+
with:
|
|
33
|
+
persist-credentials: false
|
|
34
|
+
|
|
35
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
36
|
+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
37
|
+
with:
|
|
38
|
+
python-version: ${{ matrix.python-version }}
|
|
39
|
+
cache: pip
|
|
40
|
+
cache-dependency-path: pyproject.toml
|
|
41
|
+
|
|
42
|
+
- name: Install the package and development tools
|
|
43
|
+
run: python -m pip install -e ".[dev]"
|
|
44
|
+
|
|
45
|
+
- name: Lint
|
|
46
|
+
run: python -m ruff check .
|
|
47
|
+
|
|
48
|
+
- name: Check formatting
|
|
49
|
+
run: python -m ruff format --check .
|
|
50
|
+
|
|
51
|
+
- name: Type check
|
|
52
|
+
run: python -m mypy
|
|
53
|
+
|
|
54
|
+
- name: Run tests
|
|
55
|
+
run: python -m pytest
|
|
56
|
+
|
|
57
|
+
securelint:
|
|
58
|
+
# SecureLint checks its own code with its own Action, the way another
|
|
59
|
+
# project would use it. "./" is the Action in this commit, so a change to
|
|
60
|
+
# action.yml is tested by the same pull request.
|
|
61
|
+
name: SecureLint
|
|
62
|
+
runs-on: ubuntu-latest
|
|
63
|
+
timeout-minutes: 10
|
|
64
|
+
steps:
|
|
65
|
+
- name: Check out the repository
|
|
66
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
67
|
+
with:
|
|
68
|
+
fetch-depth: 0 # the whole history, to find the changed lines
|
|
69
|
+
persist-credentials: false
|
|
70
|
+
|
|
71
|
+
- name: Scan with SecureLint
|
|
72
|
+
uses: ./
|
|
73
|
+
with:
|
|
74
|
+
# Also download the pinned Trivy, verify it and read its report.
|
|
75
|
+
trivy: "true"
|
|
76
|
+
|
|
77
|
+
package:
|
|
78
|
+
# Builds the package the way it will be published, checks it as PyPI
|
|
79
|
+
# will, and installs it in an empty environment to use it from outside
|
|
80
|
+
# the repository, as someone who ran `pip install securelint` would.
|
|
81
|
+
name: Package
|
|
82
|
+
runs-on: ubuntu-latest
|
|
83
|
+
timeout-minutes: 10
|
|
84
|
+
steps:
|
|
85
|
+
- name: Check out the repository
|
|
86
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
87
|
+
with:
|
|
88
|
+
persist-credentials: false
|
|
89
|
+
|
|
90
|
+
- name: Set up Python
|
|
91
|
+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
92
|
+
with:
|
|
93
|
+
python-version: "3.13"
|
|
94
|
+
|
|
95
|
+
- name: Build the package
|
|
96
|
+
run: |
|
|
97
|
+
python -m pip install "build==1.6.1" "twine==7.0.0"
|
|
98
|
+
python -m build
|
|
99
|
+
python -m twine check --strict dist/*
|
|
100
|
+
|
|
101
|
+
- name: Install it in an empty environment and use it
|
|
102
|
+
run: |
|
|
103
|
+
python -m venv "$RUNNER_TEMP/clean"
|
|
104
|
+
"$RUNNER_TEMP/clean/bin/python" -m pip install dist/*.whl
|
|
105
|
+
cd "$RUNNER_TEMP"
|
|
106
|
+
"$RUNNER_TEMP/clean/bin/securelint" --version
|
|
107
|
+
printf 'print("safe")\n' > ok.py
|
|
108
|
+
"$RUNNER_TEMP/clean/bin/securelint" scan ok.py
|
|
109
|
+
printf 'eval(input())\n' > risky.py
|
|
110
|
+
status=0
|
|
111
|
+
"$RUNNER_TEMP/clean/bin/securelint" scan risky.py || status=$?
|
|
112
|
+
test "$status" -eq 1
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Publishes SecureLint with PyPI's Trusted Publishing: GitHub proves to PyPI
|
|
4
|
+
# which repository and workflow is asking, so no password or token is stored
|
|
5
|
+
# anywhere.
|
|
6
|
+
#
|
|
7
|
+
# - Started by hand (Actions > Release > Run workflow): a rehearsal that
|
|
8
|
+
# publishes to TestPyPI only.
|
|
9
|
+
# - A tag such as v1.0.0: publishes to TestPyPI, then to PyPI.
|
|
10
|
+
on:
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
push:
|
|
13
|
+
tags: ["v*"]
|
|
14
|
+
|
|
15
|
+
# Nothing here writes to the repository. The publishing jobs get the one
|
|
16
|
+
# extra permission they need, and nothing else does.
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
|
|
20
|
+
# Never two releases at once, and never one cancelled halfway.
|
|
21
|
+
concurrency:
|
|
22
|
+
group: release
|
|
23
|
+
cancel-in-progress: false
|
|
24
|
+
|
|
25
|
+
jobs:
|
|
26
|
+
build:
|
|
27
|
+
name: Build
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
timeout-minutes: 10
|
|
30
|
+
steps:
|
|
31
|
+
- name: Check out the repository
|
|
32
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
33
|
+
with:
|
|
34
|
+
persist-credentials: false
|
|
35
|
+
|
|
36
|
+
- name: Set up Python
|
|
37
|
+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
38
|
+
with:
|
|
39
|
+
python-version: "3.13"
|
|
40
|
+
|
|
41
|
+
- name: Build and check the package
|
|
42
|
+
run: |
|
|
43
|
+
python -m pip install "build==1.6.1" "twine==7.0.0"
|
|
44
|
+
python -m build
|
|
45
|
+
python -m twine check --strict dist/*
|
|
46
|
+
|
|
47
|
+
- name: Check that the version matches the tag
|
|
48
|
+
env:
|
|
49
|
+
REF_TYPE: ${{ github.ref_type }}
|
|
50
|
+
TAG: ${{ github.ref_name }}
|
|
51
|
+
run: |
|
|
52
|
+
set -u
|
|
53
|
+
wheel=$(ls dist/*.whl)
|
|
54
|
+
version=$(basename "$wheel" | cut -d - -f 2)
|
|
55
|
+
echo "Package version: $version"
|
|
56
|
+
if [ "$REF_TYPE" = "tag" ] && [ "$TAG" != "v$version" ]; then
|
|
57
|
+
echo "::error::The tag $TAG does not match the package version $version"
|
|
58
|
+
exit 1
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
- name: Keep the package for the publishing jobs
|
|
62
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
63
|
+
with:
|
|
64
|
+
name: dist
|
|
65
|
+
path: dist/
|
|
66
|
+
if-no-files-found: error
|
|
67
|
+
|
|
68
|
+
testpypi:
|
|
69
|
+
name: Publish to TestPyPI
|
|
70
|
+
needs: build
|
|
71
|
+
runs-on: ubuntu-latest
|
|
72
|
+
timeout-minutes: 10
|
|
73
|
+
environment:
|
|
74
|
+
name: testpypi
|
|
75
|
+
url: https://test.pypi.org/p/securelint
|
|
76
|
+
permissions:
|
|
77
|
+
# Lets GitHub prove to TestPyPI who is publishing (Trusted Publishing).
|
|
78
|
+
id-token: write
|
|
79
|
+
steps:
|
|
80
|
+
- name: Get the package
|
|
81
|
+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
82
|
+
with:
|
|
83
|
+
name: dist
|
|
84
|
+
path: dist/
|
|
85
|
+
|
|
86
|
+
- name: Publish
|
|
87
|
+
# v1.14.3 fixes GHSA-5xjx-3w67-w9x9 (critical, October 2026).
|
|
88
|
+
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
|
|
89
|
+
with:
|
|
90
|
+
repository-url: https://test.pypi.org/legacy/
|
|
91
|
+
# A rehearsal can be run again for the same version.
|
|
92
|
+
skip-existing: true
|
|
93
|
+
|
|
94
|
+
pypi:
|
|
95
|
+
name: Publish to PyPI
|
|
96
|
+
# Only for a tag, and only after TestPyPI accepted the same files.
|
|
97
|
+
if: github.ref_type == 'tag'
|
|
98
|
+
needs: testpypi
|
|
99
|
+
runs-on: ubuntu-latest
|
|
100
|
+
timeout-minutes: 10
|
|
101
|
+
environment:
|
|
102
|
+
name: pypi
|
|
103
|
+
url: https://pypi.org/p/securelint
|
|
104
|
+
permissions:
|
|
105
|
+
# Lets GitHub prove to PyPI who is publishing (Trusted Publishing).
|
|
106
|
+
id-token: write
|
|
107
|
+
steps:
|
|
108
|
+
- name: Get the package
|
|
109
|
+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
110
|
+
with:
|
|
111
|
+
name: dist
|
|
112
|
+
path: dist/
|
|
113
|
+
|
|
114
|
+
- name: Publish
|
|
115
|
+
# v1.14.3 fixes GHSA-5xjx-3w67-w9x9 (critical, October 2026).
|
|
116
|
+
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
What changed in each version of SecureLint, newest first.
|
|
4
|
+
|
|
5
|
+
## 1.0.0 (2026-11-16)
|
|
6
|
+
|
|
7
|
+
Measured, threat-modelled and installable: `pip install securelint`. The
|
|
8
|
+
README's Stability section lists what stays the same across 1.x (commands,
|
|
9
|
+
exit codes, JSON and SARIF formats, rule ids, fingerprints, settings and the
|
|
10
|
+
Action's inputs).
|
|
11
|
+
|
|
12
|
+
- `benchmarks/compare_bandit.py` runs SecureLint and Bandit 1.9.4 on the
|
|
13
|
+
annotated corpus and scores both the same way, by statement, for the five
|
|
14
|
+
kinds of problems both look for. The README shows the results and what
|
|
15
|
+
they leave out: the corpus favours SecureLint, and Bandit does better on
|
|
16
|
+
hard-coded secrets.
|
|
17
|
+
- `docs/real-projects.md` sorts by hand every finding of SecureLint and
|
|
18
|
+
Bandit on four real projects (Flask, Requests, HTTPie, Jinja):
|
|
19
|
+
SecureLint 6 findings with 1 false alarm, Bandit 20 with 15.
|
|
20
|
+
`benchmarks/real_projects.py` lists the findings again for any folder.
|
|
21
|
+
- `docs/threat-model.md` lists what SecureLint protects, what it does not
|
|
22
|
+
trust, the attacks it was built against with the test behind each
|
|
23
|
+
protection, and the remaining risks. A test fails if a named test
|
|
24
|
+
disappears. `SECURITY.md` says how to report a vulnerability privately.
|
|
25
|
+
- The Action installs Anthropic's package only when the project's settings
|
|
26
|
+
choose the `anthropic` provider, not for every `explain: "true"`.
|
|
27
|
+
- An OpenAI-compatible service that does not answer within 60 seconds is
|
|
28
|
+
asked once more, at once; a second slow answer ends the attempt.
|
|
29
|
+
- Ready for PyPI: the package now has classifiers, keywords and project
|
|
30
|
+
links, ships a `py.typed` marker, and the README's links are full
|
|
31
|
+
addresses so they also work on PyPI. A new CI job builds the package,
|
|
32
|
+
checks it with `twine check --strict`, and installs it in an empty
|
|
33
|
+
environment to use it from outside the repository.
|
|
34
|
+
- A Release workflow publishes with PyPI's Trusted Publishing (no password
|
|
35
|
+
or token stored anywhere) and digital attestations: by hand to TestPyPI
|
|
36
|
+
as a rehearsal, and on a `v*` tag to TestPyPI then PyPI, after checking
|
|
37
|
+
that the tag matches the package version. `docs/releasing.md` explains
|
|
38
|
+
the one-time setup and the steps of a release. A rehearsal published 0.6.0
|
|
39
|
+
to TestPyPI with attestations naming this repository and workflow.
|
|
40
|
+
- The README explains installing from PyPI and what is stable in 1.x.
|
|
41
|
+
- The corpus numbers are unchanged (54 reported, 9 missed, 4 reported by
|
|
42
|
+
mistake).
|
|
43
|
+
|
|
44
|
+
Known limits: the rules find five kinds of problems in Python code, not all
|
|
45
|
+
security problems; a pull request can silence its own findings, which is
|
|
46
|
+
visible but not blocked (see the threat model); there is no size limit on
|
|
47
|
+
scanned files.
|
|
48
|
+
|
|
49
|
+
## 0.6.0 (2026-11-15)
|
|
50
|
+
|
|
51
|
+
AI explanations: a few plain words under each finding, from the AI the
|
|
52
|
+
project chooses, without ever changing what blocks.
|
|
53
|
+
|
|
54
|
+
- `scan --explain` adds a short explanation, written by an AI, under each
|
|
55
|
+
finding shown (at most 10), in the text and JSON reports. It is added
|
|
56
|
+
after the policy has decided, so it never changes what blocks or the exit
|
|
57
|
+
code, and an explanation that fails is only skipped.
|
|
58
|
+
- The AI is chosen in `[tool.securelint.ai]`: `anthropic` (Claude, through
|
|
59
|
+
Anthropic's Python package, an optional extra:
|
|
60
|
+
`pip install "securelint[anthropic]"`) or `openai-compatible` (OpenAI, or a
|
|
61
|
+
local model such as Ollama, with no package). The key is read from an
|
|
62
|
+
environment variable; a key written in the settings stops the scan. A
|
|
63
|
+
`base-url` must be `https://`, or `http://` on this machine, and redirects
|
|
64
|
+
are not followed. A busy OpenAI-compatible service (429 or 5xx) is asked
|
|
65
|
+
again up to two times, waiting longer each time.
|
|
66
|
+
- Explanations are kept in `.securelint-cache/` (never committed, no code in
|
|
67
|
+
it), so the same finding with the same lines around it is not sent to the
|
|
68
|
+
AI again. A damaged or unwritable cache is reported and changes nothing.
|
|
69
|
+
- The Action's `explain` input adds the explanations to the notes on a pull
|
|
70
|
+
request; the key comes from a repository secret given to the step. Only
|
|
71
|
+
the notes are explained, not the SARIF report, and pull requests from
|
|
72
|
+
forks, which get no secrets, are checked as usual without explanations.
|
|
73
|
+
- What is sent to explain a finding is the finding and the 3 lines before
|
|
74
|
+
and after it, never the whole file. Before it leaves, every string on the
|
|
75
|
+
line of a hard-coded secret, the value of any name that sounds secret, and
|
|
76
|
+
text shaped like a well-known key are replaced by `***`. Lines are cut at
|
|
77
|
+
200 characters.
|
|
78
|
+
- The AI must answer with a JSON object holding an `explanation` and,
|
|
79
|
+
optionally, a `fix`; any other answer is dropped. Control characters are
|
|
80
|
+
removed and long answers are cut. Explanations are shown, labelled "AI
|
|
81
|
+
explanation (may be wrong)", in the text, JSON and HTML reports and in the
|
|
82
|
+
GitHub notes, never in the job summary.
|
|
83
|
+
- Tested for real with Gemini's free tier (`gemini-3.5-flash-lite`, through
|
|
84
|
+
the `openai-compatible` provider), on the laptop and in GitHub Actions on
|
|
85
|
+
[securelint-demo pull request #1](https://github.com/Fatennhrb/securelint-demo/pull/1).
|
|
86
|
+
The Claude provider is tested against Anthropic's real package and a fake
|
|
87
|
+
service, not yet with a real key.
|
|
88
|
+
- The corpus numbers are unchanged (54 reported, 9 missed, 4 reported by
|
|
89
|
+
mistake).
|
|
90
|
+
|
|
91
|
+
Known limits: the Action installs Anthropic's package whenever `explain` is
|
|
92
|
+
on, even for another provider; a request that times out is not retried; on
|
|
93
|
+
Gemini's free tier Google may use what is sent, so it suits made-up code only.
|
|
94
|
+
|
|
95
|
+
## 0.5.0 (2026-11-15)
|
|
96
|
+
|
|
97
|
+
Dependencies and Dockerfiles: Trivy's findings go through the same gate as
|
|
98
|
+
the code's.
|
|
99
|
+
|
|
100
|
+
- `--trivy-report FILE` adds the vulnerable dependencies found by Trivy
|
|
101
|
+
(`trivy fs --format json`) to the scan, as findings of rule `SL201` on the
|
|
102
|
+
line that names the package. They go through the baseline, the policy and
|
|
103
|
+
every report like the other findings. SecureLint reads the report; it does
|
|
104
|
+
not run Trivy.
|
|
105
|
+
- The same report's failed configuration checks (Trivy's `misconfig`
|
|
106
|
+
scanner) become findings of rule `SL202`, on the Dockerfile line Trivy
|
|
107
|
+
points to.
|
|
108
|
+
- The Action's `trivy` input downloads Trivy 0.76.2, checks it against a
|
|
109
|
+
pinned checksum before running it, and adds its report to the scan.
|
|
110
|
+
SecureLint's own CI uses it, and
|
|
111
|
+
[securelint-demo pull request #2](https://github.com/Fatennhrb/securelint-demo/pull/2)
|
|
112
|
+
shows it on an old dependency and a Dockerfile.
|
|
113
|
+
- The summary counts the files a Trivy report has problems in among the
|
|
114
|
+
files checked.
|
|
115
|
+
- The corpus numbers are unchanged (54 reported, 9 missed, 4 reported by
|
|
116
|
+
mistake).
|
|
117
|
+
|
|
118
|
+
Known limits: SecureLint does not run Trivy itself outside the Action, and
|
|
119
|
+
does not scan built container images; a dependency is reported on the line
|
|
120
|
+
that names it, or on line 1 when no line does; "found in N files" counts the
|
|
121
|
+
files checked, not only those with problems.
|
|
122
|
+
|
|
123
|
+
## 0.4.0 (2026-11-15)
|
|
124
|
+
|
|
125
|
+
GitHub integration: findings appear on the lines a pull request changed.
|
|
126
|
+
|
|
127
|
+
- `--format sarif` writes the result in SARIF 2.1.0, the format GitHub reads
|
|
128
|
+
for security tools, with paths from the top of the project and each
|
|
129
|
+
finding's fingerprint.
|
|
130
|
+
- `--changed-since BRANCH` reports only findings on lines the current
|
|
131
|
+
branch added or changed since it left BRANCH, asking Git for those
|
|
132
|
+
lines. Findings elsewhere are counted and listed, not reported.
|
|
133
|
+
- `--format github` prints findings as notes GitHub Actions shows on the
|
|
134
|
+
lines of a pull request, and adds a summary table to the job's page.
|
|
135
|
+
- The repository is a GitHub Action (`action.yml`): on a pull request it
|
|
136
|
+
reports the findings on the changed lines and fails when something
|
|
137
|
+
blocks. It needs no token and no write permission.
|
|
138
|
+
- SecureLint's own CI runs the Action on its code, and a demo repository,
|
|
139
|
+
[securelint-demo](https://github.com/Fatennhrb/securelint-demo), shows it
|
|
140
|
+
on a real pull request.
|
|
141
|
+
- The corpus numbers are unchanged (54 reported, 9 missed, 4 reported by
|
|
142
|
+
mistake).
|
|
143
|
+
|
|
144
|
+
Known limits: the Action does not upload SARIF itself; `--changed-since` needs
|
|
145
|
+
the target branch in the local history (`fetch-depth: 0`); a finding is shown
|
|
146
|
+
only when its own line changed, even if the change that caused it is on
|
|
147
|
+
another line.
|
|
148
|
+
|
|
149
|
+
## 0.3.0 (2026-11-14)
|
|
150
|
+
|
|
151
|
+
Policy and configuration: what a team needs to use the scanner every day.
|
|
152
|
+
|
|
153
|
+
- Settings in `pyproject.toml`: `exclude` leaves files and directories out
|
|
154
|
+
of a scan, `ignore` turns rules off. A mistake in the settings stops the
|
|
155
|
+
scan instead of being skipped.
|
|
156
|
+
- One finding can be silenced with a comment on its line:
|
|
157
|
+
`# securelint: ignore[SL102] reason`. Silenced findings are counted and
|
|
158
|
+
listed in the reports, and a comment that silences nothing is reported as
|
|
159
|
+
`SL001`.
|
|
160
|
+
- Each finding has a `fingerprint` in the JSON report: an identity that
|
|
161
|
+
does not change when lines are added or removed elsewhere in the file.
|
|
162
|
+
- `securelint baseline` records the findings a project has today in
|
|
163
|
+
`.securelint-baseline.json`. Later scans report only new findings; the
|
|
164
|
+
known ones are counted, and listed in the JSON and HTML reports.
|
|
165
|
+
- A policy in `[tool.securelint.policy]` sets the severity and confidence
|
|
166
|
+
from which a finding blocks. Findings below it are reported as warnings
|
|
167
|
+
and do not fail the scan. Without a policy, every finding still blocks.
|
|
168
|
+
- The corpus numbers are unchanged (54 reported, 9 missed, 4 reported by
|
|
169
|
+
mistake), and the scan is not slower than in 0.2.0 when both are timed
|
|
170
|
+
side by side.
|
|
171
|
+
|
|
172
|
+
Known limits: `exclude` takes exact paths, not patterns; a silencing comment
|
|
173
|
+
must be on the line where the finding is reported; editing a line listed in
|
|
174
|
+
the baseline, even its comment, makes its finding new again.
|
|
175
|
+
|
|
176
|
+
## 0.2.0 (2026-11-13)
|
|
177
|
+
|
|
178
|
+
Data-flow analysis: the rules follow a value from where it is created to
|
|
179
|
+
where it is used, inside one file.
|
|
180
|
+
|
|
181
|
+
- Rules look through a variable to the value it was given, inside one
|
|
182
|
+
function. A query built on one line and run on the next is now reported,
|
|
183
|
+
and a fixed value kept in a variable is no longer reported. This is done
|
|
184
|
+
only when the variable is assigned exactly once.
|
|
185
|
+
- A function kept in a variable is followed: after `run = os.system`,
|
|
186
|
+
`run(command)` is checked as `os.system(command)`.
|
|
187
|
+
- A value set once at the top of a file is known inside the functions of
|
|
188
|
+
that file, and fixed pieces put together (`"ls " + "-l"`, an f-string of
|
|
189
|
+
fixed values, `", ".join("?" for _ in ids)`) count as fixed. This removes
|
|
190
|
+
false alarms.
|
|
191
|
+
- A finding whose value comes from a web request, `input()`, `sys.argv` or
|
|
192
|
+
`sys.stdin` is reported with high confidence, and its message says where
|
|
193
|
+
the value comes from and on which line.
|
|
194
|
+
- Corpus: 54 dangerous lines reported (was 50), 9 missed (was 13), 4 safe
|
|
195
|
+
lines reported by mistake (was 8).
|
|
196
|
+
- Speed: 314 files per second on Python's standard library (was 299).
|
|
197
|
+
|
|
198
|
+
Known limits: a value passed from one function to another is not followed,
|
|
199
|
+
and a variable assigned more than once is not followed.
|
|
200
|
+
|
|
201
|
+
## 0.1.0 (2026-11-12)
|
|
202
|
+
|
|
203
|
+
The first release: a working scanner for Python source code.
|
|
204
|
+
|
|
205
|
+
### Scanning
|
|
206
|
+
|
|
207
|
+
- `securelint scan [path]` scans one Python file, or every Python file in a
|
|
208
|
+
directory. Hidden directories, `__pycache__`, `node_modules`, virtual
|
|
209
|
+
environments and symbolic links are skipped.
|
|
210
|
+
- Files are only parsed, never imported or run. A file that cannot be read or
|
|
211
|
+
parsed is reported and the scan continues with the others.
|
|
212
|
+
- Exit codes for scripts and CI jobs: `0` no problems, `1` problems found,
|
|
213
|
+
`2` the scan could not be completed.
|
|
214
|
+
|
|
215
|
+
### Rules
|
|
216
|
+
|
|
217
|
+
- **SL101**: `eval()` or `exec()` called with a value built at run time.
|
|
218
|
+
- **SL102**: a shell command built at run time (`os.system()`,
|
|
219
|
+
`subprocess` with `shell=True`, and similar).
|
|
220
|
+
- **SL103**: data loaded with a format that can run code (`pickle`, `dill`,
|
|
221
|
+
`marshal`, `yaml.load()` without a safe loader).
|
|
222
|
+
- **SL104**: a password or key written directly in the code.
|
|
223
|
+
- **SL105**: an SQL query with values put into its text.
|
|
224
|
+
- Rules follow imports, so `import subprocess as sp` and
|
|
225
|
+
`from os import system as sh` are understood.
|
|
226
|
+
|
|
227
|
+
### Reports
|
|
228
|
+
|
|
229
|
+
- Text report for the terminal (the default).
|
|
230
|
+
- `--format json`: the full result as a JSON document.
|
|
231
|
+
- `--format html`: one self-contained page to open in a browser, with no
|
|
232
|
+
script and no network access.
|
|
233
|
+
|
|
234
|
+
### Quality
|
|
235
|
+
|
|
236
|
+
- An annotated corpus of example files measures the rules: 50 dangerous
|
|
237
|
+
lines reported, 13 missed, 8 safe lines reported by mistake.
|
|
238
|
+
- A benchmark script measures scan speed: 299 files per second on Python's
|
|
239
|
+
standard library, on the author's laptop.
|
|
240
|
+
- Every change is checked on Python 3.11 and 3.14 with Ruff, mypy (strict)
|
|
241
|
+
and pytest.
|
|
242
|
+
|
|
243
|
+
### Known limits
|
|
244
|
+
|
|
245
|
+
- A value that passes through a variable before reaching a dangerous call is
|
|
246
|
+
not followed (`query = f"..."` then `cursor.execute(query)`).
|
|
247
|
+
- `from module import *` is not followed.
|
|
248
|
+
- There is no configuration file and no way to silence a finding yet.
|
securelint-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Faten Harbaoui
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|