ruby-jss 5.1.0b1 → 5.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4beb91ca79699491fc5868a5e4b2e22f57048df817bca7207d65574eb94227c
4
- data.tar.gz: b31adf1c1cbcd419656aa4eeb58e70ed21147a79b3bd45730e5301b39e0acd7a
3
+ metadata.gz: 7bb6dedd3be4370cdf20cd8fc64f14490fd4f5b2dc1c50acd41f036a05330d76
4
+ data.tar.gz: bd298a9b9bf6c7274ebd37107ac3cc1e6078fabbe2123b366e87deea13ce73a8
5
5
  SHA512:
6
- metadata.gz: fcc17975fefc7e5f7d5f9830827dac4997af144817364ae866b796a4b634188f34a0dd553675e64a34aca9d53223e5e55a0dad2ed821eb135ffe91a206fdd566
7
- data.tar.gz: 721e2d5981fbc3f8123e821a9f2a9cf8507dab9889ad2723cb4a77f68a6af313bad0e2e50ad6613314baa8e6111413b4b169fe739d199b5d223d350a2594393c
6
+ metadata.gz: 97a7752e567052b6fb70b61196d8b4c36fc6fc9023707c0a868d3b5045e0e777c3efe3b65a03c9e5a24ae022aad5c8fda00767eff502be260b51e8909f43c772
7
+ data.tar.gz: 79c1e7cefa2e8fb7617bdcacb4396fb2703da8589d9b267e5507a13cbe8784b83d0c28fcedc7122e6a279020e79129a6e11e7c8033e6aa4648f8ec32429daca8
data/CHANGES.md CHANGED
@@ -15,7 +15,30 @@ __Please update all installations of ruby-jss to at least v1.6.0.__
15
15
  Many many thanks to actae0n of Blacksun Hackers Club for reporting this issue and providing examples of how it could be exploited.
16
16
 
17
17
  --------
18
- ## \[5.1.0] Unreleased
18
+ ## \[5.2.0] 2026-12-03
19
+
20
+ ### Added
21
+
22
+ - `Jamf::JPackage#deploy_via_mdm` now takes a `url:` parameter. Use this to provide as one-time manifest URL for the MDM deployment of this pkg, overriding the URL in the stored manifest. This is useful (and needed) when using, e.g. Signed URLs to access .pkgs stored in AWS/S3.
23
+
24
+
25
+
26
+ --------
27
+ ## \[5.1.1] 2026-11-13
28
+
29
+ ### Changed
30
+
31
+ - Sticky Sessions improvements:
32
+ - Sticky sessions can be used regardless of the Jamf Pro server hostname, it doesn't need to end with
33
+ 'jamfcloud.com'. If the server is not a cloud server, activating sticky sessions has no effect.
34
+ - ruby-jss now recognizes both possible stickey-session cookie names, 'jpro-ingress' and 'APBALANCEID'
35
+
36
+ ### Fixed
37
+
38
+ - Sticky session cookies are retrieved from the current Jamf Pro API Connection, not the default one, which does not work for standalone connection objects.
39
+
40
+ --------
41
+ ## \[5.1.0] 2026-08-04
19
42
 
20
43
  ### Added
21
44
 
@@ -28,7 +51,6 @@ Many many thanks to actae0n of Blacksun Hackers Club for reporting this issue an
28
51
  - When using Zeitwerk's 'eager loading' to load the whole gem, no longer fails looking for the JamfProtectPlan OAPISchema, referenced by other schemas
29
52
  - Fixed occasional arg-parsing errors with `.all_names` API object class method.
30
53
 
31
-
32
54
  --------
33
55
  ## \[5.0.2] 2026-01-24
34
56
 
@@ -143,7 +165,7 @@ For Packages this means that when setting the categoryId, for example, you must
143
165
 
144
166
  In order to move forward with Jamf Pro-based classes, while providing reasonable backward compatibility, here's the plan:
145
167
 
146
- - For each class being migrated, and new class, prepended with `J` will be created. So for accessing packages via the Jamf Pro API, we are introducing the class `Jamf::JPackage`. We've had an experimental Jamf Pro version of Jamf::JpBuilding for a while, and it has been renamed to `Jamf::JBuilding`
168
+ - For each class being migrated, a new class, prepended with `J` will be created. So for accessing packages via the Jamf Pro API, we are introducing the class `Jamf::JPackage`. We've had an experimental Jamf Pro version of Jamf::JpBuilding for a while, and it has been renamed to `Jamf::JBuilding`
147
169
  - The original Classic API-based class will be marked as deprecated when the matching J-class is released.
