Skip to content

Commit

Permalink
Fix personal settings XSS/URL test
Browse files Browse the repository at this point in the history
  • Loading branch information
elsmr committed Aug 16, 2024
1 parent 96e222c commit 22606e6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/33-settings-personal.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('Personal Settings', () => {
cy.getByTestId('personal-data-form').find('input[name="firstName"]').clear().type(name);
cy.getByTestId('personal-data-form').find('input[name="lastName"]').clear().type(name);
cy.getByTestId('save-settings-button').click();
errorToast().should('contain', 'Malicious firstName | Malicious lastName');
errorToast().should('contain', 'Potentially malicious string | Potentially malicious string');
errorToast().find('.el-notification__closeBtn').click();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('NoUrl', () => {
const entity = new Entity();

describe('URLs', () => {
const URLS = ['http://google.com', 'www.domain.tld'];
const URLS = ['http://google.com', 'www.domain.tld', 'n8n.io'];

for (const str of URLS) {
test(`should block ${str}`, async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/validators/no-url.validator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ValidationOptions, ValidatorConstraintInterface } from 'class-validator';
import { registerDecorator, ValidatorConstraint } from 'class-validator';

const URL_REGEX = /^(https?:\/\/|www\.)/i;
const URL_REGEX = /^(https?:\/\/|www\.)|(\.[\p{L}\d-]+)/iu;

@ValidatorConstraint({ name: 'NoUrl', async: false })
class NoUrlConstraint implements ValidatorConstraintInterface {
Expand Down

0 comments on commit 22606e6

Please sign in to comment.