fix(email-connectors): validate Mailchimp datacenter segment and require non-empty listId in upsertSubscriber
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Start with packages/email-connectors/src/adapters/mailchimp.adapter.ts, focusing on extractDatacenter and upsertSubscriber as identified in the issue. Check the existing adapter behavior and related tests, if present. Done means valid API keys still work, invalid datacenter segments produce a clear error, and an empty list ID returns the specified failure result.
Written by the indexing model from the issue text.
Description
Problem Description
In packages/email-connectors/src/adapters/mailchimp.adapter.ts:
extractDatacenter(lines 12-18) readsparts[1]instead of the trailing segment (parts[parts.length - 1]) and does not validate that the datacenter matches Mailchimp's format (/^[a-z]{2}\d+$/i, e.g.,us14), allowing malformed keys to inject arbitrary host prefixes intohttps://${dc}.api.mailchimp.com/3.0or silently fall back tous1.upsertSubscriber(lines 90-106) does not guard against an emptylistId, resulting in a malformedPUT /lists//members/...request (404).
Expected Behavior
extractDatacenterextracts the last hyphen-separated segment and validates/^[a-z]{2}\d+$/i, throwing a clear error on invalid Mailchimp API keys.upsertSubscriberreturns{ success: false, error: 'Mailchimp list ID is required.' }whenlistIdis empty.- All valid Mailchimp API keys (
<key>-<dc>) continue to work identically.
Where to Look
packages/email-connectors/src/adapters/mailchimp.adapter.ts(extractDatacenterlines 12-18,upsertSubscriberlines 90-106)
Solution / Implementation Guide
- In
extractDatacenter(apiKey: string):- Trim
apiKey, split on'-', takeconst dc = parts[parts.length - 1]?.trim(), and validate/^[a-z]{2}\d+$/i.test(dc)(throw anError('Invalid Mailchimp API key format (expected <key>-<dc>)')if invalid).
- Trim
- In
upsertSubscriber:- Add an early guard
if (!listId?.trim()) return { success: false, error: 'Mailchimp list ID is required.' };before building the request URL.
- Add an early guard
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 1
- Avg merge
- 6m
- Merged PRs (30d)
- 27
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sumamakhan761/tryinstance
-
backend good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
sumamakhan761/tryinstance#64 ·
Maintainers usually reply within 1 day
-
backend good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
sumamakhan761/tryinstance#63 ·
Maintainers usually reply within 1 day
-
backend good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
sumamakhan761/tryinstance#62 ·
Maintainers usually reply within 1 day
-
backend good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
sumamakhan761/tryinstance#60 ·
Maintainers usually reply within 1 day
-
backend bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
sumamakhan761/tryinstance#59 ·
Maintainers usually reply within 1 day
All issues in sumamakhan761/tryinstance
Similar issues
-
prio:low scope:hud
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
OliverRomhagen/vrigstad-joyride#953 ·
Maintainers usually reply within 1 day
-
review-followup
Difficulty 1/5 Under an hour Newbie friendliness 92/100
griffinwork40/agent-afk#5446 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
kacper-szewczyk/Ticknest#346 ·
Maintainers usually reply within 1 day
-
echarts geo: a GeoJSON URL that returns 200 with a body that is not JSON is fetched on each refreshOpenbug plugin/echarts/geo
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Yeachan-Heo/gajae-code#8230 ·
Maintainers usually reply within 1 day