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

[vulnerability][acl] ACL is skipped for tag function of template literals #348

Closed
t2ym opened this issue Mar 8, 2020 · 0 comments
Closed

Comments

@t2ym
Copy link
Owner

t2ym commented Mar 8, 2020

[vulnerability][acl] ACL is skipped for tag function of template literals

Root Cause

  • Described in the issue title

Reproducible Code

tag`\template ${param} string`; // calls to tag is not hooked

Fix

  • Transform tagged template literals into hooked function calls
__hook__(tag, null, 
  [((s,r)=>{s.raw=r; return s})(['\template ', ' string'], ['\\template ', ' string']), param], 
  __context__[0], 0);
  • The 1st argument is an array of "cooked" template strings with "raw" property for "raw" template strings to support String.raw tag function
String.raw`C:\raw\path\to\file.js` === 'C:\\raw\\path\\to\\file.js'
  • In a with clause, transform with hooked call to with-scoped variable
__hook__('w()', __with__, ['tag', 
  [((s,r)=>{s.raw=r; return s})(['\template ', ' string'], ['\\template ', ' string']),
    param], 
    (...args) => tag(...args), tag],
  __context__[0]);
t2ym added a commit that referenced this issue Mar 8, 2020
…erals, Fix #349 with function calls, Fix #350 local function calls in with clause
@t2ym t2ym closed this as completed in 8c167b5 Mar 8, 2020
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

No branches or pull requests

1 participant