Commit Graph
7128 Commits
Author SHA1 Message Date
YueGuobin d4389b7068 fix(rbac): guard None current_user on websocket auth failure
get_current_active_user_from_websocket returns None after closing the socket
on an auth failure (revoked token, bad credentials, inactive user).
has_privilege_on_websocket dereferenced current_user.is_superadmin without a
None check, so any websocket auth failure surfaced as an AttributeError
traceback instead of a clean close. Bail out early when current_user is None,
mirroring the guard already present in ws_console.
2026-07-16 00:51:45 +08:00
YueGuobin 3d6d9a3396 fix(mcp): thread token_version into console/download token minting
Token revocation is a strict version check (token_data.token_version !=
user.token_version). create_access_token defaults token_version to 0, so the
short-lived JWTs minted for the console WebSocket URL (nodes) and the download
URLs (symbols, links) carried ver=0. Any user who had logged out at least once
(token_version >= 1, e.g. the default admin) got tokens rejected as "revoked"
on first use.

e433991cf fixed this in _resolve_token's API-key branch but missed these three
independent minting sites. Now resolve token_version during _resolve_token (the
JWT branch decodes it, the API-key branch reads user.token_version), carry it
through gns3_ctx, and pass it at every minting call.
2026-07-16 00:51:45 +08:00
YueGuobin 89e11d265f fix(mcp): pass user.token_version when generating temp JWT from API key
_resolve_token generated a temp JWT with a hardcoded ver=0 after
validating the API key. Users who had logged out at least once
(token_version >= 1) would hit "Token has been revoked" 401 on
every MCP tool call, because the REST auth chain rejects ver=0
when the user's token_version no longer matches.

Fix: pass the user's actual token_version to create_access_token
so the temp JWT carries the correct ver claim.
2026-07-16 00:51:45 +08:00
grossmj 01d72aed9a Merge branch '2.2' into 3.1
# Conflicts:
#	gns3server/controller/__init__.py
#	gns3server/controller/project.py
2026-07-13 09:32:07 +02:00
Jeremy Grossmann b256d5a5f6 Merge pull request #2812 from GNS3/bugfix/2788
fix: gns3-server crashes on startup if "Open this project in the background" is active but there is a problem with that project
2026-07-12 13:50:11 +02:00
grossmj ea09cc2724 fix: gns3-server crashes on startup if "Open this project in the background" is active but there is a problem with that project 2026-07-12 13:46:12 +02:00
grossmj e3e0a511b6 Handle HTTPNotFound exception when retrieving compute status 2026-07-12 11:08:13 +02:00
grossmj 0ecaab4da0 Replace ControllerForbiddenError with aiohttp.web.HTTPForbidden for project deletion error handling 2026-07-12 11:05:15 +02:00
YueGuobinandClaude Opus 4.6 40644f33e6 Fix: Check compute connectivity before open() during project deletion
Previously the disconnected compute check ran after open(), which would
block for 120s trying to connect to unreachable remote computes before
rejecting the deletion. Now reads the topology file directly to extract
compute IDs and checks connectivity before calling open(), enabling
immediate rejection of deletions involving offline computes.

Also removes the redundant post-open() check since the early check
covers both opened and closed project states.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-12 10:57:56 +02:00
grossmj a9cce209d7 Development on 3.1.0.dev5 2026-07-10 10:01:35 +02:00
Jeremy Grossmann 94a131dab3 Merge pull request #2810 from yueguobin/feature/cloud-host-interface-ip-addresses
Expose full host interface IP addresses and link state in cloud node API
2026-07-10 09:19:54 +02:00
YueGuobin 0ed1715fe6 Use typed InterfaceStatus enum and simplify stats fallback in interfaces()
- Change `status: str` to `status: InterfaceStatus` (str Enum) in the
  HostInterface schema, matching the existing IPAddressFamily pattern.
- Use default-then-override pattern in interfaces() to eliminate the
  `else` branch and deduplicate defaults.
2026-07-10 14:55:21 +08:00
YueGuobin 9721660cc3 Expose full interface address list and link state in cloud node API
Each host interface surfaced by the cloud node now reports:
- ip_addresses: every IPv4 and IPv6 address (previously only a single
  IPv4 was collected internally and then dropped before the response)
- status / speed / mtu / flags: operational state and link attributes
  sourced from psutil.net_if_stats(), with flags normalized to a list

