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

Limiter for Javascript Output, Tests, Formatting #301

Merged
merged 3 commits into from
Jan 27, 2023

Conversation

phutelmyer
Copy link
Contributor

Describe the change
With no limits set for the string fields (e.g., tokens, strings) in ScanJavascript, events have been observed with well over thousands of objects in their associated fields. While this may be useful for some use cases, by default it may be advisable to not collect so many objects. The following modification were implemented:

  • Default limit (50) for amount of strings per field to be collected from ScanJavascript session. Configurable in backend.yml
  • Strings are distinct

The following fields are limited:

  • tokens
  • keywords
  • strings
  • identifiers
  • regular_expressions

Describe testing procedures
Created test: test_scan_javascript_character_limits in test_scan_javascript.py that ensures that the limit functions properly.

Sample output

...
          "tokens":[
                "BlockComment",
                "String",
                "Punctuator",
                "Keyword",
                "Identifier",
                "LineComment",
                "RegularExpression",
            ],
            "keywords":[
               'throw', 
               'return', 
               'else', 
               'var', 
               'new'
            ]
...

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of and tested my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

@ryanohoro
Copy link
Collaborator

👍

@phutelmyer phutelmyer merged commit 28b5fc4 into master Jan 27, 2023
@phutelmyer phutelmyer deleted the scan-javascript-limiter-and-tests branch January 30, 2023 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants