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

Remove react-json-view to solve downstream security alerts. #26852

Closed
wants to merge 172 commits into from
Closed

Remove react-json-view to solve downstream security alerts. #26852

wants to merge 172 commits into from

Conversation

codeviking
Copy link

@codeviking codeviking commented Sep 22, 2020

Several of the sites that we operate that use `@allenai/varnish`
are currently flagged with a security alert related to an out of
date version of `node-fetch`. The dependency in question traces
back to `react-json-view`. This PR removes that dependency entirely.

A careful eye might notice that the impacted `node-fetch` version is
still around in the `package-lock.json`. That's because `bisheng`
depends on an old-version of `react-router` which depends on
`create-class` which depends on an old version of `fbjs` which
depends on old version of `isomorphic-fetch` which depends on
the vulnerable version of `node-fetch`. Yikes, and I probably
missed a step or two as that was from memory.

That said it's safe to not worry about the fact that it's still
around because it's only in `devDependencies` now. That means
downstream applications won't be impacted, since they don't transitively
include `devDependencies`.

So, we net out to a package with one less transitive thing for
our clients to suck down. Turns out it wasn't even something that
was necessary too -- so we were being a bit careless and should
be more diligent about our dependency management moving forward.

I also tried to preserve some semblance of the prior UI treatment.
While there's some loss of functionality I think the new treatment
is totally ok. That said I did add a comment (and will follow up
with an issue shortly), as think this is unquestionably a place
where our docs can and should be better. Users use the `Theme` API
a lot, and there's no type safety for it given it becomes an `any`
when it crosses across the `styled-components` boundary. So it's really
important for us to make it easy for users to digest.

View rendered .github/ISSUE_TEMPLATE.md
View rendered .github/PULL_REQUEST_TEMPLATE/pr_cn.md
View rendered README-pt_BR.md
View rendered README-zh_CN.md
View rendered README.md
View rendered components/affix/demo/basic.md
View rendered components/affix/demo/debug.md
View rendered components/affix/demo/on-change.md
View rendered components/affix/demo/target.md
View rendered components/alert/demo/banner.md
View rendered components/alert/demo/basic.md
View rendered components/alert/demo/closable.md
View rendered components/alert/demo/close-text.md
View rendered components/alert/demo/custom-icon.md
View rendered components/alert/demo/description.md
View rendered components/alert/demo/error-boundary.md
View rendered components/alert/demo/icon.md

jonborchardt and others added 30 commits February 3, 2020 11:12
I couldn't run things locally because of a less error at startup.
This fixes that by:

- Fixing `@font-size-base`, as it was trying to use a Varnish
  variable that I didn't seem to have locally.
- Replace `0.75rem` with a variable reference. The variable also
  includes a unit.

Either fix in isolation didn't fix the error. I'm not sure why.
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
This ensures the build occurs prior to deploying. Previously it was
failing because `dist_varnish` didn't exist.
This removes the `--ssr` flag, which for some reason causes the
site build to fail.

I'm fairly certain it's because of `site/theme/template/Layout/Header/DemoHeader.tsx`,
which is our addition. There's probably something we have to do
to make it SSR compatible. I couldn't figure out what's wrong,
I tried lots of things (like removing `injectIntl`, etc) but couldn't
get to the root issue.

That said we're not worried about getting eyeballs on our fork
as it's an internal tool, so it seems fine to just disable SSR
and call this good.
jonborchardt and others added 24 commits August 5, 2020 18:46
Several of the sites that we operate that use `@allenai/varnish`
are currently flagged with a security alert related to an out of
date version of `node-fetch`. The dependency in question traces
back to `react-json-view`. This PR removes that dependency entirely.

A careful eye might notice that the impacted `node-fetch` version is
still around in the `package-lock.json`. That's because `bisheng`
depends on an old-version of `react-router` which depends on
`create-class` which depends on an old version of `fbjs` which
depends on old version of `isomorphic-fetch` which depends on
the vulnerable version of `node-fetch`. Yikes, and I probably
missed a step or two as that was from memory.

That said it's safe to not worry about the fact that it's still
around because it's only in `devDependencies` now. That means
downstream applications won't be impacted, since they don't transitively
include `devDependencies`.

So, we net out to a package with one less transitive thing for
our clients to suck down. Turns out it wasn't even something that
was necessary too -- so we were being a bit careless and should
be more diligent about our dependency management moving forward.

I also tried to preserve some semblance of the prior UI treatment.
While there's some loss of functionality I think the new treatment
is totally ok. That said I did add a comment (and will follow up
with an issue shortly), as think this is unquestionably a place
where our docs can and should be better. Users use the `Theme` API
a lot, and there's no type safety for it given it becomes an `any`
when it crosses across the `styled-components` boundary. So it's really
important for us to make it easy for users to digest.
@codeviking codeviking closed this Sep 22, 2020
@codeviking codeviking deleted the no-react-json-view branch September 22, 2020 04:45
@codeviking codeviking restored the no-react-json-view branch September 22, 2020 04:46
@codeviking
Copy link
Author

Oops, sorry, this was meant to be opened against our fork. Apologies for the noise!

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 096f3c2:

Sandbox Source
antd reproduction template Configuration

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

Successfully merging this pull request may close these issues.

None yet

3 participants