Skip to content
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

strings.stripTags() uses simple regex and is therefore unsafe #314

Closed
botic opened this issue Nov 21, 2015 · 3 comments
Closed

strings.stripTags() uses simple regex and is therefore unsafe #314

botic opened this issue Nov 21, 2015 · 3 comments

Comments

@botic
Copy link
Member

botic commented Nov 21, 2015

There are a lot of references why the current regex is insufficient to strip tags from a string:

What to do about stripTags? I only see a chance to enhance it or to drop it and separate packages can do the job. IMHO the stripTags() approach is broken by design, since an application should normally escape the user input and not call strip tags, since a user might want to display for some reason.

As an alternative I suggest to port striptags to ringo/utils/strings. It's MIT-based license is compatible with Ringo's Apache License.

@botic botic added this to the 0.12 milestone Nov 21, 2015
@botic
Copy link
Member Author

botic commented Nov 21, 2015

Btw. the current unit test is ridiculous:

exports.testStripTags = function () {
    assert.strictEqual('content', strings.stripTags('<tag>content</tag>'));
};

@grob
Copy link
Member

grob commented Nov 22, 2015

👍 for dropping stripTags.

@botic
Copy link
Member Author

botic commented Nov 23, 2015

I think this can be done together with dropping unwrap() from #311, or?

@botic botic closed this as completed in c1c7ca0 Nov 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants