pinstack 0.1.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.
- pinstack-0.1.0/LICENSE +194 -0
- pinstack-0.1.0/PKG-INFO +340 -0
- pinstack-0.1.0/README.md +306 -0
- pinstack-0.1.0/pinstack/__init__.py +1 -0
- pinstack-0.1.0/pinstack/__main__.py +4 -0
- pinstack-0.1.0/pinstack/checkers/__init__.py +37 -0
- pinstack-0.1.0/pinstack/checkers/cargo.py +148 -0
- pinstack-0.1.0/pinstack/checkers/compose.py +58 -0
- pinstack-0.1.0/pinstack/checkers/dockerfile.py +69 -0
- pinstack-0.1.0/pinstack/checkers/gemfile.py +110 -0
- pinstack-0.1.0/pinstack/checkers/github_actions.py +102 -0
- pinstack-0.1.0/pinstack/checkers/go.py +146 -0
- pinstack-0.1.0/pinstack/checkers/gradle.py +227 -0
- pinstack-0.1.0/pinstack/checkers/helm.py +178 -0
- pinstack-0.1.0/pinstack/checkers/maven.py +196 -0
- pinstack-0.1.0/pinstack/checkers/package_json.py +194 -0
- pinstack-0.1.0/pinstack/checkers/package_lock.py +86 -0
- pinstack-0.1.0/pinstack/checkers/pnpm_lock.py +110 -0
- pinstack-0.1.0/pinstack/checkers/pyproject.py +521 -0
- pinstack-0.1.0/pinstack/checkers/requirements.py +158 -0
- pinstack-0.1.0/pinstack/checkers/terraform.py +106 -0
- pinstack-0.1.0/pinstack/checkers/yarn_lock.py +97 -0
- pinstack-0.1.0/pinstack/cli.py +161 -0
- pinstack-0.1.0/pinstack/core.py +161 -0
- pinstack-0.1.0/pinstack/sarif.py +101 -0
- pinstack-0.1.0/pinstack.egg-info/PKG-INFO +340 -0
- pinstack-0.1.0/pinstack.egg-info/SOURCES.txt +50 -0
- pinstack-0.1.0/pinstack.egg-info/dependency_links.txt +1 -0
- pinstack-0.1.0/pinstack.egg-info/entry_points.txt +2 -0
- pinstack-0.1.0/pinstack.egg-info/requires.txt +8 -0
- pinstack-0.1.0/pinstack.egg-info/top_level.txt +1 -0
- pinstack-0.1.0/pyproject.toml +54 -0
- pinstack-0.1.0/setup.cfg +4 -0
- pinstack-0.1.0/tests/test_checker_cargo.py +80 -0
- pinstack-0.1.0/tests/test_checker_cargo_crossref.py +156 -0
- pinstack-0.1.0/tests/test_checker_docker.py +194 -0
- pinstack-0.1.0/tests/test_checker_gemfile.py +61 -0
- pinstack-0.1.0/tests/test_checker_gemfile_crossref.py +142 -0
- pinstack-0.1.0/tests/test_checker_gha.py +102 -0
- pinstack-0.1.0/tests/test_checker_go.py +71 -0
- pinstack-0.1.0/tests/test_checker_go_crossref.py +128 -0
- pinstack-0.1.0/tests/test_checker_gradle.py +337 -0
- pinstack-0.1.0/tests/test_checker_helm.py +228 -0
- pinstack-0.1.0/tests/test_checker_js.py +488 -0
- pinstack-0.1.0/tests/test_checker_maven.py +180 -0
- pinstack-0.1.0/tests/test_checker_pyproject.py +817 -0
- pinstack-0.1.0/tests/test_checker_requirements.py +206 -0
- pinstack-0.1.0/tests/test_checker_terraform.py +76 -0
- pinstack-0.1.0/tests/test_cli.py +264 -0
- pinstack-0.1.0/tests/test_core.py +494 -0
- pinstack-0.1.0/tests/test_integration.py +533 -0
- pinstack-0.1.0/tests/test_sarif.py +460 -0
pinstack-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship made available under
|
|
36
|
+
the License, as indicated by a copyright notice that is included in
|
|
37
|
+
or attached to the work (an example is provided in the Appendix below).
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
+
of this License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
48
|
+
in the Work by the copyright owner or by an individual or Legal Entity
|
|
49
|
+
authorized to submit on behalf of the copyright owner. For the purposes
|
|
50
|
+
of this definition, "submit" means any form of electronic, verbal, or
|
|
51
|
+
written communication sent to the Licensor or its representatives,
|
|
52
|
+
including but not limited to communication on electronic mailing lists,
|
|
53
|
+
source code control systems, and issue tracking systems that are managed
|
|
54
|
+
by, or on behalf of, the Licensor for the purpose of tracking
|
|
55
|
+
modifications to the Work, but excluding communication that is
|
|
56
|
+
conspicuously marked or designated in writing by the copyright owner
|
|
57
|
+
as "Not a Contribution."
|
|
58
|
+
|
|
59
|
+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
60
|
+
whom a Contribution has been received by the Licensor and included
|
|
61
|
+
within the Work.
|
|
62
|
+
|
|
63
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
64
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
65
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
66
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
67
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
68
|
+
Work and such Derivative Works in Source or Object form.
|
|
69
|
+
|
|
70
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
71
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
72
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
73
|
+
(except as stated in this section) patent license to make, have made,
|
|
74
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
75
|
+
where such license applies only to those patent claims licensable
|
|
76
|
+
by such Contributor that are necessarily infringed by their
|
|
77
|
+
Contribution(s) alone or by the combination of their Contribution(s)
|
|
78
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
79
|
+
institute patent litigation against any entity (including a cross-claim
|
|
80
|
+
or counterclaim in a lawsuit) alleging that the Work or any patent
|
|
81
|
+
claim embodied in the Work constitutes direct or indirect patent
|
|
82
|
+
infringement, then any patent licenses granted to You under this
|
|
83
|
+
License for that Work shall terminate as of the date such litigation
|
|
84
|
+
is filed.
|
|
85
|
+
|
|
86
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
87
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
88
|
+
modifications, and in Source or Object form, provided that You
|
|
89
|
+
meet the following conditions:
|
|
90
|
+
|
|
91
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
92
|
+
Works a copy of this License; and
|
|
93
|
+
|
|
94
|
+
(b) You must cause any modified files to carry prominent notices
|
|
95
|
+
stating that You changed the files; and
|
|
96
|
+
|
|
97
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
98
|
+
that You distribute, all copyright, patent, trademark, and
|
|
99
|
+
attribution notices from the Source form of the Work,
|
|
100
|
+
excluding those notices that do not pertain to any part of
|
|
101
|
+
the Derivative Works; and
|
|
102
|
+
|
|
103
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
104
|
+
distribution, You must include a readable copy of the
|
|
105
|
+
attribution notices contained within such NOTICE file, in
|
|
106
|
+
at least one of the following places: within a NOTICE text
|
|
107
|
+
file distributed as part of the Derivative Works; within
|
|
108
|
+
the Source form or documentation, if provided along with the
|
|
109
|
+
Derivative Works; or, within a display generated by the
|
|
110
|
+
Derivative Works, if and wherever such third-party notices
|
|
111
|
+
normally appear. The contents of the NOTICE file are for
|
|
112
|
+
informational purposes only and do not modify the License.
|
|
113
|
+
You may add Your own attribution notices within Derivative
|
|
114
|
+
Works that You distribute, alongside or in addition to the
|
|
115
|
+
NOTICE text from the Work, provided that such additional
|
|
116
|
+
attribution notices cannot be construed as modifying the License.
|
|
117
|
+
|
|
118
|
+
You may add Your own license statement for Your modifications and
|
|
119
|
+
may provide additional grant of rights to use, copy, modify, merge,
|
|
120
|
+
publish, distribute, sublicense, and/or sell copies of the
|
|
121
|
+
Derivative Works, as separate from the License.
|
|
122
|
+
|
|
123
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
124
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
125
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
126
|
+
this License, without any additional terms or conditions.
|
|
127
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
128
|
+
the terms of any separate license agreement you may have executed
|
|
129
|
+
with Licensor regarding such Contributions.
|
|
130
|
+
|
|
131
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
132
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
133
|
+
except as required for reasonable and customary use in describing the
|
|
134
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
135
|
+
|
|
136
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
137
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
138
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
139
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
140
|
+
implied, including, without limitation, any warranties or conditions
|
|
141
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
142
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
143
|
+
appropriateness of using or reproducing the Work and assume any
|
|
144
|
+
risks associated with Your exercise of permissions under this License.
|
|
145
|
+
|
|
146
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
147
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
148
|
+
unless required by applicable law (such as deliberate and grossly
|
|
149
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
150
|
+
liable to You for damages, including any direct, indirect, special,
|
|
151
|
+
incidental, or exemplary damages of any character arising as a
|
|
152
|
+
result of this License or out of the use or inability to use the
|
|
153
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
154
|
+
work stoppage, computer failure or malfunction, or all other
|
|
155
|
+
commercial damages or losses), even if such Contributor has been
|
|
156
|
+
advised of the possibility of such damages.
|
|
157
|
+
|
|
158
|
+
9. Accepting Warranty or Liability. While redistributing the Work or
|
|
159
|
+
Derivative Works thereof, You may choose to offer, and charge a fee
|
|
160
|
+
for, acceptance of support, warranty, indemnity, or other liability
|
|
161
|
+
obligations and/or rights consistent with this License. However, in
|
|
162
|
+
accepting such obligations, You may offer such obligations only on
|
|
163
|
+
Your own behalf and on Your sole responsibility, not on behalf of
|
|
164
|
+
any other Contributor, and only if You agree to indemnify, defend,
|
|
165
|
+
and hold each Contributor harmless for any liability incurred by,
|
|
166
|
+
or claims asserted against, such Contributor by reason of your
|
|
167
|
+
accepting any such warranty or additional liability.
|
|
168
|
+
|
|
169
|
+
END OF TERMS AND CONDITIONS
|
|
170
|
+
|
|
171
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
172
|
+
|
|
173
|
+
To apply the Apache License to your work, attach the following
|
|
174
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
175
|
+
replaced with your own identifying information. (Don't include
|
|
176
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
177
|
+
comment syntax for the format in use; we also recommend that a
|
|
178
|
+
file and/or class name and description be included on the same
|
|
179
|
+
"printed page" as the copyright notice for easier identification
|
|
180
|
+
within third-party archives.
|
|
181
|
+
|
|
182
|
+
Copyright 2024 smthmlk
|
|
183
|
+
|
|
184
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
185
|
+
you may not use this file except in compliance with the License.
|
|
186
|
+
You may obtain a copy of the License at
|
|
187
|
+
|
|
188
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
189
|
+
|
|
190
|
+
Unless required by applicable law or agreed to in writing, software
|
|
191
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
192
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
193
|
+
See the License for the specific language governing permissions and
|
|
194
|
+
limitations under the License.
|
pinstack-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pinstack
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Supply-chain dependency pinning enforcement for every ecosystem
|
|
5
|
+
Author: smthmlk
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/a4899e/pinstack
|
|
8
|
+
Project-URL: Repository, https://github.com/a4899e/pinstack
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/a4899e/pinstack/issues
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Security
|
|
22
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest==9.0.2; extra == "dev"
|
|
28
|
+
Requires-Dist: ruff==0.15.7; extra == "dev"
|
|
29
|
+
Requires-Dist: pyright==1.1.408; extra == "dev"
|
|
30
|
+
Requires-Dist: invoke==2.2.1; extra == "dev"
|
|
31
|
+
Requires-Dist: jsonschema==4.26.0; extra == "dev"
|
|
32
|
+
Requires-Dist: bandit==1.9.4; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# pinstack
|
|
36
|
+
|
|
37
|
+
Supply-chain dependency pinning enforcement for every ecosystem.
|
|
38
|
+
|
|
39
|
+
pinstack scans a project directory and reports unpinned or loosely-pinned
|
|
40
|
+
dependencies across the most common package managers, container formats, and
|
|
41
|
+
infrastructure tools. It is designed to drop into any CI pipeline with a single
|
|
42
|
+
command and zero setup beyond `pip install pinstack`.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Project Goals
|
|
47
|
+
|
|
48
|
+
**1. Broad ecosystem coverage**
|
|
49
|
+
|
|
50
|
+
pinstack understands as many project and language types as possible. A single
|
|
51
|
+
invocation on a monorepo surfaces pinning issues in Python packages, Node
|
|
52
|
+
modules, Docker images, Go modules, Rust crates, Ruby gems, Terraform providers,
|
|
53
|
+
Helm charts, and more.
|
|
54
|
+
|
|
55
|
+
**2. Zero dependencies**
|
|
56
|
+
|
|
57
|
+
pinstack has no runtime dependencies outside the Python standard library. It
|
|
58
|
+
runs on any system's `python3` (3.9 or later) without a virtual environment or
|
|
59
|
+
any other setup step. This makes it practical to adopt in non-Python projects
|
|
60
|
+
where adding a Python dependency tree would be unwelcome.
|
|
61
|
+
|
|
62
|
+
**3. CLI-only configuration**
|
|
63
|
+
|
|
64
|
+
There are no config files to maintain. Every behaviour is controlled by flags
|
|
65
|
+
passed on the command line. What you see in the command is what it does, making
|
|
66
|
+
pinstack easy to audit, reproduce, and reason about in CI logs.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
pip install pinstack
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Because pinstack has zero runtime dependencies, it can also be run directly
|
|
77
|
+
from a checkout without installation:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
python -m pinstack .
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Quick Start
|
|
86
|
+
|
|
87
|
+
Scan the current directory:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
pinstack .
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Only check Python and Docker dependency files:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
pinstack . --check requirements,pyproject,dockerfile
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Output as SARIF for GitHub Code Scanning integration:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
pinstack . --format sarif > results.sarif
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Supported Ecosystems
|
|
108
|
+
|
|
109
|
+
| Checker | Files Examined | What Is Checked |
|
|
110
|
+
|---|---|---|
|
|
111
|
+
| `requirements` | `requirements*.txt` | `==` pinning and `--hash` verification |
|
|
112
|
+
| `pyproject` | `pyproject.toml` | `==` exact pins in `[project.dependencies]` and `[project.optional-dependencies]` |
|
|
113
|
+
| `package_json` | `package.json` | No `^`, `~`, or range specifiers in any dependency section |
|
|
114
|
+
| `package_lock` | `package-lock.json` | `integrity` hashes present on all packages |
|
|
115
|
+
| `yarn_lock` | `yarn.lock` | Integrity checksums present |
|
|
116
|
+
| `pnpm_lock` | `pnpm-lock.yaml` | `integrity` hashes present |
|
|
117
|
+
| `dockerfile` | `Dockerfile*` | `@sha256:` digest on every `FROM` |
|
|
118
|
+
| `github_actions` | `.github/workflows/*.yml` | 40-char commit SHA after `@` in `uses:` |
|
|
119
|
+
| `go` | `go.mod`, `go.sum` | `go.sum` exists alongside `go.mod`; `h1:` hashes present |
|
|
120
|
+
| `cargo` | `Cargo.lock` | `checksum` field on each registry `[[package]]` |
|
|
121
|
+
| `gemfile` | `Gemfile`, `Gemfile.lock` | Lock file exists alongside Gemfile |
|
|
122
|
+
| `terraform` | `.terraform.lock.hcl` | `h1:` hashes present per provider |
|
|
123
|
+
| `helm` | `Chart.yaml`, `Chart.lock` | Lock file exists when Chart.yaml has dependencies; `digest:` present |
|
|
124
|
+
| `compose` | `docker-compose*.yml`, `compose*.yml` | `@sha256:` digest on `image:` references |
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## CLI Reference
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
pinstack [PATH] [OPTIONS]
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
| Option | Description |
|
|
135
|
+
|---|---|
|
|
136
|
+
| `PATH` | Directory to scan. Defaults to `.` (current directory). |
|
|
137
|
+
| `--check NAME,NAME` | Only run these checkers (comma-separated). Mutually exclusive with `--exclude`. |
|
|
138
|
+
| `--exclude NAME,NAME` | Skip these checkers (comma-separated). Mutually exclusive with `--check`. |
|
|
139
|
+
| `--format FORMAT` | Output format: `text` (default) or `sarif`. |
|
|
140
|
+
| `--exit-zero` | Always exit 0, even when findings are present. Useful for advisory-only runs. |
|
|
141
|
+
| `--max-depth N` | Maximum directory depth to recurse into. Default: 4. Increase for deep monorepos. |
|
|
142
|
+
| `--max-files N` | Maximum number of dependency files to index. Default: 384. Increase for large monorepos. A warning is printed to stderr if the limit is reached. |
|
|
143
|
+
| `--exclude-dir DIR,DIR` | Additional directory names to skip during traversal (comma-separated). |
|
|
144
|
+
| `--list-checkers` | Print all available checkers and exit. |
|
|
145
|
+
| `--version` | Print the pinstack version and exit. |
|
|
146
|
+
|
|
147
|
+
### Exit Codes
|
|
148
|
+
|
|
149
|
+
| Code | Meaning |
|
|
150
|
+
|---|---|
|
|
151
|
+
| `0` | No findings (or `--exit-zero` was set). |
|
|
152
|
+
| `1` | One or more findings reported. |
|
|
153
|
+
| `2` | Runtime error. |
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Output Formats
|
|
158
|
+
|
|
159
|
+
### text (default)
|
|
160
|
+
|
|
161
|
+
Human-readable output suitable for local development and CI logs:
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
FAIL Dockerfile:3 FROM without @sha256: digest: python:3.11-slim
|
|
165
|
+
FAIL requirements.txt:7 not pinned with ==: requests>=2.28
|
|
166
|
+
FAIL go.mod go.sum missing alongside go.mod
|
|
167
|
+
|
|
168
|
+
3 errors in 3 files
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### sarif
|
|
172
|
+
|
|
173
|
+
SARIF 2.1.0 JSON, consumable by GitHub Code Scanning, GitLab SAST, and other
|
|
174
|
+
tools that support the standard.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## CI Integration
|
|
179
|
+
|
|
180
|
+
pinstack is a standalone CLI tool, not a library. It works with any project
|
|
181
|
+
regardless of language. Python 3.9+ is the only requirement, and it ships on
|
|
182
|
+
virtually every CI runner out of the box.
|
|
183
|
+
|
|
184
|
+
### GitHub Actions
|
|
185
|
+
|
|
186
|
+
```yaml
|
|
187
|
+
name: Supply Chain Check
|
|
188
|
+
on: [push, pull_request]
|
|
189
|
+
|
|
190
|
+
jobs:
|
|
191
|
+
pinstack:
|
|
192
|
+
runs-on: ubuntu-latest
|
|
193
|
+
steps:
|
|
194
|
+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
|
195
|
+
|
|
196
|
+
- name: Set up Python
|
|
197
|
+
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
|
|
198
|
+
with:
|
|
199
|
+
python-version: "3.x"
|
|
200
|
+
|
|
201
|
+
- name: Install pinstack
|
|
202
|
+
run: pip install pinstack
|
|
203
|
+
|
|
204
|
+
- name: Check dependency pinning
|
|
205
|
+
run: pinstack .
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
To upload results to GitHub Code Scanning:
|
|
209
|
+
|
|
210
|
+
```yaml
|
|
211
|
+
- name: Check dependency pinning (SARIF)
|
|
212
|
+
run: pinstack . --format sarif > pinstack.sarif
|
|
213
|
+
continue-on-error: true
|
|
214
|
+
|
|
215
|
+
- name: Upload SARIF
|
|
216
|
+
uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d
|
|
217
|
+
with:
|
|
218
|
+
sarif_file: pinstack.sarif
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### GitLab CI
|
|
222
|
+
|
|
223
|
+
```yaml
|
|
224
|
+
pinstack:
|
|
225
|
+
stage: test
|
|
226
|
+
image: python:3-slim
|
|
227
|
+
before_script:
|
|
228
|
+
- pip install pinstack
|
|
229
|
+
script:
|
|
230
|
+
- pinstack .
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
To integrate with GitLab SAST, output SARIF and use the
|
|
234
|
+
[SAST report artifact](https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html):
|
|
235
|
+
|
|
236
|
+
```yaml
|
|
237
|
+
pinstack:
|
|
238
|
+
stage: test
|
|
239
|
+
image: python:3-slim
|
|
240
|
+
before_script:
|
|
241
|
+
- pip install pinstack
|
|
242
|
+
script:
|
|
243
|
+
- pinstack . --format sarif > gl-sast-report.json || true
|
|
244
|
+
artifacts:
|
|
245
|
+
reports:
|
|
246
|
+
sast: gl-sast-report.json
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Python Projects (Invoke)
|
|
250
|
+
|
|
251
|
+
Add a task to your `tasks.py`:
|
|
252
|
+
|
|
253
|
+
```python
|
|
254
|
+
from invoke import task
|
|
255
|
+
|
|
256
|
+
@task
|
|
257
|
+
def supply_chain(c):
|
|
258
|
+
"""Check dependency pinning."""
|
|
259
|
+
c.run("pinstack .")
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Then run it with `invoke supply-chain` or include it in your build task:
|
|
263
|
+
|
|
264
|
+
```python
|
|
265
|
+
@task(pre=[lint, typecheck, test, supply_chain])
|
|
266
|
+
def build(c):
|
|
267
|
+
"""Full build pipeline."""
|
|
268
|
+
pass
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Any Project
|
|
272
|
+
|
|
273
|
+
pinstack runs anywhere Python 3.9+ is available. No virtual environment needed,
|
|
274
|
+
no dependencies to install beyond pinstack itself.
|
|
275
|
+
|
|
276
|
+
**With pip:**
|
|
277
|
+
|
|
278
|
+
```
|
|
279
|
+
pip install pinstack
|
|
280
|
+
pinstack .
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Without pip (clone and run directly):**
|
|
284
|
+
|
|
285
|
+
```
|
|
286
|
+
git clone https://github.com/a4899e/pinstack.git /tmp/pinstack
|
|
287
|
+
python3 /tmp/pinstack/pinstack .
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
**Check only specific ecosystems:**
|
|
291
|
+
|
|
292
|
+
```
|
|
293
|
+
# Java project -- only check Maven and Gradle
|
|
294
|
+
pinstack . --check maven,gradle
|
|
295
|
+
|
|
296
|
+
# Node project -- only check JS ecosystem
|
|
297
|
+
pinstack . --check package_json,package_lock,yarn_lock,pnpm_lock
|
|
298
|
+
|
|
299
|
+
# Docker-only check
|
|
300
|
+
pinstack . --check dockerfile,compose
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Skip directories that contain third-party code:**
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
pinstack . --exclude-dir vendor,third_party,checkouts
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Contributing
|
|
312
|
+
|
|
313
|
+
1. Fork the repository at https://github.com/a4899e/pinstack
|
|
314
|
+
2. Create a branch from `develop` (not `main`)
|
|
315
|
+
3. Add tests for any new checker or behaviour
|
|
316
|
+
4. Open a pull request against `develop`
|
|
317
|
+
|
|
318
|
+
Development setup:
|
|
319
|
+
|
|
320
|
+
```
|
|
321
|
+
pip install -e ".[dev]"
|
|
322
|
+
git config core.hooksPath .githooks
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
The pre-commit hook runs `invoke build` (tests + lint) before each commit.
|
|
326
|
+
You can also run these manually:
|
|
327
|
+
|
|
328
|
+
```
|
|
329
|
+
invoke test # run tests
|
|
330
|
+
invoke build # tests + ruff + pyright + bandit
|
|
331
|
+
invoke clean # remove .pyc, caches, build artifacts
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## License
|
|
337
|
+
|
|
338
|
+
Apache 2.0. See [LICENSE](LICENSE) for the full text.
|
|
339
|
+
|
|
340
|
+
Copyright 2024 Trevor T. <trevort@scantonomous.ai>
|