✨ feat: install graphviz binaries - #512
Merged
Nicola Franco (franconicola) merged 2 commits intoJul 26, 2026
Merged
Conversation
Marco Russo (marcorusso97)
requested review from
Raffaele Paolino (RPaolino) and
Copilot
July 23, 2026 10:58
Nicola Franco (franconicola)
temporarily deployed
to
459-solve-graphviz-installation-issue - Docs PR #512
July 23, 2026 10:58 — with
Render
Destroyed
There was a problem hiding this comment.
Pull request overview
Adds a local-binary bootstrap for Graphviz so FC-Attack can render flowchart images even when dot isn’t installed system-wide, and integrates an interactive preflight/prefetch step into hackagent init.
Changes:
- Implemented
dotresolution with fallbacks: env override → PATH → (optionally) download portable Graphviz bundles into an OS-specific persistent directory. - Hardened macOS handling (pkg preference, dylib symlink repair, install-name patching, runtime env setup) and improved renderer fallback/error behavior.
- Added unit tests and updated FC-Attack documentation for the new Graphviz behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
tests/unit/attacks/fc/test_graphviz_bootstrap.py |
Adds unit tests for asset selection, data dir resolution, dylib symlink repair, and ZIP extraction behavior. |
hackagent/cli/main.py |
Extends hackagent init to check for Graphviz and optionally prefetch portable binaries with user consent. |
hackagent/attacks/techniques/fc/flowchart_renderer.py |
Adds Graphviz bootstrap/download/extraction logic and updates rendering to use the resolved dot binary and runtime env. |
docs/docs/attacks/fc.md |
Documents the new “no-admin Graphviz” workflow and environment variables. |
Comments suppressed due to low confidence (1)
hackagent/attacks/techniques/fc/flowchart_renderer.py:497
- Portable binaries are downloaded and extracted without any integrity verification (e.g., comparing against the release-provided .sha256 assets). If the release endpoint, redirect, or network path is compromised, this becomes a remote code execution vector. Consider verifying the archive checksum (or pinning to a known version) before extraction.
archive_path = install_root / asset_name
logger.info("Downloading Graphviz archive: %s", asset_name)
_download_file(asset_url, archive_path)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+173
to
+182
| if is_symlink: | ||
| link_target = zf.read(info).decode("utf-8").strip() | ||
| if out_path.exists() or out_path.is_symlink(): | ||
| out_path.unlink() | ||
| try: | ||
| os.symlink(link_target, out_path) | ||
| except OSError: | ||
| # Fallback: keep the placeholder file if symlink creation fails. | ||
| out_path.write_text(link_target, encoding="utf-8") | ||
| continue |
Comment on lines
+156
to
+162
| 1. Detect current OS (`Linux`/`macOS`/`Windows`). | ||
| 2. Query the **latest** official Graphviz release from GitLab. | ||
| 3. Download a portable archive into HackAgent's OS-specific persistent data directory: | ||
| - Linux: `~/.local/share/hackagent/graphviz` (or `$XDG_DATA_HOME/hackagent/graphviz`) | ||
| - macOS: `~/.local/share/hackagent/graphviz` (or `$XDG_DATA_HOME/hackagent/graphviz`) | ||
| - Windows: `%LOCALAPPDATA%\\hackagent\\graphviz` | ||
| 4. Use that local `dot` binary for rendering. |
Comment on lines
+1213
to
+1215
| "Graphviz 'dot' binary not found. FC-Attack looked in PATH and " | ||
| "tried local auto-download. You can set HACKAGENT_GRAPHVIZ_DOT to " | ||
| "a local binary path, or install Graphviz manually " |
Marco Russo (marcorusso97)
requested review from
Copilot
and removed request for
Raffaele Paolino (RPaolino)
July 23, 2026 12:35
Marco Russo (marcorusso97)
requested review from
Nicola Franco (franconicola)
and removed request for
Copilot
July 23, 2026 12:36
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Nicola Franco (franconicola)
deleted the
459-solve-graphviz-installation-issue
branch
July 26, 2026 12:24
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.
Context
FC-Attack requires Graphviz to render flowchart images. In restricted environments (no admin privileges), installing Graphviz system-wide is often not possible. This PR introduces a robust local-binary workflow so FC-Attack can run without OS-level installation.
What Changed
User Impact
Tests
Added dedicated unit tests for Graphviz bootstrap behavior:
Executed:
Notes
This PR resolves no-admin Graphviz setup for FC-Attack and stabilizes local macOS execution for downloaded Graphviz bundles.