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

Strict Mode Directive Rendered Unusable #1085

Open
AlexWilson-GIS opened this issue Jun 26, 2023 · 1 comment
Open

Strict Mode Directive Rendered Unusable #1085

AlexWilson-GIS opened this issue Jun 26, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@AlexWilson-GIS
Copy link

AlexWilson-GIS commented Jun 26, 2023

I am compiling Typescript to JavaScript, then compiling down to a single file for use in Github Actions with this library. The Typescript output begins like this:

"use strict";

// Begin code

However, this library inserts code before the directive, causing the final compiled output to look like this:

/******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ({

/***/ 7351:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {

"use strict";

// Begin code

This means that all code compiled by this library is not running in strict mode, because the directive must be placed on the first line of a script for global effect or the first line of a function for localized effect. While this is not directly a security vulnerability in ncc, it can have unexpected security and behavioral effects on the compiled output.

@styfle styfle added the bug Something isn't working label Jun 26, 2023
@AlexWilson-GIS
Copy link
Author

Wanted to add another detail: I was just reading the documentation for this project and saw that this library can compile TS directly, which I think is great. I was previously compiling with TS separately, then running it through this. I'll switch to just using this library 👍

That being said, compiling directly from Typescript doesn't include the "use strict"; directive either, so strict mode is still lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants