Skip to content

Conversation

@Napalys
Copy link
Contributor

@Napalys Napalys commented Mar 18, 2025

This pull request adds package modeling for underscore.string.

@Napalys Napalys force-pushed the js/underscore-string branch 2 times, most recently from b299373 to 3a069f9 Compare March 18, 2025 10:35
Co-authored-by: Asgerf <asgerf@github.com>
@Napalys Napalys force-pushed the js/underscore-string branch from 3a069f9 to 922a07d Compare March 18, 2025 11:58
@Napalys Napalys marked this pull request as ready for review March 18, 2025 17:20
@Napalys Napalys requested a review from a team as a code owner March 18, 2025 17:20
extensible: summaryModel
data:
- ["'underscore.string'", "Member[slugify,capitalize,decapitalize,clean,cleanDiacritics,swapCase,escapeHTML,unescapeHTML,wrap,dedent,reverse,pred,succ,titleize,camelize,classify,underscored,dasherize,humanize,trim,ltrim,rtrim,truncate,sprintf,strRight,strRightBack,strLeft,strLeftBack,stripTags,unquote,map]", "Argument[0]", "ReturnValue", "taint"]
- ["'underscore.string'", "Member[chop,chars,words,lines]", "Argument[0]", "ReturnValue", "taint"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ["'underscore.string'", "Member[chop,chars,words,lines]", "Argument[0]", "ReturnValue", "taint"]
- ["'underscore.string'", "Member[chop,chars,words,lines]", "Argument[0]", "ReturnValue.ArrayElement", "taint"]

This is a bit more precise.

If the whole return value is tainted, the analysis thinks all its properties are tainted too, including .length. You could try adding the test:

sink(s.chop(source("s1"), 3).length);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there is still something off with ArrayElement f4ca2dc?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the tests have a typo, they should access the [0] on the returned array, not on the source string:

sink(s.chars(source("s2")[0])) -> sink(s.chars(source("s2"))[0])

I know why the last test is failing but it's complicated. Would you mind leaving it as MISSING: for now?

@Napalys Napalys requested a review from asgerf March 20, 2025 11:38
@Napalys Napalys merged commit 730580a into github:main Mar 20, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants