This repository contains the source code for the LFX v2 platform member service.
The LFX v2 Member Service is a RESTful API service that provides membership data within the Linux Foundation's LFX platform. It exposes endpoints for querying project memberships and key contacts, write endpoints for managing B2B orgs (create, update, access-control settings) and key contacts (create, update, delete), and an admin reindex endpoint for pushing data into OpenSearch. Data is sourced directly from Salesforce via SOQL queries, with a per-record NATS Key-Value cache to minimise round-trips.
├── .github/ # Github files
│ └── workflows/ # Github Action workflow files
├── charts/ # Helm charts for running the service in kubernetes
├── cmd/ # Services (main packages)
│ └── member-api/ # Member service API code
│ ├── design/ # API design specifications (Goa)
│ ├── service/ # Service implementation
│ ├── main.go # Application entry point
│ └── http.go # HTTP server setup
├── gen/ # Generated code from Goa design
├── internal/ # Internal service packages
│ ├── domain/ # Domain logic layer (business logic)
│ │ ├── model/ # Domain models and entities
│ │ └── port/ # Repository and service interfaces
│ ├── service/ # Service logic layer (use cases)
│ ├── infrastructure/ # Infrastructure layer
│ │ ├── nats/ # NATS KV cache and project RPC
│ │ ├── salesforce/ # Salesforce SOQL client and repositories
│ │ ├── project/ # ProjectResolver (UID ↔ slug ↔ SFID)
│ │ └── mock/ # Mock implementations for testing
│ └── middleware/ # HTTP middleware components
└── pkg/ # Shared packages- RESTful API: Endpoints for querying project memberships and key contacts, write endpoints for B2B orgs and key contacts, org access-control settings (writers/auditors), and an admin reindex endpoint.
- Salesforce-backed: All membership data is fetched directly from Salesforce via SOQL queries; no PostgreSQL dependency at runtime.
- NATS KV cache: Six buckets —
membership-cache(Salesforce-backed records, 6 h stale / 23 h expire / 24 h TTL);member-service-cache(sObject REST responses, no soft-TTL);org-settings(org ACL, no TTL);pubsub-state(CDC replay cursors);org-workspaces(workspace registry, no TTL);org_workspace_projects(workspace-project associations, no TTL). - Project ID resolution: The
ProjectResolvertranslates v2 project UIDs to SalesforceProject__c.Idvalues by chaining a NATS RPC to the project-service and a SOQL lookup, backed by the same KV cache. - NATS RPC endpoints: Exposes request/reply subjects so other services can
resolve identifiers without querying Salesforce directly:
lfx.member.project-id-map.lookup— v2 project UID → SalesforceProject__c.Idlfx.member.b2b_org_lookup— validate ab2b_orgid and return the canonical 18-char Account SFID and logo URLlfx.member.b2b_org_lookup_by_website— resolve ab2b_orgby name/website when a caller cannot resolve it directly viab2b_org_lookup(also returns the logo URL)
- Clean Architecture: Follows hexagonal architecture with clear separation of domain, service, and infrastructure layers.
- Authorization: JWT-based authentication with Heimdall middleware integration and OpenFGA fine-grained access control.
- Health Checks: Built-in
/livezand/readyzendpoints. - Request Tracking: Automatic request ID generation and propagation.
- Structured Logging: JSON-formatted logs with contextual information.
| Method | Path | Description |
|---|---|---|
| GET | /project_memberships/{uid} |
Get a project membership |
| Method | Path | Description |
|---|---|---|
| GET | /project_memberships/{membership_uid}/key_contacts/{uid} |
Get a key contact |
| POST | /project_memberships/{membership_uid}/key_contacts |
Create a key contact |
| PUT | /project_memberships/{membership_uid}/key_contacts/{uid} |
Update a key contact |
| DELETE | /project_memberships/{membership_uid}/key_contacts/{uid} |
Remove a key contact |
| Method | Path | Description |
|---|---|---|
| POST | /b2b_orgs |
Create a B2B org from a Salesforce Account SFID |
| PUT | /b2b_orgs/{uid} |
Partial update of a B2B org |
| GET | /b2b_orgs/{uid} |
Get a B2B org |
| GET | /b2b_orgs/{uid}/settings |
Get org access-control settings (writers, auditors) |
| PUT | /b2b_orgs/{uid}/settings |
Update org access-control settings (writers, auditors) |
| GET | /b2b_orgs/member-tiers/{username} |
Highest active membership tier per org for a user (machine-to-machine) |
With B2B_ORG_INCLUDE_COMPANY_ALL_ACCOUNTS=true, writes that add or change data for an org (PUT /b2b_orgs/{uid}, the logo upload, the settings update, adding a settings user or changing their role, creating or renaming a workspace, and adding workspace projects) return 404 when the Salesforce Account is deleted or no longer qualifies as a B2B org (model.IsB2BOrgEligible). The check is one batched Salesforce read per request. With the setting off, these writes are not checked, so a Company Account without a membership stays editable until the setting is turned on. Removals (deleting a settings user, a workspace, or a workspace project) are always allowed, so access can be withdrawn after an org stops qualifying. GET /b2b_orgs/{uid} and the lfx.member.b2b_org_lookup NATS lookup still return the raw Account.
| Method | Path | Description |
|---|---|---|
| POST | /admin/reindex |
Trigger a full or incremental reindex of cached entities into OpenSearch (requires global org-admin membership) |
| Method | Path | Description |
|---|---|---|
| GET | /readyz |
Readiness check |
| GET | /livez |
Liveness check |
Note: The legacy
/members/*and/memberships/*endpoints are no longer registered and return404 Not Found; use the replacement paths above.
In addition to the HTTP API, the service handles NATS request/reply subjects that allow other services to resolve identifiers without querying Salesforce or this service's HTTP layer directly.
Resolves a v2 project UUID to its corresponding Salesforce Project__c.Id.
Resolution is cached in the membership-cache KV bucket; a cache miss triggers
a NATS RPC to the project-service (to obtain the project slug) followed by a
Salesforce SOQL query.
| Field | Value |
|---|---|
| Subject | lfx.member.project-id-map.lookup |
| Transport | NATS core request/reply |
| Queue group | lfx-v2-member-service |
Request body (JSON):
{"project_uid": "<v2 project UUID>"}Response — success (HTTP 200 equivalent):
{"project_sfid": "<Salesforce Project__c.Id>"}Response — not found:
{"error": "project not found"}Response — bad request:
{"error": "project_uid is required"}The reply is always valid JSON. Check for the presence of the "error" key to
detect failure.
Validates that an organization id resolves to an indexed b2b_org and returns
the canonical 18-char Salesforce Account SFID. Used by write-path validators in
consumer services (e.g. committee-service) per LFXV2-2400. Resolution chains:
sObject cache → Salesforce Account fetch via GetB2BOrg.
| Field | Value |
|---|---|
| Subject | lfx.member.b2b_org_lookup |
| Transport | NATS core request/reply |
| Queue group | lfx-v2-member-service |
Request body (JSON):
{"id": "<b2b_org uid or 15/18-char Account SFID>"}Response — success:
{"id": "<canonical 18-char Account SFID>", "logo_url": "<Account.Logo_URL__c>"}logo_url is omitted when the Account has no logo.
Response — not found:
{"error": "b2b org not found"}Response — bad request:
{"error": "id is required"}Response — lookup failure (infrastructure error):
{"error": "b2b org lookup failed"}The reply is always valid JSON. Check for the presence of the "error" key to
detect failure. A not-found response means the id does not resolve to a b2b_org
(e.g. CDP UUID, unknown SFID); infrastructure failures return a distinct error
message.
Resolves a b2b_org by name/website when a caller cannot resolve it directly
via lfx.member.b2b_org_lookup (e.g. a legacy, non-SFID id for an org that
exists under a different SFID). Resolution is tiered: primary domain →
domain alias → website → name, in that priority order. A match at any domain
tier is verified against the normalized hostname before being accepted, and
an ambiguous result (more than one candidate) at any domain tier stops
resolution entirely rather than falling through to a less specific tier.
| Field | Value |
|---|---|
| Subject | lfx.member.b2b_org_lookup_by_website |
| Transport | NATS core request/reply |
| Queue group | lfx-v2-member-service |
Request body (JSON):
{"name": "<org name>", "website": "<org website or bare domain>"}Response — success:
{"id": "<canonical 18-char Account SFID>", "logo_url": "<Account.Logo_URL__c>"}logo_url is omitted when the Account has no logo.
Response — not found, ambiguous, or invalid:
{"error": "b2b org not found"}Response — bad request:
{"error": "name or website is required"}Response — lookup failure (infrastructure error):
{"error": "b2b org lookup failed"}The reply is always valid JSON. Check for the presence of the "error" key to
detect failure. A not-found response covers both "no match" and "ambiguous
match" cases alike, since this RPC is read-only resolution and both mean the
same thing to a caller: do not treat the id as confirmed.
As of LFXV2-2049, b2b_org.uid equals the canonical 18-char Salesforce Account
SFID. Callers that already hold a verified Account SFID can use it directly as
the b2b_org UID without further translation. When a caller receives an opaque
organization.id (15/18-char SFID or other shape), use lfx.member.b2b_org_lookup
to confirm the org exists and obtain the normalized 18-char SFID.
To contribute to this repository:
- Fork the repository.
- Commit your changes to a feature branch in your fork. Ensure your commits
are signed with the Developer Certificate of Origin
(DCO).
You can use the
git commit -scommand to sign your commits. - Submit your pull request.
make apigen # Generate Goa API code
make build # Build the member-api binary
make test # Run tests# With NATS and Salesforce credentials
export NATS_URL=nats://localhost:4222
export SF_INSTANCE_URL=https://linuxfoundation.my.salesforce.com
export SF_CLIENT_ID=<connected-app-client-id>
export SF_CLIENT_SECRET=<connected-app-client-secret>
./bin/member-api
# With mock data (no NATS or Salesforce required)
REPOSITORY_SOURCE=mock AUTH_SOURCE=mock ./bin/member-api
# With mock auth only (NATS + Salesforce still required)
export JWT_AUTH_DISABLED_MOCK_LOCAL_PRINCIPAL=local-dev-user
./bin/member-apiThe service reads credentials from environment variables. A pre-existing
Kubernetes Secret is required in production; see the Helm chart values.yaml
salesforce.secrets stanza for configuration.
| Variable | Description | Required |
|---|---|---|
SF_INSTANCE_URL |
Salesforce instance URL | Yes |
SF_CLIENT_ID |
Connected-app consumer key | Yes |
SF_CLIENT_SECRET |
Consumer secret (username/password or client-credentials flow) | Conditional |
SF_USERNAME |
Salesforce username (username/password or JWT flow) | Conditional |
SF_PASSWORD |
Salesforce password (username/password flow) | Conditional |
SF_SECURITY_TOKEN |
Security token appended to password | No |
SF_CONSUMER_RSA_PEM |
PEM-encoded RSA private key (JWT bearer flow) | Conditional |
SF_API_VERSION |
Salesforce REST API version (default: v60.0) |
No |
At least one complete authentication flow must be configured:
- JWT bearer:
SF_USERNAME+SF_CONSUMER_RSA_PEM - Username/password:
SF_USERNAME+SF_PASSWORD+SF_CLIENT_SECRET - Client-credentials:
SF_CLIENT_SECRET(withoutSF_USERNAME)
MegaLinter's OSV scan remains blocking. Its bundled Go 1.26-era analyzer cannot load this service's Go 1.27 module, so vulnerability findings fall back to version matching. Upgrading that analyzer is tracked in lfx-self-serve#6097; do not disable scanning or downgrade the service's Go minor to work around it.
When a scanner table appears to report an installed version as already fixed, inspect the complete affected ranges in its JSON output and the source advisory:
osv-scanner scan source --format json \
--experimental-exclude .git --experimental-exclude api/salesforce \
--experimental-exclude gen --experimental-exclude megalinter-reports \
--recursive .The verified GO-2026-6278 record at Go vulnerability-database
revision 0db6d52 (2026-11-23) includes a reintroduced range starting at WebSocket
v1.5.3, fixed at v1.5.4-0.20240701034025-d67f41855da4. The
upstream fix postdates the v1.5.3 tag, so this module pins
that exact fix commit rather than suppressing the advisory. A single fixed-version
table cell or stale lookup response is not evidence that a package is unaffected.
Copyright The Linux Foundation and each contributor to LFX.
This project's source code is licensed under the MIT License. A copy of the
license is available in LICENSE.
This project's documentation is licensed under the Creative Commons Attribution
4.0 International License (CC-BY-4.0). A copy of the license is available in
LICENSE-docs.