The legacy ip_address / netmask / mac_address fields are preserved so
existing callers (compute link detection, GNS3 VM, VMware, has_netmask)
keep working. The new fields travel through the existing interfaces
payload that the controller forwards verbatim, so no controller-side
change is required and the PUT / ports_mapping flow is unaffected.
2026-07-10 13:56:07 +08:00
grossmj a66740e154 Add script to create and push annotated git tags from version.py 2026-07-09 11:02:33 +02:00
grossmj 913d021705 Release v3.1.0a4 v3.1.0a4 2026-07-09 10:40:38 +02:00
grossmj d64fdd71a9 Bundle web-ui v3.1.0a4 2026-07-09 08:40:05 +02:00
Jeremy Grossmann bdd73be6d6 Merge pull request #2808 from yueguobin/docs/jwt-refresh-token-config-example
Add jwt_refresh_token_expire_minutes to sample configuration
2026-07-09 08:34:25 +02:00
Guobin Yue 61ce59788b Merge branch '3.1' into docs/jwt-refresh-token-config-example 2026-07-09 14:19:14 +08:00
YueGuobin cccc3e5b77 Add jwt_refresh_token_expire_minutes to sample configuration
The sample gns3_server.conf documented jwt_access_token_expire_minutes but omitted jwt_refresh_token_expire_minutes (default 43200 minutes, 30 days) defined in ControllerSettings. Add it for parity with the schema.
2026-07-09 14:15:49 +08:00
grossmj 6fba497734 Remove deleted web-ui files from git 2026-07-08 22:40:27 +02:00
grossmj 54540e7ef7 Merge remote-tracking branch 'origin/3.1' into 3.1 2026-07-08 21:49:20 +02:00
grossmj 5992a284c9 Bundle web-ui v3.1.0a4 2026-07-08 21:48:48 +02:00
grossmj a2ee5389af Bundle web-ui v3.1.0a4 2026-07-08 20:11:59 +02:00
grossmj 4548d9053a Sync appliances 2026-07-08 18:45:07 +02:00
grossmj 2d3bb89e58 Merge remote-tracking branch 'origin/2.2' into 3.1 2026-07-08 10:33:00 +02:00
grossmj 809d4cc609 Merge branch 'master' into 2.2
# Conflicts:
#	.github/workflows/docker-build.yml
2026-07-08 10:30:53 +02:00
Jeremy Grossmann 89e4e836c9 Merge pull request #2806 from my-code-is-grey/2798-dockerhub
#2798 - DockerHub adjustments
2026-07-08 05:17:04 +02:00
my-code-is-grey 69ddcf553f .dockerignore ignore .dockerignore 2026-07-07 22:37:24 -04:00
my-code-is-grey 1e1ec5aae8 typo made me reconsider and move out to env 2026-07-07 21:58:49 -04:00
my-code-is-grey e30e6435ca defaulted DOCKERHUB_ORG repository variable 2026-07-07 21:48:13 -04:00
my-code-is-grey 77700f361c 2798 2026-07-07 01:30:58 -04:00
grossmj 424ae55c38 Revert "Update dependencies"
This reverts commit b6793a50f3.
2026-07-06 18:38:48 +02:00
grossmj b6793a50f3 Update dependencies 2026-07-06 18:31:52 +02:00
grossmj 562108748a Remove API docs from 2.2 after merging 2026-07-06 18:17:00 +02:00
grossmj d54b16df53 Merge branch '2.2' into 3.1
# Conflicts:
#	gns3server/handlers/api/controller/template_handler.py
#	tests/handlers/api/controller/test_template.py
2026-07-06 18:13:17 +02:00
Jeremy Grossmann ad4aa1d49b Merge pull request #2803 from GNS3/update-ga-workflows
Update GitHub Actions workflows
2026-07-06 18:10:17 +02:00
grossmj 8499ed3d65 Update GitHub Actions workflows 2026-07-06 18:05:28 +02:00
Jeremy Grossmann a0ca8761c0 Merge pull request #2802 from yueguobin/fix-web-wireshark-docker-xpra6.x
Fix web-wireshark docker build broken by xpra 6.5 release
2026-07-06 17:32:31 +02:00
Guobin Yue 277640a335 Merge branch '3.1' into fix-web-wireshark-docker-xpra6.x 2026-07-06 13:35:44 +08:00
YueGuobin f5a72532ac Fix web-wireshark docker build broken by xpra 6.5 release
Replace the `xpra=6.4*` version clamp on the apt-get install command
line with APT pinning via /etc/apt/preferences.d/pin-xpra.

