pwn 0.5.467 → 0.5.468

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3a33b87844e4b90189fcd211d5b2712dd2fb68e85643af79e48b0814a67f082
4
- data.tar.gz: bafa428dd2e68c076d9c33e402813d7f677530b1f10c440f99b26b1cdf2f47a5
3
+ metadata.gz: 5d2303b2ec4604f65e03770dcee7bed1fe067d09f57a83f2f321d63984e13dcf
4
+ data.tar.gz: 6de60cd7f5458ccbec56f7f3b7fc22708a467c4e3f3c26153b61a695a4238eb9
5
5
  SHA512:
6
- metadata.gz: 824bb07f7116b6aeef4adcc9aa83f2c3026bfe6b7b4ff55576050af40dd423f0b7451ea4445c22d5c142efd9a72586f2cfc52cb67eb7dc7dbbfc1e35c4972960
7
- data.tar.gz: 7fdd8bc18a046feaeb9b861316284277262f33f5501332368683d6a51d2bbadcbcbc432afd2bdacd640e18970a089ff94eeca3f10296f60eb832cbab9460fe59
6
+ metadata.gz: 2575756bd0d505f66e4e429f5eb29274f022da171107cb88cfdeb3a7dbbefc8c0ee074bb8f02226f7ceb244ddffa792c000aa940282aa15333aa582606159c33
7
+ data.tar.gz: 157319cff7100b366e32b9966ffe6029071c72c80d1cd7e027f91dce07c9fa0b5686bcdfae666d19e53d08e722deb57b04a41a2fff52e7ecbbe2ef3db9167b26
data/README.md CHANGED
@@ -37,7 +37,7 @@ $ cd /opt/pwn
37
37
  $ ./install.sh
38
38
  $ ./install.sh ruby-gem
39
39
  $ pwn
40
- pwn[v0.5.467]:001 >>> PWN.help
40
+ pwn[v0.5.468]:001 >>> PWN.help
41
41
  ```
42
42
 
43
43
  [![Installing the pwn Security Automation Framework](https://raw.githubusercontent.com/0dayInc/pwn/master/documentation/pwn_install.png)](https://youtu.be/G7iLUY4FzsI)
@@ -52,7 +52,7 @@ $ rvm use ruby-3.4.4@pwn
52
52
  $ gem uninstall --all --executables pwn
53
53
  $ gem install --verbose pwn
54
54
  $ pwn
55
- pwn[v0.5.467]:001 >>> PWN.help
55
+ pwn[v0.5.468]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
  If you're using a multi-user install of RVM do:
@@ -62,7 +62,7 @@ $ rvm use ruby-3.4.4@pwn
62
62
  $ rvmsudo gem uninstall --all --executables pwn
63
63
  $ rvmsudo gem install --verbose pwn
64
64
  $ pwn
65
- pwn[v0.5.467]:001 >>> PWN.help
65
+ pwn[v0.5.468]:001 >>> PWN.help
66
66
  ```
67
67
 
68
68
  PWN periodically upgrades to the latest version of Ruby which is reflected in `/opt/pwn/.ruby-version`. The easiest way to upgrade to the latest version of Ruby from a previous PWN installation is to run the following script:
@@ -405,10 +405,11 @@ module PWN
405
405
  rest_call: "issue/createmeta/#{project_key}/issuetypes/#{issue_type_id}",
406
406
  params: params
407
407
  )
408
- max_results = this_resp[:maxResults]
409
- total = this_resp[:total]
410
- is_last = this_resp[:isLast]
411
- response[:values].push(this_resp[:values])
408
+ response[:maxResults] = this_resp[:maxResults]
409
+ response[:startAt] = this_resp[:startAt]
410
+ response[:total] = this_resp[:total]
411
+ response[:isLast] = this_resp[:isLast]
412
+ response[:values].concat(this_resp[:values])
412
413
  break if is_last
413
414
 
414
415
  start_at += max_results
@@ -432,40 +433,68 @@ module PWN
432
433
 
433
434
  project_key = issue_data[:fields][:project][:key]
434
435
  summary = "CLONE - #{issue_data[:fields][:summary]}"
435
-
436
- issue_type = issue_data[:fields][:issuetype][:name].downcase.to_sym
437
- issue_type_id = issue_data[:fields][:issuetype][:id]
438
-
439
- reject_keys = %i[
440
- project
441
- summary
442
- issuetype
443
- description
444
- created
445
- updated
446
- resolution
447
- status
448
- resolutiondate
449
- environment
450
- comment
451
- attachment
452
- ]
453
-
454
436
  epic_name = nil
455
437
  epic_name_field_key = nil
456
438
  if issue_type == :epic
457
439
  all_fields = get_all_fields
458
440
  epic_name_field_key = all_fields.find { |field| field[:name] == 'Epic Name' }[:id]
459
441
  epic_name = issue_data[:fields][epic_name_field_key.to_sym]
460
- reject_keys << epic_name_field_key.to_sym
461
442
  end
462
443
 
463
444
  description = issue_data[:fields][:description]
464
445
 
465
- clone_fields = issue_data[:fields].dup
466
- clone_fields.reject! { |key, value| reject_keys.include?(key) || value.nil? }
446
+ # Determine issue type (was previously missing) and create metadata
447
+ issue_type = issue_data[:fields][:issuetype][:name].downcase.to_sym
448
+ issue_type_id = issue_data[:fields][:issuetype][:id]
449
+
450
+ meta = get_issue_type_metadata(
451
+ project_key: project_key,
452
+ issue_type_id: issue_type_id
453
+ )
454
+ candidate_array = meta[:values] ||= []
455
+
456
+ # Build list of fields we can 'set' on create (per create metadata)
457
+ allowed_fields = []
458
+ candidate_array.each do |field_obj|
459
+ next unless field_obj.is_a?(Hash)
460
+
461
+ ops = field_obj[:operations] ||= []
462
+ next unless ops.include?('set')
463
+
464
+ field_key = field_obj[:key] || field_obj[:id] || field_obj[:fieldId]
465
+ next if field_key.nil? || field_key.to_s.empty?
466
+
467
+ allowed_fields.push(field_key.to_s)
468
+ end
469
+
470
+ reserved_fields = %i[project summary issuetype description]
471
+ reserved_fields.push(epic_name_field_key.to_sym) if epic_name_field_key
472
+
473
+ filtered_fields = {}
474
+ issue_data[:fields].each do |k, v|
475
+ next if v.nil?
476
+
477
+ k_str = k.to_s
478
+ next if reserved_fields.include?(k) || reserved_fields.include?(k_str.to_sym)
479
+
480
+ next unless allowed_fields.include?(k_str)
481
+
482
+ case v
483
+ when Array
484
+ filtered_fields[k] = v.map { |elem| elem.is_a?(Hash) ? elem.slice(*%i[id key name value]) : elem }
485
+ when Hash
486
+ filtered_fields[k] =
487
+ if v.keys.any? { |kk| %i[id key name value].include?(kk) }
488
+ v.slice(*%i[id key name value])
489
+ else
490
+ v
491
+ end
492
+ else
493
+ filtered_fields[k] = v
494
+ end
495
+ end
467
496
 
468
- additional_fields = { fields: clone_fields }
497
+ additional_fields = { fields: filtered_fields }
469
498
 
470
499
  create_issue(
471
500
  project_key: project_key,
data/lib/pwn/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PWN
4
- VERSION = '0.5.467'
4
+ VERSION = '0.5.468'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.467
4
+ version: 0.5.468
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.