spaceship/lib/spaceship/spaceauth_runner.rb in fastlane-2.185.0 vs spaceship/lib/spaceship/spaceauth_runner.rb in fastlane-2.185.1

- old
+ new

@@ -37,16 +37,11 @@ # We're not sure if the key changes # # Example: # name: DES5c148586daa451e55afb017aa62418f91 # value: HSARMTKNSRVTWFlaF/ek8asaa9lymMA0dN8JQ6pY7B3F5kdqTxJvMT19EVEFX8EQudB/uNwBHOHzaa30KYTU/eCP/UF7vGTgxs6PAnlVWKscWssOVHfP2IKWUPaa4Dn+I6ilA7eAFQsiaaVT - cookies = YAML.safe_load( - itc_cookie_content, - [HTTP::Cookie, Time], # classes allowlist - [], # symbols allowlist - true # allow YAML aliases - ) + cookies = load_cookies(itc_cookie_content) # We remove all the un-needed cookies cookies.select! do |cookie| cookie.name.start_with?("myacinfo") || cookie.name == "dqsid" || cookie.name.start_with?("DES") end @@ -68,9 +63,27 @@ FastlaneCore::Clipboard.copy(content: @yaml) puts("Successfully copied the session string into your clipboard 🎨".green) end return self + end + + def load_cookies(content) + # When Ruby 2.5 support is dropped, we can safely get rid of the latter branch. + if YAML.name == 'Psych' && Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1') + YAML.safe_load( + content, + permitted_classes: [HTTP::Cookie, Time], + aliases: true + ) + else + YAML.safe_load( + content, + [HTTP::Cookie, Time], # classes allowlist + [], # symbols allowlist + true # allow YAML aliases + ) + end end def session_string FastlaneCore::UI.user_error!("`#{__method__}` method called before calling `run` in `SpaceauthRunner`") unless @yaml @yaml