The previous specifier stopped resolving once xpra 6.5 was released:
the xpra metapackage was pinned to 6.4 while its sub-packages
(xpra-client, xpra-server, xpra-codecs, ...) were unconstrained and
defaulted to 6.5, so apt could not satisfy the dependency graph and
the "Build Docker images" action failed.

Pinning all xpra* packages at the preferences level constrains the
whole set consistently (xpra-html5 is handled separately since it
follows a different version scheme, locked to v19). Blocking every
other version with priority -1 ensures that, if the pinned version
ever disappears from the repository, apt fails loudly instead of
silently upgrading to the latest release.

Fixes GNS3/gns3-registry#1044
2026-07-06 13:31:07 +08:00
Jeremy Grossmann 7650409ab6 Merge pull request #2797 from yueguobin/feature/optional-ai-support-2794
Make AI features (AI Copilot + MCP) optional via [ai-features] extra
2026-06-27 19:44:27 +02:00
YueGuobin e0ef63ebc1 Update CI to install [ai-features,dev] instead of [ai-copilot,dev]
The [ai-copilot] extra has been replaced by [ai-features] which
includes both AI Copilot and MCP dependencies.
2026-06-27 22:19:39 +08:00
YueGuobin 292b60efaa Make AI features (AI Copilot + MCP) optional via [ai-features] extra
- Move fastmcp from core requirements.txt to mcp-requirements.txt
- Add MCP_AVAILABLE feature flag in agent/__init__.py (graceful degradation)
- Guard MCP imports/registration in server.py and tasks.py
- Replace ai-copilot/mcp/ai-support extras with single ai-features extra
- Add stub MCP routes returning 501 when MCP is not installed
- Add gns3server-uninstall-ai-features CLI command
- Remove old gns3server-uninstall-ai-copilot command
- Update all error messages and docs to reference ai-features

Closes #2794
2026-06-27 10:14:43 +08:00
Jeremy Grossmann 58d3055dd3 Merge pull request #2792 from yueguobin/feature/refresh-token-mechanism-2786
Add stateless JWT refresh token mechanism
2026-06-24 00:26:07 +02:00
YueGuobin 0dd2fb4173 Add refresh token mechanism documentation under docs/features/ 2026-06-23 23:36:37 +08:00
YueGuobin c8c14af9f4 Add /refresh to allowed public endpoints list in route auth test 2026-06-23 23:19:07 +08:00
YueGuobin 0e8d0cb87b Add stateless JWT refresh token mechanism
- New config: Controller.jwt_refresh_token_expire_minutes (default 30 days)
- New endpoint: POST /v3/access/users/refresh (public, unauthenticated)
- Login/authenticate responses now include refresh_token
- AuthService: _create_token helper, create_refresh_token, get_token_data
  now parses type claim (token_use) for token classification
- Security: refresh tokens rejected on HTTP + WebSocket access paths;
  /refresh strictly requires type=='refresh'
- Logout works for free via existing token_version mechanism
- Tests: 9 new TestRefreshToken cases, all passing; 34 existing tests
  still pass (no regressions)
2026-06-23 22:39:11 +08:00
Jeremy Grossmann 4ffab7abee Merge pull request #2791 from yueguobin/fix/mcp-test-issues
Fix MCP testing issues: appliance_install version, handler unit tests, parameter validation
2026-06-17 21:07:59 +02:00
YueGuobin 471e65e48c Add project/node/link handler tests: 39 total, covering list/get/create/delete/start/stop/suspend/reload/console/update/fields 2026-06-18 00:07:14 +08:00
YueGuobin 5cc826baff Add MCP handler unit tests with mocked Gns3Connector
Tests cover:
- get_nodes_handler: fields filter, invalid fields rejection
- create_node_handler: name passthrough, fields filter, fields validation,
  batch mode inherited template_id, missing project_id
- create_link_handler: compact format, standard format, fields validation
- appliance_get, appliance_install with version
- list_templates: fields filter, invalid field error
2026-06-18 00:02:38 +08:00