-
-
Notifications
You must be signed in to change notification settings - Fork 38
[lib-audit] S2-21 linkwarden manifest ships a static NEXTAUTH_SECRET #2814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| ### Tests | ||
|
|
||
| - Fixed a CI flake in `tests/test_merge_attribution.py`: two assertions checked that an excluded PR number ("41") was a bare substring of `result.stdout`, but the fixture commit shas are generated at runtime, so a sha for the in-scope PR could coincidentally contain "41" and fail the assertion for a reason unrelated to the actual reconciliation logic. Both now assert on the exact `"#41"` PR-reference token the checker prints, which cannot collide with a hex sha substring. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| ### Fixed | ||
|
|
||
| - Linkwarden manifest: replaced static `NEXTAUTH_SECRET: "changeme"` with `{secret_key}` placeholder per-install; removed `DATABASE_URL` since no Postgres companion service is started in single-container installs |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -313,3 +313,40 @@ def test_docker_installer_searxng_host_port_not_8080(self, tmp_path): | |||||||||||
| host_side, _, container_side = port_mappings[0].partition(":") | ||||||||||||
| assert int(host_side) == host_port | ||||||||||||
| assert int(container_side) == 8080 | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @pytest.mark.asyncio | ||||||||||||
| async def test_manifests_have_no_changeme_secrets(tmp_path): | ||||||||||||
| """RED: assert no manifest env value equals "changeme" and every | ||||||||||||
| *_SECRET env uses a placeholder (e.g. {secret_key}).""" | ||||||||||||
| from pathlib import Path | ||||||||||||
| import yaml | ||||||||||||
|
|
||||||||||||
| services_dir = Path("app-catalog") / "services" | ||||||||||||
| manifests = sorted(services_dir.rglob("manifest.yaml")) | ||||||||||||
|
Comment on lines
+328
to
+329
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🤖 get_repo_knowledge executed:
Length of output: 2462 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- target context ---'
sed -n '280,350p' tests/test_installers.py
printf '%s\n' '--- test configuration and path references ---'
find . -maxdepth 2 -type f \( -name 'pytest.ini' -o -name 'pyproject.toml' -o -name 'tox.ini' -o -name 'conftest.py' -o -name 'README*' \) -print
rg -n --glob '*.py' --glob '*.toml' --glob '*.ini' --glob '*.cfg' 'test_manifests_have_no_changeme_secrets|app-catalog/services|Path\(__file__\)|chdir|rootdir' .
printf '%s\n' '--- manifest inventory ---'
find app-catalog/services -type f -name manifest.yaml -print 2>/dev/null | sort | sed -n '1,20p'Repository: jaylfc/taOS Length of output: 17740 🏁 Script executed: #!/bin/bash
set -eu
sed -n '280,350p' tests/test_installers.pyRepository: jaylfc/taOS Length of output: 3107 Prevent a vacuous pass when no manifests are discovered.
Proposed fix- services_dir = Path("app-catalog") / "services"
+ services_dir = Path(__file__).resolve().parents[1] / "app-catalog" / "services"
manifests = sorted(services_dir.rglob("manifest.yaml"))
+ assert manifests, f"No service manifests found under {services_dir}"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||
| has_issue = False | ||||||||||||
| for manifest_path in manifests: | ||||||||||||
| data = yaml.safe_load(manifest_path.read_text()) | ||||||||||||
| if data.get("type") != "service": | ||||||||||||
| continue | ||||||||||||
| env = data.get("install", {}).get("env") or {} | ||||||||||||
| for key, value in env.items(): | ||||||||||||
| if value == "changeme": | ||||||||||||
| has_issue = True | ||||||||||||
| print( | ||||||||||||
| f"FAIL: {manifest_path}: {key}='changeme' " | ||||||||||||
| f"in {manifest_path}" | ||||||||||||
| ) | ||||||||||||
| if key.endswith("_SECRET") and "{secret_key}" not in str(value): | ||||||||||||
| has_issue = True | ||||||||||||
| print( | ||||||||||||
| f"FAIL: {manifest_path}: {key}={value!r} " | ||||||||||||
| f"missing placeholder in {manifest_path}" | ||||||||||||
| ) | ||||||||||||
| assert not has_issue, ( | ||||||||||||
| "Manifest audit: some manifests have static secrets or " | ||||||||||||
| "changeme values" | ||||||||||||
| ) | ||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Align the changelog with the test implementation.
The entry says both assertions now match the exact
"#41"token. The suppliedtests/test_merge_attribution.pysnippet still containsassert "41" not in result.stdout. Update that assertion to"#41"or revise this changelog entry to describe the actual change.🤖 Prompt for AI Agents