This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Replace Release Notes with info about CHANGELOG.md and Releases * Replace Release Notes with links to CHANGELOG.md and Releases * Updated Releases (markdown) * Revert "Updated Releases (markdown)" This reverts commit b9214fd89cc3cd2238a4f43c3c4bf7ac3c2cc7e9. * Add instruction to replace @next placeholder * Move Wiki files to docs folder (fixes #808) * Apply Prettier formatter to docs * Update link to Releases doc * Replace Markdown table format with HTML table * Add links from removed Releases page to README.md
- Loading branch information
1 parent
f70d669
commit 66b9c68
Showing
17 changed files
with
257 additions
and
431 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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
TSLint-and-the-Microsoft-Security-Development-Lifecycle.md
This file was deleted.
Oops, something went wrong.
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,16 @@ | ||
# Welcome to the `tslint-microsoft-contrib` docs! | ||
|
||
## General info | ||
|
||
- [TSLint and the Microsoft Security Development Lifecycle](./TSLint-and-the-Microsoft-Security-Development-Lifecycle.md) | ||
- [Releases](./Releases.md) | ||
|
||
## Detailed info for rules | ||
|
||
- [react-a11y-img-has-alt](./react-a11y-img-has-alt-Rule.md) | ||
- [react-a11y-props](./react-a11y-props-Rule.md) | ||
- [react-a11y-role-has-required-props](./react-a11y-role-has-required-props-Rule.md) | ||
- [react-a11y-role-supports-aria-props](./react-a11y-role-supports-aria-props-Rule.md) | ||
- [react-a11y-tabindex-no-positive](./react-a11y-tabindex-no-positive-Rule.md) | ||
- [react-ally-role](./react-ally-role-Rule.md) | ||
- [react-no-dangerous-html](./react-no-dangerous-html-Rule.md) |
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,59 @@ | ||
# Overview | ||
|
||
- The npm package is published by the [Microsoft account](https://www.npmjs.com/~microsoft) | ||
- [Directions for publishing](https://opensourcehub.microsoft.com/articles/how-to-publish-npm-package) with the Microsoft Account are available with CORPNET access | ||
- Releases are made from the "master" branch and tagged with the format "[version]" | ||
|
||
## Prepare the tslint-microsoft-contrib master branch | ||
|
||
- Make sure there are 0 closed issues without a milestone. Assign milestone as needed using [this query](https://github.com/Microsoft/tslint-microsoft-contrib/issues?q=no%3Amilestone%20is%3Aclosed%20) | ||
- Close the milestone | ||
- Open the next milestone | ||
- Update `CHANGELOG.md`. Stable releases should contain list of new changes as well as full list of changes since previous stable release. | ||
- Make sure `package.json` and `package-lock.json` contain the version you wish to publish | ||
- Update `README.md` to have the correct links and version numbers for new rules (replace `@next` placeholder with next version) | ||
- Pull any recent git changes and rebuild: | ||
|
||
```shell | ||
git pull | ||
npm run test | ||
``` | ||
|
||
- Tag the master branch with the format [version] | ||
|
||
```shell | ||
git tag 0.0.1 | ||
git push --tags | ||
``` | ||
|
||
- Create [release](https://github.com/Microsoft/tslint-microsoft-contrib/releases) for newly pushed tag | ||
- Increase the version number in package.json and README.md to the next minor version and push | ||
|
||
## Prepare the tslint-microsoft-contrib releases branch | ||
|
||
- Clone the repo again to a new folder: | ||
|
||
```shell | ||
git clone https://github.com/Microsoft/tslint-microsoft-contrib tslint-microsoft-contrib-releases | ||
``` | ||
|
||
- Checkout branch `releases` | ||
|
||
```shell | ||
git checkout releases | ||
``` | ||
|
||
- Replace all files with the contents of `/dist/build` directory created from `master` | ||
- Commit and push to remote | ||
- tag the releases branch with the format `npm-[version]` | ||
|
||
```shell | ||
git tag npm-2.0.10 | ||
git push --tags | ||
``` | ||
|
||
## Publish the Package with the Microsoft npmjs Account | ||
|
||
- Follow the steps at https://docs.opensource.microsoft.com/releasing/build-your-project.html#npm | ||
- Basically just send the email they want and wait a little while | ||
- Include the npmjs.org user ids of all contributors: brndkfr, hamletdrc, dmanesku, joshuakgoldberg |
120 changes: 120 additions & 0 deletions
120
docs/TSLint-and-the-Microsoft-Security-Development-Lifecycle.md
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,120 @@ | ||
The [Security Development Lifecycle (SDL)](https://www.microsoft.com/en-us/sdl/) is a software development process that helps developers build more secure software and address security compliance requirements while reducing development cost. | ||
|
||
Together TypeScript, TSLint, and tslint-microsoft-contrib have automated most of the rules and recommendations made by the MS SDL. | ||
|
||
Enable these rules in order to be compliant with the SDL: | ||
|
||
<table> | ||
<thead> | ||
<tr> | ||
<th>Rule Name</th> | ||
<th>From</th> | ||
<th>Description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td><code>no-eval</code></td> | ||
<td>tslint</td> | ||
<td>Do not use the `eval` function or its functional equivalents.</td> | ||
</tr> | ||
<tr> | ||
<td><code>use-strict</code></td> | ||
<td>tslint</td> | ||
<td>Always enable strict mode when possible.</td> | ||
</tr> | ||
<tr> | ||
<td><code>no-octal-literal</code></td> | ||
<td>tslint-microsoft-contrib</td> | ||
<td>Do not use octal literals or escaped octal sequences in strict-mode compatible code.</td> | ||
</tr> | ||
<tr> | ||
<td><code>no-duplicate-parameter-names</code></td> | ||
<td>tslint-microsoft-contrib</td> | ||
<td>Do not duplicate parameter names.</td> | ||
</tr> | ||
<tr> | ||
<td><code>no-delete-expression</code></td> | ||
<td>tslint-microsoft-contrib</td> | ||
<td>Do not delete expressions.</td> | ||
</tr> | ||
<tr> | ||
<td><code>no-disable-auto-sanitization</code></td> | ||
<td>tslint-microsoft-contrib</td> | ||
<td>Do not disable auto-sanitization in frameworks or application helper code.</td> | ||
</tr> | ||
<tr> | ||
<td><code>no-exec-script</code></td> | ||
<td>tslint-microsoft-contrib</td> | ||
<td>Banned term - `execScript`.</td> | ||
</tr> | ||
<tr> | ||
<td><code>no-string-based-set-timeout</code></td> | ||
<td>tslint-microsoft-contrib</td> | ||
<td>Do not use the version of `setTimeout` that accepts code as a string argument. However, it is acceptable to use the version of `setTimeout` where a direct reference to a function is provided as the callback argument.</td> | ||
</tr> | ||
<tr> | ||
<td><code>no-string-based-set-interval</code></td> | ||
<td>tslint-microsoft-contrib</td> | ||
<td>Do not use the version of `setInterval` that accepts code as a string argument. However, it is acceptable to use the version of `setInterval` where a direct reference to a function is provided as the callback argument.</td> | ||
</tr> | ||
<tr> | ||
<td><code>no-string-based-set-immediate</code></td> | ||
<td>tslint-microsoft-contrib</td> | ||
<td>Do not use the version of `setImmediate` that accepts code as a string argument. However, it is acceptable to use the version of ``setImmediate` where a direct reference to a function is provided as the callback argument.</td> | ||
</tr> | ||
<tr> | ||
<td><code>no-function-constructor-with-string-args</code></td> | ||
<td>tslint-microsoft-contrib</td> | ||
<td>Do not use the version of the Function constructor that accepts a string argument to define the body of the function.</td> | ||
</tr> | ||
<tr> | ||
<td><code>no-banned-terms</code></td> | ||
<td>tslint-microsoft-contrib</td> | ||
<td>Do not access terms or variables that create ambiguity or are banned in strict mode.</td> | ||
</tr> | ||
<tr> | ||
<td><code>no-reserved-keywords</code></td> | ||
<td>tslint-microsoft-contrib</td> | ||
<td>Do not use reserved and future reserved keywords as identifiers.</td> | ||
</tr> | ||
<tr> | ||
<td><code>no-document-domain</code></td> | ||
<td>tslint-microsoft-contrib</td> | ||
<td>Do not write to `document.domain`. Scripts setting `document.domain` to any value should be validated to ensure that the value is on a list of allowed sites.</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
You will want your tslint ruleset defined similarly to this if you'd like to enable all of these rules: | ||
|
||
```json | ||
{ | ||
"rules": { | ||
"no-banned-terms": true, | ||
"no-delete-expression": true, | ||
"no-document-domain": true, | ||
"no-disable-auto-sanitization": true, | ||
"no-duplicate-parameter-names": true, | ||
"no-exec-script": true, | ||
"no-function-constructor-with-string-args": true, | ||
"no-octal-literal": true, | ||
"no-reserved-keywords": true, | ||
"no-string-based-set-immediate": true, | ||
"no-string-based-set-interval": true, | ||
"no-string-based-set-timeout": true, | ||
"no-eval": true | ||
} | ||
} | ||
``` | ||
|
||
There are also some other security related rules that are not specifically part of the SDL. We recommend that you also use these rules: | ||
|
||
- `no-document-write` - Do not use `document.write` (because it accepts unsanitized input) | ||
- `no-http-string` – It can cause an http connection without TLS thus allowing a cookie stealing attack | ||
- `no-inner-html` - Do not write values to `innerHTML`, `outerHTML`, or set HTML using the JQuery `html()` function | ||
- `react-no-dangerous-html` - Do not use React's `dangerouslySetInnerHTML` API (because it accepts unsanitized input) | ||
|
||
Additionally, some [tsc compiler options](https://www.typescriptlang.org/docs/handbook/compiler-options.html) should be enabled: | ||
|
||
- `--alwaysStrict` - Parse in strict mode and emit `"use strict"` for each source file |
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
File renamed without changes.
Oops, something went wrong.