feat(onboarding): verify Cloud Manager program via connector (SITES-47815)#2829
Draft
alinarublea wants to merge 1 commit into
Draft
feat(onboarding): verify Cloud Manager program via connector (SITES-47815)#2829alinarublea wants to merge 1 commit into
alinarublea wants to merge 1 commit into
Conversation
…7815)
During onboarding, api-service derives programId/environmentId purely from a
regex on the AEM CS preview hostname (extractDeliveryConfigFromPreviewUrl),
never checked against Cloud Manager. CM's private API is not directly
reachable from api-service's own network, so this adds a client that invokes
a dedicated connector Lambda and best-effort verifies the program.
- src/support/cloud-manager.js: CloudManagerClient (sync Lambda.invoke of the
connector) + createCloudManagerClient(context). Methods degrade gracefully
(never throw): when CM_CONNECTOR_FUNCTION_NAME is unset or the invoke fails,
verifyProgram returns { verified:false, degraded:true } and onboarding
proceeds on the regex-derived values.
- src/support/utils.js: queueDeliveryConfigWriter (post-ack, off the Slack 3s
window) verifies the program and stamps additive `programVerified` telemetry
onto the delivery-config-writer SQS payload.
- test: 13 unit tests for the client.
Requires the connector Lambda + its invoke permission and
CM_CONNECTOR_FUNCTION_NAME in the deploy env; until then it is a no-op. Draft.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
This PR will trigger a minor release when merged. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
What
During onboarding, api-service derives
programId/environmentIdpurely from a regex on the AEM CS preview hostname (extractDeliveryConfigFromPreviewUrl) — they are never checked against Cloud Manager. CM's private API is not directly reachable from api-service's own network, so this adds a client that invokes a dedicated connector Lambda and best-effort verifies the program before the delivery-config-writer job is queued.See SITES-47815.
Changes
src/support/cloud-manager.js—CloudManagerClient(synchronousLambda.invokeof the connector via@aws-sdk/client-lambda, already a dependency) +createCloudManagerClient(context). All methods degrade gracefully (never throw to the caller): whenCM_CONNECTOR_FUNCTION_NAMEis unset, or the invoke fails (e.g. before permissions/config land),verifyProgramreturns{ verified:false, degraded:true }and onboarding proceeds on the regex-derived values.src/support/utils.js—queueDeliveryConfigWriter(the post-ack onboarding path, so the call's latency is off the Slack 3s window) verifies the program and stamps additiveprogramVerifiedtelemetry onto the SQS payload.verifyProgramverified / not-verified / degraded, factory).Why a synchronous invoke (not SQS)
programId/environmentIdare needed inline to build the delivery-config-writer payload. The onboarding modal alreadyack()s before this heavy work, so a few-second call fits.@aws-sdk/client-lambdawas already a declared dependency.Validation
npm run lintclean · new client test 13 passing ·utils.test.js(123) and theplg-onboardingsuite (422) still green — graceful degradation means no behavior change while the connector is unconfigured.Before un-drafting
The connector service must be deployed and reachable, its invoke permission granted to api-service's role, and
CM_CONNECTOR_FUNCTION_NAMEset in the deploy env.Follow-up (not here)
Once verification is trusted, resolve
environmentId/authorURLfrom Cloud Manager instead of the hostname regex — this PR only verifies the program to keep the change small and safe.🤖 Generated with Claude Code