-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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(core): prevent renaming global providers and modules in the repl #9720
Merged
kamilmysliwiec
merged 4 commits into
nestjs:feat/repl
from
micalevisk:feat/repl-fix-injections
Jun 15, 2022
Merged
fix(core): prevent renaming global providers and modules in the repl #9720
kamilmysliwiec
merged 4 commits into
nestjs:feat/repl
from
micalevisk:feat/repl-fix-injections
Jun 15, 2022
Conversation
This file contains 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
micalevisk
commented
Jun 2, 2022
micalevisk
changed the title
fix(core): prevents renaming global providers and modules in the repl
fix(core): prevent renaming global providers and modules in the repl
Jun 2, 2022
micalevisk
force-pushed
the
feat/repl-fix-injections
branch
from
June 3, 2022 00:06
4487924
to
b1d3d48
Compare
by marking them as a read-only properties of `globalThis` obj
micalevisk
force-pushed
the
feat/repl-fix-injections
branch
from
June 3, 2022 00:13
b1d3d48
to
a2732a4
Compare
Pull Request Test Coverage Report for Build 60be6c3c-e300-4424-82bf-b2b719b4098f
💛 - Coveralls |
micalevisk
force-pushed
the
feat/repl-fix-injections
branch
2 times, most recently
from
June 4, 2022 22:44
bf25d6b
to
ed766bb
Compare
micalevisk
commented
Jun 4, 2022
packages/core/repl/repl.ts
Outdated
import { ReplContext } from './repl-context'; | ||
import { ReplLogger } from './repl-logger'; | ||
|
||
function copyInto(target, source): void { |
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.
we need this utility because Object.assign
won't copy property's descriptors
I could extract this to another file
micalevisk
force-pushed
the
feat/repl-fix-injections
branch
from
June 4, 2022 22:56
ed766bb
to
2c4aa9f
Compare
Tony133
approved these changes
Jun 5, 2022
micalevisk
commented
Jun 5, 2022
12 tasks
LGTM |
Great job @micalevisk! |
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.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
and I believe the above shouldn't be allowed as there's no way (I guess) to recover those classes references
What is the new behavior?
mark those injected classes as a read-only properties on
replServer.context
obj. There's no need to useglobalThis
anymore 🎉 as of nowReplContext
isn't aware of the server context that it will be used. Instead,replServer
must pollute their global scopeThe goal here is to improve UX. Now users couldn't change those references accidentally
Does this PR introduce a breaking change?