golang-context
Improve Go Context Propagation and Cancellation
Broken context propagation leaves downstream work running after requests end. This skill guides context lifecycles across Go handlers, services, and databases.
自分のエージェントでインストール
このリクエストをエージェントにコピーしてください。正規の Skill ページとマニフェストが含まれています。
Review the Skillstore skill "golang-context" from https://skillstore.io/skills/samber-golang-context.md and its manifest at https://skillstore.io/api/skills/samber-golang-context/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.エージェントは引き続き計画を提示し、セキュリティポリシーで必要な確認を求める必要があります。
エージェントが読めるリソース
AI エージェント、クローラー、スクリプトがページ全体ではなく整理されたコンテキストを必要とする場合は、これらのリンクを使ってください。
テストする
「golang-context」を使用しています。 Review a handler that creates Background before calling its repository and payment client.
期待される結果:
- The handler discards request cancellation by creating a new root context.
- Pass the request context through service, database, and HTTP client calls.
- Test that client cancellation reaches both downstream operations.
「golang-context」を使用しています。 Review a repository transaction that starts with Begin but uses ExecContext for its updates.
期待される結果:
- Transaction creation does not receive the caller context.
- Start the transaction with BeginTx and keep passing the caller context to statements.
- Retain rollback cleanup and test cancellation during transaction startup.
「golang-context」を使用しています。 Explain why an asynchronous audit event stops when its HTTP handler returns.
期待される結果:
- The goroutine inherits a request context that is canceled when the handler returns.
- WithoutCancel preserves request values while removing cancellation and deadlines.
- Add a finite timeout and shutdown ownership; detaching cancellation alone does not guarantee delivery.
セキュリティ監査
中リスクAll 49 static findings are false positives caused by Markdown formatting, Go identifiers, metadata, or illustrative evaluation fixtures. No evidence found of prompt injection, credential theft, system reconnaissance, or unauthorized command execution. One semantic risk remains: the background audit example removes cancellation and deadlines without bounding its goroutine lifetime.
確認済みのセキュリティ上の懸念 (1)
リスク要因
⚙️ 外部コマンド (25)
🌐 ネットワークアクセス (4)
このレポートを共有・引用
バージョン付き評価レポート、中立的なバッジ、埋め込みカード、引用を共有できます。Skillstore は証拠を報告しますが、この Skill が安全かどうかは判断しません。
レポートリンクをコピー
https://skillstore.io/skills/samber-golang-context/audits/1?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdownバッジ
[](https://skillstore.io/skills/samber-golang-context?utm_source=security_passport_badge)HTMLバッジ
<a href="https://skillstore.io/skills/samber-golang-context?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/samber-golang-context/security.svg" alt="Skillstore security assessment" loading="lazy"></a>埋め込みカード
<iframe src="https://skillstore.io/embed/skills/samber-golang-context.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>学術引用 (APA · BibTeX · CFF)
APA形式の引用
samber. (2026). golang-context security audit report (audit version 1) [Author version 1.3.1]. Skillstore. https://skillstore.io/skills/samber-golang-context/audits/1BibTeX形式の引用
@techreport{samber-samber-golang-context-2026,
author = {samber},
title = {golang-context security audit report (audit version 1)},
institution = {Skillstore},
year = {2026},
number = {1},
url = {https://skillstore.io/skills/samber-golang-context/audits/1},
note = {Author version 1.3.1}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "golang-context security audit report (audit version 1)"
version: "1.3.1"
type: report
authors:
- name: "samber"
date-released: "2026-10-15"
url: "https://skillstore.io/skills/samber-golang-context/audits/1"
identifiers:
- type: other
value: "skillstore:samber-golang-context:audit:1"
description: "Skillstore immutable audit report identifier"
Skillstore スコア
このスコアの理由 証拠の信頼度: 中作成できるもの
Review Request Cancellation
Find context propagation breaks between handlers, services, SQL queries, and downstream HTTP requests.
Investigate Work That Outlives Requests
Review cancellation ownership, timeout cleanup, and background goroutines that continue after client disconnection.
Standardize Request Metadata
Design typed context accessors and trace propagation conventions without hiding business inputs or infrastructure dependencies.
これらのプロンプトを試す
Explain when to use Background, TODO, and r.Context in Go. Review this function: [function].
Review this handler, service, and repository for broken context propagation: [code]. Identify missing context-aware calls and cancellation cleanup.
Review this service flow: [code]. Propose nested timeout budgets and typed request metadata accessors while keeping dependencies explicit.
Review this asynchronous audit flow: [code]. Preserve trace values with WithoutCancel, add a finite timeout, and assess shutdown ownership and concurrency limits.
ベストプラクティス
- Pass the caller context as the first parameter and use context-aware downstream APIs.
- Release derived contexts on every path unless cancellation ownership is explicitly transferred.
- Use typed metadata keys and give detached work an explicit timeout and lifecycle owner.
回避
- Creating a new Background context inside a request call chain.
- Using context values to hide database connections, configuration, or required business arguments.
- Launching detached goroutines without lifetime limits or shutdown coordination.
よくある質問
Which AI tools does this skill support?
Which Go version do the newer context examples require?
Does this skill automatically detect every context bug?
What belongs in context values?
Can a child timeout extend its parent deadline?
Does WithoutCancel guarantee background audit delivery?
開発者情報
作成者
samberライセンス
MIT
作者バージョン
v1.3.1
Skillstore リビジョン
r1
参照
e8578ae623cd20ef61db8894d3441416b52a9dad
メンテナンスの新しさ
2026/10/15
利用状況
0 ダウンロード · 0 閲覧
ファイル構成