> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/kdosukyan/scanning-practices/net-projects-security-scanning-best-practices.md).

# .NETプロジェクト: セキュリティスキャンのベストプラクティス

Aikido は、.NET の依存関係内にある既知の脆弱性（CVE）だけでなく、それらの依存関係で使用されているマルウェアや危険なライセンスも検出できます。

Aikido は、それらの依存関係とその推移的なサブ依存関係をどのように見つけるのですか？

標準では、Aikido はスキャン対象として以下のファイルをサポートしています。

* \*.csproj
* \*.deps.json
* packages.lock.json
* packages.config
* packages.props
* paket.lock

.csproj ファイルには、サブ依存関係の正確なバージョンが含まれていないことがよくあります。そのため、Aikido がサブ依存関係に対して誤検知の CVE をいくつか見つけることがあります。

## ロックファイルの使用を始めるべき理由 <a href="#why-you-should-start-using-lockfiles" id="why-you-should-start-using-lockfiles"></a>

各 NuGet 依存関係およびサブ依存関係ごとに、バージョンとハッシュを含むロックファイルを使用することを推奨します。

Aikido によるセキュリティスキャンを容易にする以外にも、ロックファイルを使う理由はあります。

* ロックファイルを使用すると、悪意のあるパッケージを介したサプライチェーン攻撃から保護できます。この種の攻撃はますます一般的になっています
* ロックファイルを使用すると、全員がパッケージのまったく同じマイナーバージョンを使うため、ビルドの予測可能性が高まります。「自分の環境では動く」問題が起きにくくなります
* ビルド時間の短縮: 依存関係解決が不要になります

### .NET プロジェクトでロックファイルの使用を始めるには？ <a href="#how-to-start-using-lockfiles-in-your-net-project" id="how-to-start-using-lockfiles-in-your-net-project"></a>

ロックファイルを作成するには、次の行を `.csproj` ファイルに追加する必要があります:

```
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <!-- ロックファイルを生成 -->
    <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>

    <!-- ロックファイルに記載された正確なパッケージを復元 -->
    <RestoreLockedMode Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</RestoreLockedMode>
  </PropertyGroup>

  <ItemGroup>
    ...
  </ItemGroup>
</Project>
```

これらの行を追加した後、次を実行します

```
dotnet.exe restore
```

これにより、リポジトリにコミットできるロックファイル（packages.lock.json）が生成されます。NPM の NodeJS の世界で package-lock.json ファイルを使うのと同様に、このファイルを手動で編集してはいけません。

既存のロックファイルを使って復元するには、次を実行します

```
dotnet.exe restore --locked-mode
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.aikido.dev/docs/docs-ja/kdosukyan/scanning-practices/net-projects-security-scanning-best-practices.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
