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

Google flagging DT tables as virus/malware? #1080

Closed
gorkang opened this issue Aug 29, 2023 · 11 comments
Closed

Google flagging DT tables as virus/malware? #1080

gorkang opened this issue Aug 29, 2023 · 11 comments
Assignees

Comments

@gorkang
Copy link

gorkang commented Aug 29, 2023

Starting a few days ago, after sharing in Google Drive Rmarkdown html reports with a few DT::datatable() tables, I received emails from Google Drive Safety (drivesafety-noreply@google.com) with the following content:

Your file may violate Google Drive's Terms of Service

"report_DF_clean.html" contains content that may violate Google Drive's Malware and Similar Malicious Content policy. Some features related to this file may have been restricted. If you think this is an error and would like the Trust & Safety team to review this file, request a review below.

The html report in question is just a bunch of DT::datatable() tables in tabsets.

Afterwards, I received a second email from Google Policy Violation Warning telling me If this behavior continues, your access to this product may be disabled. (this product being Google Drive).

I posted the issue in community.rstudio and Kim.Cressman pointed a related issue when attaching html files with DT tables inside in Gmail.

Any idea about what is happening and how to avoid it? Not being able to share the html reports with DT tables inside, and/or risking losing access to Google Drive is very disrupting...

Thanks in advance!


By filing an issue to this repo, I promise that

  • [ x ] I have fully read the issue guide at https://yihui.org/issue/.
  • [ x ] I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('DT'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/DT').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • [ x ] I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@philibe
Copy link

philibe commented Aug 29, 2023

Have you a reproducible example (reprex) ?

If your html is from DT, the issue could be from :

If your html is from Rmarkdown, the issue could be from :

In general html files are blocked when there is lot of javascript within.

PS: I am simple developer, not from rstudio/DT team.

@gorkang
Copy link
Author

gorkang commented Aug 29, 2023

Hi @philibe . I believe there is nothing special about the file causing issues other than the DT datatables and a ggplot.

In any case, here it is: report_PROBLEMS.zip

Googling around, it seems jQuery 3.6.0 (the version embedded in the html created) seems to have some sort of security issue: jquery/jquery#5062

Maybe an update to the jQuery library used by DT is needed?

@gorkang
Copy link
Author

gorkang commented Aug 29, 2023

After some more digging, I started deleting bits from the html file (report_VIRUS.html) inside reports.zip, and attempting to attach the resulting file to a gmail message.

The original file would trigger a "Virus detected!" message.

Getting rid of the jQuery code, and any others I tried, did not solve the issue.

The completely absurd way to get rid of the problem was to delete the following comment (yes, only the comment):

// some helper functions: using a global object DTWidget so that it can be used
// in JS() code, e.g. datatable(options = list(foo = JS('code'))); unlike R's
// dynamic scoping, when 'code' is eval()'ed, JavaScript does not know objects
// from the "parent frame", e.g. JS('DTWidget') will not work unless it was made
// a global object

That is the only difference between the two files attached.

The resulting file report_OK.html passes the Gmail virus detection:

Screenshot from 2023-08-29 14-26-32

@yihui
Copy link
Member

yihui commented Aug 29, 2023

That's funny... Thanks a lot for the investigation! Could you try to only delete eval() in the comment and see if it still triggers the message?

@gorkang
Copy link
Author

gorkang commented Aug 29, 2023

Oh, just for fun, I was curious about what exact part in that comment was causing the issues.

And of course, is the eval() bit.

So, this will cause the issue;

// dynamic scoping, when 'code' is eval()'ed, JavaScript does not know objects

But this is completely fine

// dynamic scoping, when 'code' is eval'ed, JavaScript does not know objects

@gorkang
Copy link
Author

gorkang commented Aug 29, 2023

That's funny... Thanks a lot for the investigation! Could you try to only delete eval() in the comment and see if it still triggers the message?

Oh, you posted this just as I was trying that and responding! :)

@yihui
Copy link
Member

yihui commented Aug 29, 2023

Okay, I'll get rid of () :)

@gorkang
Copy link
Author

gorkang commented Aug 29, 2023

Okay, I'll get rid of () :)

Let me know if you want me to do a Pull request! 🤣 (kidding, of course)

Thanks!

@philibe
Copy link

philibe commented Aug 29, 2023

IMHO it's too heavy (11Mo of rds), too complex html (many many js in html).

Instead of big html:

  • Why you don't upload *.Rmd instead of html ? (for R Users)
  • Why you don't upload *.pdf from rmarkdown instead of html ?

And in html there potentially suspicious elements for Google:

I wont be surprised that Google don't like base64 javascript in uploaded html files

I don't think that Rmarkdown was thinked and usable for export in its html form within javascript Rmarkdown engine inside. Even it was thinked for that, I could understand that Google blocks sometimes these big and complex html file. :)

@yihui yihui self-assigned this Aug 29, 2023
@yihui yihui closed this as completed in 5235b34 Aug 29, 2023
@yihui
Copy link
Member

yihui commented Aug 29, 2023

Parentheses deleted. I'll make a new CRAN release soon.

gorkang added a commit to gorkang/jsPsychHelpeR that referenced this issue Aug 29, 2023
@yihui
Copy link
Member

yihui commented Aug 29, 2023

FYI the new version is on CRAN now: https://cran.r-project.org/package=DT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants