Repository navigation
feat: structured credentials payload for sendEmail #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@open-iga/aws': minor | ||
| --- | ||
|
|
||
| sendEmail now takes a structured credentials payload (system, loginUrl, username, password, passwordChangeRequired) instead of free-form subject/body. The Host renders the wording from a fixed template and validates the same schema, so connectors can't use it for phishing. | ||
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
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
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
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
23 changes: 16 additions & 7 deletions
23
packages/connector-sdk/lib/iga/capabilities/email.schema.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,24 @@ | ||
| import * as z from 'zod/mini'; | ||
|
|
||
| // Email is a Host capability: the Host owns routing + transport (recipient, from-address, | ||
| // SMTP/SES connection, auth, retries, deliverability, audit). A connector supplies only the | ||
| // content, so the same capability is reused across every connector. | ||
| // SMTP/SES connection, auth, retries, deliverability, audit). | ||
| // | ||
| // The recipient (`to`) is deliberately NOT part of this payload: the Host already knows the | ||
| // target identity's address from the invocation input and injects it itself. That prevents a | ||
| // connector from redirecting credentials to an arbitrary address. | ||
| // A connector supplies structured data only, never free-form text. The Host renders the | ||
| // subject and body from a fixed plain-text template, so a connector can't write its own copy | ||
| // (e.g. "verify your account") and use the trusted sender for phishing. The recipient is also | ||
| // not part of the payload: the Host injects it from the invocation input. | ||
| // | ||
| // The Host must run this same schema on receipt, the connector-side parse is not a trust boundary. | ||
| export const emailPayloadSchema = z.object({ | ||
| subject: z.string().check(z.minLength(1)), | ||
| body: z.string().check(z.minLength(1)), | ||
| template: z.literal('credentials'), | ||
| reason: z.enum(['onboarded', 'reenabled']), | ||
| // Human-readable name of the target system, e.g. "AWS" | ||
| system: z.string().check(z.minLength(1), z.maxLength(64), z.regex(/^[^\r\n]*$/)), | ||
| loginUrl: z.url({ protocol: /^https$/ }).check(z.maxLength(2048)), | ||
| username: z.string().check(z.minLength(1), z.maxLength(256), z.regex(/^[^\r\n]*$/)), | ||
| password: z.string().check(z.minLength(1), z.maxLength(256), z.regex(/^[^\r\n]*$/)), | ||
| // Tell the user they must set a new password at first sign-in (not every system supports it) | ||
| passwordChangeRequired: z.boolean(), | ||
| }); | ||
|
|
||
| export type EmailPayload = z.infer<typeof emailPayloadSchema>; |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.