secretscreen 0.5.0__tar.gz → 0.6.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.
- secretscreen-0.6.0/.github/dependabot.yml +43 -0
- secretscreen-0.6.0/.github/scripts/pr_test_gate.py +200 -0
- secretscreen-0.6.0/.github/workflows/automerge.yml +48 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/.github/workflows/ci.yml +5 -2
- {secretscreen-0.5.0 → secretscreen-0.6.0}/.github/workflows/codeql.yml +3 -3
- {secretscreen-0.5.0 → secretscreen-0.6.0}/.github/workflows/publish.yml +6 -0
- secretscreen-0.6.0/.github/workflows/release.yml +132 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/.github/workflows/scorecard.yml +1 -1
- secretscreen-0.6.0/.github/workflows/test-gate.yml +83 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/PKG-INFO +8 -8
- {secretscreen-0.5.0 → secretscreen-0.6.0}/README.md +2 -2
- secretscreen-0.6.0/pyproject.toml +102 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/src/secretscreen/__init__.py +11 -1
- {secretscreen-0.5.0 → secretscreen-0.6.0}/src/secretscreen/_cli.py +21 -2
- {secretscreen-0.5.0 → secretscreen-0.6.0}/src/secretscreen/_core.py +27 -12
- {secretscreen-0.5.0 → secretscreen-0.6.0}/tests/test_architecture.py +35 -10
- {secretscreen-0.5.0 → secretscreen-0.6.0}/tests/test_cli.py +49 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/tests/test_core.py +50 -12
- {secretscreen-0.5.0 → secretscreen-0.6.0}/tests/test_yaml_and_prefixes.py +4 -1
- secretscreen-0.5.0/.github/dependabot.yml +0 -33
- secretscreen-0.5.0/.github/workflows/dependabot-automerge.yml +0 -29
- secretscreen-0.5.0/pyproject.toml +0 -59
- {secretscreen-0.5.0 → secretscreen-0.6.0}/.github/FUNDING.yml +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/.github/pull_request_template.md +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/.gitignore +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/CODE_OF_CONDUCT.md +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/CONTRIBUTING.md +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/LICENSE +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/NOTICE +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/SECURITY.md +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/docs/audits/security-audit-2026-04-05.md +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/src/secretscreen/_config.py +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/src/secretscreen/_entropy.py +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/src/secretscreen/_formats.py +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/src/secretscreen/_keys.py +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/src/secretscreen/_parsers.py +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/src/secretscreen/_urls.py +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/src/secretscreen/gitleaks.toml +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/src/secretscreen/py.typed +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/tests/__init__.py +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/tests/test_config.py +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/tests/test_entropy.py +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/tests/test_explain.py +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/tests/test_formats.py +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/tests/test_keys.py +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/tests/test_parsers.py +0 -0
- {secretscreen-0.5.0 → secretscreen-0.6.0}/tests/test_urls.py +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
# Prefixes follow one rule: "deps:" for anything that reaches a user, which
|
|
4
|
+
# cuts a patch release; "chore(...)" for anything that does not.
|
|
5
|
+
#
|
|
6
|
+
# secretscreen has NO runtime dependencies — the pip ecosystem here sees only
|
|
7
|
+
# dev tooling (pytest, ruff, mypy). A ruff bump must not cut a release of a
|
|
8
|
+
# library whose code did not change, so pip stays on "chore" and dependabot's
|
|
9
|
+
# own scope distinguishes deps from deps-dev. Switch pip to "deps" the day a
|
|
10
|
+
# real runtime dependency is added.
|
|
11
|
+
- package-ecosystem: pip
|
|
12
|
+
directory: /
|
|
13
|
+
schedule:
|
|
14
|
+
interval: daily
|
|
15
|
+
cooldown:
|
|
16
|
+
semver-major-days: 30
|
|
17
|
+
semver-minor-days: 7
|
|
18
|
+
semver-patch-days: 3
|
|
19
|
+
groups:
|
|
20
|
+
pip-patches:
|
|
21
|
+
update-types: ["patch"]
|
|
22
|
+
commit-message:
|
|
23
|
+
prefix: chore
|
|
24
|
+
include: scope
|
|
25
|
+
labels:
|
|
26
|
+
- dependencies
|
|
27
|
+
|
|
28
|
+
- package-ecosystem: github-actions
|
|
29
|
+
directory: /
|
|
30
|
+
schedule:
|
|
31
|
+
interval: weekly
|
|
32
|
+
cooldown:
|
|
33
|
+
semver-major-days: 30
|
|
34
|
+
semver-minor-days: 7
|
|
35
|
+
semver-patch-days: 3
|
|
36
|
+
groups:
|
|
37
|
+
actions:
|
|
38
|
+
patterns: ["*"]
|
|
39
|
+
commit-message:
|
|
40
|
+
prefix: chore
|
|
41
|
+
include: scope
|
|
42
|
+
labels:
|
|
43
|
+
- dependencies
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Require every behaviour change to arrive with a test that proves it.
|
|
3
|
+
|
|
4
|
+
The gate runs the pull request's own tests against the pull request's *base*
|
|
5
|
+
source. At least one newly added test must fail there, and every changed test
|
|
6
|
+
must pass once the patch is applied. A test that passes without the patch does
|
|
7
|
+
not demonstrate anything; it is the failure on base that turns a test into
|
|
8
|
+
evidence.
|
|
9
|
+
|
|
10
|
+
Exit codes: 0 pass, 1 gate failure, 2 harness error.
|
|
11
|
+
|
|
12
|
+
Run it locally the same way CI does:
|
|
13
|
+
|
|
14
|
+
python .github/scripts/pr_test_gate.py --base origin/main --head HEAD
|
|
15
|
+
|
|
16
|
+
Escape hatch: a pull request that genuinely changes no behaviour (a pure
|
|
17
|
+
refactor, a rename, a performance change covered by existing tests) is exempt
|
|
18
|
+
via the `no-test-gate` label. The label is checked by the workflow, not here,
|
|
19
|
+
so that the reason is recorded on the pull request rather than buried in a log.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
import argparse
|
|
25
|
+
import re
|
|
26
|
+
import subprocess
|
|
27
|
+
import sys
|
|
28
|
+
from pathlib import Path
|
|
29
|
+
|
|
30
|
+
SRC_DIR = "src"
|
|
31
|
+
TEST_DIR = "tests"
|
|
32
|
+
|
|
33
|
+
# `def test_x`, `async def test_x`, added by the diff.
|
|
34
|
+
ADDED_TEST_RE = re.compile(r"^\+\s*(?:async\s+)?def\s+(test_[A-Za-z0-9_]+)")
|
|
35
|
+
# pytest's short summary lines: "FAILED tests/test_x.py::Cls::test_y - detail"
|
|
36
|
+
OUTCOME_RE = re.compile(r"^(?:FAILED|ERROR)\s+(\S+)")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class GateError(RuntimeError):
|
|
40
|
+
"""The gate could not run. Distinct from the gate deciding to fail."""
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def git(*args: str) -> str:
|
|
44
|
+
result = subprocess.run(["git", *args], capture_output=True, text=True, check=False)
|
|
45
|
+
if result.returncode != 0:
|
|
46
|
+
raise GateError(f"git {' '.join(args)} failed: {result.stderr.strip()}")
|
|
47
|
+
return result.stdout
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def changed_files(base: str, head: str, path: str) -> list[str]:
|
|
51
|
+
out = git("diff", "--name-only", "--diff-filter=ACMR", base, head, "--", path)
|
|
52
|
+
return [line for line in out.splitlines() if line.strip()]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def added_test_names(base: str, head: str) -> set[str]:
|
|
56
|
+
diff = git("diff", base, head, "--", TEST_DIR)
|
|
57
|
+
return {match.group(1) for line in diff.splitlines() if (match := ADDED_TEST_RE.match(line))}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def run_pytest(paths: list[str]) -> tuple[int, str, set[str]]:
|
|
61
|
+
"""Run pytest over `paths`; return (exit code, output, failing test names)."""
|
|
62
|
+
result = subprocess.run(
|
|
63
|
+
[
|
|
64
|
+
sys.executable,
|
|
65
|
+
"-m",
|
|
66
|
+
"pytest",
|
|
67
|
+
*paths,
|
|
68
|
+
"-q",
|
|
69
|
+
"--no-header",
|
|
70
|
+
"-p",
|
|
71
|
+
"no:cacheprovider",
|
|
72
|
+
"--tb=no",
|
|
73
|
+
"-rfE",
|
|
74
|
+
],
|
|
75
|
+
capture_output=True,
|
|
76
|
+
text=True,
|
|
77
|
+
check=False,
|
|
78
|
+
)
|
|
79
|
+
output = result.stdout + result.stderr
|
|
80
|
+
failing = set()
|
|
81
|
+
for line in output.splitlines():
|
|
82
|
+
if match := OUTCOME_RE.match(line):
|
|
83
|
+
# tests/test_core.py::TestFoo::test_bar -> test_bar
|
|
84
|
+
failing.add(match.group(1).split("::")[-1].split("[")[0])
|
|
85
|
+
return result.returncode, output, failing
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def fail(reason: str, *, detail: str = "") -> int:
|
|
89
|
+
print(f"\n::error::PR test gate: {reason}")
|
|
90
|
+
print(f"\n FAILED — {reason}\n")
|
|
91
|
+
if detail:
|
|
92
|
+
print(detail)
|
|
93
|
+
print(
|
|
94
|
+
"\n A change to src/ has to arrive with a test that fails without it.\n"
|
|
95
|
+
" If this pull request genuinely changes no behaviour — a pure refactor,\n"
|
|
96
|
+
" a rename, a dependency bump — add the `no-test-gate` label and say why\n"
|
|
97
|
+
" in the pull request body. The exemption is recorded, not silent.\n"
|
|
98
|
+
)
|
|
99
|
+
return 1
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def main() -> int:
|
|
103
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
104
|
+
parser.add_argument("--base", required=True, help="base ref or SHA")
|
|
105
|
+
parser.add_argument("--head", default="HEAD", help="head ref or SHA")
|
|
106
|
+
args = parser.parse_args()
|
|
107
|
+
|
|
108
|
+
if not Path(SRC_DIR).is_dir() or not Path(TEST_DIR).is_dir():
|
|
109
|
+
raise GateError(f"expected {SRC_DIR}/ and {TEST_DIR}/ in {Path.cwd()}")
|
|
110
|
+
|
|
111
|
+
base, head = args.base, args.head
|
|
112
|
+
src_changed = changed_files(base, head, SRC_DIR)
|
|
113
|
+
test_changed = changed_files(base, head, TEST_DIR)
|
|
114
|
+
|
|
115
|
+
print(f" base {git('rev-parse', '--short', base).strip()} head {git('rev-parse', '--short', head).strip()}")
|
|
116
|
+
|
|
117
|
+
if not src_changed:
|
|
118
|
+
print("\n SKIPPED — no changes under src/. Nothing to demonstrate.\n")
|
|
119
|
+
return 0
|
|
120
|
+
|
|
121
|
+
print(f"\n source files changed ({len(src_changed)}):")
|
|
122
|
+
for path in src_changed:
|
|
123
|
+
print(f" {path}")
|
|
124
|
+
|
|
125
|
+
if not test_changed:
|
|
126
|
+
return fail(
|
|
127
|
+
"src/ changed but no test changed",
|
|
128
|
+
detail=" Changed without a test:\n" + "".join(f" {p}\n" for p in src_changed),
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
added = added_test_names(base, head)
|
|
132
|
+
if not added:
|
|
133
|
+
return fail(
|
|
134
|
+
"test files changed but no new test was added",
|
|
135
|
+
detail=f" Changed test files: {', '.join(test_changed)}\n"
|
|
136
|
+
" The gate looks for added `def test_*`. Editing an existing\n"
|
|
137
|
+
" test in place cannot show that the defect was ever present.\n",
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
print(f"\n tests added ({len(added)}):")
|
|
141
|
+
for name in sorted(added):
|
|
142
|
+
print(f" {name}")
|
|
143
|
+
|
|
144
|
+
# --- Half one: the new tests must fail against the base source. ----------
|
|
145
|
+
# Only src/ is reverted. Packaging and test fixtures stay at head so the
|
|
146
|
+
# single variable under test is the source change itself.
|
|
147
|
+
print("\n [1/2] running the PR's tests against base source ...")
|
|
148
|
+
git("checkout", base, "--", SRC_DIR)
|
|
149
|
+
try:
|
|
150
|
+
code, output, failing = run_pytest(test_changed)
|
|
151
|
+
finally:
|
|
152
|
+
git("checkout", head, "--", SRC_DIR)
|
|
153
|
+
|
|
154
|
+
if code == 0:
|
|
155
|
+
return fail(
|
|
156
|
+
"every test passes without the patch",
|
|
157
|
+
detail=" The tests in this pull request pass against the base source,\n"
|
|
158
|
+
" so they do not demonstrate that anything was broken.\n"
|
|
159
|
+
" Write a test that fails first, then make it pass.\n",
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
proving = sorted(added & failing)
|
|
163
|
+
if not proving:
|
|
164
|
+
if not failing:
|
|
165
|
+
# Base could not even collect the tests — they reference API that
|
|
166
|
+
# only exists on head. That is the strongest possible signal.
|
|
167
|
+
print(" base run could not collect the tests (new API referenced).")
|
|
168
|
+
print(" accepted as evidence the tests require the patch.")
|
|
169
|
+
else:
|
|
170
|
+
return fail(
|
|
171
|
+
"no *added* test fails without the patch",
|
|
172
|
+
detail=f" Failing on base: {', '.join(sorted(failing))}\n"
|
|
173
|
+
f" Added by this PR: {', '.join(sorted(added))}\n"
|
|
174
|
+
" Something failed on base, but nothing this pull request\n"
|
|
175
|
+
" added. That is a pre-existing failure, not evidence.\n",
|
|
176
|
+
)
|
|
177
|
+
else:
|
|
178
|
+
print(f" {len(proving)} added test(s) fail without the patch:")
|
|
179
|
+
for name in proving:
|
|
180
|
+
print(f" {name}")
|
|
181
|
+
|
|
182
|
+
# --- Half two: everything must pass with the patch applied. -------------
|
|
183
|
+
print("\n [2/2] running the same tests against the PR ...")
|
|
184
|
+
code, output, failing = run_pytest(test_changed)
|
|
185
|
+
if code != 0:
|
|
186
|
+
return fail(
|
|
187
|
+
"the tests do not pass with the patch applied",
|
|
188
|
+
detail=f" Still failing: {', '.join(sorted(failing))}\n\n{output[-2000:]}",
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
print("\n PASSED — the defect is demonstrated and the patch closes it.\n")
|
|
192
|
+
return 0
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
if __name__ == "__main__":
|
|
196
|
+
try:
|
|
197
|
+
sys.exit(main())
|
|
198
|
+
except GateError as exc:
|
|
199
|
+
print(f"::error::PR test gate could not run: {exc}", file=sys.stderr)
|
|
200
|
+
sys.exit(2)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Auto-merge
|
|
2
|
+
|
|
3
|
+
# main-protection requires one approving review. GitHub forbids self-approval and
|
|
4
|
+
# only one account has write access, so that rule was unsatisfiable and every
|
|
5
|
+
# merge became an admin bypass. This turns the approval into an author allowlist,
|
|
6
|
+
# which is what the rule was actually for.
|
|
7
|
+
on:
|
|
8
|
+
pull_request_target:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: write
|
|
12
|
+
pull-requests: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
automerge:
|
|
16
|
+
# pull_request.user.login is the PR author. github.actor is whoever triggered
|
|
17
|
+
# the event, which is not the same thing on pull_request_target.
|
|
18
|
+
if: >-
|
|
19
|
+
contains(fromJSON('["dependabot[bot]", "featurecreep-cron",
|
|
20
|
+
"github-actions[bot]", "featurecreep-promoter[bot]"]'),
|
|
21
|
+
github.event.pull_request.user.login)
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
# No checkout anywhere in this job. pull_request_target runs with repository
|
|
25
|
+
# secrets, so checking out PR head code would hand them to the PR author.
|
|
26
|
+
- name: Generate token
|
|
27
|
+
id: generate_token
|
|
28
|
+
uses: actions/create-github-app-token@v3
|
|
29
|
+
with:
|
|
30
|
+
app-id: ${{ secrets.BOT_APP_ID }}
|
|
31
|
+
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
|
|
32
|
+
|
|
33
|
+
- name: Approve PR
|
|
34
|
+
uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501
|
|
35
|
+
with:
|
|
36
|
+
github-token: ${{ steps.generate_token.outputs.token }}
|
|
37
|
+
|
|
38
|
+
# Must be the app token, not GITHUB_TOKEN. GitHub does not start new
|
|
39
|
+
# workflow runs for events triggered by GITHUB_TOKEN, so an auto-merge
|
|
40
|
+
# enabled with it lands the commit and then runs nothing.
|
|
41
|
+
#
|
|
42
|
+
# --merge, not --rebase: rebasing a develop -> main promotion would give
|
|
43
|
+
# main new SHAs for develop's commits and diverge the branches.
|
|
44
|
+
- name: Enable auto-merge
|
|
45
|
+
run: gh pr merge --auto --merge "$PR_URL"
|
|
46
|
+
env:
|
|
47
|
+
PR_URL: ${{ github.event.pull_request.html_url }}
|
|
48
|
+
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
|
|
@@ -2,12 +2,15 @@ name: CI
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
branches: [main]
|
|
5
|
+
branches: [main, develop]
|
|
6
6
|
# No `branches:` filter. Gating on the base branch means a stacked pull
|
|
7
7
|
# request — one opened against another feature branch — runs nothing, and
|
|
8
8
|
# reports only the skipped automerge job, which reads like a pass. Push is
|
|
9
|
-
#
|
|
9
|
+
# limited to the long-lived branches so feature-branch pushes do not
|
|
10
|
+
# double-run.
|
|
10
11
|
pull_request:
|
|
12
|
+
# Called by release.yml to verify main before anything is tagged.
|
|
13
|
+
workflow_call:
|
|
11
14
|
|
|
12
15
|
concurrency:
|
|
13
16
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
@@ -21,12 +21,12 @@ jobs:
|
|
|
21
21
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
22
22
|
|
|
23
23
|
- name: Initialize CodeQL
|
|
24
|
-
uses: github/codeql-action/init@
|
|
24
|
+
uses: github/codeql-action/init@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
|
|
25
25
|
with:
|
|
26
26
|
languages: python
|
|
27
27
|
|
|
28
28
|
- name: Autobuild
|
|
29
|
-
uses: github/codeql-action/autobuild@
|
|
29
|
+
uses: github/codeql-action/autobuild@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
|
|
30
30
|
|
|
31
31
|
- name: Perform CodeQL Analysis
|
|
32
|
-
uses: github/codeql-action/analyze@
|
|
32
|
+
uses: github/codeql-action/analyze@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
|
|
@@ -14,6 +14,12 @@ jobs:
|
|
|
14
14
|
|
|
15
15
|
steps:
|
|
16
16
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
17
|
+
with:
|
|
18
|
+
# Build the released tag, not the default branch, and with full
|
|
19
|
+
# history: hatch-vcs derives the version from the tag, so a shallow
|
|
20
|
+
# or wrong-ref checkout publishes the wrong version.
|
|
21
|
+
ref: ${{ github.event.release.tag_name }}
|
|
22
|
+
fetch-depth: 0
|
|
17
23
|
|
|
18
24
|
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
19
25
|
with:
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Releases are deliberate, not a side effect of merging. workflow_dispatch is
|
|
4
|
+
# the normal path; the weekly schedule is the floor, so a maintainer absent for
|
|
5
|
+
# months does not leave fixes sitting on develop unreleased.
|
|
6
|
+
on:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
force:
|
|
10
|
+
description: "Force version bump type (leave empty for auto-detect)"
|
|
11
|
+
required: false
|
|
12
|
+
type: choice
|
|
13
|
+
options:
|
|
14
|
+
- ""
|
|
15
|
+
- "patch"
|
|
16
|
+
- "minor"
|
|
17
|
+
- "major"
|
|
18
|
+
schedule:
|
|
19
|
+
- cron: "0 6 * * 1"
|
|
20
|
+
|
|
21
|
+
permissions:
|
|
22
|
+
contents: read
|
|
23
|
+
|
|
24
|
+
concurrency:
|
|
25
|
+
group: release
|
|
26
|
+
cancel-in-progress: false
|
|
27
|
+
|
|
28
|
+
jobs:
|
|
29
|
+
# Promote develop -> main through a PR, not a direct push. Nothing is exempt
|
|
30
|
+
# from main-protection: the PR is approved by the automerge workflow's author
|
|
31
|
+
# allowlist and merged by auto-merge once the required checks are green.
|
|
32
|
+
promote:
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
permissions:
|
|
35
|
+
contents: write
|
|
36
|
+
pull-requests: write
|
|
37
|
+
steps:
|
|
38
|
+
# A second app, distinct from the one that approves: GitHub refuses
|
|
39
|
+
# self-approval, so the opener and the approver cannot be the same
|
|
40
|
+
# identity. Keeps the promotion inside the normal PR path with nothing
|
|
41
|
+
# exempt from main-protection.
|
|
42
|
+
- name: Generate promoter token
|
|
43
|
+
id: promoter
|
|
44
|
+
uses: actions/create-github-app-token@v3
|
|
45
|
+
with:
|
|
46
|
+
app-id: ${{ secrets.PROMOTER_APP_ID }}
|
|
47
|
+
private-key: ${{ secrets.PROMOTER_PRIVATE_KEY }}
|
|
48
|
+
|
|
49
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
50
|
+
with:
|
|
51
|
+
fetch-depth: 0
|
|
52
|
+
|
|
53
|
+
- name: Open promotion PR and wait for it to merge
|
|
54
|
+
env:
|
|
55
|
+
GH_TOKEN: ${{ steps.promoter.outputs.token }}
|
|
56
|
+
run: |
|
|
57
|
+
set -euo pipefail
|
|
58
|
+
|
|
59
|
+
if git diff --quiet origin/main origin/develop; then
|
|
60
|
+
echo "develop and main are identical — nothing to promote."
|
|
61
|
+
exit 0
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
pr=$(gh pr list --base main --head develop --state open \
|
|
65
|
+
--json number --jq '.[0].number // empty')
|
|
66
|
+
if [ -z "$pr" ]; then
|
|
67
|
+
pr=$(gh pr create --base main --head develop \
|
|
68
|
+
--title "release: promote develop to main" \
|
|
69
|
+
--body "Automated promotion. Merged by auto-merge once CI is green." \
|
|
70
|
+
| grep -oE '[0-9]+$')
|
|
71
|
+
echo "opened PR #$pr"
|
|
72
|
+
else
|
|
73
|
+
echo "reusing open PR #$pr"
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
# Auto-merge is enabled by automerge.yml, which fires on this PR and
|
|
77
|
+
# approves it as a different identity. Doing it here as well needs
|
|
78
|
+
# permissions the promoter does not have, and does not need:
|
|
79
|
+
# "Resource not accessible by integration (enablePullRequestAutoMerge)".
|
|
80
|
+
|
|
81
|
+
for _ in $(seq 1 60); do
|
|
82
|
+
state=$(gh pr view "$pr" --json state --jq .state)
|
|
83
|
+
[ "$state" = "MERGED" ] && { echo "promotion merged"; exit 0; }
|
|
84
|
+
[ "$state" = "CLOSED" ] && { echo "::error::promotion PR was closed"; exit 1; }
|
|
85
|
+
sleep 30
|
|
86
|
+
done
|
|
87
|
+
echo "::error::promotion PR #$pr did not merge within 30 minutes"
|
|
88
|
+
exit 1
|
|
89
|
+
|
|
90
|
+
# Run the suite against main as it now stands, before anything is tagged.
|
|
91
|
+
verify:
|
|
92
|
+
needs: promote
|
|
93
|
+
uses: ./.github/workflows/ci.yml
|
|
94
|
+
secrets: inherit
|
|
95
|
+
|
|
96
|
+
release:
|
|
97
|
+
needs: verify
|
|
98
|
+
runs-on: ubuntu-latest
|
|
99
|
+
permissions:
|
|
100
|
+
contents: write
|
|
101
|
+
steps:
|
|
102
|
+
# The app token, not GITHUB_TOKEN. psr creates the GitHub Release, and
|
|
103
|
+
# publish.yml fires on `release: published` — an event triggered by
|
|
104
|
+
# GITHUB_TOKEN starts no workflow run, so the package would never be
|
|
105
|
+
# published. This is the one credential this workflow needs.
|
|
106
|
+
- name: Generate token
|
|
107
|
+
id: generate_token
|
|
108
|
+
uses: actions/create-github-app-token@v3
|
|
109
|
+
with:
|
|
110
|
+
app-id: ${{ secrets.BOT_APP_ID }}
|
|
111
|
+
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
|
|
112
|
+
|
|
113
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
114
|
+
with:
|
|
115
|
+
ref: main
|
|
116
|
+
fetch-depth: 0
|
|
117
|
+
token: ${{ steps.generate_token.outputs.token }}
|
|
118
|
+
|
|
119
|
+
# Tag-only. hatch-vcs derives the version from the tag, so there is no
|
|
120
|
+
# file to write and no commit to make — which means no push to a protected
|
|
121
|
+
# branch and no bypass actor anywhere. Rulesets cover branches, not tags.
|
|
122
|
+
- name: Python Semantic Release
|
|
123
|
+
uses: python-semantic-release/python-semantic-release@9a026e9303981c866c3425723009becb2437c757 # v10.6.2
|
|
124
|
+
with:
|
|
125
|
+
github_token: ${{ steps.generate_token.outputs.token }}
|
|
126
|
+
force: ${{ github.event.inputs.force || '' }}
|
|
127
|
+
commit: "false"
|
|
128
|
+
changelog: "false"
|
|
129
|
+
tag: "true"
|
|
130
|
+
push: "true"
|
|
131
|
+
vcs_release: "true"
|
|
132
|
+
build: "false"
|
|
@@ -30,6 +30,6 @@ jobs:
|
|
|
30
30
|
publish_results: true
|
|
31
31
|
|
|
32
32
|
- name: Upload to code-scanning
|
|
33
|
-
uses: github/codeql-action/upload-sarif@
|
|
33
|
+
uses: github/codeql-action/upload-sarif@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
|
|
34
34
|
with:
|
|
35
35
|
sarif_file: results.sarif
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
name: Test Gate
|
|
2
|
+
|
|
3
|
+
# Every change to src/ must arrive with a test that fails without it. The gate
|
|
4
|
+
# runs the pull request's own tests against the base source: at least one newly
|
|
5
|
+
# added test has to fail there, and all of them have to pass once the patch is
|
|
6
|
+
# applied. A test that passes either way proves nothing.
|
|
7
|
+
#
|
|
8
|
+
# Exemptions are deliberate and visible: Dependabot is skipped by author, and a
|
|
9
|
+
# genuine no-behaviour-change pull request is skipped by the `no-test-gate`
|
|
10
|
+
# label, which leaves the reason on the pull request instead of in a log.
|
|
11
|
+
|
|
12
|
+
on:
|
|
13
|
+
pull_request:
|
|
14
|
+
|
|
15
|
+
concurrency:
|
|
16
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
17
|
+
cancel-in-progress: true
|
|
18
|
+
|
|
19
|
+
permissions:
|
|
20
|
+
contents: read
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
gate:
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
if: >-
|
|
26
|
+
github.actor != 'dependabot[bot]' &&
|
|
27
|
+
!contains(github.event.pull_request.labels.*.name, 'no-test-gate')
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
30
|
+
with:
|
|
31
|
+
# Full history: the gate diffs against the merge base and checks the
|
|
32
|
+
# base revision of src/ out in place.
|
|
33
|
+
fetch-depth: 0
|
|
34
|
+
|
|
35
|
+
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
36
|
+
with:
|
|
37
|
+
python-version: "3.13"
|
|
38
|
+
cache: pip
|
|
39
|
+
|
|
40
|
+
- name: Install dependencies
|
|
41
|
+
run: pip install -e ".[dev]"
|
|
42
|
+
|
|
43
|
+
- name: Resolve merge base
|
|
44
|
+
run: |
|
|
45
|
+
BASE=$(git merge-base "origin/${{ github.base_ref }}" HEAD)
|
|
46
|
+
echo "BASE_SHA=$BASE" >> "$GITHUB_ENV"
|
|
47
|
+
echo "Comparing against $BASE (merge base with ${{ github.base_ref }})"
|
|
48
|
+
|
|
49
|
+
- name: Does the test prove the fix?
|
|
50
|
+
run: python .github/scripts/pr_test_gate.py --base "$BASE_SHA" --head HEAD
|
|
51
|
+
|
|
52
|
+
# Reports the exemption rather than leaving a silent gap in the checks list.
|
|
53
|
+
exempt:
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
if: contains(github.event.pull_request.labels.*.name, 'no-test-gate')
|
|
56
|
+
steps:
|
|
57
|
+
- name: Record the exemption
|
|
58
|
+
run: |
|
|
59
|
+
echo "::notice::Test gate skipped via the no-test-gate label."
|
|
60
|
+
echo "This pull request claims it changes no behaviour."
|
|
61
|
+
echo "That claim is the reviewer's to check."
|
|
62
|
+
|
|
63
|
+
# A required status check has to report on EVERY pull request. `gate` and
|
|
64
|
+
# `exempt` are mutually exclusive and both skip on Dependabot PRs, so
|
|
65
|
+
# requiring either directly would block those PRs forever waiting for a check
|
|
66
|
+
# that never runs. This job always reports, and fails only when the gate
|
|
67
|
+
# actually failed — which is what makes the gate enforceable rather than
|
|
68
|
+
# advisory. Require THIS check, not `gate`.
|
|
69
|
+
gate-result:
|
|
70
|
+
needs: [gate, exempt]
|
|
71
|
+
if: always()
|
|
72
|
+
runs-on: ubuntu-latest
|
|
73
|
+
steps:
|
|
74
|
+
- name: Report the gate outcome
|
|
75
|
+
run: |
|
|
76
|
+
echo "gate=${{ needs.gate.result }} exempt=${{ needs.exempt.result }}"
|
|
77
|
+
if [ "${{ needs.gate.result }}" = "failure" ]; then
|
|
78
|
+
echo "::error::The test gate failed: no added test fails against base source."
|
|
79
|
+
exit 1
|
|
80
|
+
fi
|
|
81
|
+
if [ "${{ needs.exempt.result }}" = "success" ]; then
|
|
82
|
+
echo "::notice::Exempted via the no-test-gate label."
|
|
83
|
+
fi
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: secretscreen
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: Detect and redact secrets in key-value pairs, dicts, and environment variables. Library and CLI.
|
|
5
5
|
Project-URL: Homepage, https://github.com/featurecreep-cron/secretscreen
|
|
6
6
|
Project-URL: Repository, https://github.com/featurecreep-cron/secretscreen
|
|
@@ -24,10 +24,10 @@ Classifier: Topic :: Utilities
|
|
|
24
24
|
Classifier: Typing :: Typed
|
|
25
25
|
Requires-Python: >=3.11
|
|
26
26
|
Provides-Extra: dev
|
|
27
|
-
Requires-Dist: mypy
|
|
28
|
-
Requires-Dist: pytest-cov
|
|
29
|
-
Requires-Dist: pytest
|
|
30
|
-
Requires-Dist: ruff
|
|
27
|
+
Requires-Dist: mypy==2.3.1; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest-cov==7.1.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest==9.1.1; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff==0.16.5; extra == 'dev'
|
|
31
31
|
Description-Content-Type: text/markdown
|
|
32
32
|
|
|
33
33
|
# secretscreen
|
|
@@ -201,7 +201,7 @@ secretscreen: explain — key names and reasons only, no values
|
|
|
201
201
|
unscanned BACKUP_BLOB - 2202009 bytes exceeds the 65536-byte scan cap
|
|
202
202
|
```
|
|
203
203
|
|
|
204
|
-
Four states. `redacted` and `clean` are self-explanatory; the two in between are the ones worth reading. **`vetoed`** means a rule fired and something suppressed it — that is where the tool decided to stay quiet. **`unscanned`** means the size cap skipped the value-scanning layers.
|
|
204
|
+
Four states. `redacted` and `clean` are self-explanatory; the two in between are the ones worth reading. **`vetoed`** means a rule fired and something suppressed it — that is where the tool decided to stay quiet. **`unscanned`** means the size cap skipped the value-scanning layers, so the value is redacted on the grounds that it was never examined — an unscanned value is not a clean one.
|
|
205
205
|
|
|
206
206
|
Clean lines carry the nearest miss rather than silence. The entropy figure is computed even in normal mode, where that layer never runs, so you can see what `--aggressive` would change before turning it on.
|
|
207
207
|
|
|
@@ -215,7 +215,7 @@ Like `--audit`, this never prints a value — paste it into a bug report as-is.
|
|
|
215
215
|
| 1 | `--audit` found secrets |
|
|
216
216
|
| 2 | Something could not be parsed or read — see stderr |
|
|
217
217
|
|
|
218
|
-
That third case is the one that matters. This is best-effort defense-in-depth, and a cat-replacement is exactly the tool people stop thinking about, so the CLI never prints unparsed content verbatim: a line it cannot structure is replaced with the redaction token, named on stderr, and turns the exit code non-zero. The same applies to values above the 64 KB detection cap — they are reported as unscanned rather than passed off as clean.
|
|
218
|
+
That third case is the one that matters. This is best-effort defense-in-depth, and a cat-replacement is exactly the tool people stop thinking about, so the CLI never prints unparsed content verbatim: a line it cannot structure is replaced with the redaction token, named on stderr, and turns the exit code non-zero. The same applies to values above the 64 KB detection cap — they are redacted and reported as unscanned rather than passed off as clean. That holds in the library too, not just the CLI: `redact_pair` returns the replacement and `audit_pair` returns a `size_cap` finding, so a consumer cannot mistake *not examined* for *examined and clean*.
|
|
219
219
|
|
|
220
220
|
If you are scanning a git repository rather than config-shaped data, use [gitleaks](https://github.com/gitleaks/gitleaks) instead. That is a different job.
|
|
221
221
|
|
|
@@ -169,7 +169,7 @@ secretscreen: explain — key names and reasons only, no values
|
|
|
169
169
|
unscanned BACKUP_BLOB - 2202009 bytes exceeds the 65536-byte scan cap
|
|
170
170
|
```
|
|
171
171
|
|
|
172
|
-
Four states. `redacted` and `clean` are self-explanatory; the two in between are the ones worth reading. **`vetoed`** means a rule fired and something suppressed it — that is where the tool decided to stay quiet. **`unscanned`** means the size cap skipped the value-scanning layers.
|
|
172
|
+
Four states. `redacted` and `clean` are self-explanatory; the two in between are the ones worth reading. **`vetoed`** means a rule fired and something suppressed it — that is where the tool decided to stay quiet. **`unscanned`** means the size cap skipped the value-scanning layers, so the value is redacted on the grounds that it was never examined — an unscanned value is not a clean one.
|
|
173
173
|
|
|
174
174
|
Clean lines carry the nearest miss rather than silence. The entropy figure is computed even in normal mode, where that layer never runs, so you can see what `--aggressive` would change before turning it on.
|
|
175
175
|
|
|
@@ -183,7 +183,7 @@ Like `--audit`, this never prints a value — paste it into a bug report as-is.
|
|
|
183
183
|
| 1 | `--audit` found secrets |
|
|
184
184
|
| 2 | Something could not be parsed or read — see stderr |
|
|
185
185
|
|
|
186
|
-
That third case is the one that matters. This is best-effort defense-in-depth, and a cat-replacement is exactly the tool people stop thinking about, so the CLI never prints unparsed content verbatim: a line it cannot structure is replaced with the redaction token, named on stderr, and turns the exit code non-zero. The same applies to values above the 64 KB detection cap — they are reported as unscanned rather than passed off as clean.
|
|
186
|
+
That third case is the one that matters. This is best-effort defense-in-depth, and a cat-replacement is exactly the tool people stop thinking about, so the CLI never prints unparsed content verbatim: a line it cannot structure is replaced with the redaction token, named on stderr, and turns the exit code non-zero. The same applies to values above the 64 KB detection cap — they are redacted and reported as unscanned rather than passed off as clean. That holds in the library too, not just the CLI: `redact_pair` returns the replacement and `audit_pair` returns a `size_cap` finding, so a consumer cannot mistake *not examined* for *examined and clean*.
|
|
187
187
|
|
|
188
188
|
If you are scanning a git repository rather than config-shaped data, use [gitleaks](https://github.com/gitleaks/gitleaks) instead. That is a different job.
|
|
189
189
|
|