-
Notifications
You must be signed in to change notification settings - Fork 1k
JavaScript Snippet injection #6381
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
|
/easycla |
Content length
9f8a263 to
1a0198f
Compare
1a0198f to
b59e83e
Compare
Member
|
closing in favor of #7650 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Open Questions
1. Character encoding
<head>tag characters is split across two bytes in some character encoding?<hand we think it looks like the beginning of a head tag?2. What if ServletOutputStream delegates to another ServletOutputStream?
Currently the instrumentation may inject the snippet twice.
Thoughts: Could use ThreadLocal to suppress duplicate injection?
Future Work
1. Content Type set after calling getOutputStream or getWriter
Currently, injection is not performed in this case.
Cases: static html and JSP
Possible solution: as soon as the content type is being set, create injection state and connect the
state to servlet out put stream and print writer
2. Support Netty
3. Support Servlet 5
4. Handle spaces in tag ex:< head >
5. Add tests for multibyte character encodings, e.g. Chinese
6. Send back traceId for the server request to the browser, so that you can associate the page to the original request
Thoughts: Splunk distro sends header back to the browser in Server-Timing header
a W3C draft proposal https://github.com/w3c/trace-context/blob/main/spec/21-http_response_header_format.md