pubrules 0.48.0__py3-none-any.whl
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.
- pubrules/__init__.py +14 -0
- pubrules/audit.py +116 -0
- pubrules/audit_draft.py +295 -0
- pubrules/audit_prepare.py +1128 -0
- pubrules/cache.py +319 -0
- pubrules/cbor.py +45 -0
- pubrules/ci.py +910 -0
- pubrules/cli.py +1069 -0
- pubrules/conform.py +295 -0
- pubrules/doc_coverage.py +235 -0
- pubrules/freshness.py +75 -0
- pubrules/gherkin.py +348 -0
- pubrules/hooks.py +59 -0
- pubrules/hosting.py +372 -0
- pubrules/ignores.py +86 -0
- pubrules/new.py +242 -0
- pubrules/nightly.py +1002 -0
- pubrules/paths.py +32 -0
- pubrules/protect.py +596 -0
- pubrules/providers.py +129 -0
- pubrules/refs.py +213 -0
- pubrules/release-commit +1 -0
- pubrules/releases.py +107 -0
- pubrules/repos.py +67 -0
- pubrules/ruleset.json +43 -0
- pubrules/secrets_config.py +165 -0
- pubrules/security.py +134 -0
- pubrules/service_needs.py +467 -0
- pubrules/standard.json +635 -0
- pubrules/standard.py +266 -0
- pubrules/supply_chain.py +188 -0
- pubrules/tag-ruleset.json +14 -0
- pubrules/templates/common/AGENTS.md +32 -0
- pubrules/templates/common/pubrules +26 -0
- pubrules/templates/common/tests/features/repository.feature +11 -0
- pubrules/templates/common/tests/install-lock +65 -0
- pubrules/templates/common/tests/pytest.ini +4 -0
- pubrules/templates/common/tests/requirements-pubrules.txt +17 -0
- pubrules/templates/common/tests/requirements.txt +3 -0
- pubrules/templates/common/tests/steps/test_repository.py +14 -0
- pubrules/templates/deploy/pubdeploy +28 -0
- pubrules/templates/new-rust/CHANGELOG.md +3 -0
- pubrules/templates/new-rust/Cargo.toml +46 -0
- pubrules/templates/new-rust/LICENSE +202 -0
- pubrules/templates/new-rust/Makefile +18 -0
- pubrules/templates/new-rust/README.md +34 -0
- pubrules/templates/new-rust/SECURITY.md +26 -0
- pubrules/templates/new-rust/corpus/corpus.json +11 -0
- pubrules/templates/new-rust/deny.toml +32 -0
- pubrules/templates/new-rust/fuzz/Cargo.toml +23 -0
- pubrules/templates/new-rust/fuzz/fuzz_targets/greet.rs +8 -0
- pubrules/templates/new-rust/fuzz/gitignore +4 -0
- pubrules/templates/new-rust/fuzz/regressions/README.md +4 -0
- pubrules/templates/new-rust/gitignore +10 -0
- pubrules/templates/new-rust/src/lib.rs +91 -0
- pubrules/templates/new-rust/src/main.rs +19 -0
- pubrules/templates/new-rust/supply-chain/audits.toml +4 -0
- pubrules/templates/new-rust/supply-chain/config.toml +23 -0
- pubrules/templates/new-rust/supply-chain/imports.lock +2 -0
- pubrules/templates/new-rust/tests/conftest.py +9 -0
- pubrules/templates/new-rust/tests/features/cli.feature +14 -0
- pubrules/templates/new-rust/tests/steps/test_cli.py +15 -0
- pubrules/templates/new-rust/tests/vectors.rs +30 -0
- pubrules/templates/new-rust/tools/vectors/generate.py +24 -0
- pubrules/templates/python/Makefile +5 -0
- pubrules/templates/python/pubrules-python.mk +47 -0
- pubrules/templates/rust/Makefile +9 -0
- pubrules/templates/rust/pubrules.mk +138 -0
- pubrules/templates/rust/rust-toolchain.toml +8 -0
- pubrules/templates/service/pubsec +27 -0
- pubrules/templates/service/with-secrets +20 -0
- pubrules/templates/service/with-secrets.json +8 -0
- pubrules/variables.py +45 -0
- pubrules-0.48.0.dist-info/METADATA +1241 -0
- pubrules-0.48.0.dist-info/RECORD +79 -0
- pubrules-0.48.0.dist-info/WHEEL +5 -0
- pubrules-0.48.0.dist-info/entry_points.txt +2 -0
- pubrules-0.48.0.dist-info/licenses/LICENSE +202 -0
- pubrules-0.48.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Managed by pubrules {version}: `pubrules sync` rewrites this file, and
|
|
3
|
+
# `pubrules sync --check` fails when it differs.
|
|
4
|
+
#
|
|
5
|
+
# Run this repository's pinned pubdeploy, the deploy walk: what pubrules.json's
|
|
6
|
+
# deploy block says the service needs, whether it has it, and making it.
|
|
7
|
+
#
|
|
8
|
+
# ./with-secrets ./pubdeploy walk --fulfil
|
|
9
|
+
# ./pubdeploy check --offline
|
|
10
|
+
# ./pubdeploy types
|
|
11
|
+
#
|
|
12
|
+
# The release is deploy.providers' pubdeploy (`pubrules bump` moves it), and
|
|
13
|
+
# it runs with every
|
|
14
|
+
# other deploy.providers wheel, so their need types load. Each wheel is
|
|
15
|
+
# fetched once into the user's cache (from the wheel mirror, when
|
|
16
|
+
# pubrules.json names one and GitHub fails) and checked against its sha256 on
|
|
17
|
+
# every run, and uvx runs that file; nothing is installed into the
|
|
18
|
+
# repository or the system. pubdeploy runs in the repository's root, where
|
|
19
|
+
# pubrules.json is, from whichever directory this is called.
|
|
20
|
+
set -euo pipefail
|
|
21
|
+
|
|
22
|
+
if ! command -v uvx >/dev/null 2>&1; then
|
|
23
|
+
echo "pubdeploy: ./pubdeploy runs pubdeploy with uv, which is not installed: curl -LsSf https://astral.sh/uv/install.sh | sh" >&2
|
|
24
|
+
exit 127
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
cd "$(dirname "$0")"
|
|
28
|
+
{pubdeploy}exec uvx --from "$fetched" ${with[@]+"${with[@]}"} pubdeploy "$@"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "{name}"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
rust-version = "1.85"
|
|
6
|
+
license = "Apache-2.0"
|
|
7
|
+
description = "{description}"
|
|
8
|
+
repository = "https://github.com/{owner}/{name}"
|
|
9
|
+
documentation = "https://docs.rs/{name}"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
keywords = ["publet"]
|
|
12
|
+
categories = []
|
|
13
|
+
# Anchored with /: like gitignore patterns, a bare name matches at any depth.
|
|
14
|
+
include = ["/src/**/*.rs", "/README.md", "/CHANGELOG.md", "/LICENSE", "/SECURITY.md", "/SUPPLY-CHAIN.md", "/TESTING.md"]
|
|
15
|
+
|
|
16
|
+
[package.metadata.docs.rs]
|
|
17
|
+
all-features = true
|
|
18
|
+
rustdoc-args = ["--generate-link-to-definition"]
|
|
19
|
+
|
|
20
|
+
[lib]
|
|
21
|
+
name = "{crate}"
|
|
22
|
+
path = "src/lib.rs"
|
|
23
|
+
|
|
24
|
+
[[bin]]
|
|
25
|
+
name = "{name}"
|
|
26
|
+
path = "src/main.rs"
|
|
27
|
+
|
|
28
|
+
[dependencies]
|
|
29
|
+
|
|
30
|
+
[profile.release]
|
|
31
|
+
overflow-checks = true
|
|
32
|
+
|
|
33
|
+
[lints.rust]
|
|
34
|
+
unsafe_code = "forbid"
|
|
35
|
+
missing_docs = "deny"
|
|
36
|
+
missing_debug_implementations = "warn"
|
|
37
|
+
unreachable_pub = "warn"
|
|
38
|
+
rust_2018_idioms = { level = "warn", priority = -1 }
|
|
39
|
+
|
|
40
|
+
[lints.clippy]
|
|
41
|
+
all = { level = "warn", priority = -1 }
|
|
42
|
+
pedantic = { level = "warn", priority = -1 }
|
|
43
|
+
unwrap_used = "deny"
|
|
44
|
+
expect_used = "deny"
|
|
45
|
+
panic = "deny"
|
|
46
|
+
indexing_slicing = "deny"
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# The shared targets come from pubrules.mk, which pubrules manages: the ones the
|
|
2
|
+
# Rust crate standard requires (`make required` lists what CI runs), and
|
|
3
|
+
# venv, lock, fmt, test, build and supply-chain. This file adds {name}'s own.
|
|
4
|
+
SUPPLY_CHAIN_CRATES := {name}
|
|
5
|
+
|
|
6
|
+
include pubrules.mk
|
|
7
|
+
|
|
8
|
+
# Binaries under test, by <NAME>_BIN_DIR.
|
|
9
|
+
export {bin_var} ?= $(CURDIR)/target/debug
|
|
10
|
+
|
|
11
|
+
.DEFAULT_GOAL := help
|
|
12
|
+
.PHONY: check clean
|
|
13
|
+
|
|
14
|
+
check: sync-check fmt-check lint test doc doc-coverage-check functional vectors-check publish-check supply-chain-check vet deny ## Everything CI runs
|
|
15
|
+
|
|
16
|
+
clean: ## Remove build artifacts
|
|
17
|
+
cargo clean
|
|
18
|
+
rm -rf .pytest_cache tests/.pytest_cache
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# {name}
|
|
2
|
+
|
|
3
|
+
{description}
|
|
4
|
+
|
|
5
|
+
Licensed under Apache-2.0.
|
|
6
|
+
|
|
7
|
+
### Documentation
|
|
8
|
+
|
|
9
|
+
[docs.rs/{name}](https://docs.rs/{name}): the overview, examples, how every
|
|
10
|
+
item is tested, and how each dependency is vouched for.
|
|
11
|
+
|
|
12
|
+
### Usage
|
|
13
|
+
|
|
14
|
+
```toml
|
|
15
|
+
[dependencies]
|
|
16
|
+
{name} = "0.1"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Example
|
|
20
|
+
|
|
21
|
+
```rust
|
|
22
|
+
assert_eq!({crate}::greet("publet"), "hello, publet");
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Minimum Rust version
|
|
26
|
+
|
|
27
|
+
Rust 1.85, tested in CI. The minimum may rise in a release that bumps the
|
|
28
|
+
minor version, and never in a patch release.
|
|
29
|
+
|
|
30
|
+
### Security
|
|
31
|
+
|
|
32
|
+
Report a vulnerability privately through the repository's Security tab.
|
|
33
|
+
[`SECURITY.md`](SECURITY.md) describes what is checked, and
|
|
34
|
+
[`SUPPLY-CHAIN.md`](SUPPLY-CHAIN.md) how each dependency is vouched for.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
## Reporting a vulnerability
|
|
4
|
+
|
|
5
|
+
Report it privately through GitHub:
|
|
6
|
+
**[report a vulnerability](https://github.com/{owner}/{name}/security/advisories/new)**
|
|
7
|
+
(the repository's Security tab, "Report a vulnerability"). Please don't open
|
|
8
|
+
a public issue for it.
|
|
9
|
+
|
|
10
|
+
## Supported versions
|
|
11
|
+
|
|
12
|
+
Releases are cut only from `main`, with pubrel. A fix is released as the
|
|
13
|
+
next version. Earlier versions get no separate fixes.
|
|
14
|
+
|
|
15
|
+
## What is checked
|
|
16
|
+
|
|
17
|
+
On every pull request, pubrules' `rust-ci.yml` runs every check the Rust
|
|
18
|
+
crate standard requires: formatting, clippy, docs, doc coverage, packaging,
|
|
19
|
+
the tests on Linux, macOS, Windows, i686 and s390x, the Gherkin suite, the
|
|
20
|
+
test vectors, the minimum Rust version, fuzzing, `cargo deny` and
|
|
21
|
+
`cargo vet`. A release also needs a current quality audit in `audit/`.
|
|
22
|
+
|
|
23
|
+
**Fuzzing found** nothing yet.
|
|
24
|
+
|
|
25
|
+
**In the code:** `unsafe` is forbidden (`unsafe_code = "forbid"`). Release
|
|
26
|
+
builds keep integer overflow checks.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# cargo-deny: licences and advisories are a review decision, not a surprise.
|
|
2
|
+
[advisories]
|
|
3
|
+
# Every RustSec advisory for a crate in the tree fails the check: known
|
|
4
|
+
# vulnerabilities always, and here also crates marked unmaintained or
|
|
5
|
+
# unsound, and yanked releases. An advisory may be ignored only by naming
|
|
6
|
+
# it below, with the reason beside it.
|
|
7
|
+
unmaintained = "all"
|
|
8
|
+
unsound = "all"
|
|
9
|
+
yanked = "deny"
|
|
10
|
+
ignore = []
|
|
11
|
+
|
|
12
|
+
[licenses]
|
|
13
|
+
allow = [
|
|
14
|
+
"Apache-2.0",
|
|
15
|
+
"MIT",
|
|
16
|
+
"BSD-2-Clause",
|
|
17
|
+
"BSD-3-Clause",
|
|
18
|
+
"ISC",
|
|
19
|
+
"Unicode-3.0",
|
|
20
|
+
]
|
|
21
|
+
confidence-threshold = 0.93
|
|
22
|
+
|
|
23
|
+
[bans]
|
|
24
|
+
multiple-versions = "warn"
|
|
25
|
+
wildcards = "deny"
|
|
26
|
+
|
|
27
|
+
[sources]
|
|
28
|
+
# Dependencies come from crates.io and nowhere else: no other registry, no
|
|
29
|
+
# git repository.
|
|
30
|
+
unknown-registry = "deny"
|
|
31
|
+
unknown-git = "deny"
|
|
32
|
+
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Fuzz targets for what {name} reads from outside. A workspace of its own:
|
|
2
|
+
# it needs a nightly compiler and libFuzzer.
|
|
3
|
+
[package]
|
|
4
|
+
name = "{name}-fuzz"
|
|
5
|
+
version = "0.0.0"
|
|
6
|
+
publish = false
|
|
7
|
+
edition = "2024"
|
|
8
|
+
|
|
9
|
+
[package.metadata]
|
|
10
|
+
cargo-fuzz = true
|
|
11
|
+
|
|
12
|
+
[dependencies]
|
|
13
|
+
libfuzzer-sys = "0.4"
|
|
14
|
+
{name} = { path = ".." }
|
|
15
|
+
|
|
16
|
+
[workspace]
|
|
17
|
+
|
|
18
|
+
[[bin]]
|
|
19
|
+
name = "greet"
|
|
20
|
+
path = "fuzz_targets/greet.rs"
|
|
21
|
+
test = false
|
|
22
|
+
doc = false
|
|
23
|
+
bench = false
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/target
|
|
2
|
+
# A directory or a link: pubrel prepare links the checkout's .venv into its worktree.
|
|
3
|
+
.venv
|
|
4
|
+
__pycache__/
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
*.pyc
|
|
7
|
+
# A corpus's working store and secret key; objects/ is its durable form.
|
|
8
|
+
/corpus/.publet/
|
|
9
|
+
# Local secrets, such as the Bitwarden token ./with-secrets reads: never committed.
|
|
10
|
+
.env
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
{description}
|
|
3
|
+
|
|
4
|
+
```
|
|
5
|
+
assert_eq!({crate}::greet("publet"), "hello, publet");
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
# Overview
|
|
9
|
+
|
|
10
|
+
| Item | What it is |
|
|
11
|
+
|---|---|
|
|
12
|
+
| [`greet`] | the one function this new crate starts with |
|
|
13
|
+
|
|
14
|
+
The rest of this page: [why this crate](#why-this-crate), [crate
|
|
15
|
+
features](#crate-features), [the minimum Rust version](#minimum-rust-version)
|
|
16
|
+
and [versioning](#versioning). Longer documents live in [`_documentation`]:
|
|
17
|
+
how every item is [tested](crate::_documentation::testing), how each
|
|
18
|
+
dependency is [vouched for](crate::_documentation::supply_chain), the
|
|
19
|
+
[security](crate::_documentation::security) policy, and the
|
|
20
|
+
[changelog](crate::_documentation::changelog).
|
|
21
|
+
|
|
22
|
+
# Why this crate?
|
|
23
|
+
|
|
24
|
+
Say what this crate does that a general-purpose one would get wrong here.
|
|
25
|
+
|
|
26
|
+
# Crate features
|
|
27
|
+
|
|
28
|
+
None.
|
|
29
|
+
|
|
30
|
+
# Minimum Rust version
|
|
31
|
+
|
|
32
|
+
1.85, the `rust-version` in `Cargo.toml`. It may rise in a release that
|
|
33
|
+
bumps the second number of the version, never in one that bumps only the
|
|
34
|
+
third.
|
|
35
|
+
|
|
36
|
+
# Versioning
|
|
37
|
+
|
|
38
|
+
Cargo's convention: below 1.0, a breaking change bumps the second number
|
|
39
|
+
and anything else the third. Each change is recorded with pubrel as it
|
|
40
|
+
lands, and the public API is checked against the last release by
|
|
41
|
+
cargo-semver-checks.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/// A greeting for `name`.
|
|
45
|
+
///
|
|
46
|
+
/// ```
|
|
47
|
+
/// assert_eq!({crate}::greet("world"), "hello, world");
|
|
48
|
+
/// ```
|
|
49
|
+
#[must_use]
|
|
50
|
+
pub fn greet(name: &str) -> String {
|
|
51
|
+
["hello, ", name].concat()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// Longer documents: testing, the supply chain, security, and the changelog.
|
|
55
|
+
///
|
|
56
|
+
/// These modules hold no code. Each is a document, kept in the repository as
|
|
57
|
+
/// Markdown and rendered here so it is versioned with the crate.
|
|
58
|
+
#[allow(clippy::doc_markdown, rustdoc::broken_intra_doc_links)]
|
|
59
|
+
pub mod _documentation {
|
|
60
|
+
/// How every public item is tested.
|
|
61
|
+
#[doc = include_str!("../TESTING.md")]
|
|
62
|
+
pub mod testing {}
|
|
63
|
+
|
|
64
|
+
/// Every crate this one depends on, and how its code is vouched for.
|
|
65
|
+
#[doc = include_str!("../SUPPLY-CHAIN.md")]
|
|
66
|
+
pub mod supply_chain {}
|
|
67
|
+
|
|
68
|
+
/// How to report a vulnerability, and what is checked before each release.
|
|
69
|
+
#[doc = include_str!("../SECURITY.md")]
|
|
70
|
+
pub mod security {}
|
|
71
|
+
|
|
72
|
+
/// Every release, newest first, generated from the package publet.
|
|
73
|
+
#[doc = include_str!("../CHANGELOG.md")]
|
|
74
|
+
pub mod changelog {}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/// The README's examples, run as tests without being rendered twice.
|
|
78
|
+
#[cfg(doctest)]
|
|
79
|
+
#[doc = include_str!("../README.md")]
|
|
80
|
+
struct ReadmeDoctests;
|
|
81
|
+
|
|
82
|
+
#[cfg(test)]
|
|
83
|
+
mod tests {
|
|
84
|
+
use super::*;
|
|
85
|
+
|
|
86
|
+
// covers: greet
|
|
87
|
+
#[test]
|
|
88
|
+
fn greets_by_name() {
|
|
89
|
+
assert_eq!(greet(""), "hello, ");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//! The `{name}` command.
|
|
2
|
+
|
|
3
|
+
use std::process::ExitCode;
|
|
4
|
+
|
|
5
|
+
const USAGE: &str = "usage: {name} [--version | --help | NAME]";
|
|
6
|
+
|
|
7
|
+
fn main() -> ExitCode {
|
|
8
|
+
let args: Vec<String> = std::env::args().skip(1).collect();
|
|
9
|
+
match args.first().map(String::as_str) {
|
|
10
|
+
Some("--version") => println!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")),
|
|
11
|
+
Some("-h" | "--help") => println!("{USAGE}"),
|
|
12
|
+
Some(name) => println!("{}", {crate}::greet(name)),
|
|
13
|
+
None => {
|
|
14
|
+
eprintln!("{USAGE}");
|
|
15
|
+
return ExitCode::FAILURE;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
ExitCode::SUCCESS
|
|
19
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
# cargo-vet config file
|
|
3
|
+
|
|
4
|
+
[cargo-vet]
|
|
5
|
+
version = "0.10"
|
|
6
|
+
|
|
7
|
+
[imports.bytecode-alliance]
|
|
8
|
+
url = "https://raw.githubusercontent.com/bytecodealliance/wasmtime/main/supply-chain/audits.toml"
|
|
9
|
+
|
|
10
|
+
[imports.embark-studios]
|
|
11
|
+
url = "https://raw.githubusercontent.com/EmbarkStudios/rust-ecosystem/main/audits.toml"
|
|
12
|
+
|
|
13
|
+
[imports.google]
|
|
14
|
+
url = "https://raw.githubusercontent.com/google/supply-chain/main/audits.toml"
|
|
15
|
+
|
|
16
|
+
[imports.isrg]
|
|
17
|
+
url = "https://raw.githubusercontent.com/divviup/libprio-rs/main/supply-chain/audits.toml"
|
|
18
|
+
|
|
19
|
+
[imports.mozilla]
|
|
20
|
+
url = "https://raw.githubusercontent.com/mozilla/supply-chain/main/audits.toml"
|
|
21
|
+
|
|
22
|
+
[imports.zcash]
|
|
23
|
+
url = "https://raw.githubusercontent.com/zcash/rust-ecosystem/main/supply-chain/audits.toml"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Feature: The {name} command
|
|
2
|
+
Scenario: --version prints the version
|
|
3
|
+
When I run {name} "--version"
|
|
4
|
+
Then it succeeds
|
|
5
|
+
And it prints "{name} 0.1.0"
|
|
6
|
+
|
|
7
|
+
Scenario: A name is greeted
|
|
8
|
+
When I run {name} "publet"
|
|
9
|
+
Then it prints "hello, publet"
|
|
10
|
+
|
|
11
|
+
Scenario: No arguments prints the usage and fails
|
|
12
|
+
When I run {name} with no arguments
|
|
13
|
+
Then it fails
|
|
14
|
+
And stderr mentions "usage: {name}"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Steps for the {name} command."""
|
|
2
|
+
|
|
3
|
+
from pytest_bdd import parsers, scenarios, when
|
|
4
|
+
|
|
5
|
+
scenarios("../features/cli.feature")
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@when(parsers.parse('I run {name} "{arg}"'), target_fixture="result")
|
|
9
|
+
def run_program(run, program, arg):
|
|
10
|
+
return run(program, arg)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@when("I run {name} with no arguments", target_fixture="result")
|
|
14
|
+
def run_bare(run, program):
|
|
15
|
+
return run(program)
|