mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM-19914][PM-19913] trim domains and long fields in forwarders (#14141)
* PM-19913: Added max length to the generated_for and description peroperties in the FirefoxRelay API payload * [PM-19913] Added maxLength restriction to the website and generatedBy methods. Added maxLength limit of 200 to the description of addy.io
This commit is contained in:
@@ -55,6 +55,10 @@ describe("Addy.io forwarder", () => {
|
||||
|
||||
const result = AddyIo.forwarder.createForwardingEmail.body(null, context);
|
||||
|
||||
expect(context.generatedBy).toHaveBeenCalledWith(null, {
|
||||
extractHostname: true,
|
||||
maxLength: 200,
|
||||
});
|
||||
expect(result).toEqual({
|
||||
domain: "domain",
|
||||
description: "generated by",
|
||||
|
||||
@@ -39,7 +39,7 @@ const createForwardingEmail = Object.freeze({
|
||||
body(request: IntegrationRequest, context: ForwarderContext<AddyIoSettings>) {
|
||||
return {
|
||||
domain: context.emailDomain(),
|
||||
description: context.generatedBy(request),
|
||||
description: context.generatedBy(request, { extractHostname: true, maxLength: 200 }),
|
||||
};
|
||||
},
|
||||
hasJsonPayload(response: Response) {
|
||||
|
||||
@@ -56,6 +56,11 @@ describe("Firefox Relay forwarder", () => {
|
||||
|
||||
const result = FirefoxRelay.forwarder.createForwardingEmail.body(null, context);
|
||||
|
||||
expect(context.website).toHaveBeenCalledWith(null, { maxLength: 255 });
|
||||
expect(context.generatedBy).toHaveBeenCalledWith(null, {
|
||||
extractHostname: true,
|
||||
maxLength: 64,
|
||||
});
|
||||
expect(result).toEqual({
|
||||
enabled: true,
|
||||
generated_for: "website",
|
||||
|
||||
@@ -33,8 +33,8 @@ const createForwardingEmail = Object.freeze({
|
||||
body(request: IntegrationRequest, context: ForwarderContext<FirefoxRelaySettings>) {
|
||||
return {
|
||||
enabled: true,
|
||||
generated_for: context.website(request),
|
||||
description: context.generatedBy(request),
|
||||
generated_for: context.website(request, { maxLength: 255 }),
|
||||
description: context.generatedBy(request, { extractHostname: true, maxLength: 64 }),
|
||||
};
|
||||
},
|
||||
hasJsonPayload(response: Response) {
|
||||
|
||||
Reference in New Issue
Block a user