You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: secure-dev-c-sharp.mdc
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Generated code must not violate these rules. If a rule is violated, a comment mu
12
12
13
13
## 1. Validate All external inputs
14
14
- **Rule:** Validate all external inputs by manually checking the type, format and size of the input manually or by using libraries like `FluentValidation`.
15
-
For file validation, tilize MIME Type Validation libraries, like `MimeDetective` or `HeyRed.Mime` to check whether a file's type and content actually matches the expected type.
15
+
For file validation, utilize MIME Type Validation libraries, like `MimeDetective` or `HeyRed.Mime` to check whether a file's type and content actually matches the expected type.
16
16
17
17
## 2. Use Parameterized Queries in EntityFramework
18
18
- **Rule:** Parameterize queries in EntityFramework using LINQ and `FromSqlInterpolated`.
@@ -39,7 +39,7 @@ For file validation, tilize MIME Type Validation libraries, like `MimeDetective`
39
39
```
40
40
41
41
## 3. Avoid Singleton Dependency Injection On User-Specific Services
42
-
- **Rule:** When registring services in ASP.NET Dependency Injection, choose the correct service lifetime to avoid exposing unauthorized users to other users' requests.
42
+
- **Rule:** When registering services in ASP.NET Dependency Injection, choose the correct service lifetime to avoid exposing unauthorized users to other users' requests.
43
43
44
44
- **Unsafe:**
45
45
```cs
@@ -58,7 +58,7 @@ For file validation, tilize MIME Type Validation libraries, like `MimeDetective`
58
58
- **Rule:** Handling of mutable data in Singleton services should be avoided to prevent data inconsistencies. Ensure thread safety in Singletons to avoid race conditions that can cause logic bypass, for example by escalating privilages in authorization logic.
59
59
60
60
## 5. Ensure Solution's Project Paths Are Within the Expected Directory Structure
61
-
- **Rule:** Check that referenced projects inside .sln files do not poimt to suspicious project files outsdie the expected directory structure.
61
+
- **Rule:** Check that referenced projects inside .sln files do not point to suspicious project files outside the expected directory structure.
62
62
63
63
## 6. Use Secure Deserialization Methods
64
64
- **Rule:** When deserializing data use type-safe methods to avoid malicious code injection.
@@ -75,7 +75,7 @@ For file validation, tilize MIME Type Validation libraries, like `MimeDetective`
0 commit comments