-
Notifications
You must be signed in to change notification settings - Fork 74
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
feat(transforms): add SES censorship evasion function #1812
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of exporting evadeCensor(source, sourceMap) => {source, sourceMap}
for less public coupling?
// (featuring homoglyphs for @kriskowal) | ||
.replace(IMPORT_RE, '\u{406}\u{16D6}\u{420}\u{39F}\u{13D2}\u{422}$2') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
summoning @mhofman, resident homoglyph idea haver. (I do not need credit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to use homoglyphs in addition to, uh, lulz?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They have the benefit of preserving the column numbers for subsequent code on the same line. But mostly lulz.
.replace(HTML_COMMENT_START_RE, '<!X-') | ||
.replace(HTML_COMMENT_END_RE, '-X>') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also potential homoglyph, e.g., \u2010
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also would like:
- unit test
- integration test in compartment-mapper
- refactor bundle-source in place to take on this dependency
Let’s be sure to separate the commit that changes the behavior to use homoglyphs so it can be easily reverted if necessary.
I defer to @michaelfig or @erights regarding the comment end marker escape and why we replace I have no strong feelings about how to escape homoglphys. Also worth noting that there are other evasive transforms we hope to add one day to provide better compatibility with the ecosystem, particularly transforms that break strings that have censored terms. |
@kriskowal Which unit test do you mean? |
I do not remember being aware that we changed comments this way, so I also do not remember why. If I was aware at the time, my apologies for not capturing or at least leaving more clues. |
There is none as such and we are relying on integration tests inside bundle-source for the effect. I’m willing to continue in that vein. |
For posterity: this PR does include some unit tests. |
This sounds like I'd need to copy Was the intention to rehome the entirety of |
I had not thought that many steps ahead, but that would seem to be necessary in order to decouple the public interface from the encapsulated dependencies, so I’m in favor. |
fc26c2f
to
de80b75
Compare
this is getting closer, but I need to add some more tests. I'm not sure how unit-y I can make them, though... |
7f6e715
to
059e724
Compare
@kriskowal Please let me know if my test fixtures in |
I suppose I should update |
564fe4b
to
07c843b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The substance of this change is perfect. I challenge you to consider my comments about anticipating future changes in the names and paths of functions and modules.
4e90108
to
83d0fb2
Compare
@kriskowal OK, I've
|
c44e721
to
93d3a29
Compare
linefeeds. lol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some homoglyph suggestions that should make comments look the same to a developer in a debugger without tripping the censor.
943d3b9
to
b81d6d2
Compare
OK. Don't touch anything. @kriskowal can I be done please |
8d9d2b7 was committed from windows where I am evidently not setup properly with gpg. |
Thanks, @boneskull. You’re green. Would you like to squash some or all of the commits or shall I command Github to do so on your behalf? |
… package This extracts everything from `@endo/bundle-source/src/transform.js` into a new package (formerly `@endo/transforms`). LavaMoat has need to consume the SES-censorship-evasion functionality, and it would be cumbersome to try to use `@endo/bundle-source` for this.
This jettisons `src/transform.js` and consumes `@endo/evasive-transform` instead.
This normalizes linebreaks to `lf`. Sorry, Windows contributors. Additionally, forces `.snap` and `.agar` to be binary, if not already recognized as such.
b81d6d2
to
ce8f3f0
Compare
@kriskowal Squashed |
Description
Extracts the
rewriteComment
function from@endo/bundle-source/src/transform.js
and exposes it astransformComment
in theevade-censor
export. This should be considered an experimental API.Motivation
We could use this functionality in LavaMoat itself, so extracting it into a module lighter than
@endo/bundle-source
seems appropriate.The function is not exported from the main entry point, nor documented publicly, as to avoid committing to a API we may not be ready to commit to. I can change this, if desired!
Notes
@babel/types
is added as a production dependency, because the "public" API surface depends on types from this module.README.md
Questions
CommentBlock
?