This skill should be used when the user asks for "security review", "vulnerability scan", "audit F# security", "security audit", "find vulnerabilities", "check for security issues", or wants a deep security analysis of F# code including input validation, .NET interop safety, and dependency concerns.
Install
npx skillscat add bromanko/llm-agents/fsharp-security-review Install via the SkillsCat registry.
F# Security Review
Action required: Run /review fsharp security to start an interactive security review. Do not perform the review manually.
Perform a comprehensive security audit of F# code, examining input validation, serialization boundaries, secrets handling, and potential vulnerabilities.
Before starting the review, read the shared security review guidelines at
`../security-review-base/guidelines.md`
for false-positive filtering rules, confidence scoring, and output format
requirements. Apply those rules throughout this review.
Scope Determination
First, determine what code to review:
- If the user specifies files/directories: Review those paths
- If no scope specified: Review working changes
- Check for
.jjdirectory first, usejj diffif present - Otherwise use
git diffto identify changed.fsand.fsxfiles - If no changes, ask the user what to review
- Check for
Review Process
- Understand existing security posture: Identify security frameworks,
middleware, validation libraries, and established conventions already in the
codebase before reviewing changes. Look for how the project currently handles
auth, input validation, serialization, and secrets management. - Map the attack surface: Identify entry points (HTTP handlers, CLI args,
file inputs, external service calls) - Trace data flow: Follow untrusted input through the codebase
- Check each security domain below
- Review dependencies: Check
.fsprojandpaket.dependencies/nuget.configfor known issues - Apply false-positive filtering from the shared guidelines and the
F#-specific rules below - Output findings in the format specified by the shared guidelines
F#-Specific False-Positive Rules
In addition to the shared guidelines:
- Memory safety issues from pure F# code are extremely unlikely — only flag
unsafe interop viaNativePtr,NativeInterop, P/Invoke, orfixed
statements - F#'s type system and immutability-by-default prevent many classes of bugs —
focus on boundaries where data enters or leaves the system (HTTP, DB,
file I/O, deserialization, interop) failwithmessages in internal code paths are not information disclosure
unless the message is surfaced to end users via an API response- Missing
[<Authorize>]on internal/non-routable functions is not a
vulnerability — only flag missing auth on actual HTTP endpoint handlers objdowncasting in internal code is a code quality issue, not a security
issue, unless theobjoriginates from untrusted input
Security Checklist
Input Validation
- All external input validated at system boundaries
- String inputs checked for length limits
- Numeric inputs bounded appropriately
- File paths sanitized (no path traversal)
- URLs validated before use
- No assumption that input matches expected format
- Type providers used safely (data source trusted)
Serialization & Deserialization
- JSON/XML deserialization uses safe settings (no type-name handling unless required)
System.Text.Json/Newtonsoft.Jsonconfigured to prevent type confusion attacks- Deserialized data validated after parsing
- No
BinaryFormatterusage (inherently unsafe) - Custom serializers handle malformed input gracefully
SQL & Data Access
- Parameterized queries used (no string interpolation in SQL)
- Type providers (e.g., SqlProvider, Dapper.FSharp) used safely
- ORM queries don't expose raw SQL injection paths
- Connection strings not hardcoded
- Database permissions follow principle of least privilege
Secrets Handling
- No hardcoded secrets, API keys, or credentials
- Environment variables or secret managers used for sensitive config
- Secrets not logged or included in error messages
- Config files with secrets not committed to repo
IConfiguration/User Secretsused in development
Dependency Security
- Check
.fsproj/paket.dependencies:- Are packages from trusted sources (NuGet)?
- Are there known vulnerabilities? (
dotnet list package --vulnerable) - Are dependencies pinned to specific versions?
- Any unnecessary dependencies that increase attack surface?
External Service Calls
- HTTP requests use HTTPS
HttpClientreused (not created per-request)- API responses validated before use
- Timeouts configured for external calls
- Certificate validation not disabled
- No command injection in
Process.Startcalls
Unsafe Code & Interop
NativePtr/NativeInteropreviewed for memory safety- P/Invoke signatures correct (buffer overflows possible with wrong sizes)
fixedstatements used correctlyUncheckedmodule usage justified- No
objdowncasting on untrusted data use/IDisposableproperly handled (no resource leaks)
Authentication & Authorization
- Auth checks at appropriate boundaries
- No auth bypass through alternate code paths
- ASP.NET authorization attributes/policies applied correctly
- Session/token handling secure
- Privilege escalation paths reviewed
- CORS configured appropriately
Error Handling & Information Disclosure
- Error messages don't leak internal details (stack traces, connection strings)
to end users via API responses - Logging doesn't contain PII or secrets
- Debug endpoints /
#if DEBUGcode not in production - Exception filters don't silently swallow security-relevant errors
Data Exposure
- Sensitive fields excluded from serialization (
[<JsonIgnore>], etc.) - API responses filtered to authorized data only
ToString()overrides don't expose sensitive fields