freeswitch/conf
Andrey Volk c1bb5c6ab3
Some checks failed
Build and Distribute / Preconfig (push) Successful in 1s
CI / Unit-tests pre-config (push) Failing after 1s
Build and Distribute / Get Nonce for token (push) Has been cancelled
Windows / x64 (push) Has been cancelled
CI / Unit-tests D-in-D (push) Has been cancelled
CI / Scan Build (push) Has been cancelled
MacOS Build / Build MacOS (push) Has been cancelled
CI / Unit-tests (group ) (push) Has been cancelled
Build and Distribute / Issue temporary token (push) Has been cancelled
Build and Distribute / DEB-PUBLIC (push) Has been cancelled
Build and Distribute / Revoke temporary token (push) Has been cancelled
Build and Distribute / Publish build data to meta-repo (push) Has been cancelled
CI / Validate Unit-tests (push) Has been cancelled
[Core, mod_commands] Interface allowlist (#3086)
* [core] Add interface allowlist to gate module app/api registration

Adds an optional, presence-activated allowlist in switch.conf.xml that
controls which modules may register application / api / json_api /
chat-application interfaces. With no <interface-allowlist> configured
nothing is enforced; when at least one <allow> entry is present, only
listed interfaces register at load time and all others are refused (the
module still loads and switch_loadable_module_process still returns
SUCCESS -- the blocked interface is simply never exposed).

Entries match at three levels of precision:
  mod_commands            - whole module
  mod_commands.system     - any interface named "system"
  mod_commands.system.api - a specific type (app|api|json_api|chat_app)

Enforcement lives in switch_loadable_module_process() so every module, at
boot and at runtime `load`, is subject to the same policy. This gives
operators a way to disable the "system"/"spawn" shell-exec API commands
(and equivalents) system-wide.

Also adds the `interface_allowlist_dump [modules] [plain]` API, which
walks the loaded modules and prints their interfaces in the allowlist key
format so the current state can be captured and pruned offline into config.

* [mod_commands] Add tests for the interface allowlist

New test_interface_allowlist boots the core with an active
<interface-allowlist> (conf_interface_allowlist/) that permits only a
couple of mod_commands interfaces, then loads mod_commands and verifies:

- listed commands register and run (status, version) while unlisted and
  shell-exec commands are refused (system, spawn, uptime) -- refusal
  surfaces as switch_api_execute returning FALSE / command-not-found,
  with the command function never invoked;
- a "module.name.type" entry gates by type: the API "status" loads while
  the JSON API of the same name stays blocked;
- interface_allowlist_dump prints the config format in its xml, modules
  and plain variants, and reflects module capabilities (system appears in
  the dump even though it was blocked from registering).

* [config] Fix interior -- in interface-allowlist comment breaking XML parse

The explanatory comment used -- as em-dash pairs. The XML parser treats
-- inside a comment as the comment close, causing an "unclosed <!--"
error that prevents the whole freeswitch.xml from parsing (boot and
reloadxml both fail). Replace the -- pairs with ordinary punctuation.

* update .gitignore

* [core] Warn when interface-allowlist section is present but parses no entries

Co-authored-by: Chris Rienzo <chris@signalwire.com>
2026-08-05 18:44:33 +03:00
..
curl [mod_rss] Remove from tree 2025-01-11 02:36:12 +03:00
insideout [mod_python] Remove from tree 2025-03-31 18:49:17 +03:00
minimal [timezones] Update timezones to version 2023c. 2023-09-05 12:46:13 -04:00
sbc [mod_h26x] Remove from tree 2025-01-13 23:24:50 +03:00
softphone FS-11555: [mod_signalwire] Initial commit. 2018-12-21 21:45:59 +04:00
testing [timezones] Update timezones to version 2023c. 2023-09-05 12:46:13 -04:00
vanilla [Core, mod_commands] Interface allowlist (#3086) 2026-08-05 18:44:33 +03:00
FreeMono.ttf [core] and core video alpha patch test code 2021-10-23 22:00:01 +03:00
freeswitch.xml make configs work from in the source tree if needed 2012-03-26 10:48:03 -05:00