Skip to content

6.2.0: the network selector in the Android library and in links (e=) - #219

Merged
compot-dev merged 2 commits into
masterfrom
link-selector
Nov 23, 2026
Merged

compot-dev merged 2 commits into
masterfrom
link-selector

Conversation

@compot-dev

Copy link
Copy Markdown
Collaborator

The follow-up of #218 (6.1.0, #201): the selector where the Android apps and links can carry it.

  • Values / CamexTunnel.fields(): a text field Network selector after the network's name. check() takes 1 to 31 of A-Z a-z 0-9 . _ -, and only with a network name and without a psk (the selector goes in CPace; camex refuses --network-selector otherwise). argv() passes --network-selector.
  • ConnectLink: e= (the letter s is the psk already), checked as above; a malformed one is named in errors and left out.
  • docs/connect/index.html: shows e as Network selector, names a malformed one, passes it on to the app (it passes every field already).
  • install.sh does not add e=: its link has the psk, and with a psk there is no CPace. A link with a selector is written by hand (#h=…&w=…&e=…), as docs/android.md says.
  • MINOR: the library and the APK get a field.

The companion apps (decoder, microsnander, vectis) build their settings from fields(), so they get the field by themselves; they will be told.

Tests (local, Docker): ValuesTest (the field's place, kind and label; selector(): check, argv, refused with a psk or without a network, e= from a link and a malformed one), :tunnel:testDebugUnitTest, lintDebug, assembleDebug; docker/test-connect-page.sh (e= shown and passed on, a malformed one named); C unit tests; check-version.sh.

CamexTunnel.fields() gets Network selector, passed as --network-selector
with a network name and without a psk (camex refuses it otherwise);
ConnectLink reads e=; the link's page shows it and passes it on.
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Expose network selectors in Android settings and connection links

✨ Enhancement 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Add an optional Android network-selector field for CPace connections without a pre-shared key.
• Read and validate e= in connection links; show it on the link page.
• Document the link format, test both entry points, and bump the version to 6.2.0.
Merge Risk 🟡 Medium

Blast radius 🟡 Medium 💥 2 capabilities

  • 2 affected capabilities within one bounded functional scope: network-selector client onboarding.
  • The changed Android settings, link, persistence, and argv hops all implement one user outcome: starting an Android tunnel against a selected server network.
  • They are technical hops of the same bounded onboarding integration, not independent capabilities.
  • The page's parsing, validation, display, Android intent, and desktop CLI generation serve one bounded outcome: onboarding a client to a selected network.
  • This is related to, but a distinct user operation from an already-running Android tunnel.
Sources

android/app/src/main/java/org/openipc/camex/Prefs.java[47-50]

        // The network's name and its selector (camex 4.6, 6.1): kept and given back, so a
        // network set up here (or by a link) reaches the tunnel (the review of #219)
        v.put(CamexTunnel.NETWORK, p.getString("network", ""));
        v.put(CamexTunnel.SELECTOR, p.getString("network_selector", ""));

android/tunnel/src/main/java/org/openipc/camex/tunnel/Values.java[106-113]

        // The selector goes in CPace: with a network, without a psk (camex refuses it else)
        String selector = get(v, SELECTOR).trim();
        if (!selector.isEmpty() && !isSelector(selector)) {
            return new String[]{SELECTOR, "1 to 31 of A-Z a-z 0-9 . _ -, or empty"};
        }
        if (!selector.isEmpty() && (network.isEmpty() || !get(v, PSK).isEmpty())) {
            return new String[]{SELECTOR, "only with a network name and without a psk, or empty"};
        }

docs/connect/index.html[123-133]

        if (!m.h || !((m.k && m.s) || m.w)) return '';
        // the network's name is a key too: shown only in the command "with the psk"
        return 'camex --mode client --auto' + (m.n && CAMEX.valid('n', m.n) ? ' --name ' + q(m.n) : '') +
            ' --server-host ' + q(m.h) + ' --port ' + q(m.p || '5800') +
            (m.t === 'tcp' ? ' --transport tcp' : '') +
            (m.m && CAMEX.valid('m', m.m) ? ' --mtu ' + m.m : '') +
            (m.a && CAMEX.valid('a', m.a) ? ' --keepalive ' + m.a : '') +
            (m.w ? ' --network ' + (psk ? q(m.w) : "'<network>'") : '') +
            (m.w && m.e ? ' --network-selector ' + q(m.e) : '') +
            (m.k ? ' --server-pubkey ' + q(m.k) : '') +
            (m.s ? ' --psk ' + (psk ? q(m.s) : "'<psk>'") : '');

docs/connect/index.html[150-156]

        if ((CAMEX.names[k2] || k2 === 's' || k2 === 'w') && !CAMEX.valid(k2, f[i2][1])) {
            bad.push(CAMEX.names[k2] || (k2 === 's' ? 'Pre-shared key' : 'Network name'));
        }
    }
    // A selector goes in CPace: only with a network's name and without a psk, as the app
    // takes it (the review of #219)
    if (has.e && (!has.w || has.s)) bad.push('Network selector (only with a network name and without a psk)');
Behavioral complexity 🟡 Medium 🧩 Interacting branches, Compatibility cases

  • Before: Android had network-name handling and separate key/PSK modes, but no selector value crossing settings, links, persistence, and tunnel startup.
  • After: an optional selector is parsed and stored, validated against both network presence and PSK absence, and emitted only in the network/CPace command path.
  • New correctness conditions: valid selector values must survive the link-to-settings-to-preferences-to-argv path; selector-without-network and selector-with-PSK must remain rejected; empty selector must preserve existing network behavior.
  • The field ordering and old key/PSK modes are compatibility cases, while the coupled validation and propagation branches are newly interacting behavior.
  • The underlying CPace implementation is unchanged.
Sources

android/tunnel/src/main/java/org/openipc/camex/tunnel/Values.java[106-113]

        // The selector goes in CPace: with a network, without a psk (camex refuses it else)
        String selector = get(v, SELECTOR).trim();
        if (!selector.isEmpty() && !isSelector(selector)) {
            return new String[]{SELECTOR, "1 to 31 of A-Z a-z 0-9 . _ -, or empty"};
        }
        if (!selector.isEmpty() && (network.isEmpty() || !get(v, PSK).isEmpty())) {
            return new String[]{SELECTOR, "only with a network name and without a psk, or empty"};
        }

android/app/src/main/java/org/openipc/camex/Prefs.java[47-50]

        // The network's name and its selector (camex 4.6, 6.1): kept and given back, so a
        // network set up here (or by a link) reaches the tunnel (the review of #219)
        v.put(CamexTunnel.NETWORK, p.getString("network", ""));
        v.put(CamexTunnel.SELECTOR, p.getString("network_selector", ""));
Potential damage 🟡 Medium 🩹 Temporary loss

  • A wrong selector can prevent a user from connecting to a network whose server requires that selector, or cause repeated failed authentication attempts.
  • Reverting the app/library restores the prior behavior; saved selector data may need to be cleared or corrected if a bad value was persisted, but there is no evidence of persistent tunnel-state corruption or external side effects.
  • The selector is only effective when a tunnel is activated with a network and no PSK.
  • Revert or update the app and retry with corrected settings/link data.
  • Code rollback does not automatically repair a wrongly persisted selector, but the supported settings path can overwrite it; no server-side repair or compensation is indicated.
Sources

android/tunnel/src/main/java/org/openipc/camex/tunnel/Values.java[106-113]

        // The selector goes in CPace: with a network, without a psk (camex refuses it else)
        String selector = get(v, SELECTOR).trim();
        if (!selector.isEmpty() && !isSelector(selector)) {
            return new String[]{SELECTOR, "1 to 31 of A-Z a-z 0-9 . _ -, or empty"};
        }
        if (!selector.isEmpty() && (network.isEmpty() || !get(v, PSK).isEmpty())) {
            return new String[]{SELECTOR, "only with a network name and without a psk, or empty"};
        }

android/app/src/main/java/org/openipc/camex/Prefs.java[47-50]

        // The network's name and its selector (camex 4.6, 6.1): kept and given back, so a
        // network set up here (or by a link) reaches the tunnel (the review of #219)
        v.put(CamexTunnel.NETWORK, p.getString("network", ""));
        v.put(CamexTunnel.SELECTOR, p.getString("network_selector", ""));
Assessed commit c2467dc
Diagram

graph TD
  Page["Connection page"] --> App["Android app"] --> Parser["ConnectLink parser"] --> Values["Settings values"] --> CLI["camex arguments"]
  Values -->|fields| App
Loading
High-Level Assessment

Extending the existing shared settings and link parser is appropriate: companion apps already obtain their settings from fields(). A separate selector-specific app interface would duplicate that contract.

Files changed (8) +103 / -12

Enhancement (3) +31 / -4
ConnectLink.javaParse network selectors from 'e=' link fields +6/-2

Parse network selectors from 'e=' link fields

• Recognizes 'e=', validates its characters and length, and maps valid values to the selector setting. Malformed values are reported under 'e' and excluded.

android/tunnel/src/main/java/org/openipc/camex/tunnel/ConnectLink.java

Values.javaExpose and validate the Android selector setting +21/-0

Expose and validate the Android selector setting

• Adds an optional text field after the network name. Validation requires a permitted selector, a network name, and no pre-shared key; argument generation passes valid values as '--network-selector'.

android/tunnel/src/main/java/org/openipc/camex/tunnel/Values.java

index.htmlDisplay and validate selectors on the connection page +4/-2

Display and validate selectors on the connection page

• Names 'e=' as Network selector and applies the selector character and length check. The page's existing intent generation forwards valid fields to the app.

docs/connect/index.html

Tests (2) +53 / -7
ValuesTest.javaTest selector fields, validation, arguments, and links +46/-7

Test selector fields, validation, arguments, and links

• Checks field order and type, accepted and rejected selector settings, command-line output, and valid or malformed 'e=' links.

android/tunnel/src/test/java/org/openipc/camex/tunnel/ValuesTest.java

connect-test.jsTest selector display, forwarding, and malformed-value feedback +7/-0

Test selector display, forwarding, and malformed-value feedback

• Verifies that a valid 'e=' appears on the page and in its app link, while a selector containing a space is named as malformed.

tests/connect-page/connect-test.js

Documentation (2) +18 / -0
CHANGELOG.mdRecord the 6.2.0 network-selector release +8/-0

Record the 6.2.0 network-selector release

• Adds a release entry describing the Android field, its CPace constraints, and the 'e=' link parameter.

CHANGELOG.md

android.mdDocument Android selectors and the 'e=' link format +10/-0

Document Android selectors and the 'e=' link format

• Explains when the selector is needed, its constraints, and why 'install.sh' does not add it. Adds 'w' and 'e' to the link-field reference.

docs/android.md

Other (1) +1 / -1
version.hSet the camex version to 6.2.0 +1/-1

Set the camex version to 6.2.0

• Bumps the shared version definition from 6.1.0 to 6.2.0.

src/version.h

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Valid selector links cannot open the app ✓ Resolved
Description
The connect page recognizes e but its readiness gate still requires both k and s. A documented
#h=…&w=…&e=… link therefore stops at the page's invalid-link state before the app handoff is
offered.

2. Android drops selectors opened from links ✓ Resolved
Description
ConnectLink.parse() puts e in values as Values.SELECTOR, but SettingsActivity.fromLink()
copies neither the selector nor its required network name into the form. Opening a valid w/e
link therefore leaves those settings unchanged instead of filling and marking them for the user.

3. Saved selectors vanish before tunnel start ✓ Resolved
Description
The new selector appears in the Android settings form, but Prefs.save() and Prefs.load() do not
store or restore it or its required network name. A user can enter a valid selector and tap Save,
yet the next load supplies neither value to the command builder, so --network-selector is not
passed.


Remediation recommended

4. Selector links yield no desktop command ✓ Resolved
Description
The page's cli() function still returns an empty string without k and s, and its command
construction has no w or e options. Once a valid network-and-selector link reaches the ready
state, both displayed desktop-command variants remain empty rather than giving users a command they
can run.

5. The page approves unusable selector links ✓ Resolved
Description
The new e check validates its characters but does not check that w is present and s is absent.
A link containing h, k, s, and e is shown as ready and offered to the app even though
Values.check() refuses that selector-and-PSK combination on Save.

6. Library clients lack a selector key ✓ Resolved
Description
Values.SELECTOR is package-private, and the public CamexTunnel API does not export a matching
constant alongside its other values-map keys. Companion apps can discover the new field through
fields(), but code that constructs or updates its values map must hard-code the selector key
instead of using the library API.

Grey Divider

Tip of the day
💡 Did you know, you can keep summaries lean with Findings visible per group, which tucks the rest behind a View link

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

…d takes them from a link; CamexTunnel.SELECTOR; the link's page takes a network link, refuses a selector with a psk, and gives --network and --network-selector
@compot-dev
compot-dev merged commit 1102755 into master Nov 23, 2026
18 checks passed
@compot-dev
compot-dev deleted the link-selector branch November 23, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant