Feat: Add composer graph - #457
Conversation
**Details**: The `/api/_action/frosh-tools/composer-graph` endpoint provides an SVG dependency graph of shopware core packages and any additionally provided `packages`. The dev-dependencies are not included by default. Caches are used if possible, SVG results are cached for `3800s`, refresh may be forced. Standard cache compression is supported. Any vulnerable packages are marked red in the dependency graph generated through `dot` (graphviz). A new configuration parameter `composer.graphviz_path` can be used to set a custom dist path (useful for non-PATH setups). A Shopware 6.6 compatible Dockerfile with `graphwiz` support is provided.
|
no API key found — this repo is configured to use To fix: add the key as a GitHub Actions secret (referenced from your workflow's Open repo secrets → · Configure model → · Setup docs → · Ask in Discord →
|
Greptile SummaryAdds an ACL-protected API and administration UI for generating, caching, and displaying Graphviz Composer dependency graphs with vulnerable packages highlighted.
Confidence Score: 3/5The PR should not merge until graph reloads actually invalidate the cache and graph styling safely handles audited packages absent from the generated dependency graph. The reload path cannot transmit the backend’s refresh input, and a reachable advisory shape can make the new endpoint throw during an unconditional graph vertex lookup. Files Needing Attention: src/Components/ComposerAudit/ComposerGraphService.php, src/Resources/app/administration/src/api/frosh-tools.js, src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-security-dependencies/template.twig
|
| Filename | Overview |
|---|---|
| src/Components/ComposerAudit/ComposerGraphService.php | Adds graph generation and caching, but advisory styling can throw when an audited package is absent from the root dependency graph. |
| src/Controller/ComposerAuditController.php | Adds the ACL-scoped SVG endpoint and consumes refresh, strict, development-dependency, and package query inputs. |
| src/Resources/app/administration/src/api/frosh-tools.js | Adds the graph request wrapper, but sends forceRefresh rather than the refresh parameter expected by the endpoint. |
| src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-security-dependencies/index.js | Adds graph loading and data-URI state, while its refresh flag is not activated by the UI. |
| src/Resources/app/administration/src/module/frosh-tools/component/frosh-tools-security-dependencies/template.twig | Adds graph display and controls, but the reload-labelled action performs a normal cached load. |
| composer.json | Adds the graph-composer fork and PHP 8.3 resolution platform while changing the package’s declared development version. |
Sequence Diagram
sequenceDiagram
participant Admin as Administration UI
participant API as ComposerAuditController
participant Service as ComposerGraphService
participant Audit as ComposerAuditService
participant Cache as Cache
participant Dot as Graphviz
Admin->>API: GET /composer-graph
API->>Service: graph(packages, dev, strict, refresh)
Service->>Audit: audit(refresh)
Service->>Cache: get graph cache key
alt cache miss or invalidated
Service->>Dot: render dependency graph
Dot-->>Service: SVG file
Service->>Cache: store compressed SVG
end
Cache-->>Service: SVG data
Service-->>API: SVG
API-->>Admin: image/svg+xml
Reviews (1): Last reviewed commit: "Add experimental composer graph in admin..." | Re-trigger Greptile
| return this.httpClient | ||
| .get(apiRoute, { | ||
| headers: this.getBasicHeaders(), | ||
| params: { packages, withDevDependencies, strict, forceRefresh }, |
There was a problem hiding this comment.
| private function setGraphLayout(Graph $graph, array $advisory, array $layout): void | ||
| { | ||
| $packageName = $advisory['packageName']; | ||
| $vertex = $graph->getVertex($packageName); |
There was a problem hiding this comment.

Example:
With vulnerable
twig/twig:3.25.0 as 3.26.0installed through platform'scomposer.json:Details
The
/api/_action/frosh-tools/composer-graphendpoint provides an SVG dependency graph of shopware core packages and any additionally providedpackages.The dev-dependencies are not included by default. Caches are used if possible, SVG results are cached for
3800s, refresh may be forced. Standard cache compression is supported.Some vendors are always included to keep the graph meaningful:
shopware/*,frosh/*andstore.shopware.com/*.Any vulnerable packages are marked red in the dependency graph generated through
dot(graphviz).A new configuration parameter
composer.graphviz_pathcan be used to set a custom dist path (useful for non-PATH setups).A Shopware 6.6 compatible Dockerfile with
graphwizsupport is provided.