Pushkar v8 security fixes & updates#2078
Open
pushkarjethwa wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new security audit report for graphify/ that documents potential security hardening areas and suggested remediations.
Changes:
- Introduces
Pushkar-Security-Audit.mdcontaining 5 security findings with severity ratings and proposed fixes - Includes CLI/graph database export, MinHash, Google Workspace export, and git-hook launcher considerations
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,158 @@ | |||
| Add Two factor authentication for pull request | |||
Comment on lines
+5
to
+8
| **Auditor:** Pushkar | ||
| **Date:** 2026-07-21 | ||
| **Scope:** Static analysis of `graphify/` Python source | ||
|
|
Comment on lines
+30
to
+32
| Although `_safe_label` and `_safe_rel` strip most special characters, the sanitisation is applied to data that originates from `G.nodes` / `G.edges` attributes, which are populated from arbitrary source files. A node with `file_type = "A} DETACH DELETE n //"` could survive a weak regex and produce a destructive query. | ||
|
|
||
| **Fix:** Enforce a strict allowlist on `_safe_label` / `_safe_rel` (letters, digits, underscore only, max 64 chars) and raise an error — rather than silently coercing — when the sanitised value differs from the input: |
Comment on lines
+51
to
+53
| The `graphify export neo4j --push URI --password <pass>` and equivalent FalkorDB flag pass database credentials as a command-line argument. On any multi-user Linux/macOS system `ps aux` reveals the plaintext password to all local users. The help text acknowledges the risk ("or set `NEO4J_PASSWORD` instead") but no runtime warning is emitted when the insecure flag is used. | ||
|
|
||
| **Fix:** Emit a warning at runtime when `--password` is supplied on the command line, and prefer the environment variable path: |
Comment on lines
+78
to
+80
| MinHash security relies on the hash functions being unknown to an adversary. With a public, hardcoded seed of `1`, an attacker who can influence what files are fed into graphify can craft two semantically different files that produce identical MinHash signatures, forcing deduplication to silently drop one. This is relevant when graphify runs in automated CI pipelines processing untrusted repositories. | ||
|
|
||
| **Fix:** Derive the seed from `os.urandom` so the functions are unpredictable per run: |
Comment on lines
+92
to
+95
| ## Finding 4 — Temporary Files with `delete=False` Risk Sensitive Data Leakage on Exception | ||
|
|
||
| **File:** `graphify/google_workspace.py` (lines 184, 197, 212) | ||
| **Severity:** Medium |
Comment on lines
+102
to
+105
| Three export paths use `delete=False` and write exported Google Workspace content (documents, spreadsheets, slides) to `out_dir`. If an exception is raised inside the `with` block or at any later processing step, the temporary file is left on disk with its full contents and no cleanup guarantee. | ||
|
|
||
| **Fix:** Wrap each block in a `try/finally` to guarantee removal on failure: | ||
|
|
Comment on lines
+154
to
+158
| | 1 | Cypher injection via node labels / relationship types | `exporters/graphdb.py` | **High** | | ||
| | 2 | Database password exposed in process listing | `cli.py` | **High** | | ||
| | 3 | Hardcoded MinHash RNG seed enables collision crafting | `_minhash.py` | Medium | | ||
| | 4 | Leaked temporary files on exception in GWS export | `google_workspace.py` | Medium | | ||
| | 5 | Unconstrained dynamic Python code in git hook launcher | `hooks.py` | Medium | No newline at end of file |
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.
No description provided.