Skip to content

Pushkar v8 security fixes & updates#2078

Open
pushkarjethwa wants to merge 2 commits into
Graphify-Labs:v8from
pushkarjethwa:pushkar-v8-security-fixes
Open

Pushkar v8 security fixes & updates#2078
pushkarjethwa wants to merge 2 commits into
Graphify-Labs:v8from
pushkarjethwa:pushkar-v8-security-fixes

Conversation

@pushkarjethwa

Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings July 21, 2026 08:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md containing 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.

Comment thread Pushkar-Security-Audit.md
@@ -0,0 +1,158 @@
Add Two factor authentication for pull request
Comment thread Pushkar-Security-Audit.md
Comment on lines +5 to +8
**Auditor:** Pushkar
**Date:** 2026-07-21
**Scope:** Static analysis of `graphify/` Python source

Comment thread Pushkar-Security-Audit.md
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 thread Pushkar-Security-Audit.md
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 thread Pushkar-Security-Audit.md
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 thread Pushkar-Security-Audit.md
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 thread Pushkar-Security-Audit.md
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 thread Pushkar-Security-Audit.md
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants