SAP Connection Testing
Overview
Connection testing now follows the generalized connection model:- Workspace admins create named entries in
workspace_connections - Connector auth keys are stored per connection in
connection_secrets - Each user can store their own SAP username/password per connection in
user_connection_credentials(encrypted)
- Admin-managed infrastructure secrets (
connector_key, host/sysnr/client/router) - User-managed SAP credentials (for permission-sensitive RFC execution)
Current setup flow
In Workspace Settings, the connection setup wizard runs in three steps:- Enter SAP system details
- Deploy connector and verify connector URL reachability
- Test connection and save
src/frontend/components/connections/AddConnectionWizard.tsxsrc/frontend/components/connections/ConnectionCard.tsxsrc/frontend/components/SapCredentialForm.tsxsrc/frontend/components/connection-test/useConnectionTest.ts
What the test checks
The connector test still validates the same SAP capabilities:- System info (
RFC_SYSTEM_INFO) - User info and roles (
USR02,AGR_USERS) - Core capability checks:
read_tableget_schemaread_dictionaryanalyze_code
ready: read_table + get_schema + read_dictionary passlimited: read_table + get_schema pass, read_dictionary failsblocked: read_table or get_schema fails
analyze_code remains non-blocking for overall status.
API endpoints
POST /api/workspaces/:workspaceId/connector-health
Checks whether a connector URL is reachable (GET /health) before saving a connection.
Request:
- Admin-only workspace access
- URL is validated with SSRF protections before fetch
POST /api/workspaces/:workspaceId/test-connection-preview
Runs a test against unsaved connection settings.
Request:
- Admin-only workspace access
detected_system_typeis inferred from SAP release (>=1511=>s4, elseecc)
POST /api/workspaces/:workspaceId/test-connection
Runs test for a persisted connection and stores result on that connection row.
Request:
- Uses
connection_secrets.connector_keyforX-Connector-Key - Uses decrypted user credentials (if present) for
X-SAP-User/X-SAP-Password - Persists:
workspace_connections.connection_testworkspace_connections.connection_tested_atworkspace_connections.system_type(auto-detected when available)
GET /api/workspaces/:workspaceId/connection-status
Returns cached connection test results.
Optional query:
connection_id=<id>for a single connection- no query to return all workspace connection test records
Data storage
Connection-level storage
workspace_connections.connection_test(JSONB)workspace_connections.connection_tested_at(timestamp)workspace_connections.system_type(s4/ecc, nullable, auto-detected)
Secret and credential storage
connection_secrets- Admin-managed key/value secrets per connection
- Includes
connector_key(and optionalsap_host,sap_sysnr,sap_client,sap_router_string)
user_connection_credentials- Per-user credentials per connection
- Password is AES-256-GCM encrypted (
encrypted_password,encryption_iv) - Encryption key: Worker
ENCRYPTION_KEYenv var
Security model
- Connector URL validation uses the same SSRF protections as other connector calls
- Connector API key remains required in real mode on the Java connector (
CONNECTOR_API_KEY) - Worker never stores plain SAP passwords in Durable Object storage
- User SAP passwords are decrypted only per request for connector calls
Files
Worker routes
src/routes/connection-test.tssrc/routes/credentials.ts
Worker helpers
src/lib/encryption.tssrc/tools/sap-connector-client.ts
Java connector
connector/src/main/java/com/aisi/connector/controller/ConnectionTestController.javaconnector/src/main/java/com/aisi/connector/config/SapUserFilter.javaconnector/src/main/java/com/aisi/connector/config/DynamicDestinationProvider.java
Not included (by design)
- Deep authorization object introspection (for example full S_RFC/S_TABU_DIS breakdown)
- Historical trend storage for every test execution (only latest status is persisted on connection)