Repository navigation
[codex] Address CodeQL findings - #79
Closed
shanguangzai wants to merge 5 commits into
Closed
shanguangzai wants to merge 5 commits into
shanguangzai wants to merge 5 commits into
Conversation
This branch was previously deployed
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.
Summary
Addresses the open CodeQL findings surfaced while reviewing #78 and adds a security preflight workflow so pull requests targeting
developare scanned before they are promoted tomain.CodeQL findings reviewed
The URL allowlist findings are valid. The existing checks used substring matching for trusted hosts, and one branch in
check_url_availablewas effectively always true for non-internal URLs. This PR switches those decisions to parsed host/path checks and adds regression coverage for spoofed URLs that contain trusted host strings in the wrong part of the URL.The Paramiko findings are valid in the sense that the code accepted unknown SSH host keys at every call site. These flows are first-contact DevKit workflows, so strict known-host enforcement would break factory-reset or freshly flashed boards. This PR centralizes the behavior in a DevKit SSH helper, loads system host keys, and keeps the first-contact trust behavior explicit and reusable instead of repeating
AutoAddPolicythroughout the code.The bind-to-all-interface findings are mixed. Some port availability probes can safely use loopback, so those are narrowed. Discovery, netboot, and Docker port-collision diagnostics intentionally need all-interface checks; those known findings are documented and excluded from the preflight gate so new CodeQL findings still fail the PR.
Workflow change
Adds
.github/workflows/security-pr-preflight.ymlwith a non-uploading CodeQL preflight for:pull_requestintodevelopandmainpushtodevelopandmainworkflow_dispatchThe workflow is named
Security PR Preflightso it does not conflict with GitHub's default CodeQL setup. It runs thepythonandactionsanalyzers withupload: never, parses the generated SARIF locally, and fails the check on new warning/error findings. This keeps repository default setup enabled while still catching issues before changes land indevelop.Validation
actionlint .github/workflows/security-pr-preflight.ymlpython -m pytestSecurity PR Preflightpassed on https://github.com/sima-neat/sima-cli/actions/runs/27843287959