junoser 0.7.0 → 0.7.2
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/workflows/test-linux.yaml +1 -1
- data/CHANGELOG.md +20 -0
- data/Gemfile.lock +5 -5
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/lib/junoser/js_ruler.rb +32 -16
- data/lib/junoser/parser.rb +14 -4
- data/lib/junoser/ruler.rb +3 -0
- data/lib/junoser/version.rb +1 -1
- metadata +3 -6
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 54f09e05dbba47b559c3a8ba68644a5648b646719830ca573fad81821b7aa6e6
         | 
| 4 | 
            +
              data.tar.gz: d8c0cd5221c4d534bbf3b3986bef228e47c3db44cfe9d3dc9977e70a3ade15dd
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 262a923cabcf89668f1b1cb73a773662971fc2b577abb314196fd27a458da801a7ac78740fe31b500652787af7a338fe3906fb569eb12f7363832353289dc3c1
         | 
| 7 | 
            +
              data.tar.gz: 0b01ef6de4abefa8234a5cdfdae9320ad690ea90f9544fbeefb82198195f89eb82c66fb966305a4c813ff9f166cb60280a3de0f0523df5f3a6c02c68935f3dba
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,23 @@ | |
| 1 | 
            +
            ## [0.7.2] - 2025-04-22
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            ### Fixed
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            * A Nokogiri's [security vulnerability](https://github.com/codeout/junoser/security/dependabot/19)
         | 
| 6 | 
            +
            * The argument of commands below should be a regular expression
         | 
| 7 | 
            +
              * "system login class foo allow-commands-regexps"
         | 
| 8 | 
            +
              * "system login class foo deny-commands-regexps"
         | 
| 9 | 
            +
              * "system login class foo allow-configuration-regexps"
         | 
| 10 | 
            +
              * "system login class foo deny-configuration-regexps"
         | 
| 11 | 
            +
             | 
| 12 | 
            +
             | 
| 13 | 
            +
            ## [0.7.1] - 2025-02-03
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            ### Added
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            * Newly supported syntax for vSRX
         | 
| 18 | 
            +
              * "system services web-management http"
         | 
| 19 | 
            +
             | 
| 20 | 
            +
             | 
| 1 21 | 
             
            ## [0.7.0] - 2024-12-19
         | 
| 2 22 |  | 
| 3 23 | 
             
            ### Added
         | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,21 +1,21 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                junoser (0.7. | 
| 4 | 
            +
                junoser (0.7.2)
         | 
| 5 5 | 
             
                  parslet
         | 
| 6 6 |  | 
| 7 7 | 
             
            GEM
         | 
| 8 8 | 
             
              remote: https://rubygems.org/
         | 
| 9 9 | 
             
              specs:
         | 
| 10 10 | 
             
                mini_portile2 (2.8.8)
         | 
| 11 | 
            -
                nokogiri (1. | 
| 11 | 
            +
                nokogiri (1.18.8)
         | 
| 12 12 | 
             
                  mini_portile2 (~> 2.8.2)
         | 
| 13 13 | 
             
                  racc (~> 1.4)
         | 
| 14 14 | 
             
                parslet (2.0.0)
         | 
| 15 | 
            -
                power_assert (2.0. | 
| 15 | 
            +
                power_assert (2.0.5)
         | 
| 16 16 | 
             
                racc (1.8.1)
         | 
| 17 17 | 
             
                rake (13.2.1)
         | 
| 18 | 
            -
                test-unit (3.6. | 
| 18 | 
            +
                test-unit (3.6.8)
         | 
| 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.6.2
         | 
    
        data/LICENSE.txt
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            The MIT License (MIT)
         | 
| 2 2 |  | 
| 3 | 
            -
            Copyright (c) 2015- | 
| 3 | 
            +
            Copyright (c) 2015-2025 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/lib/junoser/js_ruler.rb
    CHANGED
    
    | @@ -29,17 +29,20 @@ module Junoser | |
| 29 29 | 
             
                  # set groups
         | 
| 30 30 | 
             
                  str.gsub! /"groups" \(.*\s*s\(\s*any\s*\)\s*\)/, <<-EOS.strip
         | 
| 31 31 | 
             
                      "groups" arg (  /* Configuration groups */
         | 
| 32 | 
            -
                         | 
| 33 | 
            -
                           | 
| 34 | 
            -
             | 
| 35 | 
            -
                             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
                              " | 
| 42 | 
            -
                               | 
| 32 | 
            +
                        c(
         | 
| 33 | 
            +
                          this.configuration({ groups: false }),
         | 
| 34 | 
            +
                          "when" (  /* Specify additional conditions for groups */
         | 
| 35 | 
            +
                            c(
         | 
| 36 | 
            +
                              "chassis" arg  /* Chassis id */,
         | 
| 37 | 
            +
                              "member" arg  /* Member of virtual chassis */,
         | 
| 38 | 
            +
                              "model" arg  /* Model name */,
         | 
| 39 | 
            +
                              "node" arg  /* Node of cluster */,
         | 
| 40 | 
            +
                              "peers" arg  /* Hosts on which this group should be effective */,
         | 
| 41 | 
            +
                              "routing-engine" arg  /* Routing Engine */,
         | 
| 42 | 
            +
                              "time" (  /* Time at which group should be effective */
         | 
| 43 | 
            +
                                "to" arg  /* End time([yyyy-mm-dd.]hh:mm) */,
         | 
| 44 | 
            +
                                arg
         | 
| 45 | 
            +
                              )
         | 
| 43 46 | 
             
                            )
         | 
| 44 47 | 
             
                          )
         | 
| 45 48 | 
             
                        )
         | 
| @@ -91,8 +94,8 @@ module Junoser | |
| 91 94 | 
             
                end
         | 
| 92 95 |  | 
| 93 96 | 
             
                def process_common_syntax(str)
         | 
| 94 | 
            -
                  # rule(:foo) do  ->  foo( | 
| 95 | 
            -
                  str.gsub!(/^rule\(:(\S+)\) do/) { "#$1( | 
| 97 | 
            +
                  # rule(:foo) do  ->  foo(opts) {
         | 
| 98 | 
            +
                  str.gsub!(/^rule\(:(\S+)\) do/) { "#$1(opts) { return_next_line" }
         | 
| 96 99 | 
             
                  # end  ->  }
         | 
| 97 100 | 
             
                  str.gsub!(/^(\s*)end$/) { "#$1}" }
         | 
| 98 101 |  | 
| @@ -167,12 +170,12 @@ module Junoser | |
| 167 170 | 
             
                end
         | 
| 168 171 |  | 
| 169 172 | 
             
                def process_structural_syntax(str)
         | 
| 170 | 
            -
                  # "foo" (  /* doc */  ->  "foo | doc": ( | 
| 173 | 
            +
                  # "foo" (  /* doc */  ->  "foo | doc": (opts) => {
         | 
| 171 174 | 
             
                  str.gsub!(%r|^(\s*)"(\S+)" \(  /\* (.*) \*/|) { "#$1\"#$2 | #$3\": {" }
         | 
| 172 | 
            -
                  # "foo" (  ->  "foo": ( | 
| 175 | 
            +
                  # "foo" (  ->  "foo": (opts) => {
         | 
| 173 176 | 
             
                  str.gsub!(%r|^(\s*)"(\S+)" \($|) { "#$1\"#$2\": {" }
         | 
| 174 177 |  | 
| 175 | 
            -
                  # "foo" arg (  /* doc */  ->  "foo | doc": ( | 
| 178 | 
            +
                  # "foo" arg (  /* doc */  ->  "foo | doc": (opts) => {
         | 
| 176 179 | 
             
                  str.gsub!(%r|^(\s*)"(\S+)" arg \(  /\* (.*) \*/|) { "#$1\"#$2 | #$3\": {" }
         | 
| 177 180 |  | 
| 178 181 | 
             
                  str
         | 
| @@ -286,6 +289,8 @@ module Junoser | |
| 286 289 |  | 
| 287 290 | 
             
                  # "arg"  ->  "arg_1"
         | 
| 288 291 | 
             
                  lines.gsub('"arg":') { %["arg_#{sequence}":] }
         | 
| 292 | 
            +
             | 
| 293 | 
            +
                  conditional_groups(lines)
         | 
| 289 294 | 
             
                end
         | 
| 290 295 |  | 
| 291 296 | 
             
                # }  ->  )
         | 
| @@ -349,6 +354,17 @@ module Junoser | |
| 349 354 | 
             
                  lines
         | 
| 350 355 | 
             
                end
         | 
| 351 356 |  | 
| 357 | 
            +
                def conditional_groups(lines)
         | 
| 358 | 
            +
                  # "null_13264": this.configuration(false),
         | 
| 359 | 
            +
                  # ->
         | 
| 360 | 
            +
                  # (opts === undefined || opts?.configuration !== false) && { "null_13264": this.configuration(false) },
         | 
| 361 | 
            +
                  #
         | 
| 362 | 
            +
                  # ref: process_lines()
         | 
| 363 | 
            +
                  lines.gsub(/("groups\(arg\) \| .*":) {/) {
         | 
| 364 | 
            +
                    "#{$1} opts?.groups !== false && {"
         | 
| 365 | 
            +
                  }
         | 
| 366 | 
            +
                end
         | 
| 367 | 
            +
             | 
| 352 368 | 
             
                def rule_header
         | 
| 353 369 | 
             
                  <<~EOS
         | 
| 354 370 | 
             
                    /* eslint-disable semi */
         | 
    
        data/lib/junoser/parser.rb
    CHANGED
    
    | @@ -86876,6 +86876,16 @@ module Junoser | |
| 86876 86876 | 
             
                                                )
         | 
| 86877 86877 | 
             
                                            )
         | 
| 86878 86878 | 
             
                                        ),
         | 
| 86879 | 
            +
                                        # Ported from vSRX 18.4R1.8
         | 
| 86880 | 
            +
                                        b(str("http"),
         | 
| 86881 | 
            +
                                            c(
         | 
| 86882 | 
            +
                                                a(str("port"), arg),
         | 
| 86883 | 
            +
                                                b(str("interface"),
         | 
| 86884 | 
            +
                                                    interface_name
         | 
| 86885 | 
            +
                                                )
         | 
| 86886 | 
            +
                                            )
         | 
| 86887 | 
            +
                                        ),
         | 
| 86888 | 
            +
                                        # End of vSRX 18.4R1.8
         | 
| 86879 86889 | 
             
                                        b(str("control"),
         | 
| 86880 86890 | 
             
                                            c(
         | 
| 86881 86891 | 
             
                                                a(str("max-threads"), arg)
         | 
| @@ -111164,10 +111174,10 @@ module Junoser | |
| 111164 111174 | 
             
                        b(str("deny-configuration"),
         | 
| 111165 111175 | 
             
                          regular_expression
         | 
| 111166 111176 | 
             
                        ),
         | 
| 111167 | 
            -
                        a(str("allow-commands-regexps"),  | 
| 111168 | 
            -
                        a(str("deny-commands-regexps"),  | 
| 111169 | 
            -
                        a(str("allow-configuration-regexps"),  | 
| 111170 | 
            -
                        a(str("deny-configuration-regexps"),  | 
| 111177 | 
            +
                        a(str("allow-commands-regexps"), regular_expression),
         | 
| 111178 | 
            +
                        a(str("deny-commands-regexps"), regular_expression),
         | 
| 111179 | 
            +
                        a(str("allow-configuration-regexps"), regular_expression),
         | 
| 111180 | 
            +
                        a(str("deny-configuration-regexps"), regular_expression),
         | 
| 111171 111181 | 
             
                        str("configuration-breadcrumbs"),
         | 
| 111172 111182 | 
             
                        b(a(str("confirm-commands"), arg),
         | 
| 111173 111183 | 
             
                            c(
         | 
    
        data/lib/junoser/ruler.rb
    CHANGED
    
    
    
        data/lib/junoser/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: junoser
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.7. | 
| 4 | 
            +
              version: 0.7.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Shintaro Kojima
         | 
| 8 | 
            -
            autorequire:
         | 
| 9 8 | 
             
            bindir: exe
         | 
| 10 9 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 10 | 
            +
            date: 2025-04-22 00:00:00.000000000 Z
         | 
| 12 11 | 
             
            dependencies:
         | 
| 13 12 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 13 | 
             
              name: parslet
         | 
| @@ -141,7 +140,6 @@ files: | |
| 141 140 | 
             
            homepage: https://github.com/codeout/junoser
         | 
| 142 141 | 
             
            licenses: []
         | 
| 143 142 | 
             
            metadata: {}
         | 
| 144 | 
            -
            post_install_message:
         | 
| 145 143 | 
             
            rdoc_options: []
         | 
| 146 144 | 
             
            require_paths:
         | 
| 147 145 | 
             
            - lib
         | 
| @@ -156,8 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 156 154 | 
             
                - !ruby/object:Gem::Version
         | 
| 157 155 | 
             
                  version: '0'
         | 
| 158 156 | 
             
            requirements: []
         | 
| 159 | 
            -
            rubygems_version: 3. | 
| 160 | 
            -
            signing_key:
         | 
| 157 | 
            +
            rubygems_version: 3.6.2
         | 
| 161 158 | 
             
            specification_version: 4
         | 
| 162 159 | 
             
            summary: PEG parser for JUNOS configuration.
         | 
| 163 160 | 
             
            test_files: []
         |