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

Fix eval #491

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

Conversation

LiteracyFanatic
Copy link
Contributor

This addresses #486. It will almost definitely have broken other places that use eval_in_node. I'll add commits fixing those later. I'll also write some guidelines on how to use the js evaluation since it's gotten a bit more complicated than before. Hopefully the end result will be more robust and rely less on parsing scripts as strings.

@codecov
Copy link

codecov bot commented Aug 23, 2020

Codecov Report

Merging #491 into master will decrease coverage by 0.26%.
The diff coverage is 22.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #491      +/-   ##
==========================================
- Coverage   18.91%   18.64%   -0.27%     
==========================================
  Files         107      107              
  Lines        4208     4140      -68     
==========================================
- Hits          796      772      -24     
+ Misses       3412     3368      -44     
Impacted Files Coverage Δ
anime_downloader/extractors/mp4upload.py 0.00% <0.00%> (ø)
anime_downloader/util.py 19.93% <50.00%> (+0.26%) ⬆️
tests/conftest.py 36.36% <0.00%> (-5.31%) ⬇️
anime_downloader/players/baseplayer.py 57.14% <0.00%> (-4.15%) ⬇️
anime_downloader/extractors/base_extractor.py 77.41% <0.00%> (-1.37%) ⬇️
anime_downloader/sites/anime.py 61.29% <0.00%> (-1.02%) ⬇️
anime_downloader/sites/animesimple.py 68.75% <0.00%> (-0.95%) ⬇️
anime_downloader/config.py 50.90% <0.00%> (-0.88%) ⬇️
anime_downloader/players/mpv.py 69.44% <0.00%> (-0.83%) ⬇️
anime_downloader/sites/animeflv.py 77.55% <0.00%> (-0.45%) ⬇️
... and 51 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6a6bf49...6c3fe34. Read the comment docs.

@Blatzar Blatzar linked an issue Aug 23, 2020 that may be closed by this pull request
@vn-ki
Copy link
Collaborator

vn-ki commented Aug 23, 2020

A fallback (with a warning) if it fails would be good.


def eval_in_node(js: str):
def eval_in_node(js: str, sandbox: str = "{}"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be transparent? We can't assume the next developer (who's going to use eval_in_node for implementing a provider) to know how to construct a sandbox string.

@Blatzar Blatzar changed the base branch from master to javascript_sandbox August 27, 2020 12:02
@ArjixWasTaken
Copy link
Collaborator

We should use https://github.com/amol-/dukpy instead, that would also remove our dependency for nodejs.

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.

Js sandbox causing errors
3 participants