orfeas_petri_flow 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/petri_flow/verification_runner.rb +3 -2
- data/lib/petri_flow/version.rb +1 -1
- data/lib/petri_flow/visualization/graphviz.rb +9 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: efec22c77e2eb0bcde1043972301901f99fe6ae5744839ed7f124bfd2e0344bf
|
|
4
|
+
data.tar.gz: 1505174afa2f87b1e53d7174228151bf6e2f0bdf45965d2c5b016ff1bea3bfa9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 217e171ba67b6afa9ec312f7b26797a41418f602dfb7f23c94bf5fb7f12b382a71ea77bc50d7687154a514e99c21694ea74b0b318784e3f213a4d67a27ee26db
|
|
7
|
+
data.tar.gz: 70452430546ed19f788d40d24b23500fd2cebf8ee51ea5951c11a16115d6b288b5fa03abaef2701f0c024ec1f64159b825b66e76fb84d328038be40ef7099039
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@ All notable changes to the PetriFlow gem will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.9.3] - 2026-11-04
|
|
8
|
+
|
|
9
|
+
### Security
|
|
10
|
+
- **Graphviz is run without a shell.** `VerificationRunner#generate_graphviz_images` and
|
|
11
|
+
`Visualization::Graphviz#render` built a shell command from the report directory, the
|
|
12
|
+
workflow's name, the output path and the layout. They now pass Graphviz its arguments one by
|
|
13
|
+
one, and `render` accepts only Graphviz's layout engines (`Graphviz::LAYOUTS`) and plain format
|
|
14
|
+
names, raising `ArgumentError` otherwise. The version moves to 0.9.3, with Lyra and PAM DSL.
|
|
15
|
+
|
|
7
16
|
## [0.9.1] - 2026-11-02
|
|
8
17
|
|
|
9
18
|
### Changed
|
|
@@ -169,13 +169,14 @@ module PetriFlow
|
|
|
169
169
|
end
|
|
170
170
|
|
|
171
171
|
def graphviz_available?
|
|
172
|
-
system("which dot
|
|
172
|
+
system("which", "dot", out: File::NULL, err: File::NULL)
|
|
173
173
|
end
|
|
174
174
|
|
|
175
175
|
def generate_graphviz_images(dot_file, workflow_id)
|
|
176
176
|
%w[png pdf svg].each do |format|
|
|
177
177
|
output_file = File.join(@reports_dir, "#{workflow_id}_petri.#{format}")
|
|
178
|
-
|
|
178
|
+
# Arguments, not a shell string: the paths never reach a shell.
|
|
179
|
+
system("dot", "-T#{format}", dot_file, "-o", output_file, err: File::NULL)
|
|
179
180
|
end
|
|
180
181
|
end
|
|
181
182
|
|
data/lib/petri_flow/version.rb
CHANGED
|
@@ -21,6 +21,9 @@ module PetriFlow
|
|
|
21
21
|
rankdir: "TB" # TB (top-bottom), LR (left-right)
|
|
22
22
|
}.freeze
|
|
23
23
|
|
|
24
|
+
# Graphviz layout engines render accepts, each the name of its executable.
|
|
25
|
+
LAYOUTS = %w[dot neato fdp sfdp circo twopi osage patchwork].freeze
|
|
26
|
+
|
|
24
27
|
def initialize(net, options = {})
|
|
25
28
|
@net = net
|
|
26
29
|
@options = DEFAULT_OPTIONS.merge(options)
|
|
@@ -69,10 +72,13 @@ module PetriFlow
|
|
|
69
72
|
def render(output_file, format: "png")
|
|
70
73
|
require 'open3'
|
|
71
74
|
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
layout = @options[:layout].to_s
|
|
76
|
+
raise ArgumentError, "unknown Graphviz layout #{layout.inspect} (one of #{LAYOUTS.join(', ')})" unless LAYOUTS.include?(layout)
|
|
77
|
+
raise ArgumentError, "invalid Graphviz format #{format.inspect}" unless format.to_s.match?(/\A[a-z0-9:]+\z/)
|
|
74
78
|
|
|
75
|
-
|
|
79
|
+
dot_content = to_dot
|
|
80
|
+
# Arguments, not a shell string: no path or option reaches a shell.
|
|
81
|
+
stdout, stderr, status = Open3.capture3(layout, "-T#{format}", "-o", output_file.to_s, stdin_data: dot_content)
|
|
76
82
|
|
|
77
83
|
unless status.success?
|
|
78
84
|
raise "Graphviz rendering failed: #{stderr}"
|