forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Enable tsec checks for critical packages. (angular#43108)
tsec is a static analyzer that discovers Trusted Types violations. Deploy tsec to make sure there will be no TT regression in several critical packages, including core, platform-browser, platform-server and their dependencies. Existing violations have been reviewed and exempted in packages/tsec-exemption.json. Future changes to the exemption list requires security review. PR Close angular#43108
- Loading branch information
1 parent
79eee55
commit 509031c
Showing
18 changed files
with
292 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,3 +52,6 @@ baseline.json | |
|
||
# Husky | ||
.husky/_ | ||
|
||
# tsec | ||
.tsec |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** For building //packages/animations/browser. */ | ||
{ | ||
"extends": "../../tsconfig-tsec-base.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": ".tsec", | ||
"paths": { | ||
"@angular/core": ["../../core"], | ||
"@angular/animations": ["../"] | ||
} | ||
}, | ||
"include": [ | ||
"*.ts", | ||
"src/**/*.ts" | ||
], | ||
"references": [ | ||
{"path": "../../core/tsconfig-tsec.json"}, | ||
{"path": "../tsconfig-tsec.json"} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** For building //packages/animations. */ | ||
{ | ||
"extends": "../tsconfig-tsec-base.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": ".tsec", | ||
"paths": { | ||
"@angular/core": ["../core"] | ||
} | ||
}, | ||
"include": [ | ||
"*.ts", | ||
"src/**/*.ts" | ||
], | ||
"references": [ | ||
{"path": "../core/tsconfig-tsec.json"} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** For building //packages/common/http. */ | ||
{ | ||
"extends": "../../tsconfig-tsec-base.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": ".tsec", | ||
"paths": { | ||
"@angular/core": ["../../core"], | ||
"@angular/common": [".."] | ||
} | ||
}, | ||
"include": [ | ||
"*.ts", | ||
"src/**/*.ts" | ||
], | ||
"references": [ | ||
{"path": "../../core/tsconfig-tsec.json"}, | ||
{"path": "../tsconfig-tsec.json"} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** For building //packages/common. */ | ||
{ | ||
"extends": "../tsconfig-tsec-base.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": ".tsec", | ||
"paths": { | ||
"@angular/core": ["../core"] | ||
} | ||
}, | ||
"include": [ | ||
"*.ts", | ||
"src/**/*.ts" | ||
], | ||
"references": [ | ||
{"path": "../core/tsconfig-tsec.json"} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** For building //packages/compiler. */ | ||
{ | ||
"extends": "../tsconfig-tsec-base.json", | ||
"compilerOptions": { | ||
"outDir": ".tsec" | ||
}, | ||
"include": [ | ||
"*.ts", | ||
"src/**/*.ts" | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** For building //packages/core. */ | ||
{ | ||
"extends": "../tsconfig-tsec-base.json", | ||
"compilerOptions": { | ||
"outDir": ".tsec" | ||
}, | ||
"include": [ | ||
"*.ts", | ||
"src/**/*.ts", | ||
"../*.d.ts" | ||
], | ||
"references": [ | ||
{"path": "../zone.js/lib/tsconfig-tsec.json"} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** For building //packages/platform-browser-dynamic. */ | ||
{ | ||
"extends": "../tsconfig-tsec-base.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": ".tsec", | ||
"paths": { | ||
"@angular/core": ["../core"], | ||
"@angular/common": ["../common"], | ||
"@angular/compiler": ["../compiler"], | ||
"@angular/platform-browser": ["../platform-browser"] | ||
} | ||
}, | ||
"include": [ | ||
"*.ts", | ||
"src/**/*.ts", | ||
"../*.d.ts" | ||
], | ||
"references": [ | ||
{"path": "../core/tsconfig-tsec.json"}, | ||
{"path": "../common/tsconfig-tsec.json"}, | ||
{"path": "../compiler/tsconfig-tsec.json"}, | ||
{"path": "../platform-browser/tsconfig-tsec.json"} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** For building //packages/platform-browser/animations. */ | ||
{ | ||
"extends": "../../tsconfig-tsec-base.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": ".tsec", | ||
"paths": { | ||
"@angular/core": ["../../core"], | ||
"@angular/common": ["../../common"], | ||
"@angular/platform-browser": ["../"], | ||
"@angular/animations": ["../../animations"], | ||
"@angular/animations/browser": ["../../animations/browser"] | ||
} | ||
}, | ||
"include": [ | ||
"*.ts", | ||
"src/**/*.ts" | ||
], | ||
"references": [ | ||
{"path": "../../core/tsconfig-tsec.json"}, | ||
{"path": "../../common/tsconfig-tsec.json"}, | ||
{"path": "../tsconfig-tsec.json"}, | ||
{"path": "../../animations/tsconfig-tsec.json"}, | ||
{"path": "../../animations/browser/tsconfig-tsec.json"} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** For building //packages/platform-browser. */ | ||
{ | ||
"extends": "../tsconfig-tsec-base.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": ".tsec", | ||
"paths": { | ||
"@angular/core": ["../core"], | ||
"@angular/common": ["../common"] | ||
} | ||
}, | ||
"include": [ | ||
"*.ts", | ||
"src/**/*.ts", | ||
"../*.d.ts" | ||
], | ||
"references": [ | ||
{"path": "../core/tsconfig-tsec.json"}, | ||
{"path": "../common/tsconfig-tsec.json"}, | ||
{"path": "../zone.js/lib/tsconfig-tsec.json"} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** For building //packages/platform-server. */ | ||
{ | ||
"extends": "../tsconfig-tsec-base.json", | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": ".tsec", | ||
"paths": { | ||
"@angular/core": ["../core"], | ||
"@angular/common": ["../common"], | ||
"@angular/common/http": ["../common/http"], | ||
"@angular/compiler": ["../compiler"], | ||
"@angular/platform-browser": ["../platform-browser"], | ||
"@angular/platform-browser/animations": ["../platform-browser/animations"], | ||
"@angular/platform-browser-dynamic": ["../platform-browser-dynamic"], | ||
"@angular/animations/browser": ["../animations/browser"] | ||
} | ||
}, | ||
"include": [ | ||
"*.ts", | ||
"src/**/*.ts" | ||
], | ||
"references": [ | ||
{"path": "../core/tsconfig-tsec.json"}, | ||
{"path": "../common/tsconfig-tsec.json"}, | ||
{"path": "../common/http/tsconfig-tsec.json"}, | ||
{"path": "../compiler/tsconfig-tsec.json"}, | ||
{"path": "../platform-browser/tsconfig-tsec.json"}, | ||
{"path": "../platform-browser/animations/tsconfig-tsec.json"}, | ||
{"path": "../platform-browser-dynamic/tsconfig-tsec.json"}, | ||
{"path": "../zone.js/lib/tsconfig-tsec.json"}, | ||
{"path": "../animations/browser/tsconfig-tsec.json"} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** Root tsconfig file for checking Angular packages with tsec. */ | ||
{ | ||
"extends": "./tsconfig-build.json", | ||
"compilerOptions": { | ||
"composite": true, | ||
"emitDeclarationOnly": true, | ||
"lib": ["es2017", "dom"], | ||
"plugins": [{"name": "tsec", "exemptionConfig": "./tsec-exemption.json"}] | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** Main config for building all packages that need to be checked by tsec. */ | ||
{ | ||
"extends": "./tsconfig-tsec-base.json", | ||
"include": [], | ||
"references": [ | ||
{"path": "core/tsconfig-tsec.json"}, | ||
{"path": "platform-browser/tsconfig-tsec.json"}, | ||
{"path": "platform-server/tsconfig-tsec.json"} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* The central exemption list of existing tsec violations. Modifications to | ||
* this list should be carefully reviewed by a security expert. | ||
*/ | ||
{ | ||
"ban-trustedtypes-createpolicy": [ | ||
"core/src/util/security/trusted_types_bypass.ts", | ||
"core/src/util/security/trusted_types.ts", | ||
"compiler/src/output/output_jit_trusted_types.ts" | ||
], | ||
"ban-element-innerhtml-assignments": [ | ||
"core/src/sanitization/inert_body.ts" | ||
], | ||
"ban-element-setattribute": [ | ||
"platform-browser/src/browser/meta.ts" | ||
], | ||
"ban-domparser-parsefromstring": [ | ||
"core/src/sanitization/inert_body.ts" | ||
], | ||
"ban-script-content-assignments": [ | ||
"platform-server/src/transfer_state.ts" | ||
], | ||
"ban-function-calls": [ | ||
"core/src/interface/type.ts", | ||
"core/src/reflection/reflection_capabilities.ts", | ||
"core/src/util/security/trusted_types.ts", | ||
"core/src/render3/instructions/listener.ts", | ||
"compiler/src/core.ts", | ||
"compiler/src/output/output_jit_trusted_types.ts", | ||
"platform-server/src/server_renderer.ts" | ||
], | ||
"ban-window-stringfunctiondef": [ | ||
"core/src/render3/util/misc_utils.ts" | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* For building //packages/zone.js/lib:zone_d_ts. */ | ||
{ | ||
"extends": "../../tsconfig-tsec-base.json", | ||
"compilerOptions": { | ||
"outFile": ".tsec/zone.d.ts", | ||
"types": ["node"] | ||
}, | ||
"files": ["zone.ts"] | ||
} |
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