FCC Diagnostics Proxy

Overview

ft-fcc-service is an internal, docker-network-only service with no authentication of its own and no port published outside the docker network. The Angular portals (Support Center / Management Console) never talk to it directly — they only ever talk to ui-backend, which exposes a transparent proxy under /iot-webservice/iotw/FCC/** and forwards every request to ${ft.fcc.service.url}/FCC/**.

ACS and ft-fcc-service communicate with each other independently, over Hazelcast queues, for the diagnostics collection pipeline itself. That exchange is outside the scope of this page, which documents the browser-facing HTTP proxy only.

`ui-backend’s role in this feature is strictly limited to the proxy. It explicitly does not:

  • store any FCC configuration;

  • resolve devices for FCC in any way;

  • publish to, or read from, any FCC-related Hazelcast queue;

  • take any part in the legacy FCC ETL.

Everything FCC-specific that ui-backend does is: authenticate the caller (existing JWT filter chain), resolve the caller’s identity and domain scope, and forward the HTTP request/response verbatim.

There is one exception. For the Group Update device list of an FCC test, ui-backend makes one extra call of its own to read the domain of the test. See The test domain lookup.

Request flow

fcc-diagnostics-proxy-flow

Identity and domain-scope headers

FccIdentityService.identityHeaders() builds the outgoing header set from scratch for every proxied call; it never copies headers from the incoming request.

Header Present when Meaning

X-FT-User-Id

Always

The authenticated caller’s user id (AuthUtils.getUserId()).

X-FT-Client-Type

Always

The authenticated caller’s client type (AuthUtils.getClientType().getName()), e.g. the portal that issued the request.

X-FT-Domain-Scope

Always

ALL or LIST (see below).

X-FT-Domain-Id

Only when scope is LIST

The caller’s own domain id.

X-FT-Domain-Ids

Only when scope is LIST and the visible domain id count fits in one header

Comma-separated list of every domain id visible to the caller (own domain id included).

X-FT-Domain-Ids-1 .. X-FT-Domain-Ids-N

Only when scope is LIST and the visible domain id count exceeds ft.fcc.proxy.domain-ids-per-header

The same id list, split into fixed-size chunks (see Domain-ids chunking).

The two scopes

  • ALL — the super domain. CommonUtils.isSuperDomain(domainId) is true for a domain id of null, 0, or -1. In this case neither X-FT-Domain-Id nor any X-FT-Domain-Ids* header is sent — ft-fcc-service treats the presence of X-FT-Domain-Scope: ALL alone as "no domain restriction".

  • LIST — every other user. The header set carries the caller’s own domain id plus every domain id the caller may see (DomainService.getDomainIds(user)), with null, 0, and -1 sentinel values stripped before the list is sent. If the resolved id list is empty after stripping, the scope is considered unresolvable and the call is rejected before it ever reaches ft-fcc-service (see Troubleshooting, 9209).

Every client-supplied header starting with X-FT- is dropped by the proxy — a browser cannot forge its own identity or domain scope by sending X-FT-Domain-Scope: ALL (or any other X-FT-* header) on the original request. The headers ft-fcc-service receives are always the ones FccIdentityService computed server-side.

Symmetrically, ft-fcc-service treats a missing X-FT-Domain-Scope header as a refusal to serve the request (403), never as "no restriction, show everything". The absence of the header is not equivalent to ALL.

Domain-ids chunking

Tomcat caps the entire request header block at 8 KB. A user visible in more than ft.fcc.proxy.domain-ids-per-header domains (default 200) would risk overflowing that limit in a single X-FT-Domain-Ids header, so FccIdentityService.addDomainIds splits the list into X-FT-Domain-Ids-1, X-FT-Domain-Ids-2, … instead of emitting one oversized header. Consumers on the ft-fcc-service side must read all numbered chunks, not just X-FT-Domain-Ids, when the scope is LIST.

What the proxy passes through unchanged

FccProxyService is a contract-agnostic proxy: it does not parse or understand the FCC payloads it forwards.

Request → upstream:

  • HTTP method

  • remaining path (the part of the URL after /iot-webservice/iotw/FCC, kept URL-encoded exactly as received)

  • query string

  • body (buffered for ordinary requests; rebuilt from the parsed parts for multipart/form-data, since the DispatcherServlet has already drained the original multipart input stream)

  • Content-Type (for non-multipart requests only — for multipart requests WebClient writes its own multipart/form-data header with its own boundary)

  • Accept

Upstream → response:

  • status code, including 4xx/5xx, returned verbatim (the controller uses exchangeToMono rather than retrieve() specifically so an upstream error status and body are not rewritten into a generic proxy error)

  • response headers, except the hop-by-hop set that must not be copied back to the client: Connection, Keep-Alive, Proxy-Authenticate, Proxy-Authorization, TE, Trailer, Transfer-Encoding, Upgrade, and Content-Length (the servlet container recomputes Content-Length for the response it actually writes)

  • response body, byte-for-byte

Two path-level guards run before any of the above: a suffix containing .. is rejected (9212), and any path under /FCC/internal/** is rejected with a 404 before it reaches ft-fcc-service — that segment is reserved for internal callers and is deliberately unreachable from the browser.

The test domain lookup

The Group Update device list is shared with the FCC edit screen. When the screen sends ownerType=FCC and ownerId greater than 0, ui-backend must know the domain in which the FCC test was created. Only ft-fcc-service stores that domain. FccTestDomainClient.fetchTestDomainId reads it with one backend call. It is not a proxied browser request.

For ownerType=FCC, ownerId is the id of the FCC test. It is not the id of the diagnostics configuration.

The backend call

Item Value

Request

POST ${ft.fcc.service.url}/FCC/internal/item/domain on the same WebClient as the proxy. The base URL has no trailing slash.

Body

{"id": <test id>}

Headers

The X-FT-* identity headers of the caller, built by FccIdentityService.identityHeaders(), plus Content-Type: application/json and Accept: application/json.

Success

Status 2xx with an integer domainId. The value 0 is the super domain.

Timeout

ft.fcc.timeouts.lookup for the whole call (default 5s, see Configuration reference).

The call uses the identity of the caller. ft-fcc-service answers 404 for a test that the caller cannot see. ui-backend shows this as "not found", never as "forbidden".

The endpoint is internal. It is not in the OpenAPI file of ft-fcc-service. A browser cannot reach it, see The internal path block.

Fail-closed behaviour

Every outcome other than a successful answer stops the request. The device list never falls back to the whole scope of the caller.

Answer of ft-fcc-service Error HTTP status

2xx with an integer domainId

none, the value is used

-

404 with the body code 9404: the test does not exist or the caller cannot see it

9213 FCC_TEST_NOT_FOUND

404

Any other 404 (for example, an older ft-fcc-service without the route, or a wrong base URL)

9211 FCC_SERVICE_UNAVAILABLE

502

Any other status

9211

502

2xx with a missing, null or non-integer domainId, or a body that is not JSON

9211

502

Connect error, read timeout, lookup timeout, or a connection closed without a response

9211

502

The errors use 404 and 502 on purpose. The portal treats 401 and 403 as a lost session.

After a saved test is found, the list is also checked against the scope of the caller. If a restricted caller shares no domain with the subtree of the test, the request fails with 9213. If the test belongs to the super domain, the caller scope is used.

This feature must ship in the same release as the portal change that sends the test id as ownerId. Before that change, the device window of a saved configuration sends the configuration id. ui-backend then reads that number as a test id. Two results are possible:

  • Usually no test has that id, and the request fails with 9213.

  • If another test visible to the caller has that id, the domain of that test limits the list. The list stays inside the scope of the caller.

Each lookup adds one round trip to ft-fcc-service for every POST /GroupUpdate/devices call with ownerType=FCC.

The internal path block

The path /FCC/internal/** belongs to internal callers. The browser cannot reach it through /iot-webservice/iotw/FCC/**. Two controls apply.

Control What it rejects Result

FccProxyService.remainingPath

The path /internal and every path below it. The check ignores upper and lower case. It decodes the path up to three times, so /INTERNAL/item/domain, /int%65rnal/item/domain and /int%2565rnal/item/domain are rejected.

404, code 9210. ft-fcc-service is not called.

Spring Security StrictHttpFirewall (the default)

A path with ;, with %3B, or with //.

The firewall rejects the request before the proxy runs.

The firewall control holds only while no code of the application configures a firewall. FccHttpFirewallDefaultGuardTest scans the main sources of the services, commons, acs and iot-web-app-build modules. It fails if a source defines or configures an HttpFirewall, calls setFirewall, or calls a setAllow* method on a firewall. The test reads the source roots of these four modules in the reactor only. It does not scan the com.friendly dependency jars, so a firewall configured in a jar is not detected.

Declared gap: no automated test sends a ;, %3B or // path through the running application. The application has no Spring context test harness for this. The guard test pins only the precondition that the default firewall stays in place. Check the runtime rejection by hand after a change to the security configuration.

Report export

POST /iot-webservice/iotw/FCC/reports/export (upstream POST /FCC/reports/export) is handled by a separate code path because a report export can be a multi-million-row payload:

  • it uses its own WebClient (fccExportWebClient) with a longer response timeout (ft.fcc.timeouts.export-response, default 5m) than the ordinary buffered client (ft.fcc.timeouts.response, default 30s), and with no codec maxInMemorySize limit since nothing is buffered into memory;

  • the response is streamed straight from the upstream Flux<DataBuffer> to the servlet output stream via StreamingResponseBody — the report is never buffered in memory nor spooled to a temporary file;

  • it sets its own per-request MVC async timeout (ft.fcc.timeouts.export-async, default 11m) on the AsyncWebRequest before returning, so this one endpoint can run longer than the application’s global spring.mvc.async.request-timeout (190s) without raising that global default for every other endpoint.

Configuration reference

All properties live under the ft.fcc prefix (FccProxyProperties, bound in iot-web-app-build/src/main/resources/application.yaml). Every field has a code-level default, so the application still starts if the ft.fcc block is absent from configuration.

Property Environment variable Default Controls

ft.fcc.service.url

FT_FCC_SERVICE_URL

http://ft-fcc-service:8080

Base URL of the internal ft-fcc-service (without the /FCC path segment). This is the variable the docker-compose stacks set on the ui-backend service.

ft.fcc.timeouts.connect

FT_FCC_CONNECT_TIMEOUT

2s

TCP connect timeout, shared by both the buffered and the export WebClient.

ft.fcc.timeouts.response

FT_FCC_RESPONSE_TIMEOUT

30s

Upstream response timeout of the buffered (non-export) client.

ft.fcc.timeouts.export-response

FT_FCC_EXPORT_RESPONSE_TIMEOUT

5m

Upstream response timeout of the streaming export client.

ft.fcc.timeouts.export-async

FT_FCC_EXPORT_ASYNC_TIMEOUT

11m

Per-request MVC async timeout applied to the export endpoint only; must stay above export-response and above the export limit of ft-fcc-service (10 minutes by default). The global spring.mvc.async.request-timeout (190s) is left untouched.

ft.fcc.timeouts.lookup

FT_FCC_LOOKUP_TIMEOUT

5s

Bound of the whole test domain lookup, from the start of the call to the end of the answer. A lookup that exceeds it fails with 9211.

ft.fcc.cache.user-ttl

FT_FCC_USER_CACHE_TTL

30s

TTL of the per-user domain-scope entry in the Hazelcast FccDomainScopeCache map.

ft.fcc.proxy.max-in-memory-size

FT_FCC_MAX_IN_MEMORY_SIZE

16MB

WebClient codec limit for buffered (non-export) responses; the Spring default of 256 KB is too small for FCC list and report payloads.

ft.fcc.proxy.domain-ids-per-header

FT_FCC_DOMAIN_IDS_PER_HEADER

200

Maximum number of domain ids carried by a single X-FT-Domain-Ids* header before the list is split into chunks (see Domain-ids chunking).

Portal menu item and the FCCId setting

The FCC Diagnostics menu node is static: it is declared in the Management Portal’s own app-permissions-config.json and gated by the UserGroupTemplate permissions described below — no interface item creates or positions it. FCCId is a Settings item: the Superset dashboard id that the System Reports fcc route resolves by id to show the FCC Diagnostics report (an empty value disables the report).

How interface items are registered

Interface items are not seeded through Liquibase INSERT`s. At application start, `SettingInitializer (services module, around lines 151-166) reads iot-web-app-build/conf/interfaceItems.json and filters out every id that already exists in table iotw_interface_item — only genuinely new ids get inserted.

Editing interfaceItems.json only affects new installations. An id already present in iotw_interface_item is left untouched by SettingInitializer; changing it in an existing installation requires an explicit UPDATE — see the Liquibase changeset below.

A JSON interface item carries only id, isRequired, defaultValue, valueType, groupId, and interfaceDescriptions — there is no url and no order field. groupId decides only which section of Settings › Interface shows the item; it has no effect on the portal menu.

FCCId: back in system reports

FCCId holds the Superset dashboard id of the FCC Diagnostics report, so it lives in the system reports group next to the other report dashboard ids, with the EN description "Superset dashboard ID for the FCC Diagnostics report. Leave empty to disable the report." An earlier changeset had moved it to diagnostics; a later one moves it back:

Change Where Applies to

"groupId": "system reports" and the EN description for the FCCId entry

iot-web-app-build/conf/interfaceItems.json and deployment/config/interfaceItems.json

New installations only (see note above)

UPDATE iotw_interface_item SET group_id = 'system reports' WHERE id = 'FCCId' and the matching iotw_interface_description update for locale EN

iot-web-app-build/liquibase/db.changelog/ui/changelog-move-fcc-interface-item-back-to-system-reports.xml, included from db.changelog/ui/db.changelog-master.yaml after changelog-move-fcc-interface-item-to-diagnostics.xml

Existing installations, applied automatically on upgrade

Existing groups, for reference: others, reports, system reports, diagnostics, pass policy, ai chatbot, network score, grafana, auth, timeouts, isp.

Because both paths are covered, no manual step is required after upgrading an existing installation: FCCId appears under System reports in the Management Portal settings as soon as the Liquibase changeset has run.

Portal and permission scope

InterfaceService (around lines 445-458) hides the reports and grafana groups from the Support Portal (sc client type), and additionally hides FCCId explicitly by id. The group FCCId belongs to does not change this: FCC Diagnostics remains a Management Portal (mc) feature only in this version, and that explicit by-id filter is intentionally left in place.

ui-backend does not check per-screen permissions for any screen. The FCC Diagnostics node, with VIEW/EXECUTE, lives in the portal’s JSON user-group permission template (UserGroupTemplate), uploaded by the portal itself via PUT Setting/userGroup/permissions with the X-Internal-Keyword header — that template, and the screen-level permission model it encodes, is owned by the Angular side, not by ui-backend.

Caching

FccIdentityService caches the derived FccDomainScope — not the raw UserResponse — per user id, in a Hazelcast IMap named FccDomainScopeCache, with an explicit TTL taken from ft.fcc.cache.user-ttl (default 30s).

Why this cache exists:

  • UserService.getUser(userId, zoneId) goes straight to userRepository.findById — it has no cache of its own.

  • The JWT filter already performs a session lookup plus a user lookup on every request. Without this cache, every proxied FCC call would add a third database round-trip.

Why the derived scope is cached rather than the UserResponse:

  • UserResponse carries the password field and must not be replicated around the Hazelcast cluster.

  • FccDomainScope is a small, Serializable record (scope, domainId, domainIds) with no sensitive fields.

A failed resolution (the 9209 outcome) is never cached — every request from a user whose domain scope cannot be resolved re-attempts resolution.

Operational consequence: because the scope is cached for up to user-ttl, a domain reassignment for a user takes up to that TTL to take effect on FCC calls specifically (other parts of the application that read the domain directly, without this cache, are unaffected).

Troubleshooting

Code HTTP status Name Likely cause / fix

9209

403 Forbidden

FCC_DOMAIN_SCOPE_UNRESOLVED

The caller’s domain scope could not be resolved — DomainService.getDomainIds returned null/empty, or every id resolved was a sentinel (null/0/-1). Check the user’s domain assignment in IOTW; this is not cached, so a fix takes effect immediately on the next request.

9210

404 Not Found

FCC_INTERNAL_PATH_NOT_FOUND

A request under /FCC/internal/** was made through the browser-facing proxy. That segment is reserved for internal callers and is never reachable from /iot-webservice/iotw/FCC/**. If a client legitimately needs this path, it needs a different entry point — it will not be exposed here. See The internal path block.

9211

502 Bad Gateway

FCC_SERVICE_UNAVAILABLE

ft-fcc-service could not be reached, or timed out (WebClientRequestException, ReadTimeoutException, or ConnectException anywhere in the reactive error chain). Check that the ft-fcc-service container is running and on the same docker network as ui-backend; note that its port is deliberately not published, so a curl to it from the docker host (as opposed to from inside the network) is expected to fail. The same code is returned by the test domain lookup for every failure except a missing test. An ft-fcc-service version without the route /FCC/internal/item/domain also produces 9211: update ft-fcc-service first.

9212

400 Bad Request

FCC_INVALID_REQUEST_PATH

The remaining path did not start with the expected prefix, contained a .. segment, or could not be assembled into a valid upstream URI.

9213

404 Not Found

FCC_TEST_NOT_FOUND

The FCC test named by ownerId does not exist, or the caller cannot see it. A restricted caller whose scope shares no domain with the domain of the test gets the same error. Check that ownerId is the id of the test, not the id of the configuration. See The test domain lookup.

The proxy emits two greppable log lines useful for diagnosing the above:

  • fcc identity resolved userId=…​ scope=…​ domainId=…​ domainIdsCount=…​ — logged (at DEBUG) on every cache miss in FccIdentityService, once the scope has been freshly resolved.

  • fcc test domain lookup failed closed ownerType=FCC ownerId=…​ outcome=…​ status=…​ — logged (at WARN) by FccTestDomainClient whenever the test domain lookup fails closed. A successful lookup logs fcc test domain resolved ownerType=FCC ownerId=…​ domainId=…​ at DEBUG.

  • fcc upstream call failed userId=…​ method=…​ path=…​ url=…​ — logged (at ERROR, with the underlying exception) by FccProxyService.execute whenever a call to ft-fcc-service fails with a connection/timeout error, immediately before it is translated into 9211.

Limitations / not in this version

  • Multipart import/export forwarding is implemented (FccProxyService.multipartBody) but has not yet been exercised end-to-end against a real ft-fcc-service multipart endpoint.

  • There is no FCC-specific role model in ui-backend. Screen-level access (VIEW/EXECUTE on the FCC Diagnostics node) is defined entirely in the portal’s UserGroupTemplate JSON — see Portal menu item — plus the domain scope described above; there is no separate FCC permission/role check in ui-backend itself.

  • The runtime rejection of the paths ;, %3B and // has no automated test. See The internal path block.

  • /FCC/internal/platform-event, an ACS webhook relay, is reserved and unused: the /FCC/internal/** prefix is already blocked from the browser-facing proxy (9210), but no route for this path exists in ui-backend today — the ACS-to-ft-fcc-service exchange is expected to continue over Hazelcast queues, not through this proxy.