Repository navigation
chore(security): clear bandit baseline so quality-gate can enforce Security: 0 - #2
Merged
Merged
Conversation
…lity
Three coordinated changes that together let the new PR quality-gate
enforce Security: 0 across the full Ubuntu / macOS / Windows matrix.
1. Bandit clean baseline (Security: 0)
Take `bandit -r langgoap/` from 17 LOW findings to 0 by combining a
narrow `[tool.bandit]` configuration with two per-line markers.
B101 (assert_used) Every assert in langgoap/ is an invariant or
type-narrowing guard, not a security check.
Bandit's concern (asserts stripped under -O)
is not applicable.
B311 (pseudo-random) The planner is defined by deterministically
seedable stochastic search (MCTS rollouts,
QoS jitter, transition sampling). Crypto
randomness is inappropriate.
serde.py `import pickle` is gated behind the opt-in
`pickle_fallback` flag. Documented inline and
marked `# nosec B403`.
cli/plan_cmd.py `_auto_explain` previously swallowed exceptions
with `except Exception: pass` (B110). Replaced the
bare `pass` with a `logger.debug(...)` call so
failures surface under LOG_LEVEL=DEBUG.
test.yml quality-gate now invokes bandit with `-c pyproject.toml`.
2. Multi-OS test exclusions
GitHub-hosted Windows *and* macOS runners ship without a Docker
daemon, so testcontainers-based Postgres/Redis tests in
tests/integration/test_checkpointing.py cannot run. Broaden the
existing windows-only ignore so any non-Linux runner skips that
file.
3. Windows file-encoding portability
CPython on Windows defaults to cp1252 for text I/O, which breaks
our CLI write paths and the LangGraph deployment scaffold on UTF-8
content. Add explicit `encoding="utf-8"` to:
- langgoap/cli/plan_cmd.py (`open(out, "w")`)
- langgoap/cli/visualize_cmd.py (`open(out, "w")`)
- langgoap/cli/_loader.py (`open(path)` for JSON)
- langgoap/integrations/langgraph_deploy.py (`path.write_text`)
Verification:
uv run bandit -r langgoap/ -c pyproject.toml -> No issues identified
uv run pytest -m 'not api' -> 1687 passed
Ubuntu / macOS / Windows runners are now expected to pass.
Closes #1
bsbodden
force-pushed
the
chore/bandit-clean-baseline
branch
from
May 13, 2026 18:54
3fa4586 to
89cd92e
Compare
✅ Code Quality Report
Quality Gates
🎉 All quality gates passed! This PR maintains high code quality standards. 📊 View detailed MFCQI breakdownRun |
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
Closes #1.
Takes
uv run bandit -r langgoap/from 17 LOW findings → 0 so the newPR quality-gate can enforce
Security: 0without false positives.Strategy
Two project-wide skips for categories that are non-applicable by design,
two narrow code mitigations for the remaining cases.
[tool.bandit]inpyproject.tomlassert_used)assertinlanggoap/is an invariant or type-narrowing guard, never a security check. Bandit's concern (asserts stripped underpython -O) is not applicable.pseudo-random)Code changes
langgoap/serde.py—import pickleis gated behind the opt-inpickle_fallbackflag. Added a docstring-style comment above the import explaining the gate, plus# nosec B403.langgoap/cli/plan_cmd.py—_auto_explainpreviously usedexcept Exception: pass(B110). Replaced the barepasswith alogger.debug("auto-explain failed: %s", exc, exc_info=True)call. The CLI still must not crash on explainer edge cases, but failures are now visible underLOG_LEVEL=DEBUG. The finding goes away because the body is no longer justpass.CI
.github/workflows/test.ymlnow invokes bandit with-c pyproject.tomlso the quality-gate step picks up the new configuration.Verification
Acceptance criteria checklist
uv run bandit -r langgoap/ -c pyproject.toml→ 0 resultsSecurity: ✅ Clean (Current: 0)once this landsFiles changed
pyproject.toml+10 / -0— new[tool.bandit]section.github/workflows/test.yml+2 / -2— pass-c pyproject.tomlto banditlanggoap/serde.py+5 / -1— rationale comment +# nosec B403langgoap/cli/plan_cmd.py+7 / -2— logger +logger.debugin lieu ofpass