Antd Less creates global JavaScript leaks
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Version
3.6.4
Environment
Mac Node.js
Reproduction link
https://github.com/ant-design/ant-design
Steps to reproduce
I’m a maintainer of Less. There were some reported issues of using Antd with Less 3.x. I decided to try adding ant-design to Less tests. But immediately a global leak was detected by Less tests. I got the error message: Global leak detected: colorEasing, tinycolor, colorPalette
It seems that the Less files, when Inline JavaScript is enabled, add functions to the global object.
What is expected?
Less style files should not manipulate or leak into the global object.
What is actually happening?
colorEasing, tinycolor, colorPalette
are leaking globally.
If you need help with creating a proper Less plugin (Inline JavaScript is discouraged for security and leak reasons like this), you can ask questions here: https://gitter.im/less/less.js
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Antd Less creates global JavaScript leaks #11097 - Issuehunt
Less style files should not manipulate or leak into the global object. What is actually happening? colorEasing, tinycolor, colorPalette are leaking globally. If ......
Read more >Can't import Antd single component without messing up with ...
I'd like to import a few components from the Ant Design React CSS library but I can't manage to get it working. I...
Read more >Getting Started - Ant Design
Ant Design React is dedicated to providing a good development experience for programmers. Before starting, it is recommended to learn React and ES2015...
Read more >Configure less with ant design in React | by Sunil kumar Banjare
npm install antd @craco/craco craco-antd craco-less less-loader --save. Step 4: Create a new file craco.config.js in same level where your ...
Read more >How to use Ant Design with Next.js - LogRocket Blog
Using the next-plugin-antd-less and babel-plugin-import packages and adding some config, we can achieve this. ... After installation, create .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tylik1 This isn’t directly related to the inline JavaScript issue. This is what that inline JavaScript is doing (leaking into the global namespace), which is its own problem. So this isn’t so much a security vulnerability issue as a performance / memory issue. Antd shouldn’t be calling “Less” code that then has embedded JS code that is injecting vars globally into the Node runtime. There are layers of bad practices here.
Is the antd team bailing on this issue? I see the PR to resolve was closed rather unceremoniously (https://github.com/ant-design/ant-design/pull/20470) and switching
javascriptEnabled
tofalse
in my webpack.config throws errors for.bezierEasingMixin();
.