148
170
  - The deprecated classes will exist for at least one year (probably longer) but will get few, if any, updates, mostly limited to security-related fixes. As of this release, `Jamf::Package` and `Jamf::Building` are deprecated.
149
171
  - During the deprecation period, please update all your code to use the new Jamf Pro API-based classes.
@@ -9,7 +9,7 @@
9
9
  module Jamf
10
10
 
11
11
  # This module should be mixed in to Jamf::Computer and Jamf::MobileDevice
12
- # ang Jamf::ComputerGroup and Jamf::MobileDeviceGroup.
12
+ # and Jamf::ComputerGroup and Jamf::MobileDeviceGroup.
13
13
  #
14
14
  # Those must define the following constants:
15
15
  # - MDM_COMMAND_TARGET - one of :computers, :computergroups, :mobiledevices, :mobiledevicegroups
@@ -914,7 +914,7 @@ module Jamf
914
914
 
915
915
  # newstyle, 'notifications' subset
916
916
  notif = ssvc.add_element('notifications')
917
- notif.add_element('notifications_enabled').text = self_service_notifications_enabled.to_s
917
+ notif.add_element('notification_enabled').text = self_service_notifications_enabled.to_s
918
918
  notif.add_element('notification_type').text = NOTIFICATION_TYPES[self_service_notification_type] if self_service_notification_type
919
919
  notif.add_element('notification_subject').text = self_service_notification_subject if self_service_notification_subject
920
920
  notif.add_element('notification_message').text = self_service_notification_message if self_service_notification_message
@@ -1769,6 +1769,11 @@ module Jamf
1769
1769
  doc.to_s
1770
1770
  end
1771
1771
 
1772
+ # Send the current rest_xml to stdout for preview
1773
+ def show_xml
1774
+ REXML::Document.new(rest_xml).write STDOUT, 2
1775
+ end
1776
+
1772
1777
  end # class APIObject
1773
1778
 
1774
1779
  end # module Jamf
@@ -71,26 +71,22 @@ module Jamf
71
71
 
72
72
  ##########################################
73
73
 
74
- # Turn sticky-sessions on or off. If turning on, host must be a Jamf Cloud
75
- # server, with a hostname ending with Jamf::Connection::JAMFCLOUD_DOMAIN
74
+ # Turn sticky-sessions on or off.
76
75
  #
77
76
  # @param value [Boolean] should we use a sticky session?
78
77
  #
79
78
  # @return [void]
80
79
  #
81
80
  def sticky_session=(value)
82
- @sticky_session ||= false
81
+ @sticky_session = false unless defined? @sticky_session
83
82
 
84
83
  # convert boolean-y to boolean
85
- value = value ? true : false
86
-
84
+ value = !!value
87
85
  return if @sticky_session == value
88
86
 
89
87
  if value
90
- raise Jamf::UnsupportedError, 'Sticky Sessions may only be used with Jamf Cloud servers.' unless host.end_with? Jamf::Connection::JAMFCLOUD_DOMAIN
91
-
88
+ enable_sticky_session @jp_cnx.head.headers
92
89
  @sticky_session = true
93
- enable_sticky_session Jamf.cnx.jp_cnx.head.headers
94
90
 
95
91
  else
96
92
  @sticky_session = false
@@ -232,9 +232,9 @@ module Jamf
232
232
 
233
233
  # attribute name and value are separated by '='
234
234
  cookie_name, cookie_value = cookie_data.split('=')
235
- next unless cookie_name == Jamf::Connection::STICKY_SESSION_COOKIE_NAME
235
+ next unless Jamf::Connection::STICKY_SESSION_COOKIE_NAMES.include? cookie_name
236
236
 
237
- @sticky_session_cookie = "#{Jamf::Connection::STICKY_SESSION_COOKIE_NAME}=#{cookie_value}"
237
+ @sticky_session_cookie = "#{cookie_name}=#{cookie_value}"
238
238
  jp_cnx.headers[Jamf::Connection::COOKIE_HEADER] = @sticky_session_cookie
239
239
  c_cnx.headers[Jamf::Connection::COOKIE_HEADER] = @sticky_session_cookie
240
240
  return @sticky_session_cookie
@@ -94,7 +94,8 @@ module Jamf
94
94
 
95
95
  COOKIE_HEADER = 'Cookie'.freeze
96
96
 
97
- STICKY_SESSION_COOKIE_NAME = 'APBALANCEID'.freeze
97
+ # STICKY_SESSION_COOKIE_NAME = 'APBALANCEID'.freeze
98
+ STICKY_SESSION_COOKIE_NAMES = %w[jpro-ingress APBALANCEID].freeze
98
99
 
99
100
  end # module
100
101
 
@@ -550,7 +550,11 @@ module Jamf
550
550
  #################################
