Skip to content

Commit 7b5588e

Browse files
committed
fix conflict
2 parents 69ac7c4 + 1d9485e commit 7b5588e

17 files changed

Lines changed: 280 additions & 165 deletions

File tree

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
steps:
4040
- name: Checkout repository
41-
uses: actions/checkout@v6
41+
uses: actions/checkout@v7
4242

4343
# Initializes the CodeQL tools for scanning.
4444
- name: Initialize CodeQL

.github/workflows/functional-test.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ jobs:
5555
platform: tvOS
5656
wdaName: WebDriverAgentRunner_tvOS-Runner.app
5757

58-
runs-on: macos-15
58+
runs-on: macos-26
5959

6060
# Please make sure the available Xcode versions and iOS versions
6161
# on the runner images. https://github.com/actions/runner-images
6262
env:
63-
XCODE_VERSION: 16.4
64-
IOS_VERSION: 18.5
65-
IOS_DEVICE_NAME: iPhone 16 Plus
63+
XCODE_VERSION: 26.4
64+
IOS_VERSION: 26.4
65+
IOS_DEVICE_NAME: iPhone 17
6666

6767
steps:
68-
- uses: actions/checkout@v6
68+
- uses: actions/checkout@v7
6969

7070
- name: Install Node.js
7171
uses: actions/setup-node@v6
@@ -80,7 +80,7 @@ jobs:
8080

8181
- uses: futureware-tech/simulator-action@v5
8282
with:
83-
# https://github.com/actions/runner-images/blob/main/images/macos/macos-15-arm64-Readme.md
83+
# https://github.com/actions/runner-images/blob/main/images/macos/macos-26-arm64-Readme.md
8484
model: ${{ env.IOS_DEVICE_NAME }}
8585
os_version: ${{ env.IOS_VERSION }}
8686
wait_for_boot: true
@@ -123,17 +123,17 @@ jobs:
123123
test/report/
124124
125125
ios_test_with_other_deps:
126-
runs-on: macos-15
126+
runs-on: macos-26
127127

128128
# Please make sure the available Xcode versions and iOS versions
129129
# on the runner images. https://github.com/actions/runner-images
130130
env:
131-
XCODE_VERSION: 16.4
132-
IOS_VERSION: 18.5
133-
IOS_DEVICE_NAME: iPhone 16 Plus
131+
XCODE_VERSION: 26.4
132+
IOS_VERSION: 26.4
133+
IOS_DEVICE_NAME: iPhone 17
134134

135135
steps:
136-
- uses: actions/checkout@v6
136+
- uses: actions/checkout@v7
137137

138138
- name: Install Node.js
139139
uses: actions/setup-node@v6
@@ -148,7 +148,7 @@ jobs:
148148

149149
- uses: futureware-tech/simulator-action@v5
150150
with:
151-
# https://github.com/actions/runner-images/blob/main/images/macos/macos-15-arm64-Readme.md
151+
# https://github.com/actions/runner-images/blob/main/images/macos/macos-26-arm64-Readme.md
152152
model: ${{ env.IOS_DEVICE_NAME }}
153153
os_version: ${{ env.IOS_VERSION }}
154154
wait_for_boot: true
@@ -248,7 +248,7 @@ jobs:
248248
ARCH: x86_64
249249

250250
steps:
251-
- uses: actions/checkout@v6
251+
- uses: actions/checkout@v7
252252

253253
- uses: actions/setup-java@v5
254254
with:
@@ -275,7 +275,7 @@ jobs:
275275
sudo udevadm trigger --name-match=kvm
276276
277277
- name: AVD cache
278-
uses: actions/cache@v5
278+
uses: actions/cache@v6
279279
id: avd-cache
280280
with:
281281
path: |

.github/workflows/unittest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
UNIT_TEST: true
2020

2121
steps:
22-
- uses: actions/checkout@v6
22+
- uses: actions/checkout@v7
2323
- name: Set up Ruby
2424
uses: ruby/setup-ruby@v1
2525
with:
@@ -48,7 +48,7 @@ jobs:
4848
UNIT_TEST: true
4949

5050
steps:
51-
- uses: actions/checkout@v6
51+
- uses: actions/checkout@v7
5252
- name: Set up Ruby
5353
uses: ruby/setup-ruby@v1
5454
with:

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
All notable changes to this project will be documented in this file.
33
Read `release_notes.md` for commit level details.
44

