Add security scanning CI (CodeQL, pip-audit, Dependabot) and pre-commit#92
Add security scanning CI (CodeQL, pip-audit, Dependabot) and pre-commit#92ivan-pinatti wants to merge 5 commits into
Conversation
Adds three free security layers for the public repo: - CodeQL SAST for Python logic bugs and unsafe API usage - pip-audit dependency scan against OSV database for CVEs - Dependabot for automated dependency and Actions version updates Closes: AlfredoSequeida#91
Adds bandit (SAST) as a pre-commit hook for catching security issues in Python code locally before push. Runs only on staged files by default. Existing findings in the codebase (shell=True, pickle.loads, /tmp socket path) are pre-existing and for the maintainer to review separately. pip-audit is intentionally CI-only: installing this project requires system libs (libgirepository, Cairo) unavailable in pre-commit's isolated environment.
Adds local dependency vulnerability scanning via pip-audit alongside the existing bandit SAST hook. requirements.txt mirrors setup.py install_requires and is used by pip-audit with --no-deps to avoid dependency resolution. PyGObject is excluded from requirements.txt: it requires gobject-introspection system headers to build metadata, which are not universally available locally. It is fully covered by pip-audit in CI where system libs are installed. Transitive dependency CVEs are also covered by CI.
|
Hey, thank you for the ci updates. I think this is a good idea to keep better code quality. One suggestion: Can we change this to not used a requirements.txt file? I know that is very common place, but I rather keep the requirements in a single place instead of duplicating them and the requirements already exist as part of the |
|
Hi @AlfredoSequeida, I agree that duplicating dependencies between This PR was mainly intended as a proof of concept to introduce the CI/code quality workflow and start the discussion around improving the project tooling. Longer term, I think it would make sense to migrate dependency management to a more modern and centralized approach, either fully using I’d be happy to collaborate on that refactor as a follow-up improvement if you think it fits the direction of the project. |
Summary
Implements the security scanning proposal from #91.
Adds free, automated security scanning at two levels:
CI (GitHub Actions)
Local (pre-commit)
requirements.txtagainst the OSV database before each commit.requirements.txt: it requiresgobject-introspectionsystem headers to build metadata, which are not universally available locally. It is fully covered by pip-audit in CI.Files added / modified
.github/workflows/security.yml.github/dependabot.yml.pre-commit-config.yamlrequirements.txtsetup.py install_requires)README.mdTrigger conditions (CI)
mainworkflow_dispatchPre-existing findings
bandit surfaced the following in the existing codebase (not introduced by this PR):
shell=Truein subprocess calls (hints.py,setup.py,plasmashell.py, others) — CWE-78pickle.loadsfrom a Unix domain socket (mouse.py,mouse_service.py) — CWE-502/tmpsocket path (constants.py) — CWE-377These are reported for the maintainer's awareness. The pre-commit hook runs only on staged files so it won't block existing workflows.
All tooling is free for public repositories — no external accounts or tokens required. All CI jobs have been validated on the fork before this PR.