junoser 0.5.5 → 0.6.0
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/.github/dependabot.yml +6 -0
- data/.github/workflows/test-linux.yaml +2 -2
- data/.pre-commit-config.yaml +1 -1
- data/CHANGELOG.md +23 -0
- data/Gemfile.lock +7 -7
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/Rakefile +14 -2
- data/lib/junoser/development.rb +1 -0
- data/lib/junoser/input.rb +21 -0
- data/lib/junoser/js_ruler.rb +5 -0
- data/lib/junoser/parser.rb +4949 -3662
- data/lib/junoser/rule_tree/node.rb +24 -0
- data/lib/junoser/rule_tree/parser.rb +66 -0
- data/lib/junoser/rule_tree.rb +2 -0
- data/lib/junoser/ruler.rb +12 -6
- data/lib/junoser/version.rb +1 -1
- data/sig/junoser/rule_tree/node.rbs +17 -0
- data/sig/junoser/rule_tree/parser.rbs +21 -0
- data/sig/junoser/ruler.rbs +9 -7
- metadata +9 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a73208784003b23a9dc996cf06ef4941a3da1ad35143848885c3e37a0e921e84
|
|
4
|
+
data.tar.gz: ae1ded9c7e208d3af98a96cf4c9fe5839b51d79447f1921fb36807f4202017ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ac8d0ca12b3dada5bea555115c5ac172cc7dd3123c3fb5b85ab01e7f7e116daed5b2e9faebfc6237569719ad363c182522359a0cb1d1f1892f3bb85cfb5cc47
|
|
7
|
+
data.tar.gz: c37c95e729cdbf60a517845c0561c80b5bbb6e43f5b1dfd0c6ed8a8f49e431028c12ffb6dd0b081e8ce15ce829af599e246635a60df8d7f528d567835271e154
|
|
@@ -9,7 +9,7 @@ jobs:
|
|
|
9
9
|
strategy:
|
|
10
10
|
fail-fast: false
|
|
11
11
|
matrix:
|
|
12
|
-
ruby-version: ['3.
|
|
12
|
+
ruby-version: ['3.3', '3.2', '3.1']
|
|
13
13
|
os: [ubuntu-latest]
|
|
14
14
|
experimental: [false]
|
|
15
15
|
include:
|
|
@@ -19,7 +19,7 @@ jobs:
|
|
|
19
19
|
|
|
20
20
|
name: Test with ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
|
|
21
21
|
steps:
|
|
22
|
-
- uses: actions/checkout@
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
23
|
- name: Set up Ruby
|
|
24
24
|
uses: ruby/setup-ruby@v1
|
|
25
25
|
with:
|
data/.pre-commit-config.yaml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
## [0.6.0] - 2024-09-15
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
* Update vSRX syntax to 22.4R1.10
|
|
6
|
+
* "security"
|
|
7
|
+
* "chassis cluster"
|
|
8
|
+
* Newly supported syntax
|
|
9
|
+
* "interfaces xxx enable"
|
|
10
|
+
* "interfaces xxx unit xxx enable"
|
|
11
|
+
* Rake task
|
|
12
|
+
* `rule:tree` to show the dependency tree of rules
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [0.5.6] - 2024-05-01
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
* "teardown" may appear outside of "prefix-limit" block
|
|
20
|
+
* "tcp-flags" should accept a quoted string as an argument
|
|
21
|
+
* Structured config with square brackets ( `[ ... ]` ) should be parsed even when it's split into multiple lines
|
|
22
|
+
|
|
23
|
+
|
|
1
24
|
## [0.5.5] - 2023-11-14
|
|
2
25
|
|
|
3
26
|
### Fixed
|
data/Gemfile.lock
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
junoser (0.
|
|
4
|
+
junoser (0.6.0)
|
|
5
5
|
parslet
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
mini_portile2 (2.8.
|
|
11
|
-
nokogiri (1.
|
|
10
|
+
mini_portile2 (2.8.7)
|
|
11
|
+
nokogiri (1.16.7)
|
|
12
12
|
mini_portile2 (~> 2.8.2)
|
|
13
13
|
racc (~> 1.4)
|
|
14
14
|
parslet (2.0.0)
|
|
15
15
|
power_assert (2.0.3)
|
|
16
|
-
racc (1.
|
|
17
|
-
rake (13.
|
|
18
|
-
test-unit (3.6.
|
|
16
|
+
racc (1.8.1)
|
|
17
|
+
rake (13.2.1)
|
|
18
|
+
test-unit (3.6.2)
|
|
19
19
|
power_assert
|
|
20
20
|
|
|
21
21
|
PLATFORMS
|
|
@@ -29,4 +29,4 @@ DEPENDENCIES
|
|
|
29
29
|
test-unit
|
|
30
30
|
|
|
31
31
|
BUNDLED WITH
|
|
32
|
-
2.
|
|
32
|
+
2.5.9
|
data/LICENSE.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2015-
|
|
3
|
+
Copyright (c) 2015-2024 Shintaro Kojima
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
data/Rakefile
CHANGED
|
@@ -20,7 +20,7 @@ def open_files(input, output, &block)
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def move_wildcards(element)
|
|
23
|
-
[
|
|
23
|
+
%w[ipaddr ipv6addr ipprefix].each do |pattern|
|
|
24
24
|
element.xpath(%[.//xsd:element[@type="#{pattern}"]/xsd:annotation/xsd:appinfo/flag[text()="nokeyword"]/../../..]).each do |wildcard|
|
|
25
25
|
parent = wildcard.parent
|
|
26
26
|
removed = wildcard.remove
|
|
@@ -60,12 +60,24 @@ task 'find-srx-methods' do
|
|
|
60
60
|
vmx = File.read('lib/junoser/parser.rb')
|
|
61
61
|
|
|
62
62
|
vsrx.scan(/^ +([0-9a-z_]+) *$/).flatten.uniq.sort.each do |method|
|
|
63
|
-
next if [
|
|
63
|
+
next if %w[arg end ipaddr time].include?(method)
|
|
64
64
|
|
|
65
65
|
puts method unless vsrx =~ /rule\(:#{method}\)/m || vmx =~ /rule\(:#{method}\)/m
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
+
namespace :rule do
|
|
70
|
+
desc 'Show rule tree'
|
|
71
|
+
task :tree, [:path] do |_, args|
|
|
72
|
+
if args.path
|
|
73
|
+
raise "File not found: #{args.path}" unless File.exist?(args.path)
|
|
74
|
+
Junoser::RuleTree::Parser.new(File.read(args.path)).print
|
|
75
|
+
else
|
|
76
|
+
Junoser::RuleTree::Parser.new($stdin.read).print
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
69
81
|
Rake::TestTask.new do |t|
|
|
70
82
|
t.libs << 'test'
|
|
71
83
|
|
data/lib/junoser/development.rb
CHANGED
data/lib/junoser/input.rb
CHANGED
|
@@ -13,6 +13,7 @@ module Junoser
|
|
|
13
13
|
|
|
14
14
|
content = remove_blank_and_comment_line(content)
|
|
15
15
|
content = unify_carriage_return(content)
|
|
16
|
+
content = unify_square_brackets(content)
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
|
|
@@ -30,5 +31,25 @@ module Junoser
|
|
|
30
31
|
str.gsub! /\r\n?/, "\n"
|
|
31
32
|
str
|
|
32
33
|
end
|
|
34
|
+
|
|
35
|
+
# Statements or [ ... ] may be split into multiple lines. This method unifies them into one line.
|
|
36
|
+
def unify_square_brackets(str)
|
|
37
|
+
lines = []
|
|
38
|
+
|
|
39
|
+
open_brackets = 0
|
|
40
|
+
str.split("\n").each do |line|
|
|
41
|
+
raise "ERROR: invalid statement: #{line}" if open_brackets < 0
|
|
42
|
+
|
|
43
|
+
if open_brackets == 0
|
|
44
|
+
lines << line
|
|
45
|
+
else
|
|
46
|
+
lines.last << " " << line
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
open_brackets += line.count('[') - line.count(']')
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
lines.join("\n")
|
|
53
|
+
end
|
|
33
54
|
end
|
|
34
55
|
end
|
data/lib/junoser/js_ruler.rb
CHANGED