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

Send lines to highlight in trace [trace viewing 1/2] #658

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abishekvashok
Copy link
Contributor

Summary:
Adds feature in Pysa playground to view trace. After computation of taint-output.json file, send the results to Pysa frontend.

Modifies existing cache approach to make it more modular and add support for caching annotations as well.

Adds Github actions CI tests (in existing pysa action) to make sure the code for parsing the taint_config doesn't go out of date as the format of taint-output.json changes often. Existing pysa test was used because it already runs pysa from source code on delibrately_vulnerable_flask_app, and adding a same action with just few more lines to the pysa test doesn't really make much sense.

Signed-off-by: Abishek V Ashok [email protected]

Differential Revision: D38980480

Summary:
Adds feature in Pysa playground to view trace. After computation of taint-output.json file, send the results to Pysa frontend.

Modifies existing cache approach to make it more modular and add support for caching annotations as well.

Adds Github actions CI tests (in existing pysa action) to make sure the code for parsing the taint_config doesn't go out of date as the format of taint-output.json changes often. Existing pysa test was used because it already runs pysa from source code on `delibrately_vulnerable_flask_app`, and adding a same action with just few more lines to the pysa test doesn't really make much sense.

Signed-off-by: Abishek V Ashok <[email protected]>

Differential Revision: D38980480

fbshipit-source-id: bbb8b60bae73c0005625c10f7e0abd1e38227837
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D38980480

cache_contents = _get_cache_contents(cache_file_path).split("\n")
run_status = cache_contents.pop(0)
cache_contents = _get_cache_contents(cache_file_path)
run_status = cache_contents["return_code"]

Check failure

Code scanning / Pyre

Incompatible parameter type

Incompatible parameter type [6]: In call `str.__getitem__`, for 1st positional only parameter expected `Union[slice, SupportsIndex]` but got `str`.
run_status = cache_contents.pop(0)
cache_contents = _get_cache_contents(cache_file_path)
run_status = cache_contents["return_code"]
lines = cache_contents["lines"]

Check failure

Code scanning / Pyre

Incompatible parameter type

Incompatible parameter type [6]: In call `str.__getitem__`, for 1st positional only parameter expected `Union[slice, SupportsIndex]` but got `str`.
cache_contents = _get_cache_contents(cache_file_path)
run_status = cache_contents["return_code"]
lines = cache_contents["lines"]
annotations = cache_contents["annotations"]

Check failure

Code scanning / Pyre

Incompatible parameter type

Incompatible parameter type [6]: In call `str.__getitem__`, for 1st positional only parameter expected `Union[slice, SupportsIndex]` but got `str`.
Comment on lines +15 to +32
def test_parser(self):
expected_output = {}
expected_output_file_path = Path(
os.getcwd() / "taint_output_parsed.expected.json"
)
self.assertTrue(
expected_output_file_path.exists() and expected_output_file_path.is_file()
)
with expected_output_file_path.open() as expected_output_file:
expected_output_file = json.loads(expected_output_file.read())
taint_output_file_path = Path(os.getcwd() / "taint_output.json")
self.assertTrue(
taint_output_file_path.exists() and taint_output_file_path.is_file()
)
self.assertEqual(
_parse_annotations_from_taint_output(taint_output_file_path),
expected_output,
)

Check failure

Code scanning / Pyre

Missing return annotation

Missing return annotation [3]: Returning `None` but no return type is specified.
def test_parser(self):
expected_output = {}
expected_output_file_path = Path(
os.getcwd() / "taint_output_parsed.expected.json"

Check failure

Code scanning / Pyre

Unsupported operand

Unsupported operand [58]: `/` is not supported for operand types `str` and `str`.
)
with expected_output_file_path.open() as expected_output_file:
expected_output_file = json.loads(expected_output_file.read())
taint_output_file_path = Path(os.getcwd() / "taint_output.json")

Check failure

Code scanning / Pyre

Unsupported operand

Unsupported operand [58]: `/` is not supported for operand types `str` and `str`.
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.

None yet

2 participants