5+
## [13.0.1] - 2026-06-07
6+
- Update the `rbs_collection.lock.yaml`
7+
8+
## [13.0.0] - 2026-05-10
9+
- Remove extenced methods in `Appium::Core::Base::Driver` only for the appium_lib - which is covered by the library.
10+
11+
## [12.2.0] - 2026-04-19
12+
- Add validation for direct connect URL when `direct_connect` capability is `true`.
13+
514
## [12.1.0] - 2026-03-21
615
- Replace internal `add_command` method with Selnium Bridge's `add_command` to simplify the codebase.
716

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ gem 'minitest', '~> 5.0'
88
gem 'minitest-reporters', '~> 1.1'
99
gem 'parallel_tests'
1010
gem 'rake', '~> 13.0'
11-
gem 'rubocop', '1.86.0'
11+
gem 'rubocop', '1.88.0'
1212
gem 'simplecov'
1313
gem 'steep', '~> 1.10.0'
1414
gem 'webmock', '~> 3.26.0'

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,21 @@ $ IGNORE_VERSION_SKIP=true CI=true bundle exec rake test:func:android
114114
opts = {
115115
capabilities: { # Append capabilities
116116
platformName: 'ios',
117-
platformVersion: '26.0',
117+
platformVersion: '15.8.3',
118118
deviceName: 'iPhone 17',
119119
# app: '/path/to/MyiOS.app', # Without 'app' capability, an appium session starts with the home screen
120-
automationName: 'XCUITest'
120+
automationName: 'XCUITest',
121+
# "appium:bundleId":"com.apple.mobilesafari",
122+
# "usePreinstalledWDA": true,
123+
useNewWDA: false,
124+
browserName: 'Safari',
125+
# "webDriverAgentUrl": "http://192.168.4.47:8100",
126+
"udid": "00008020-000E5CDA0A23002E",
127+
'xcodeOrgId': '47PCFA586Q',
128+
'xcodeSigningId': 'iPhone Developer',
129+
'updatedWDABundleId': 'com.kazucocoa.wda',
130+
allowProvisioningDeviceRegistration: true,
131+
# 'appium:skipLogCapture': true
121132
},
122133
appium_lib: {
123134
wait: 30

lib/appium_lib_core/common/device/app_management.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def background_app(duration = 0)
2929

3030
def install_app(path, options = {}) # steep:ignore
3131
args = { appPath: path }
32-
args[:options] = options unless options&.empty?
32+
args[:options] = options unless options && options.empty?
3333

3434
execute :install_app, {}, args
3535
end

lib/appium_lib_core/device.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,6 @@ module Device
2020
class << self
2121
def extended(_mod)
2222
extend_webdriver_with_forwardable
23-
24-
# Compatibility for appium_lib. Below command are extended by `extend Appium::Core::Deivce`in appium_lib.
25-
# TODO: Will remove
26-
[
27-
:take_element_screenshot, :save_viewport_screenshot,
28-
:lock, :device_locked?, :unlock,
29-
:hide_keyboard, :is_keyboard_shown,
30-
:ime_activate, :ime_available_engines, :ime_active_engine, :ime_activated, :ime_deactivate,
31-
:get_settings, :update_settings,
32-
:within_context, :current_context, :available_contexts, :set_context,
33-
:push_file, :pull_file, :pull_folder,
34-
:keyevent, :press_keycode, :long_press_keycode,
35-
:match_images_features, :find_image_occurrence, :get_images_similarity, :compare_images,
36-
:app_strings, :background_app,
37-
:install_app, :remove_app, :app_installed?, :activate_app, :terminate_app,
38-
:app_state,
39-
:stop_recording_screen, :stop_and_save_recording_screen,
40-
:shake, :device_time,
41-
:execute_driver, :execute_cdp
42-
].each(&method(:delegate_from_appium_driver))
4323
end
4424

4525
# def extended

lib/appium_lib_core/driver.rb

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
# limitations under the License.
1414

1515
require 'uri'
16+
require 'socket'
17+
require 'ipaddr'
18+
require 'timeout'
1619

1720
module Appium
1821
# The struct for 'location'
@@ -98,6 +101,59 @@ def initialize(capabilities)
98101
@port = capabilities[W3C_KEYS[:port]] || capabilities[KEYS[:port]]
99102
@path = capabilities[W3C_KEYS[:path]] || capabilities[KEYS[:path]]
100103
end
104+
105+
def valid?
106+
return false unless [@protocol, @host, @port, @path].none?(&:nil?)
107+
108+
addresses = resolve_addresses(@host)
109+
return false if addresses.empty?
110+
111+
addresses.find { |ip| disallowed? ip }.nil?
112+
end
113+
114+
private
115+
116+
# Do not allow loopback, link-local, unspecified and multicast addresses for
117+
# direct connect since they are not accessible from outside of the server.
118+
DNS_RESOLVE_TIMEOUT_SECONDS = 30
119+
LOOPBACK_RANGES = [IPAddr.new('127.0.0.0/8'), IPAddr.new('::1/128')].freeze
120+
LINK_LOCAL_RANGES = [IPAddr.new('169.254.0.0/16'), IPAddr.new('fe80::/10')].freeze
121+
UNSPECIFIED_RANGES = [IPAddr.new('0.0.0.0/32'), IPAddr.new('::/128')].freeze
122+
MULTICAST_RANGES = [IPAddr.new('224.0.0.0/4'), IPAddr.new('ff00::/8')].freeze
123+
DISALLOWED_RANGES = [
124+
*LOOPBACK_RANGES,
125+
*LINK_LOCAL_RANGES,
126+
*UNSPECIFIED_RANGES,
127+
*MULTICAST_RANGES
128+
].freeze
129+
130+
def resolve_addresses(host)
131+
normalized_host = host.to_s.delete_prefix('[').delete_suffix(']')
132+
# If the host is already an IP literal, skip DNS resolution to avoid blocking calls
133+
return [normalized_host] if ip_literal?(normalized_host)
134+
135+
Timeout.timeout(DNS_RESOLVE_TIMEOUT_SECONDS) do
136+
Socket.getaddrinfo(normalized_host, nil).map { |entry| entry[3] }.uniq
137+
end
138+
rescue Timeout::Error
139+
::Appium::Logger.warn("DNS resolution for '#{host}' timed out after #{DNS_RESOLVE_TIMEOUT_SECONDS}s")
140+
[]
141+
rescue SocketError => e
142+
::Appium::Logger.warn("Failed to resolve host '#{host}' for direct connect: #{e.message}")
143+
[]
144+
end
145+
146+
def ip_literal?(host)
147+
IPAddr.new(host)
148+
true
149+
rescue IPAddr::InvalidAddressError
150+
false
151+
end
152+
153+
def disallowed?(ip)
154+
address = IPAddr.new ip
155+
DISALLOWED_RANGES.any? { |range| range.include? address }
156+
end
101157
end
102158

103159
class Driver
@@ -158,8 +214,7 @@ class Driver
158214
# @return [Appium::Core::Base::Driver]
159215
attr_reader :driver
160216

161-
# <b>[Experimental feature]</b><br>
162-
# Enable an experimental feature updating Http client endpoint following below keys by Appium/Selenium server.<br>
217+
# Enable updating Http client endpoint following below keys by Appium/Selenium server.<br>
163218
# This works with {Appium::Core::Base::Http::Default}.
164219
#
165220
# If your Selenium/Appium server decorates the new session capabilities response with the following keys:<br>
@@ -171,6 +226,12 @@ class Driver
171226
# ignore them if this parameter is <code>false</code>. Defaults to true.
172227
# These keys can have <code>appium:</code> prefix.
173228
#
229+
# Note that the server should provide the keys with valid values. The host value must not be
230+
# - loopback (for example `127.0.0.1`, `::1`)
231+
# - link-local (for example `169.254.x.x`, `fe80::/10`)
232+
# - unspecified/wildcard (`0.0.0.0`, `::`)
233+
# - multicast (`224.0.0.0/4`, `ff00::/8`)
234+
#
174235
# @return [Bool]
175236
attr_reader :direct_connect
176237

@@ -409,7 +470,14 @@ def start_driver(server_url: nil,
409470

410471
if @direct_connect
411472
d_c = DirectConnections.new(@driver.capabilities)
412-
@driver.update_sending_request_to(protocol: d_c.protocol, host: d_c.host, port: d_c.port, path: d_c.path)
473+
if d_c.valid?
474+
@driver.update_sending_request_to(protocol: d_c.protocol, host: d_c.host, port: d_c.port, path: d_c.path)
475+
else
476+
::Appium::Logger.warn(
477+
"Direct connect is enabled but the server did not provide valid direct connect information (#{d_c.protocol}, #{d_c.host}, #{d_c.port}, #{d_c.path}). " \
478+
"Continue with the original URL (#{@custom_url})"
479+
)
480+
end
413481
end
414482
rescue Errno::ECONNREFUSED => e
415483
raise "ERROR: Unable to connect to Appium. Is the server running on #{@custom_url}? Error: #{e}"

lib/appium_lib_core/version.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
module Appium
1616
module Core
17-
VERSION = '12.1.0' unless defined? ::Appium::Core::VERSION
18-
DATE = '2026-03-21' unless defined? ::Appium::Core::DATE
17+
VERSION = '13.0.1' unless defined? ::Appium::Core::VERSION
18+
DATE = '2026-06-07' unless defined? ::Appium::Core::DATE
1919
end
2020
end

0 commit comments

Comments
 (0)