Bound CLI paths and clear the new-code findings on main#461
Merged
Conversation
Merging the release exposed a batch of SonarCloud findings that the PR gates never saw, because a PR only rates its own diff. The CLI entry points took a path straight from argv into write_text / mkdir. They now canonicalise it through a shared `path_guard` helper — realpath first, so `..` and symlinks resolve before the check — and refuse anything outside the working directory, the user's home or the temp directory. AUTOCONTROL_ALLOWED_PATH_ROOTS re-opens a mounted volume when a deployment needs one. The rest: the container images pin pip and take wheels only; the reusable action-json-lint workflow pins its default install spec; determinism tests bind their two calls to names so the assertion is not literally `f(x) == f(x)`; the two record scripts no longer hide an assert inside a handler that catches AssertionError; and the file, language and token inputs get real `label for=` associations.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 29 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
The runtime layer resolved and built its dependencies straight from PyPI, so a rebuild could pick up a different set and any sdist in the graph got to run its setup script inside the image. A throwaway builder stage now produces every wheel, and the runtime installs with --only-binary and --no-index against that directory — nothing new can be fetched there. Drop the two suppressions that turned out to be inert: NOSONAR is not honoured inside a Dockerfile or a `run: |` block, so they were noise.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


main's branch quality gate went ERROR after the release merge — not from the release itself, but because a PR gate only rates its own diff while the branch gate rates the whole new-code window. This clears the fixable findings.Security —
pythonsecurity:S8707(path traversal from argv)New
je_auto_control/utils/path_guard/:validate_path()canonicalises withos.path.realpath(so..and symlinks resolve before the check) and requires the result to sit under the working directory, the user's home or the temp dir.AUTOCONTROL_ALLOWED_PATH_ROOTSextends the roots for containers writing to a mounted volume. Wired into the three CLIs that took a path from argv:stubs.generator(also suffix-locked to.pyi),config_bundle export|import(import additionally requires the file to exist),remote_desktop.turn_config. 10 headless tests cover traversal, containment, suffix, env override and the CLI refusal path.CI reproducibility —
docker:S8541/S8544,githubactions:S8544docker/Dockerfile+Dockerfile.xfcepin pip and accept wheels only; the editable install of the copied source keeps an inline justification. The reusableaction-json-lintworkflow now defaults to a pinnedje_auto_control==0.0.214spec.Test correctness —
python:S5863,python:S5779Determinism assertions bound their two calls to names, so the assertion is no longer literally
f(x) == f(x). The twototal_recordscripts stop hiding anassertinside a handler that catchesAssertionError— a mismatch now exits or reports instead of being swallowed.Accessibility —
Web:InputWithoutLabelCheckReal
label for=associations for the file, language and bearer-token inputs (aria-labelalone did not satisfy the rule).Not touched: 27
python:S2068hits on i18n label strings ("eml_password_label": "パスワード:") — the key name trips the rule, there is no credential.host_service.pywrites to a module constant, not to argv. Both need a suppression decision rather than a code change.Verified locally: full headless suite 3704 passed, ruff clean, bandit clean, radon reports no function at C or worse in the new module.