feat: template referral system in echo-start#726
Open
285729101 wants to merge 2 commits intoMerit-Systems:masterfrom
Open
feat: template referral system in echo-start#726285729101 wants to merge 2 commits intoMerit-Systems:masterfrom
285729101 wants to merge 2 commits intoMerit-Systems:masterfrom
Conversation
When scaffolding from an external template, echo-start now reads echo.config.json for a referralCode and writes it to .env.local so the OAuth flow auto-registers the template creator as referrer. Closes Merit-Systems#612
Contributor
|
@285729101 is attempting to deploy a commit to the Merit Systems Team on Vercel. A member of the Team first needs to authorize it. |
Author
Add sanitizeReferralCode() that validates referral codes from echo.config.json against a strict alphanumeric allowlist pattern before writing to .env.local. Malicious template authors could previously inject arbitrary environment variables via newlines or special characters in the referralCode field.
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
Implements #612 - Template referral system for external templates.
echo-start, the CLI now reads anecho.config.jsonfrom the template for areferralCodefield.env.localwith the appropriate framework prefix (NEXT_PUBLIC_ECHO_REFERRAL_CODE,VITE_ECHO_REFERRAL_CODE, etc.) so the OAuth flow auto-registers the template creator as the referrer on the new appecho.config.jsonis cleaned up after processing since it's template metadata, not app code{ "referralCode": "<their-code>" }inecho.config.jsonto earn referral rewards when others use their templateHow it works
echo.config.jsonto their template repo:{ "referralCode": "abc-123-def-456" }npx echo-start --template https://github.com/creator/template --app-id <id>echo-startreads the referral code, writes it to.env.local, and removes the config fileCloses #612
Test plan
echo-startwith an external template containingecho.config.jsonwithreferralCodewrites the code to.env.localecho-startwith an external template withoutecho.config.jsonworks unchangedecho.config.jsonis removed from the scaffolded project after processing