Skip to content

Commit 436331a

Browse files
authored
Add tsec script to all packages (#8285)
Added the `yarn trusted-type-check` script to all packages. The script runs https://github.com/google/tsec to report possible security issues related to XSS.
1 parent 92a39b5 commit 436331a

File tree

35 files changed

+56
-8
lines changed

35 files changed

+56
-8
lines changed

config/tsconfig.base.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
"target": "es5",
2626
"typeRoots": [
2727
"../node_modules/@types"
28+
],
29+
"plugins": [
30+
{
31+
"name": "tsec",
32+
"reportTsecDiagnosticsOnly": true
33+
}
2834
]
2935
}
3036
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"test:changed": "ts-node-script scripts/ci-test/test_changed.ts",
3939
"test:setup": "node tools/config.js",
4040
"test:saucelabs": "node scripts/run_saucelabs.js",
41+
"trusted-type-check": "lerna run --scope @firebase/* trusted-type-check --no-bail",
4142
"docgen": "ts-node-script scripts/docgen/docgen.ts",
4243
"docgen:compat": "node scripts/docgen-compat/generate-docs.js --api js",
4344
"docgen:all": "yarn docgen devsite && yarn docgen toc",
@@ -151,6 +152,7 @@
151152
"terser": "5.16.1",
152153
"ts-loader": "9.5.1",
153154
"ts-node": "10.9.1",
155+
"tsec": "0.2.8",
154156
"tslint": "6.1.3",
155157
"typedoc": "0.16.11",
156158
"typescript": "4.7.4",

packages/analytics-compat/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:browser",
5050
"test:browser": "karma start --single-run",
5151
"test:browser:debug": "karma start --browsers=Chrome --auto-watch",
52+
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
5253
"add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../analytics/dist/analytics-public.d.ts -o dist/src/index.d.ts -a -r Analytics:FirebaseAnalytics -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/analytics"
5354
},
5455
"typings": "dist/src/index.d.ts",

packages/analytics/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all",
3232
"test:browser": "karma start --single-run --nocache",
3333
"test:integration": "karma start ./karma.integration.conf.js --single-run --nocache",
34+
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
3435
"api-report": "api-extractor run --local --verbose",
3536
"doc": "api-documenter markdown --input temp --output docs",
3637
"build:doc": "yarn build && yarn doc",

packages/app-check-compat/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"test": "run-p --npm-path npm lint test:browser",
3030
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:browser",
3131
"test:browser": "karma start --single-run --nocache",
32+
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
3233
"add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../app-check/dist/app-check-public.d.ts -o dist/src/index.d.ts -a -r AppCheck:FirebaseAppCheck -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/app-check"
3334
},
3435
"peerDependencies": {

packages/app-check/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"test": "run-p --npm-path npm lint test:browser",
3030
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:browser",
3131
"test:browser": "karma start --single-run --nocache",
32+
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
3233
"api-report": "api-extractor run --local --verbose",
3334
"doc": "api-documenter markdown --input temp --output docs",
3435
"build:doc": "yarn build && yarn doc",

packages/app-compat/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"test:browser": "karma start --single-run",
3636
"test:browser:debug": "karma start --browsers Chrome --auto-watch",
3737
"test:node": "TS_NODE_FILES=true TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha test/**/*.test.* src/**/*.test.ts --config ../../config/mocharc.node.js",
38+
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
3839
"api-report": "api-extractor run --local --verbose",
3940
"typings:public": "node ../../scripts/build/use_typings.js ./dist/app-compat-public.d.ts"
4041
},

packages/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"test:all": "run-p --npm-path npm test:browser test:node",
3232
"test:browser": "karma start --single-run",
3333
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.ts --config ../../config/mocharc.node.js",
34+
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
3435
"api-report": "api-extractor run --local --verbose",
3536
"doc": "api-documenter markdown --input temp --output docs",
3637
"build:doc": "yarn build && yarn doc",

packages/auth-compat/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"test:node:integration": "ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --integration",
4545
"test:webdriver": "rollup -c test/integration/webdriver/static/rollup.config.js && ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --webdriver",
4646
"test:integration": "firebase emulators:exec --project demo-emulatedproject --only auth \"run-s --npm-path npm test:browser:integration test:node:integration test:webdriver\"",
47+
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
4748
"add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../auth/dist/auth-public.d.ts -o dist/auth-compat/index.d.ts -a -r Auth:types.FirebaseAuth -r User:types.User -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/auth"
4849
},
4950
"peerDependencies": {

packages/auth/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
"test:node:integration": "ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --integration",
112112
"test:node:integration:local": "ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --integration --local",
113113
"test:webdriver": "rollup -c test/integration/webdriver/static/rollup.config.js && ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --webdriver",
114+
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
114115
"api-report": "api-extractor run --local --verbose --config ./api-extractor.json && api-extractor run --local --verbose --config ./web-extension/api-extractor.json && api-extractor run --local --verbose --config ./cordova/api-extractor.json",
115116
"doc": "api-documenter markdown --input temp --output docs",
116117
"build:doc": "yarn build && yarn doc",

0 commit comments

Comments
 (0)