inspec-core 5.22.55 → 5.22.58
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/inspec-core.gemspec +3 -1
- data/lib/inspec/resources/oracledb_session.rb +5 -8
- data/lib/inspec/resources/postgres_session.rb +1 -1
- data/lib/inspec/version.rb +1 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 02f7fb4aedd2162975d1cbf01938cc2e749fb4a935dbe1d52b4e6ecee3bb360f
         | 
| 4 | 
            +
              data.tar.gz: 277ae958544f136bf8f2444d839dfc45d378506be00c587689813b98cd798439
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 484a35f9b50804ebcd94b3234881ebc2d4dc5518bd9df66c9af42f37c314586f8b6305972045e9c23f2d3e04fdbba95de9ed386ce3c4e0ce95fc54bc002cdc38
         | 
| 7 | 
            +
              data.tar.gz: 31c1e550ab9532a8ddc5c3447dec9a518b7699cb39c979a28cbf5b53eab860abfd4589b220331ef98a0e8b937ebdae1e0840e534a454f2e6050d674adcdf4810
         | 
    
        data/inspec-core.gemspec
    CHANGED
    
    | @@ -13,7 +13,9 @@ Gem::Specification.new do |spec| | |
| 13 13 | 
             
              spec.license       = "Apache-2.0"
         | 
| 14 14 | 
             
              spec.require_paths = ["lib"]
         | 
| 15 15 |  | 
| 16 | 
            -
               | 
| 16 | 
            +
              # We want to support ruby 3.0 as Chef is using ruby to support AIX and we want to make sure InSpec works with it. (Ref: https://github.com/chef/chef/pull/13207)
         | 
| 17 | 
            +
              # TODO: Once we have Chef working fully with ruby 3.1 we can drop ruby 3.0
         | 
| 18 | 
            +
              spec.required_ruby_version = ">= 3.0.3"
         | 
| 17 19 |  | 
| 18 20 | 
             
              # the gemfile and gemspec are necessary for appbundler so don't remove it
         | 
| 19 21 | 
             
              spec.files =
         | 
| @@ -57,7 +57,7 @@ module Inspec::Resources | |
| 57 57 | 
             
                  inspec_cmd = inspec.command(command)
         | 
| 58 58 | 
             
                  out = inspec_cmd.stdout + "\n" + inspec_cmd.stderr
         | 
| 59 59 |  | 
| 60 | 
            -
                  if inspec_cmd.exit_status != 0 ||  | 
| 60 | 
            +
                  if inspec_cmd.exit_status != 0 || out.downcase =~ /^error.*/
         | 
| 61 61 | 
             
                    raise Inspec::Exceptions::ResourceFailed, "Oracle query with errors: #{out}"
         | 
| 62 62 | 
             
                  else
         | 
| 63 63 | 
             
                    begin
         | 
| @@ -134,10 +134,8 @@ module Inspec::Resources | |
| 134 134 | 
             
                end
         | 
| 135 135 |  | 
| 136 136 | 
             
                def escape_query(query)
         | 
| 137 | 
            -
                   | 
| 138 | 
            -
                   | 
| 139 | 
            -
                  escaped_query = query.gsub(/["\\]/) { |match| match == '"' ? '\\"' : "\\\\" } # Escape backslashes and double quotes
         | 
| 140 | 
            -
                  escaped_query.gsub!("$", '\\$') unless escaped_query.include? "\\$" # Escape dollar signs, but only if not already escaped
         | 
| 137 | 
            +
                  escaped_query = query.gsub(/\\\\/, "\\").gsub(/"/, '\\"')
         | 
| 138 | 
            +
                  escaped_query = escaped_query.gsub("$", '\\$') unless escaped_query.include? "\\$"
         | 
| 141 139 | 
             
                  escaped_query
         | 
| 142 140 | 
             
                end
         | 
| 143 141 |  | 
| @@ -145,9 +143,8 @@ module Inspec::Resources | |
| 145 143 | 
             
                  output = stdout.split("oracle_query_string")[-1]
         | 
| 146 144 | 
             
                  # comma_query_sub replaces the csv delimiter "," in the output.
         | 
| 147 145 | 
             
                  # Handles CSV parsing of data like this (DROP,3) etc
         | 
| 148 | 
            -
             | 
| 149 | 
            -
                   | 
| 150 | 
            -
                  output = output.gsub(/\r/, "").strip.gsub(",", "comma_query_sub")
         | 
| 146 | 
            +
             | 
| 147 | 
            +
                  output = output.sub(/\r/, "").strip.gsub(",", "comma_query_sub")
         | 
| 151 148 | 
             
                  converter = ->(header) { header.downcase }
         | 
| 152 149 | 
             
                  CSV.parse(output, headers: true, header_converters: converter).map do |row|
         | 
| 153 150 | 
             
                    next if row.entries.flatten.empty?
         | 
| @@ -55,7 +55,7 @@ module Inspec::Resources | |
| 55 55 | 
             
                  psql_cmd = create_psql_cmd(query, db)
         | 
| 56 56 | 
             
                  cmd = inspec.command(psql_cmd, redact_regex: %r{(:\/\/[a-z]*:).*(@)})
         | 
| 57 57 | 
             
                  out = cmd.stdout + "\n" + cmd.stderr
         | 
| 58 | 
            -
                  if cmd.exit_status != 0 && ( out =~ /could not connect to/ || out =~ /password authentication failed/ ) && out.downcase =~ /error:/
         | 
| 58 | 
            +
                  if cmd.exit_status != 0 && ( out =~ /could not connect to/ || out =~ /password authentication failed/ ) && (out.downcase =~ /error:/ || out.downcase =~ /fatal:/)
         | 
| 59 59 | 
             
                    raise Inspec::Exceptions::ResourceFailed, "PostgreSQL connection error: #{out}"
         | 
| 60 60 | 
             
                  elsif cmd.exit_status != 0 && out.downcase =~ /error:/
         | 
| 61 61 | 
             
                    Lines.new(out, "PostgreSQL query with error: #{query}", cmd.exit_status)
         | 
    
        data/lib/inspec/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: inspec-core
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 5.22. | 
| 4 | 
            +
              version: 5.22.58
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Chef InSpec Team
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024- | 
| 11 | 
            +
            date: 2024-08-27 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: chef-telemetry
         | 
| @@ -861,7 +861,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 861 861 | 
             
              requirements:
         | 
| 862 862 | 
             
              - - ">="
         | 
| 863 863 | 
             
                - !ruby/object:Gem::Version
         | 
| 864 | 
            -
                  version:  | 
| 864 | 
            +
                  version: 3.0.3
         | 
| 865 865 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 866 866 | 
             
              requirements:
         | 
| 867 867 | 
             
              - - ">="
         |