Repository navigation
Harden customer portal plan validation and outbound requests - #22
Merged
Merged
Conversation
## Context Several code paths accepted input more broadly than the UI or configuration intended. ## Description - Share the customer portal plan visibility rules between the available plans resolver and the portal subscription mutations, and escape LIKE wildcards in product key lookups. - Resolve and check outbound destinations for webhook endpoints and Okta hosts, pin connections to the checked address, and validate on save and on send. LAGO_OUTBOUND_ALLOW_PRIVATE disables the checks outside production. - Apply the signup setting and a per-user limit to organization creation. - Add a white_label API key permission resource. - Bind white-label gate links to a nonce rotated on acceptance and reset, and stop falling back to the customer portal on repeat visits. - Restrict portal return_to to LAGO_PORTAL_RETURN_TO_HOSTS. - Limit the image build workflow to the main branch.
Regenerated by running all migrations on a fresh database and dumping with db:schema:dump (pg_dump 15).
Records created in around hooks were resolved before the before-hook stub was installed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tightens input handling in the customer portal, outbound HTTP calls, organization creation, the white-label API and the white-label agreement gate.
Customer portal plans
CustomerPortal::AvailablePlansQueryholds the plan visibility rules (top-level,self_serve, nothidden_in_portal,visible_to_products). ThecustomerPortalAvailablePlansresolver and the portalcreate/changePlanmutations now share it, so the server accepts exactly the plans the portal lists.product_keylookups escape LIKE wildcards.execution_errorsignature.Outbound HTTP
LagoHttpClient::OutboundUrlGuardresolves the destination host and only allows public addresses (IPv4 and IPv6, including IPv4-mapped/NAT64/6to4 forms).LagoHttpClient::Clientacceptsrestrict_outbound: true. With it, the connection is pinned to the checked address (Host header and SNI keep the hostname), the proxy is turned off, and redirects are not followed.LAGO_OUTBOUND_ALLOW_PRIVATE=trueturns the checks off for local development. It has no effect in production.Organization creation
createOrganizationfollowsLAGO_DISABLE_SIGNUP: when signup is disabled, only users who are already admin of an organization can create one.LAGO_MAX_ORGANIZATIONS_PER_USERorganizations (default 10).White-label
white_labelAPI key permission resource.provisionandresetneed write access andagreementsneeds read access. A migration grants it to existing keys that already have full access.signing_urlis no longer returned. A repeat visit to the gate goes back to Stripe checkout only and never falls back to the customer portal.Customer portal URL
return_tois kept only if its host is listed inLAGO_PORTAL_RETURN_TO_HOSTS(comma-separated,*.example.comsupported). Otherwise it is dropped.CI
build-and-pushonly runs forrefs/heads/mainin this repository.New configuration
LAGO_PORTAL_RETURN_TO_HOSTSreturn_toLAGO_MAX_ORGANIZATIONS_PER_USER10LAGO_OUTBOUND_ALLOW_PRIVATEMigrations
AddWhiteLabelToFullAccessApiKeys(data, reversible)AddTokenNonceToWhiteLabelAgreements(nullable column)Tests
New and updated specs cover the plan query, the portal mutations, the outbound guard and client, webhook endpoints, Okta, organization creation, white-label agreements, the gate, the API permissions and portal URL generation.