551
551
  def parse_token_from_api_client_auth(resp)
552
552
  @token_response_body = resp.body
553
+ raise Jamf::AuthenticationError, 'Token Reponse Body malformed!' unless @token_response_body.is_a? Hash
554
+
553
555
  @token = @token_response_body[:access_token]
556
+ raise Jamf::AuthenticationError, 'Token Reponse Body missing access_token!' unless @token
557
+
554
558
  @expires = Time.now + @token_response_body[:expires_in] - 1
555
559
  @api_role_ids = @token_response_body[:scope].split(' ').map { |r| r.split(':').last }
556
560
  @valid = true
@@ -269,7 +269,7 @@ module Jamf
269
269
  # Looks like:
270
270
  # {
271
271
  # :id=>"10392",
272
- # :href=>"https://casper-int.pixar.com:8443/api/v1/packages/10392/upload/10392"
272
+ # :href=>"https://jamf.host.com/api/v1/packages/10392/upload/10392"
273
273
  # :time=>2025-09-01 12:00:00 -0700
274
274
  # }
275
275
  # see #upload
@@ -791,12 +791,15 @@ module Jamf
791
791
  #
792
792
  # @param group_id [Integer] The id of the computer group to deploy to
793
793
  #
794
+ # @param url [String] a custom URL to use in the manifest, rather than that stored
795
+ # with the Package object. Use this for, e.g. AWS/S3 'signed' urls
796
+ #
794
797
  # @param managed [Boolean] Should the installed package be managed by Jamf Pro?
795
798
  # Defaults to false. This seems to be for App Store apps only??
796
799
  #
797
800
  # @return [Hash] the response from the server. see #deploy_response
798
801
  ##############################
799
- def deploy_via_mdm(computer_ids: nil, group_id: nil, managed: false)
802
+ def deploy_via_mdm(computer_ids: nil, group_id: nil, url: nil, managed: false)
800
803
  raise ArgumentError, 'No computer_ids or group_id provided' unless computer_ids || group_id
801
804
  raise Jamf::MissingDataError, 'No manifest set for this package' if manifest.to_s.empty?
802
805
  raise Jamf::NoSuchItemError, 'This package has no id, it must be saved in Jamf Pro before uploading' unless exist?
@@ -807,7 +810,7 @@ module Jamf
807
810
  # manifest data for the MDMDeploy command, which is a hash.
808
811
  # hopefully some day Jamf will just use the manifest for the pkg
809
812
  mdm_manifest = {}
810
- mdm_manifest['url'] = manifest_url_for_deployment(parsed_manifest)
813
+ mdm_manifest['url'] = url || manifest_url_for_deployment(parsed_manifest)
811
814
  mdm_manifest['hash'], mdm_manifest['hashType'] = manifest_checksum_for_deployment(parsed_manifest)
812
815
  mdm_manifest['bundleId'] = manifest_bundle_identifier_for_deployment(parsed_manifest)
813
816
  mdm_manifest['bundleVersion'] = manifest_bundle_version_for_deployment(parsed_manifest)
data/lib/jamf/version.rb CHANGED
@@ -9,6 +9,6 @@
9
9
  module Jamf
10
10
 
11
11
  ### The version of ruby-jss
12
- VERSION = '5.1.0b1'.freeze
12
+ VERSION = '5.2.0'.freeze
13
13
 
14
14
  end # module
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-jss
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0b1
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Lasell
8
8
  - Aurica Hayes
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2026-07-02 00:00:00.000000000 Z
12
+ date: 2026-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pixar-ruby-extensions
@@ -542,7 +542,7 @@ metadata:
542
542
  source_code_uri: https://github.com/PixarAnimationStudios/ruby-jss
543
543
  changelog_uri: https://github.com/PixarAnimationStudios/ruby-jss/blob/master/CHANGES.md
544
544
  wiki_uri: https://github.com/PixarAnimationStudios/ruby-jss/wiki
545
- post_install_message:
545
+ post_install_message:
546
546
  rdoc_options:
547
547
  - "--title"
548
548
  - Jamf
@@ -558,12 +558,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
558
558
  version: 2.6.3
559
559
  required_rubygems_version: !ruby/object:Gem::Requirement
560
560
  requirements:
561
- - - ">"
561
+ - - ">="
562
562
  - !ruby/object:Gem::Version
563
- version: 1.3.1
563
+ version: '0'
564
564
  requirements: []
565
- rubygems_version: 3.0.3.1
566
- signing_key:
565
+ rubygems_version: 3.3.11
566
+ signing_key:
567
567
  specification_version: 4
568
568
  summary: A Ruby interface to the Jamf Pro REST APIs
569
569
  test_files: []