<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tomo</id>
		<title>OWASP - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tomo"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Tomo"/>
		<updated>2026-05-06T12:55:44Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113475</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113475"/>
				<updated>2011-07-06T13:18:52Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* 11. セキュリティ承認と保守 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条項が私たちにとって適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の開始地点です。あなたは、すべての活動が好きではないかもしれません、または、より多くの提案をしたいかもしれません。あなたは異なる責任を割り当てたいかもしれません。この文書は、すべてのソフトウェア顧客と開発者の要望を厳密に取り込むことを意図しているわけではありません。ソフトウェアが最終的にセキュアになることを確実にするために重要である、主要な項目を議論するためのフレームワークを提供することを意図します。セキュリティを議論して合意を得た後で、あなたはこの合意を適合するように調整すべきです。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題については、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、それたはソフトウェア産業で定期的に実践されることはありません。誰が（そして、いくら）支払うかという問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用対効果がよい方法について確信しています。それは、セキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることです。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書化とテストの活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし、私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端では、顧客はすべてのリスクをとることができました、そして、開発者はたくさんの脆弱性をもつコードを供給することができました。他の極端では、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの両極端は、どちらとも実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]] （[https://www.owasp.org/index.php/Secure_software_contracting_hypothetical_case_study/ja 日本語訳]）を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書化を目的とした文書化を推奨しません。この契約は品質（量ではない）を促進することに集中します。私たちは、短いリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条項によりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高レベルで、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者と顧客は、アプリケーションに直面しているリスクを理解して、文書化するために協力することに同意します。この努力は、アプリケーションにより提供される重要な資産と機能への主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために協力することに同意します。この付属書の要件部分で記載される個々のトピックは、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフトウェア、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、十分に解説されなければなりません。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスが含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、個々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信頼できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素および他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条項を満たして、この契約のもとで開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題管理セクションにより追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題管理 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追跡します。個々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と関連する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定に定められたように他のバグや問題と同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装とテスト結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受入 : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113474</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113474"/>
				<updated>2011-07-06T13:17:39Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* 10. 保証 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条項が私たちにとって適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の開始地点です。あなたは、すべての活動が好きではないかもしれません、または、より多くの提案をしたいかもしれません。あなたは異なる責任を割り当てたいかもしれません。この文書は、すべてのソフトウェア顧客と開発者の要望を厳密に取り込むことを意図しているわけではありません。ソフトウェアが最終的にセキュアになることを確実にするために重要である、主要な項目を議論するためのフレームワークを提供することを意図します。セキュリティを議論して合意を得た後で、あなたはこの合意を適合するように調整すべきです。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題については、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、それたはソフトウェア産業で定期的に実践されることはありません。誰が（そして、いくら）支払うかという問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用対効果がよい方法について確信しています。それは、セキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることです。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書化とテストの活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし、私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端では、顧客はすべてのリスクをとることができました、そして、開発者はたくさんの脆弱性をもつコードを供給することができました。他の極端では、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの両極端は、どちらとも実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]] （[https://www.owasp.org/index.php/Secure_software_contracting_hypothetical_case_study/ja 日本語訳]）を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書化を目的とした文書化を推奨しません。この契約は品質（量ではない）を促進することに集中します。私たちは、短いリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条項によりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高レベルで、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者と顧客は、アプリケーションに直面しているリスクを理解して、文書化するために協力することに同意します。この努力は、アプリケーションにより提供される重要な資産と機能への主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために協力することに同意します。この付属書の要件部分で記載される個々のトピックは、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフトウェア、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、十分に解説されなければなりません。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスが含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、個々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信頼できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素および他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条項を満たして、この契約のもとで開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題管理セクションにより追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題管理 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追跡します。個々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と関連する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定に定められたように他のバグや問題と同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装とテスト結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113473</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113473"/>
				<updated>2011-07-06T13:16:35Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* 9. セキュリティ問題管理 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条項が私たちにとって適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の開始地点です。あなたは、すべての活動が好きではないかもしれません、または、より多くの提案をしたいかもしれません。あなたは異なる責任を割り当てたいかもしれません。この文書は、すべてのソフトウェア顧客と開発者の要望を厳密に取り込むことを意図しているわけではありません。ソフトウェアが最終的にセキュアになることを確実にするために重要である、主要な項目を議論するためのフレームワークを提供することを意図します。セキュリティを議論して合意を得た後で、あなたはこの合意を適合するように調整すべきです。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題については、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、それたはソフトウェア産業で定期的に実践されることはありません。誰が（そして、いくら）支払うかという問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用対効果がよい方法について確信しています。それは、セキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることです。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書化とテストの活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし、私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端では、顧客はすべてのリスクをとることができました、そして、開発者はたくさんの脆弱性をもつコードを供給することができました。他の極端では、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの両極端は、どちらとも実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]] （[https://www.owasp.org/index.php/Secure_software_contracting_hypothetical_case_study/ja 日本語訳]）を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書化を目的とした文書化を推奨しません。この契約は品質（量ではない）を促進することに集中します。私たちは、短いリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条項によりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高レベルで、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者と顧客は、アプリケーションに直面しているリスクを理解して、文書化するために協力することに同意します。この努力は、アプリケーションにより提供される重要な資産と機能への主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために協力することに同意します。この付属書の要件部分で記載される個々のトピックは、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフトウェア、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、十分に解説されなければなりません。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスが含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、個々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信頼できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素および他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条項を満たして、この契約のもとで開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題管理セクションにより追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題管理 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追跡します。個々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と関連する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定に定められたように他のバグや問題と同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113472</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113472"/>
				<updated>2011-07-06T13:12:44Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* 9. セキュリティ問題マネジメント */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条項が私たちにとって適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の開始地点です。あなたは、すべての活動が好きではないかもしれません、または、より多くの提案をしたいかもしれません。あなたは異なる責任を割り当てたいかもしれません。この文書は、すべてのソフトウェア顧客と開発者の要望を厳密に取り込むことを意図しているわけではありません。ソフトウェアが最終的にセキュアになることを確実にするために重要である、主要な項目を議論するためのフレームワークを提供することを意図します。セキュリティを議論して合意を得た後で、あなたはこの合意を適合するように調整すべきです。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題については、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、それたはソフトウェア産業で定期的に実践されることはありません。誰が（そして、いくら）支払うかという問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用対効果がよい方法について確信しています。それは、セキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることです。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書化とテストの活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし、私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端では、顧客はすべてのリスクをとることができました、そして、開発者はたくさんの脆弱性をもつコードを供給することができました。他の極端では、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの両極端は、どちらとも実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]] （[https://www.owasp.org/index.php/Secure_software_contracting_hypothetical_case_study/ja 日本語訳]）を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書化を目的とした文書化を推奨しません。この契約は品質（量ではない）を促進することに集中します。私たちは、短いリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条項によりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高レベルで、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者と顧客は、アプリケーションに直面しているリスクを理解して、文書化するために協力することに同意します。この努力は、アプリケーションにより提供される重要な資産と機能への主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために協力することに同意します。この付属書の要件部分で記載される個々のトピックは、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフトウェア、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、十分に解説されなければなりません。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスが含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、個々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信頼できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素および他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条項を満たして、この契約のもとで開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題管理セクションにより追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題管理 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追跡します。個々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と関連する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113471</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113471"/>
				<updated>2011-07-06T13:10:51Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* 8. セキュリティ・レビュー */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条項が私たちにとって適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の開始地点です。あなたは、すべての活動が好きではないかもしれません、または、より多くの提案をしたいかもしれません。あなたは異なる責任を割り当てたいかもしれません。この文書は、すべてのソフトウェア顧客と開発者の要望を厳密に取り込むことを意図しているわけではありません。ソフトウェアが最終的にセキュアになることを確実にするために重要である、主要な項目を議論するためのフレームワークを提供することを意図します。セキュリティを議論して合意を得た後で、あなたはこの合意を適合するように調整すべきです。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題については、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、それたはソフトウェア産業で定期的に実践されることはありません。誰が（そして、いくら）支払うかという問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用対効果がよい方法について確信しています。それは、セキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることです。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書化とテストの活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし、私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端では、顧客はすべてのリスクをとることができました、そして、開発者はたくさんの脆弱性をもつコードを供給することができました。他の極端では、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの両極端は、どちらとも実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]] （[https://www.owasp.org/index.php/Secure_software_contracting_hypothetical_case_study/ja 日本語訳]）を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書化を目的とした文書化を推奨しません。この契約は品質（量ではない）を促進することに集中します。私たちは、短いリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条項によりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高レベルで、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者と顧客は、アプリケーションに直面しているリスクを理解して、文書化するために協力することに同意します。この努力は、アプリケーションにより提供される重要な資産と機能への主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために協力することに同意します。この付属書の要件部分で記載される個々のトピックは、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフトウェア、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、十分に解説されなければなりません。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスが含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、個々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信頼できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素および他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条項を満たして、この契約のもとで開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題管理セクションにより追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113470</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113470"/>
				<updated>2011-07-06T13:08:13Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* 7. ライブラリ、フレームワーク、および生産物 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条項が私たちにとって適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の開始地点です。あなたは、すべての活動が好きではないかもしれません、または、より多くの提案をしたいかもしれません。あなたは異なる責任を割り当てたいかもしれません。この文書は、すべてのソフトウェア顧客と開発者の要望を厳密に取り込むことを意図しているわけではありません。ソフトウェアが最終的にセキュアになることを確実にするために重要である、主要な項目を議論するためのフレームワークを提供することを意図します。セキュリティを議論して合意を得た後で、あなたはこの合意を適合するように調整すべきです。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題については、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、それたはソフトウェア産業で定期的に実践されることはありません。誰が（そして、いくら）支払うかという問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用対効果がよい方法について確信しています。それは、セキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることです。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書化とテストの活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし、私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端では、顧客はすべてのリスクをとることができました、そして、開発者はたくさんの脆弱性をもつコードを供給することができました。他の極端では、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの両極端は、どちらとも実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]] （[https://www.owasp.org/index.php/Secure_software_contracting_hypothetical_case_study/ja 日本語訳]）を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書化を目的とした文書化を推奨しません。この契約は品質（量ではない）を促進することに集中します。私たちは、短いリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条項によりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高レベルで、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者と顧客は、アプリケーションに直面しているリスクを理解して、文書化するために協力することに同意します。この努力は、アプリケーションにより提供される重要な資産と機能への主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために協力することに同意します。この付属書の要件部分で記載される個々のトピックは、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフトウェア、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、十分に解説されなければなりません。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスが含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、個々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信頼できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素および他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条項を満たして、この契約のもとで開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題マネジメント部分により追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113466</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113466"/>
				<updated>2011-07-06T13:04:20Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* 5. 要員および組織 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条項が私たちにとって適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の開始地点です。あなたは、すべての活動が好きではないかもしれません、または、より多くの提案をしたいかもしれません。あなたは異なる責任を割り当てたいかもしれません。この文書は、すべてのソフトウェア顧客と開発者の要望を厳密に取り込むことを意図しているわけではありません。ソフトウェアが最終的にセキュアになることを確実にするために重要である、主要な項目を議論するためのフレームワークを提供することを意図します。セキュリティを議論して合意を得た後で、あなたはこの合意を適合するように調整すべきです。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題については、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、それたはソフトウェア産業で定期的に実践されることはありません。誰が（そして、いくら）支払うかという問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用対効果がよい方法について確信しています。それは、セキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることです。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書化とテストの活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし、私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端では、顧客はすべてのリスクをとることができました、そして、開発者はたくさんの脆弱性をもつコードを供給することができました。他の極端では、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの両極端は、どちらとも実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]] （[https://www.owasp.org/index.php/Secure_software_contracting_hypothetical_case_study/ja 日本語訳]）を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書化を目的とした文書化を推奨しません。この契約は品質（量ではない）を促進することに集中します。私たちは、短いリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条項によりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高レベルで、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者と顧客は、アプリケーションに直面しているリスクを理解して、文書化するために協力することに同意します。この努力は、アプリケーションにより提供される重要な資産と機能への主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために協力することに同意します。この付属書の要件部分で記載される個々のトピックは、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフトウェア、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、十分に解説されなければなりません。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスが含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、個々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信頼できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素と他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条件を満たして、この契約の基で開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題マネジメント部分により追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113458</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113458"/>
				<updated>2011-07-06T12:45:00Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* 3.ライフサイクル活動 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条項が私たちにとって適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の開始地点です。あなたは、すべての活動が好きではないかもしれません、または、より多くの提案をしたいかもしれません。あなたは異なる責任を割り当てたいかもしれません。この文書は、すべてのソフトウェア顧客と開発者の要望を厳密に取り込むことを意図しているわけではありません。ソフトウェアが最終的にセキュアになることを確実にするために重要である、主要な項目を議論するためのフレームワークを提供することを意図します。セキュリティを議論して合意を得た後で、あなたはこの合意を適合するように調整すべきです。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題については、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、それたはソフトウェア産業で定期的に実践されることはありません。誰が（そして、いくら）支払うかという問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用対効果がよい方法について確信しています。それは、セキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることです。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書化とテストの活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし、私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端では、顧客はすべてのリスクをとることができました、そして、開発者はたくさんの脆弱性をもつコードを供給することができました。他の極端では、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの両極端は、どちらとも実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]] （[https://www.owasp.org/index.php/Secure_software_contracting_hypothetical_case_study/ja 日本語訳]）を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書化を目的とした文書化を推奨しません。この契約は品質（量ではない）を促進することに集中します。私たちは、短いリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条項によりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高レベルで、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者と顧客は、アプリケーションに直面しているリスクを理解して、文書化するために協力することに同意します。この努力は、アプリケーションにより提供される重要な資産と機能への主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために協力することに同意します。この付属書の要件部分で記載される個々のトピックは、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフトウェア、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、十分に解説されなければなりません。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスが含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、各々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信用できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素と他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条件を満たして、この契約の基で開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題マネジメント部分により追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113455</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113455"/>
				<updated>2011-07-06T12:31:54Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* 2. 原理 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条項が私たちにとって適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の開始地点です。あなたは、すべての活動が好きではないかもしれません、または、より多くの提案をしたいかもしれません。あなたは異なる責任を割り当てたいかもしれません。この文書は、すべてのソフトウェア顧客と開発者の要望を厳密に取り込むことを意図しているわけではありません。ソフトウェアが最終的にセキュアになることを確実にするために重要である、主要な項目を議論するためのフレームワークを提供することを意図します。セキュリティを議論して合意を得た後で、あなたはこの合意を適合するように調整すべきです。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題については、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、それたはソフトウェア産業で定期的に実践されることはありません。誰が（そして、いくら）支払うかという問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用対効果がよい方法について確信しています。それは、セキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることです。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書化とテストの活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし、私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端では、顧客はすべてのリスクをとることができました、そして、開発者はたくさんの脆弱性をもつコードを供給することができました。他の極端では、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの両極端は、どちらとも実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]] （[https://www.owasp.org/index.php/Secure_software_contracting_hypothetical_case_study/ja 日本語訳]）を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書化を目的とした文書化を推奨しません。この契約は品質（量ではない）を促進することに集中します。私たちは、短いリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条項によりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高レベルで、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者とClientは、アプリケーションに直面しているリスクを理解して、文書化するために一緒に働くことに同意します。この努力は、アプリケーションにより提供される重要な資産と機能に主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために一緒に働くことに同意します。この付属書の要件部分で記載されるトピックの各々は、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフト、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、完全にコメントされます。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスは、含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、各々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信用できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素と他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条件を満たして、この契約の基で開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題マネジメント部分により追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113454</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113454"/>
				<updated>2011-07-06T12:23:14Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* 1. 序文 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条項が私たちにとって適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の開始地点です。あなたは、すべての活動が好きではないかもしれません、または、より多くの提案をしたいかもしれません。あなたは異なる責任を割り当てたいかもしれません。この文書は、すべてのソフトウェア顧客と開発者の要望を厳密に取り込むことを意図しているわけではありません。ソフトウェアが最終的にセキュアになることを確実にするために重要である、主要な項目を議論するためのフレームワークを提供することを意図します。セキュリティを議論して合意を得た後で、あなたはこの合意を適合するように調整すべきです。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題については、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、それたはソフトウェア産業で定期的に実践されることはありません。誰が（そして、いくら）支払うかという問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用対効果がよい方法について確信しています。それは、セキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることです。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書化とテストの活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし、私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端では、顧客はすべてのリスクをとることができました、そして、開発者はたくさんの脆弱性をもつコードを供給することができました。他の極端では、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの両極端は、どちらとも実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]] （[https://www.owasp.org/index.php/Secure_software_contracting_hypothetical_case_study/ja 日本語訳]）を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書化を目的とした文書化を推奨しません。この契約は品質（量ではない）を促進することに集中します。私たちは、短いリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条項によりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高水準で、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は、完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者とClientは、アプリケーションに直面しているリスクを理解して、文書化するために一緒に働くことに同意します。この努力は、アプリケーションにより提供される重要な資産と機能に主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために一緒に働くことに同意します。この付属書の要件部分で記載されるトピックの各々は、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフト、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、完全にコメントされます。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスは、含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、各々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信用できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素と他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条件を満たして、この契約の基で開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題マネジメント部分により追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Legal_Project_Roadmap/ja&amp;diff=113346</id>
		<title>OWASP Legal Project Roadmap/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Legal_Project_Roadmap/ja&amp;diff=113346"/>
				<updated>2011-07-05T04:49:16Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;プロジェクトの全体的なゴールは以下である。&lt;br /&gt;
&lt;br /&gt;
 ソフトウェア・セキュリティの法律面で、開発者、&lt;br /&gt;
 ソフトウェア購入者および販売者にサポートを提供すること&lt;br /&gt;
&lt;br /&gt;
当面の間、私たちは以下の戦術的な目標に集中する。&lt;br /&gt;
&lt;br /&gt;
# 契約付属書を開発することを続ける&lt;br /&gt;
# ソフトウェア・セキュリティの契約と取得を取り巻くプロセス活動をつくる&lt;br /&gt;
# 法的なプロセス活動をすべてのOWASPプロセス資材に統合する&lt;br /&gt;
&lt;br /&gt;
私たちがこれらの目標を達成するのを助けるために定められた現在のタスクは次のとおりである。&lt;br /&gt;
&lt;br /&gt;
* プロセス活動「ソフトウェア・セキュリティにおいて合意に達する」を下書きする&lt;br /&gt;
* 付属書の有用性を評価するために事例研究を実施する&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113344</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113344"/>
				<updated>2011-07-05T02:22:42Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条項が私たちにとって適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の開始地点です。あなたは、すべての活動が好きではないかもしれません、または、より多くの提案をしたいかもしれません。あなたは異なる責任を割り当てたいかもしれません。この文書は、すべてのソフトウェア顧客と開発者の要望を厳密に取り込むことを意図しているわけではありません。ソフトウェアが最終的にセキュアになることを確実にするために重要である、主要な項目を議論するためのフレームワークを提供することを意図します。セキュリティを議論して合意を得た後で、あなたはこの合意を適合するように調整すべきです。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題については、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、それたはソフトウェア産業で定期的に実践されることはありません。誰が（そして、いくら）支払うかという問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用対効果がよい方法について確信しています。それは、セキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることです。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書化とテストの活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし、私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端では、顧客はすべてのリスクをとることができました、そして、開発者はたくさんの脆弱性をもつコードを供給することができました。他の極端では、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの両極端は、どちらとも実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]] （[https://www.owasp.org/index.php/Secure_software_contracting_hypothetical_case_study/ja 日本語訳]）を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書化を目的とした文書化を推奨しません。この契約は品質（量ではない）を促進することに集中します。私たちは、短いリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条件のよりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高水準で、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は、完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者とClientは、アプリケーションに直面しているリスクを理解して、文書化するために一緒に働くことに同意します。この努力は、アプリケーションにより提供される重要な資産と機能に主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために一緒に働くことに同意します。この付属書の要件部分で記載されるトピックの各々は、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフト、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、完全にコメントされます。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスは、含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、各々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信用できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素と他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条件を満たして、この契約の基で開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題マネジメント部分により追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113343</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113343"/>
				<updated>2011-07-05T02:08:12Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* しかし、このドキュメントですべてを作ることは難しい */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条項が私たちにとって適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の開始地点です。あなたは、すべての活動が好きではないかもしれません、または、より多くの提案をしたいかもしれません。あなたは異なる責任を割り当てたいかもしれません。この文書は、すべてのソフトウェア顧客と開発者の要望を厳密に取り込むことを意図しているわけではありません。ソフトウェアが最終的にセキュアになることを確実にするために重要である、主要な項目を議論するためのフレームワークを提供することを意図します。セキュリティを議論して合意を得た後で、あなたはこの合意を適合するように調整すべきです。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題については、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、それたはソフトウェア産業で定期的に実践されることはありません。誰が（そして、いくら）支払うかという問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用対効果がよい方法について確信しています。それは、セキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることです。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書化とテストの活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし、私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端では、顧客はすべてのリスクをとることができました、そして、開発者はたくさんの脆弱性をもつコードを供給することができました。他の極端では、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの両極端は、どちらとも実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]]  を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書化を目的とした文書化を推奨しません。この契約は品質（量ではない）を促進することに集中します。私たちは、短いリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条件のよりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高水準で、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は、完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者とClientは、アプリケーションに直面しているリスクを理解して、文書化するために一緒に働くことに同意します。この努力は、アプリケーションにより提供される重要な資産と機能に主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために一緒に働くことに同意します。この付属書の要件部分で記載されるトピックの各々は、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフト、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、完全にコメントされます。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスは、含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、各々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信用できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素と他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条件を満たして、この契約の基で開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題マネジメント部分により追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113342</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113342"/>
				<updated>2011-07-05T00:39:40Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* しかし私たちはそれほど多くのリスクをとることができない… */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条項が私たちにとって適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の開始地点です。あなたは、すべての活動が好きではないかもしれません、または、より多くの提案をしたいかもしれません。あなたは異なる責任を割り当てたいかもしれません。この文書は、すべてのソフトウェア顧客と開発者の要望を厳密に取り込むことを意図しているわけではありません。ソフトウェアが最終的にセキュアになることを確実にするために重要である、主要な項目を議論するためのフレームワークを提供することを意図します。セキュリティを議論して合意を得た後で、あなたはこの合意を適合するように調整すべきです。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題については、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、それたはソフトウェア産業で定期的に実践されることはありません。誰が（そして、いくら）支払うかという問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用対効果がよい方法について確信しています。それは、セキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることです。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書化とテストの活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし、私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端では、顧客はすべてのリスクをとることができました、そして、開発者はたくさんの脆弱性をもつコードを供給することができました。他の極端では、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの両極端は、どちらとも実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]]  を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書の目的のために文書を励ましません。この契約は、品質（量でない）を促すことに集中します。私たちは、短時間のリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条件のよりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高水準で、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は、完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者とClientは、アプリケーションに直面しているリスクを理解して、文書化するために一緒に働くことに同意します。この努力は、アプリケーションにより提供される重要な資産と機能に主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために一緒に働くことに同意します。この付属書の要件部分で記載されるトピックの各々は、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフト、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、完全にコメントされます。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスは、含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、各々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信用できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素と他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条件を満たして、この契約の基で開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題マネジメント部分により追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113341</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113341"/>
				<updated>2011-07-05T00:37:45Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* しかし厳密さのレベルは間違っている…. */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条項が私たちにとって適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の開始地点です。あなたは、すべての活動が好きではないかもしれません、または、より多くの提案をしたいかもしれません。あなたは異なる責任を割り当てたいかもしれません。この文書は、すべてのソフトウェア顧客と開発者の要望を厳密に取り込むことを意図しているわけではありません。ソフトウェアが最終的にセキュアになることを確実にするために重要である、主要な項目を議論するためのフレームワークを提供することを意図します。セキュリティを議論して合意を得た後で、あなたはこの合意を適合するように調整すべきです。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題については、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、それたはソフトウェア産業で定期的に実践されることはありません。誰が（そして、いくら）支払うかという問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用対効果がよい方法について確信しています。それは、セキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることです。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書化とテストの活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端で、顧客はすべてのリスクをすることができました、そして、開発者はたくさんの脆弱性でコードを供給することができました。他の極端で、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの極端の両方とも、実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]]  を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書の目的のために文書を励ましません。この契約は、品質（量でない）を促すことに集中します。私たちは、短時間のリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条件のよりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高水準で、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は、完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者とClientは、アプリケーションに直面しているリスクを理解して、文書化するために一緒に働くことに同意します。この努力は、アプリケーションにより提供される重要な資産と機能に主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために一緒に働くことに同意します。この付属書の要件部分で記載されるトピックの各々は、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフト、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、完全にコメントされます。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスは、含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、各々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信用できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素と他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条件を満たして、この契約の基で開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題マネジメント部分により追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113340</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113340"/>
				<updated>2011-07-05T00:31:54Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条項が私たちにとって適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の開始地点です。あなたは、すべての活動が好きではないかもしれません、または、より多くの提案をしたいかもしれません。あなたは異なる責任を割り当てたいかもしれません。この文書は、すべてのソフトウェア顧客と開発者の要望を厳密に取り込むことを意図しているわけではありません。ソフトウェアが最終的にセキュアになることを確実にするために重要である、主要な項目を議論するためのフレームワークを提供することを意図します。セキュリティを議論して合意を得た後で、あなたはこの合意を適合するように調整すべきです。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題については、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、それたはソフトウェア産業で定期的に実践されることはありません。誰が（そして、いくら）支払うかという問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用対効果がよい方法について確信しています。それは、セキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることです。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書とテストしている活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端で、顧客はすべてのリスクをすることができました、そして、開発者はたくさんの脆弱性でコードを供給することができました。他の極端で、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの極端の両方とも、実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]]  を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書の目的のために文書を励ましません。この契約は、品質（量でない）を促すことに集中します。私たちは、短時間のリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条件のよりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高水準で、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は、完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者とClientは、アプリケーションに直面しているリスクを理解して、文書化するために一緒に働くことに同意します。この努力は、アプリケーションにより提供される重要な資産と機能に主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために一緒に働くことに同意します。この付属書の要件部分で記載されるトピックの各々は、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフト、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、完全にコメントされます。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスは、含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、各々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信用できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素と他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条件を満たして、この契約の基で開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題マネジメント部分により追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113339</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113339"/>
				<updated>2011-07-05T00:22:44Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* しかし、すべての条件が私たちに対して適切であるというわけではありません… */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条項が私たちにとって適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の開始地点です。あなたは、すべての活動が好きではないかもしれません、または、より多くの提案をしたいかもしれません。あなたは異なる責任を割り当てたいかもしれません。この文書は、すべてのソフトウェア顧客と開発者の要望を厳密に取り込むことを意図しているわけではありません。ソフトウェアが最終的にセキュアになることを確実にするために重要である、主要な項目を議論するためのフレームワークを提供することを意図します。セキュリティを議論して合意を得た後で、あなたはこの合意を適合するように調整すべきです。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題について、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、彼らはソフトウェア産業で定期的に実践されません。誰が支払うか（そして、いくら）という問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用効果がよい方法がセキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることであることを確信しています。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書とテストしている活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端で、顧客はすべてのリスクをすることができました、そして、開発者はたくさんの脆弱性でコードを供給することができました。他の極端で、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの極端の両方とも、実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]]  を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書の目的のために文書を励ましません。この契約は、品質（量でない）を促すことに集中します。私たちは、短時間のリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条件のよりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高水準で、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は、完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者とClientは、アプリケーションに直面しているリスクを理解して、文書化するために一緒に働くことに同意します。この努力は、アプリケーションにより提供される重要な資産と機能に主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために一緒に働くことに同意します。この付属書の要件部分で記載されるトピックの各々は、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフト、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、完全にコメントされます。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスは、含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、各々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信用できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素と他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条件を満たして、この契約の基で開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題マネジメント部分により追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113338</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113338"/>
				<updated>2011-07-05T00:18:31Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* プロジェクトについて */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団（セキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門とする非営利の慈善団体）によって作成されました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたが適すると思うように、修正してもよいですし、使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条件が私たちに対して適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の出発点と考えられなければなりません。あなたはすべての活動が好きでなくてもよいですが、より提案したくてもよいです。あなたは、違って責任を割り当てたくてもよいです。この文書は、必ずしもすべてのソフトウェア顧客と開発者のニーズを捕えることを目的としません。ソフトウェアがセキュアに終わることを確実とすることにとって重要である主要な話題を議論するためのフレームワークを提供することを目的とします。あなたがセキュリティ議論をして、合意に達したあと、あなたは合致するためにこの合意を手直ししなければなりません。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題について、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、彼らはソフトウェア産業で定期的に実践されません。誰が支払うか（そして、いくら）という問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用効果がよい方法がセキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることであることを確信しています。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書とテストしている活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端で、顧客はすべてのリスクをすることができました、そして、開発者はたくさんの脆弱性でコードを供給することができました。他の極端で、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの極端の両方とも、実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]]  を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書の目的のために文書を励ましません。この契約は、品質（量でない）を促すことに集中します。私たちは、短時間のリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条件のよりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高水準で、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は、完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者とClientは、アプリケーションに直面しているリスクを理解して、文書化するために一緒に働くことに同意します。この努力は、アプリケーションにより提供される重要な資産と機能に主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために一緒に働くことに同意します。この付属書の要件部分で記載されるトピックの各々は、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフト、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、完全にコメントされます。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスは、含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、各々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信用できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素と他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条件を満たして、この契約の基で開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題マネジメント部分により追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113337</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113337"/>
				<updated>2011-07-04T22:39:36Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* 序文 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客と開発者が、期待について議論して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に添付されることを目的とします。これらの条項は交渉の余地があります。そして、それらは顧客と開発者によって、協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団によって作成されました。そして、非営利の慈善団体がセキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門としました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたは変更してもよいです、そして、あなたに適すると思うように使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条件が私たちに対して適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の出発点と考えられなければなりません。あなたはすべての活動が好きでなくてもよいですが、より提案したくてもよいです。あなたは、違って責任を割り当てたくてもよいです。この文書は、必ずしもすべてのソフトウェア顧客と開発者のニーズを捕えることを目的としません。ソフトウェアがセキュアに終わることを確実とすることにとって重要である主要な話題を議論するためのフレームワークを提供することを目的とします。あなたがセキュリティ議論をして、合意に達したあと、あなたは合致するためにこの合意を手直ししなければなりません。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題について、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、彼らはソフトウェア産業で定期的に実践されません。誰が支払うか（そして、いくら）という問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用効果がよい方法がセキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることであることを確信しています。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書とテストしている活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端で、顧客はすべてのリスクをすることができました、そして、開発者はたくさんの脆弱性でコードを供給することができました。他の極端で、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの極端の両方とも、実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]]  を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書の目的のために文書を励ましません。この契約は、品質（量でない）を促すことに集中します。私たちは、短時間のリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条件のよりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高水準で、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は、完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者とClientは、アプリケーションに直面しているリスクを理解して、文書化するために一緒に働くことに同意します。この努力は、アプリケーションにより提供される重要な資産と機能に主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために一緒に働くことに同意します。この付属書の要件部分で記載されるトピックの各々は、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフト、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、完全にコメントされます。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスは、含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、各々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信用できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素と他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条件を満たして、この契約の基で開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題マネジメント部分により追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113304</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113304"/>
				<updated>2011-07-04T13:34:25Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* 序文 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
OWASPセキュア・ソフトウェア開発契約付属書は、ソフトウェアの開発者とその顧客が、開発または供給されるソフトウェアのセキュリティに関連した重要な契約条項と条件を交渉し、取り込むことを助けます。このプロジェクトの理由は、多くの契約はこれらの問題に触れておらず、しばしば関係者が実際に同意されたものに劇的に異なる見解を持つことです。私たちは、これらの条項を明確に述べることは、双方の関係者が進め方について情報に基づいた意思決定ができることを確実にするもっともよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティは改善します。&lt;br /&gt;
 最低限、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると市販ソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客を開発者に期待を協議して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に追加されることを目的とします。これらの条件は交渉の余地があります。そして、それらは顧客よ開発者によって協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団によって作成されました。そして、非営利の慈善団体がセキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門としました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたは変更してもよいです、そして、あなたに適すると思うように使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条件が私たちに対して適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の出発点と考えられなければなりません。あなたはすべての活動が好きでなくてもよいですが、より提案したくてもよいです。あなたは、違って責任を割り当てたくてもよいです。この文書は、必ずしもすべてのソフトウェア顧客と開発者のニーズを捕えることを目的としません。ソフトウェアがセキュアに終わることを確実とすることにとって重要である主要な話題を議論するためのフレームワークを提供することを目的とします。あなたがセキュリティ議論をして、合意に達したあと、あなたは合致するためにこの合意を手直ししなければなりません。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題について、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、彼らはソフトウェア産業で定期的に実践されません。誰が支払うか（そして、いくら）という問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用効果がよい方法がセキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることであることを確信しています。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書とテストしている活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端で、顧客はすべてのリスクをすることができました、そして、開発者はたくさんの脆弱性でコードを供給することができました。他の極端で、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの極端の両方とも、実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]]  を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書の目的のために文書を励ましません。この契約は、品質（量でない）を促すことに集中します。私たちは、短時間のリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条件のよりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高水準で、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は、完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者とClientは、アプリケーションに直面しているリスクを理解して、文書化するために一緒に働くことに同意します。この努力は、アプリケーションにより提供される重要な資産と機能に主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために一緒に働くことに同意します。この付属書の要件部分で記載されるトピックの各々は、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフト、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、完全にコメントされます。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスは、含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、各々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信用できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素と他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条件を満たして、この契約の基で開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題マネジメント部分により追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113303</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=113303"/>
				<updated>2011-07-04T13:33:42Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュア・ソフトウェア開発契約付属書'''&lt;br /&gt;
&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
この契約付属書はソフトウェア開発者を助けることを目的とします、そして、彼らのクライアントは開発されるか、供給されるソフトウェアのセキュリティに関連した重要な契約の期間と条件を協議して、取り込みます。このプロジェクトの理由は大部分の契約がこれらの問題について語られていないということです、そして、関係者は実は同意されたことの上にまったく異なる見解をしばしば持ちます。私たちは、これらの条件を明らかに明瞭に表現することが双方が前進する方法について情報に基づいた決定をすることができることを確実とする最もよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティはよくなります。&lt;br /&gt;
 最低限で、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると既製のソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客を開発者に期待を協議して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に追加されることを目的とします。これらの条件は交渉の余地があります。そして、それらは顧客よ開発者によって協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団によって作成されました。そして、非営利の慈善団体がセキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門としました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたは変更してもよいです、そして、あなたに適すると思うように使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条件が私たちに対して適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の出発点と考えられなければなりません。あなたはすべての活動が好きでなくてもよいですが、より提案したくてもよいです。あなたは、違って責任を割り当てたくてもよいです。この文書は、必ずしもすべてのソフトウェア顧客と開発者のニーズを捕えることを目的としません。ソフトウェアがセキュアに終わることを確実とすることにとって重要である主要な話題を議論するためのフレームワークを提供することを目的とします。あなたがセキュリティ議論をして、合意に達したあと、あなたは合致するためにこの合意を手直ししなければなりません。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題について、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、彼らはソフトウェア産業で定期的に実践されません。誰が支払うか（そして、いくら）という問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用効果がよい方法がセキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることであることを確信しています。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書とテストしている活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端で、顧客はすべてのリスクをすることができました、そして、開発者はたくさんの脆弱性でコードを供給することができました。他の極端で、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの極端の両方とも、実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]]  を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書の目的のために文書を励ましません。この契約は、品質（量でない）を促すことに集中します。私たちは、短時間のリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条件のよりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高水準で、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は、完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者とClientは、アプリケーションに直面しているリスクを理解して、文書化するために一緒に働くことに同意します。この努力は、アプリケーションにより提供される重要な資産と機能に主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために一緒に働くことに同意します。この付属書の要件部分で記載されるトピックの各々は、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフト、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、完全にコメントされます。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスは、含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、各々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信用できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素と他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条件を満たして、この契約の基で開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題マネジメント部分により追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Category:OWASP_Legal_Project&amp;diff=113302</id>
		<title>Category:OWASP Legal Project</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Category:OWASP_Legal_Project&amp;diff=113302"/>
				<updated>2011-07-04T10:15:44Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: Add * Contract Annex in Japanese.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==== Home ====&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! width=&amp;quot;66%&amp;quot; | &lt;br /&gt;
! width=&amp;quot;33%&amp;quot; | &lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| &lt;br /&gt;
The goal of the '''OWASP Legal Project''' is to ensure, at each stage of the life cycle, that appropriate attention has been paid to security. The cornerstone of the Legal Project is its Secure Software Development Contract Annex. The Contract Annex  helps software developers and their clients negotiate and capture important contractual terms and conditions related to the security of the software to be developed or delivered. Here are two examples:&lt;br /&gt;
&lt;br /&gt;
* '''Implementation.''' Developer agrees to provide and follow a set of secure coding guidelines and to use a set of common security control programming interfaces (such as the [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP ESAPI]). Guidelines will indicate how code should be formatted, structured, and commented. Common security control programming interfaces will define how security controls must be called and how security controls shall function. All security-relevant code shall be thoroughly commented. Specific guidance on avoiding common security vulnerabilities shall be included. Also, all code shall be reviewed by at least one other Developer against the security requirements and coding guideline before it is considered ready for unit test.&lt;br /&gt;
* '''Security Analysis and Testing.''' Developer will perform application security analysis and testing (also called &amp;quot;verification&amp;quot;) according to the verification requirements of an agreed-upon standard (such as the [http://www.owasp.org/index.php/ASVS OWASP ASVS]). The Developer shall document verification findings according to the reporting requirements of the standard. The Developer shall provide the verification findings to Client.&lt;br /&gt;
| &lt;br /&gt;
[[Image:Esapi-sponsors.PNG]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! width=&amp;quot;33%&amp;quot; | &lt;br /&gt;
! width=&amp;quot;33%&amp;quot; | &lt;br /&gt;
! width=&amp;quot;33%&amp;quot; | &lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| &lt;br /&gt;
== Let's talk here  ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-bulb.jpg]]'''Legal Communities''' &lt;br /&gt;
&lt;br /&gt;
Further development of Legal Project documents occurs through mailing list discussions and occasional workshops, and suggestions for improvement are welcome. For more information, please [mailto:jeff.williams@owasp.org contact us]. &lt;br /&gt;
&lt;br /&gt;
*[https://lists.owasp.org/mailman/listinfo/owasp-legal owasp-legal mailing list (this is the main list)]&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
== Got translation cycles?  ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-writing.JPG]]'''Legal Project Translations''' &lt;br /&gt;
&lt;br /&gt;
The Legal Project project is always on the lookout for volunteers who are interested in translating Legal Project documents into another language. &lt;br /&gt;
&lt;br /&gt;
*Translation Onboarding Instructions -- Coming soon!&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
== Related resources ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-satellite.jpg]]'''OWASP Resources''' &lt;br /&gt;
&lt;br /&gt;
* [[Top Ten|OWASP Top Ten]]&lt;br /&gt;
* [[ASVS|OWASP Application Security Verification Standard]]&lt;br /&gt;
*[http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP ESAPI] &lt;br /&gt;
*[http://www.owasp.org/index.php/Category:OWASP_Newsletter#tab=Press_releases OWASP Press Releases]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Downloads ====&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! width=&amp;quot;33%&amp;quot; | &lt;br /&gt;
! width=&amp;quot;33%&amp;quot; | &lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| &lt;br /&gt;
[[Image:Asvs-step1.jpg]]'''1. About Legal Project Documents''' &lt;br /&gt;
&lt;br /&gt;
* One Page Datasheet ([http://www.owasp.org/images/a/aa/Legal_One_Page_Handout.doc Word], [http://www.owasp.org/index.php/Image:Legal_One_Page_Handout.pdf PDF]) &lt;br /&gt;
* One Page Datasheet in Japanese ([https://www.owasp.org/index.php/File:Legal_One_Page_Handout-ja.pdf PDF])&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-step2.jpg]]'''2. Get Legal Project Documents''' &lt;br /&gt;
&lt;br /&gt;
* Contract Annex in English ([http://www.owasp.org/index.php/Image:OWASP_Secure_Software_Contract_Annex.doc Word], [http://www.owasp.org/index.php/OWASP_Secure_Software_Contract_Annex HTML])&lt;br /&gt;
* Contract Annex in Spanish ([http://www.owasp.org/index.php/Anexo_para_Contrato_de_Software_Seguro_de_OWASP HTML])&lt;br /&gt;
* Contract Annex in Japanese ([https://www.owasp.org/index.php/OWASP_Secure_Software_Contract_Annex/ja HTML])&lt;br /&gt;
* Verification schedule in English ([http://www.owasp.org/index.php/Image:Sample_ASVS_Fee_Schedule_Template.xls Excel])&lt;br /&gt;
&lt;br /&gt;
{{OWASP Book|4037498}}&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-step3.jpg]]'''3. Learn About Legal Project Documents''' &lt;br /&gt;
&lt;br /&gt;
* Coming soon!&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==== Glossary ====&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-letters.jpg]]'''Legal Project Terminology''' &lt;br /&gt;
&lt;br /&gt;
* Coming soon!&lt;br /&gt;
&lt;br /&gt;
==== Project Details  ====&lt;br /&gt;
{{:GPC_Project_Details/OWASP_Legal_Project | OWASP Project Identification Tab}}&lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt; ''This project licensed under the [http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution ShareAlike 3.0].'' &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Category:OWASP_Legal_Project&amp;diff=113301</id>
		<title>Category:OWASP Legal Project</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Category:OWASP_Legal_Project&amp;diff=113301"/>
				<updated>2011-07-04T10:08:39Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: Add * One Page Datasheet in Japanese.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==== Home ====&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! width=&amp;quot;66%&amp;quot; | &lt;br /&gt;
! width=&amp;quot;33%&amp;quot; | &lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| &lt;br /&gt;
The goal of the '''OWASP Legal Project''' is to ensure, at each stage of the life cycle, that appropriate attention has been paid to security. The cornerstone of the Legal Project is its Secure Software Development Contract Annex. The Contract Annex  helps software developers and their clients negotiate and capture important contractual terms and conditions related to the security of the software to be developed or delivered. Here are two examples:&lt;br /&gt;
&lt;br /&gt;
* '''Implementation.''' Developer agrees to provide and follow a set of secure coding guidelines and to use a set of common security control programming interfaces (such as the [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP ESAPI]). Guidelines will indicate how code should be formatted, structured, and commented. Common security control programming interfaces will define how security controls must be called and how security controls shall function. All security-relevant code shall be thoroughly commented. Specific guidance on avoiding common security vulnerabilities shall be included. Also, all code shall be reviewed by at least one other Developer against the security requirements and coding guideline before it is considered ready for unit test.&lt;br /&gt;
* '''Security Analysis and Testing.''' Developer will perform application security analysis and testing (also called &amp;quot;verification&amp;quot;) according to the verification requirements of an agreed-upon standard (such as the [http://www.owasp.org/index.php/ASVS OWASP ASVS]). The Developer shall document verification findings according to the reporting requirements of the standard. The Developer shall provide the verification findings to Client.&lt;br /&gt;
| &lt;br /&gt;
[[Image:Esapi-sponsors.PNG]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! width=&amp;quot;33%&amp;quot; | &lt;br /&gt;
! width=&amp;quot;33%&amp;quot; | &lt;br /&gt;
! width=&amp;quot;33%&amp;quot; | &lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| &lt;br /&gt;
== Let's talk here  ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-bulb.jpg]]'''Legal Communities''' &lt;br /&gt;
&lt;br /&gt;
Further development of Legal Project documents occurs through mailing list discussions and occasional workshops, and suggestions for improvement are welcome. For more information, please [mailto:jeff.williams@owasp.org contact us]. &lt;br /&gt;
&lt;br /&gt;
*[https://lists.owasp.org/mailman/listinfo/owasp-legal owasp-legal mailing list (this is the main list)]&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
== Got translation cycles?  ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-writing.JPG]]'''Legal Project Translations''' &lt;br /&gt;
&lt;br /&gt;
The Legal Project project is always on the lookout for volunteers who are interested in translating Legal Project documents into another language. &lt;br /&gt;
&lt;br /&gt;
*Translation Onboarding Instructions -- Coming soon!&lt;br /&gt;
&lt;br /&gt;
| &lt;br /&gt;
== Related resources ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-satellite.jpg]]'''OWASP Resources''' &lt;br /&gt;
&lt;br /&gt;
* [[Top Ten|OWASP Top Ten]]&lt;br /&gt;
* [[ASVS|OWASP Application Security Verification Standard]]&lt;br /&gt;
*[http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP ESAPI] &lt;br /&gt;
*[http://www.owasp.org/index.php/Category:OWASP_Newsletter#tab=Press_releases OWASP Press Releases]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Downloads ====&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! width=&amp;quot;33%&amp;quot; | &lt;br /&gt;
! width=&amp;quot;33%&amp;quot; | &lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| &lt;br /&gt;
[[Image:Asvs-step1.jpg]]'''1. About Legal Project Documents''' &lt;br /&gt;
&lt;br /&gt;
* One Page Datasheet ([http://www.owasp.org/images/a/aa/Legal_One_Page_Handout.doc Word], [http://www.owasp.org/index.php/Image:Legal_One_Page_Handout.pdf PDF]) &lt;br /&gt;
* One Page Datasheet in Japanese ([https://www.owasp.org/index.php/File:Legal_One_Page_Handout-ja.pdf PDF])&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-step2.jpg]]'''2. Get Legal Project Documents''' &lt;br /&gt;
&lt;br /&gt;
* Contract Annex in English ([http://www.owasp.org/index.php/Image:OWASP_Secure_Software_Contract_Annex.doc Word], [http://www.owasp.org/index.php/OWASP_Secure_Software_Contract_Annex HTML])&lt;br /&gt;
* Contract Annex in Spanish ([http://www.owasp.org/index.php/Anexo_para_Contrato_de_Software_Seguro_de_OWASP HTML])&lt;br /&gt;
* Verification schedule in English ([http://www.owasp.org/index.php/Image:Sample_ASVS_Fee_Schedule_Template.xls Excel])&lt;br /&gt;
&lt;br /&gt;
{{OWASP Book|4037498}}&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-step3.jpg]]'''3. Learn About Legal Project Documents''' &lt;br /&gt;
&lt;br /&gt;
* Coming soon!&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==== Glossary ====&lt;br /&gt;
&lt;br /&gt;
[[Image:Asvs-letters.jpg]]'''Legal Project Terminology''' &lt;br /&gt;
&lt;br /&gt;
* Coming soon!&lt;br /&gt;
&lt;br /&gt;
==== Project Details  ====&lt;br /&gt;
{{:GPC_Project_Details/OWASP_Legal_Project | OWASP Project Identification Tab}}&lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &amp;lt;headertabs /&amp;gt; ''This project licensed under the [http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution ShareAlike 3.0].'' &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=File:Legal_One_Page_Handout-ja.pdf&amp;diff=113300</id>
		<title>File:Legal One Page Handout-ja.pdf</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=File:Legal_One_Page_Handout-ja.pdf&amp;diff=113300"/>
				<updated>2011-07-04T10:01:35Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=109810</id>
		<title>OWASP Secure Software Contract Annex/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Secure_Software_Contract_Annex/ja&amp;diff=109810"/>
				<updated>2011-04-29T12:51:13Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: Created page with &amp;quot;'''セキュアなソフトウェア開発契約付属書'''   警告：この文書は、単にガイダンスと考えられなければなりません。   OWASPは、ソフ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''セキュアなソフトウェア開発契約付属書'''&lt;br /&gt;
  警告：この文書は、単にガイダンスと考えられなければなりません。&lt;br /&gt;
  OWASPは、ソフトウェア契約を交渉するのを手助けするために、&lt;br /&gt;
  あなたが資格のある弁護士に相談するよう強く勧めます。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
この契約付属書はソフトウェア開発者を助けることを目的とします、そして、彼らのクライアントは開発されるか、供給されるソフトウェアのセキュリティに関連した重要な契約の期間と条件を協議して、取り込みます。このプロジェクトの理由は大部分の契約がこれらの問題について語られていないということです、そして、関係者は実は同意されたことの上にまったく異なる見解をしばしば持ちます。私たちは、これらの条件を明らかに明瞭に表現することが双方が前進する方法について情報に基づいた決定をすることができることを確実とする最もよい方法であると思っています。&lt;br /&gt;
&lt;br /&gt;
 「市場がより良いセキュリティを要求するとき、商用ソフトのセキュリティはよくなります。&lt;br /&gt;
 最低限で、あらゆるソフトウェア提案依頼書は、ベンダーに彼らがセキュリティ脆弱性に対して&lt;br /&gt;
 生産物をテストする方法を詳述するよう依頼しなければなりません。このステップは、企業が&lt;br /&gt;
 セキュリティを評価すると既製のソフトウェアのベンダーと外部調達された開発者を納得させ始めます。」&lt;br /&gt;
       -- John Pescatore（Gartnerのリサーチ・ディレクター）として&lt;br /&gt;
&lt;br /&gt;
私たちは、顧客を開発者に期待を協議して、責任について交渉することに対するフレームワークとしてこの文書を使うよう勧めます。この付属書は、ソフトウェア開発契約に追加されることを目的とします。これらの条件は交渉の余地があります。そして、それらは顧客よ開発者によって協議されることができて、協議されなければならないことを意味します。&lt;br /&gt;
&lt;br /&gt;
==プロジェクトについて==&lt;br /&gt;
&lt;br /&gt;
この文書はOpen Web Application Security Project（OWASP）財団によって作成されました。そして、非営利の慈善団体がセキュアなソフトウェアに関連した無料でオープンなツールとドキュメンテーションを作成することを専門としました。個人契約において容易に使用できるようにするために、この文書はCC Share Alike 3.0ライセンスにて提供されます。あなたは変更してもよいです、そして、あなたに適すると思うように使用してもよいです。あなたは、http://www.owasp.com/index.php/OWASP_Legal_Project でこのプロジェクトについて更なる詳細を見つけることができます。私たちは、ソフトウェア（法律コミュニティだけでなく）の製作者と消費者のコメントを歓迎します。&lt;br /&gt;
&lt;br /&gt;
OWASPは、この文書の研究と準備における彼らの役割に対して [http://www.aspectsecurity.com Aspect Security] から特別な貢献を感謝して認めます。&lt;br /&gt;
&lt;br /&gt;
==異論==&lt;br /&gt;
&lt;br /&gt;
以下のわずかなページは、ソフトウェア開発契約においてこの言い回しを使用することに対するいくらかのたびたび聞こえる異論をカバーします：&lt;br /&gt;
&lt;br /&gt;
===しかし、すべての条件が私たちに対して適切であるというわけではありません…===&lt;br /&gt;
&lt;br /&gt;
この文書は、あなたの合意の出発点と考えられなければなりません。あなたはすべての活動が好きでなくてもよいですが、より提案したくてもよいです。あなたは、違って責任を割り当てたくてもよいです。この文書は、必ずしもすべてのソフトウェア顧客と開発者のニーズを捕えることを目的としません。ソフトウェアがセキュアに終わることを確実とすることにとって重要である主要な話題を議論するためのフレームワークを提供することを目的とします。あなたがセキュリティ議論をして、合意に達したあと、あなたは合致するためにこの合意を手直ししなければなりません。&lt;br /&gt;
&lt;br /&gt;
===しかし、これらの活動に対して誰が代金を払わなければならないのでしょうか===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェア開発者により多くの負担を与えることはほとんどありません。問題は、セキュリティ ― もちろんそこにある ― と関連したコストがあるかどうかということでありません。むしろ、適切な問題はどんな活動がそれらのコストを最小にするために双方によって実行されなければならないかということです、そして、いつ、それらは起こらなければなりませんか。&lt;br /&gt;
&lt;br /&gt;
この付属書は、誰がここに記述される活動の料金を払わなければならないかという問題について、意図的に語られていません。これらの活動の多くがすでに起こらなければならなくて、多くの顧客によって期待される一方、彼らはソフトウェア産業で定期的に実践されません。誰が支払うか（そして、いくら）という問題が、交渉の一部でなければなりません。&lt;br /&gt;
&lt;br /&gt;
セキュリティのコストを計算することは、非常に難しいです。セキュリティ活動を実行することに関連したコストがある一方、それらを無視することに関連したかなりのコストもあります。私たちは、ソフトウェアを開発する最も費用効果がよい方法がセキュリティ瑕疵が導入されるという可能性を減らして、瑕疵を導入して、それを修正することの間で時間を最小にすることであることを確信しています。&lt;br /&gt;
&lt;br /&gt;
コストを計算するときにする一つの重要な区別は、セキュリティ手法を構築することと、それらの手法が正しくて効果的であることを確実にする保証活動の間にあります。ライフサイクルの終わりに手法を加えようとすることは、深刻な設計問題を引き起こすことがありえて、めざましくコストを増やします。この合意は、手法についての早い段階の決定がこれらのコストを最小にするのを奨励します。同様に、配備直前に保証活動（例えばコードレビューと侵入テスト）をするまで待つことはコストをめざましく増やします。私たちは、保証を得る最も費用効果がよい方法がライフサイクルを通して努力の一定のレベルを保証に入れることであると思っています。&lt;br /&gt;
&lt;br /&gt;
===しかし厳密さのレベルは間違っている….===&lt;br /&gt;
&lt;br /&gt;
この合意は、開発されているソフトウェアが大企業または政府機関にとってかなり重要であると仮定します。私たちは、大部分のソフトウェア開発組織によって達成できる合意のために「厳格さのレベル」を選んで、最も一般的なリスクを確認して、取り扱います。&lt;br /&gt;
&lt;br /&gt;
しかし、重要なアプリケーション（例えば医学であるか、財政的であるか、防衛に関連したソフトウェア）で使われそうであるソフトウェアについては、あなたは厳格さのレベルを上げたいかもしれません。あなたは、追加のレビュー、文書とテストしている活動を加えたくてもよいです。あなたは、脆弱性を探すこと、診断すること、修正することに対するプロセスを強化しくてもよいです。より機密を扱わないアプリケーションのために、あなたは活動を減らすか、取り除きたくてもよいです。&lt;br /&gt;
&lt;br /&gt;
===しかし私たちはそれほど多くのリスクをとることができない…===&lt;br /&gt;
&lt;br /&gt;
この契約は、ソフトウェアにおけるセキュリティ脆弱性に対するリスクをとるのかという議論を容易にすることを目的とします。範囲の一端で、顧客はすべてのリスクをすることができました、そして、開発者はたくさんの脆弱性でコードを供給することができました。他の極端で、開発者はすべてのリスクをとることができて、完全なコードを供給することに対する責任を負うことができました。これらの極端の両方とも、実行不可能です。&lt;br /&gt;
&lt;br /&gt;
現在、この契約において、開発者は要求においてカバーされたか、理にかなったテスト努力によってカバーされるべき問題に対するリスクをとります。しかし、「新しい」セキュリティ問題の改善は、顧客によって代金を払われるべきです。私たちは、これが開発者が彼らのリスクの境界となることができて役に立つバランスで、顧客が前もってセキュリティ要求を正しくするのを奨励すると思っています。しかし、この問題の多くの他の可能性がある解決が、あります。あなたには他の提案があるかどうか私たちに知らせます、そして、私たちは彼らをこの文書の将来の版に含めてもよいです。&lt;br /&gt;
&lt;br /&gt;
ここでの議論がコードにおいてセキュリティ脆弱性を修正することに関連したリスクをカバーだけして、これらの脆弱性のあらゆるエクスプロイットに基づくあらゆるセキュリティ・インシデントから立ち直ることと関連したコストを含まないことに注意すべきです。私たちは、この領域におけるベスト・プラクティスに興味があります。&lt;br /&gt;
&lt;br /&gt;
===私たちはどのように第三者のコードを保証するでしょうか===&lt;br /&gt;
&lt;br /&gt;
ほとんどすべてのソフトウェアプロジェクトは、第三者のコード（例えばライブラリ、フレームワークと生産物）のかなりの量を使います。このコードは、ただセキュリティ観点から、カスタム・コードがあなたのプロジェクトのために特に発達したのと同じくらい重要です。&lt;br /&gt;
私たちはこのコードのセキュリティを確実にすることに対する責任が開発者によって負われて最もよいと思っています、しかし、彼らにはこのセキュリティを保証するために彼ら自身のいっぱいの能力がないかもしれません。しかし、セキュリティは「構築するか、買うか」議論の一部分でなければなりません、これはそれを促進する最もよい方法のようです。&lt;br /&gt;
&lt;br /&gt;
開発者は、もちろん、終わりまで第三者のソフトウェアの提供者にこの責任をパスする選択権があります。開発者は彼ら自身第三者のコードを分析することもできるか、彼らのためにそれを分析するために、セキュリティの専門家を雇うこともできます。&lt;br /&gt;
&lt;br /&gt;
===しかし、なぜ私はすべてのこのトラブルにいくべきなのでしょうか===&lt;br /&gt;
&lt;br /&gt;
最後に、私たちはソフトウェアを契約しているプロセスの一部分をセキュリティをすることに代わるものがないと思っています。現在では、私たちは多くのソフトウェア開発契約のもとで供給されているコードのセキュリティに関する重大な誤解があると思っています。これは、わずかなソフトウェア経験または理解とともに個人によってなされる高価な訴訟と決定に至ることができるだけです。この問題の完全な議論に対して [[Secure software contracting hypothetical case study]]  を読んでください。&lt;br /&gt;
&lt;br /&gt;
多くの利点が、この契約を通してうまくいくことにあります。主要なものは、それが関係する関係者の間で期待を明らかにするということです。場合によっては、難しいセキュリティ問題がソフトウェアで表面化するとき、それは訴訟を妨げるのを助けます。また、これらは多くの法的で調整するコンプライアンスの理由によって必要とされる同じ活動です。&lt;br /&gt;
&lt;br /&gt;
===しかし、このドキュメントですべてを作ることは難しい===&lt;br /&gt;
&lt;br /&gt;
OWASPは、文書の目的のために文書を励ましません。この契約は、品質（量でない）を促すことに集中します。私たちは、短時間のリスク評価、数ページの要求、短いセキュリティ設計文書、テストプラン、いくつかのテスト結果とともに、この契約に応じることが（若干のプロジェクトにおいて）ありえると思っています。&lt;br /&gt;
&lt;br /&gt;
この文書の目標は、ライフサイクルの各段階で、単に適切な注意がセキュリティに払われたことを確実とすることです。追加の利点は、この文書が基本的に、このソフトウェアが安心してそれがそれがすると主張することをするのをまかせられなければならない理由に対する議論を配置する「証明パッケージ」をつくるために一緒に集められることができるということです。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==契約付属書==&lt;br /&gt;
&lt;br /&gt;
===1. 序文===&lt;br /&gt;
&lt;br /&gt;
この付属書は、顧客と開発者の間で_____________________ (&amp;quot;合意&amp;quot;) するために作られます。顧客と開発者は、以下の条件のよりソフトウェアのセキュリティを最大にすることに同意します。&lt;br /&gt;
&lt;br /&gt;
===2. 原理===&lt;br /&gt;
&lt;br /&gt;
この付属書は、ソフトウェア開発関係のすべての関係者のセキュリティ関連の権利と義務をはっきりさせることを目的とします。最高水準で、関係者は以下に同意します&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ決定は、リスクに基づきます : セキュリティについての決定は、関係するリスクのしっかりした理解に基づく顧客と開発者によって共同でなされす。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ活動はバランスが保たれます : セキュリティ努力は、全てのソフトウェア開発ライフサイクル全体でおおよそ均一に配布されます。&lt;br /&gt;
&lt;br /&gt;
;(c) セキュリティ活動は統合されます : ここに協議されるすべての活動と文書は、開発者のソフトウェア開発ライフサイクルに統合されて、残りのプロジェクトと別にしておかれるというわけではありません。この付属書の何も、どんな特定のソフトウェア開発プロセスを意味しません。&lt;br /&gt;
&lt;br /&gt;
;(d) 脆弱性は予想されます : すべてのソフトウェアにはバグがあります、そして、それらのいくらかはセキュリティ問題を生じさせます。顧客と開発者は、ライフサイクルにおいてできるだけ早く脆弱性を特定するよう努めます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ情報は、完全に明らかにされます : すべてのセキュリティ関連した情報は、すぐに、そして、完全に、顧客と開発者で共有されます。&lt;br /&gt;
&lt;br /&gt;
;(f) 役に立つセキュリティ文書だけが必要とされます : セキュリティ文書は、セキュリティ設計、リスク分析または問題を明確に記述するために詳細にわたる必要はありません。&lt;br /&gt;
&lt;br /&gt;
===3.ライフサイクル活動===&lt;br /&gt;
&lt;br /&gt;
;(a) リスク識別 : 開発者とClientは、アプリケーションに直面しているリスクを理解して、文書化するために一緒に働くことに同意します。この努力は、アプリケーションにより提供される重要な資産と機能に主要なリスクを確認しなければなりません。要件部にリストされるトピックの各々は、考慮されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 要求 : リスクに基づいて、開発者と顧客は、開発されるソフトウェアの仕様の一部として詳細なセキュリティ要件を確立するために一緒に働くことに同意します。この付属書の要件部分で記載されるトピックの各々は、開発者と顧客によって協議されなければならなくて、評価されなければなりません。これらの要件は、カスタム・ソフト、第三者のソフトウェアまたはプラットホームによって満たされてもよいです。&lt;br /&gt;
&lt;br /&gt;
;(c) 設計 : 開発者は、セキュリティ要件の各々を達成するために明確に設計を説明する文書を提供することに同意します。ほとんどの場合、この文書はセキュリティ手法を記載します、そこで、手法はアーキテクチャに適合しました、そして、関連したすべては彼らの適正使用を確実にするためにパターンを設計します。設計は、サポートがカスタム・ソフトか、第三者のソフトウェアかプラットホームから来るかどうか、明確に指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(d) 実装 : 開発者は、一組のセキュアなコーディング指針に提供することに、従って、一組の共通セキュリティ制御プログラミング・インターフェース（例えば [http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API OWASP Enterprise Security API（ESAPI）] ）を使って同意します。ガイドラインは、コードがどのようにフォーマットされなければならなくて、構築されなければならなくて、コメントされなければならないかについて示します。共通セキュリティ制御プログラミング・インターフェースは、セキュリティ制御がどのように呼ばれなければならないか、そして、セキュリティ制御がどのように機能するか定めます。すべてのセキュリティに関連したコードは、完全にコメントされます。共通のセキュリティ脆弱性を回避するときの具体的なガイダンスは、含まれなければなりません。また、すべてのコードはセキュリティ要件に対して少なくとも他の一人の開発者によってレビューされなければなりません、そして、それの前のコーディング・ガイドラインは単体テストの準備ができていると思われます。&lt;br /&gt;
&lt;br /&gt;
;(e) セキュリティ分析とテスト : 開発者は、（ [http://www.owasp.org/index.php/Category:OWASP_Application_Security_Verification_Standard_Project OWASP Application Security Verification Standard (ASVS)] のような）合意された標準の検証要件により、アプリケーション・セキュリティ分析とテスト（「検証」とも言われる）を実行します。開発者は、標準の報告要件によって検証結論を文書化しなければなりません。開発者は、検証結論を顧客に提供しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) セキュリティ配備 : 開発者は、ソフトウェアの全体的なセキュリティのために完全にすべてのセキュリティ関連した構成オプションとそれらの関連性を記述するセキュアな構成ガイドラインを提供することに同意します。ガイドラインは、オペレーティングシステム、ウェブサーバとアプリケーション・サーバーを含むサポート的なプラットホームにおける依存関係の完全な記述を含まなければいけません。また、どのようにそれらをセキュリティのために構成されるべきかを含まなければいけません。ソフトウェアのデフォルトコンフィグレーションは、セキュアでなければなりません。&lt;br /&gt;
&lt;br /&gt;
===4.セキュリティ要求エリア===&lt;br /&gt;
&lt;br /&gt;
以下のトピック領域は、リスク理解と要求定義活動の間、考慮されなければなりません。この努力は一組の具体的で、注文仕立てで、分析できる要求を生産しなければなりません。そして、開発者と顧客はこのプロセスに関与していなければならなくて、要求の最終セットについて同意しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(a) 入力検証とエンコーディング : 要求は、ユーザー、ファイルシステム、データベース、ディレクトリまたは外部システムからであるかどうかにかかわらず、アプリケーションへの各々の入力を標準化し、検証し、コード化するためにルールを指定しなければなりません。　　　デフォルトルールは、それが何が許可されるかという詳細な仕様にマッチしない限り、すべての入力が無効であるということでなければなりません。そのうえ、無効な入力が受け取られるとき、要求はとられる措置を指定しなければなりません。具体的には、アプリケーションはインジェクション、オーバフロー、不正操作することまたは他の不正な入力攻撃に影響されやすくてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) 認証とセッション管理 : 要求は、認証証明書とセッション識別子がどのようにそれらのライフサイクルを通して保護されているかについて明記しなければなりません。すべての関連する機能（パスワード忘却、パスワード変更、パスワードリマインダ、ログアウト、そして複数ログインを含む）に対する要求は含められなければいけません。&lt;br /&gt;
&lt;br /&gt;
;(c) アクセス制御 : 要求は、アプリケーションで使われるすべての役割（グループ、特権、認可）の詳細な記述を含まなければなりません。要求は、アプリケーションにより提供されるすべての資産と機能も示さなければなりません。要求は、完全に各々の資産に正確なアクセス権を指定しなければならなくて、各々の役割に対して機能しなければなりません。アクセス制御マトリックスは、これらのルールのための提案されたフォーマットです。&lt;br /&gt;
&lt;br /&gt;
;(d) エラー処理 : 要求は、処理の間、発生しているエラーが取り扱われる方法を詳述しなければなりません。若干のアプリケーションはエラーの場合には最もよい努力結果を提供しなければなりません、一方、他はすぐに処理を終了しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(e) ロギング : 要求は、どんなイベントがセキュリティに関連して、記録される必要があるか、たとえば、検知された攻撃、失敗したログイン試行、認可を上回ろうとする試行、を指定しなければなりません。要求は、時間と日付、イベント記述、アプリケーション詳細とフォレンジクス努力に役立つ他の情報を含む、各々のイベントでどんな情報を記録するべきかについても指定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(f) 外部システムへの接続 : 要求は、認証と暗号化がどのようにすべての外部システム（例えばデータベース、ディレクトリとウェブ・サービス）のために取り扱われるかについて指定しなければなりません。外部システムでコミュニケーションのために必要とされるすべてのクレディンシャルは、暗号化された形で構成ファイルでコードの外側に保存されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(g) 暗号 : 要求は、どんなデータが暗号化されなければならないか、暗号化されることがどれほどか、そして、すべての証明書と他のクレディンシャルがどのように取り扱われなければならないか指定しなければなりません。アプリケーションは、広く使われていてテストされた暗号化ライブラリで実装される標準的なアルゴリズムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(h) 可用性 : 要求は、それがどのようにサービス不能攻撃から保護するかについて指定しなければなりません。アプリケーションへのすべてのありそうな攻撃は考慮されなければなりません。そして、認証ロックアウト、接続消耗と他の資源消耗攻撃を含みます。&lt;br /&gt;
&lt;br /&gt;
;(i) セキュアな設定 : 要求は、すべてのセキュリティに関連した構成オプションに対するデフォルト値がセキュアでなければならないことを示していなければなりません。監査目的のために、ソフトウェアはすべてのセキュリティに関連した構成詳細を示している簡単に読めるレポートをつくることができなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(j) 特定の脆弱性 : 要求は、ソフトウェアで見つかってはならない一組の具体的な脆弱性を含まなければなりません。指定されていないならば、ソフトウェアは現在の「OWASP Top Ten Most Critical Web Application Vulnerabilities」で記述される瑕疵の何も含んではいけません。&lt;br /&gt;
&lt;br /&gt;
===5. 要員および組織===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュリティ・アーキテクト : 開発者は一つの上位の技術的な資源に責任をセキュリティに指定します。そして、プロジェクトのセキュリティ・アーキテクトとして知られています。セキュリティ・アーキテクトは、各々の納品可能なもののセキュリティを保証します。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ・トレーニング : 開発者は、開発者チームのすべてのメンバーがセキュアなプログラミング技法の訓練をされたことを確かめる役割を果たします。&lt;br /&gt;
&lt;br /&gt;
;(c) 信用できる開発者 : 開発者は、すべての開発チーム・メンバーの適切な経歴調査を実行することに同意します。&lt;br /&gt;
&lt;br /&gt;
===6.開発環境===&lt;br /&gt;
&lt;br /&gt;
;(a) セキュア・コーディング : 開発者は、どんなツールがセキュアなコーディングを促すためにソフトウェア開発環境で使われるかについて明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 構成管理 : 開発者は、ソフトウェア・ベースラインに対するすべての変更とすべての関連した設定とビルド・ファイルを関連づけ　とすべての関連した構成にすべての変化と関連したチーム・メンバーを認証して、記録して、ファイルを構築したソース・コード管理システムを使用しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 配布 : 開発者は、ソースから確実に完全な配布を構築するビルド・プロセスを使用しなければなりません。このプロセスは、顧客に供給されるソフトウェアの完全性を確かめる方法を含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
===7. ライブラリ、フレームワーク、および生産物===&lt;br /&gt;
&lt;br /&gt;
;(a) 開示 : 開発者は、商用、フリー、オープンソース、クローズソースであるにせよ、すべてのライブラリ、フレームワーク、構成要素と他の生産物を含む、ソフトウェアで使われるすべての第三者のソフトウェアを明らかにしなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 評価 : 開発者は、第三者のソフトウェアがこの契約のすべての条件を満たして、この契約の基で開発されたカスタム開発されたコードと同じくらいセキュアなことを確実とするために、理にかなった努力をしなければなりません。&lt;br /&gt;
&lt;br /&gt;
===8. セキュリティ・レビュー===&lt;br /&gt;
&lt;br /&gt;
;(a) レビューする権利 : 依頼人には、ソフトウェアを納品の60日間以内にいつでも彼らの費用でセキュリティ瑕疵のためにレビューしておく権利があります。開発者は、ソース・コードとテスト環境へのアクセスを提供することによって理にかなったサポートをレビュー・チームに提供することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(b) レビュー・カバレッジ : セキュリティ・レビューは供給されるソフトウェアのすべての面をカバーしなければなりません。そして、カスタム・コード、構成要素、生産物とシステム設定を含みます。&lt;br /&gt;
&lt;br /&gt;
;(c) レビューの範囲 : 最低限で、レビューはセキュリティ要求の全てをカバーしなければならなくて、他の一般的な脆弱性を捜さなければなりません。レビューは、脆弱性スキャン、侵入テスト、ソースコードの静的分析と専門家のコードレビューの組み合わせを含んでもよいです。&lt;br /&gt;
&lt;br /&gt;
;(d) 見つけられた問題 : 発見されたセキュリティ問題は、顧客と開発者に報告されます。すべての問題は、この付属書のセキュリティ問題マネジメント部分により追跡されて、矯正されます。&lt;br /&gt;
&lt;br /&gt;
===9. セキュリティ問題マネジメント ===&lt;br /&gt;
&lt;br /&gt;
;(a) 識別 : 要求、設計、実装、テスト、配備、または、運用中の問題にせよ、開発者は全てのライフサイクルの間に発見されるすべてのセキュリティ問題を追います。各々のセキュリティ問題に関連したリスクは、発見後できるだけ早く、評価されて、文書化されて、発見の後、顧客に報告されます。&lt;br /&gt;
&lt;br /&gt;
;(b) 保護 : 開発者はセキュリティ問題と付随する文書に関して情報を適切に保護します。そして、運用中の顧客ソフトウェアの脆弱性が露出するという可能性を制限するのを助けます。&lt;br /&gt;
&lt;br /&gt;
;(c) 改善 : 納品の前に確認されるセキュリティ問題は、開発者によって修正されなければなりません。納品の後に発見されるセキュリティ問題は、本契約の規定による他のバグと問題として同様に取り扱われなければなりません。&lt;br /&gt;
&lt;br /&gt;
===10. 保証===&lt;br /&gt;
&lt;br /&gt;
;(a) 保証 : 開発者は、開発プロセスを通して作成されるセキュリティ文書からなる「証明パッケージ」を提供します。パッケージは、セキュリティ要求、設計、実装と試験結果がきちんと完了された、そして、すべてのセキュリティ問題が適切に解決されたと確認しなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(b) 自己証明 : セキュリティ・アーキテクトは、ソフトウェアがセキュリティ要求を満たすこと、すべてのセキュリティ活動が実行されていること、そして、すべての識別されたセキュリティ問題が文書化されて、解決されたことを証明します。証明ステータスに対するあらゆる例外は、納品で完全に文書化されなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 悪意のあるコードのなし : 開発者は、ソフトウェアがソフトウェア要求をサポートせず、コンピュータ・ウイルス、ワーム、時限爆弾、バック・ドア、トロイの木馬、イースターエッグと他のあらゆる形の悪意のあるソフトウェアを含む、アプリケーションのセキュリティを弱めるあらゆるコードを含んではならないと保証します。&lt;br /&gt;
&lt;br /&gt;
===11. セキュリティ承認と保守 ===&lt;br /&gt;
&lt;br /&gt;
;(a) 受け入れ : 証明パッケージが完全であり、すべてのセキュリティ問題が解決されるまで、ソフトウェアは受け入れられると考慮されてはいけません。&lt;br /&gt;
&lt;br /&gt;
;(b) セキュリティ問題の調査 : 受理の後、セキュリティ問題が発見されるか、かなり疑われるならば、開発者は顧客が問題の性質を決定するために調査を実行するのを援助しなければなりません。それがセキュリティ要求によってカバーされないで、セキュリティ・テストの理にかなった範囲の外にあるならば、問題は「新しい」と思われなければなりません。&lt;br /&gt;
&lt;br /&gt;
;(c) 新しいセキュリティ問題 : 開発者と顧客は、新しいセキュリティ問題を解決するために必要な努力を探し出すことに同意します。また、それらに取り組むために必要とされる仕事を実行するための合意を達成するために誠意を持って交渉することに同意します。&lt;br /&gt;
&lt;br /&gt;
;(d) 他のセキュリティ問題 : 開発者は堅実なソフトウェア開発慣行。そして、リスクのひどさを考慮すること、そして、できるだけ速く新しいと思われないすべてのセキュリティ問題を解決することと一致したすべての商業的に理にかなった努力を使わなければなりません&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Authorization_form/ja&amp;diff=108972</id>
		<title>Authorization form/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Authorization_form/ja&amp;diff=108972"/>
				<updated>2011-04-15T13:31:22Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: Created page with &amp;quot;==目的==  以下の語法は、アプリケーション・スキャン、侵入テストまたは他の攻撃的な技術を必要とされている業務のアプリケーシ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==目的==&lt;br /&gt;
&lt;br /&gt;
以下の語法は、アプリケーション・スキャン、侵入テストまたは他の攻撃的な技術を必要とされている業務のアプリケーション・セキュリティ明細書への付録として提供されなければなりません。&lt;br /&gt;
目標は、業務を実行しているそれらを保護することです。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==委任状のひな形==&lt;br /&gt;
&lt;br /&gt;
アプリケーション・セキュリティ検証は、技術（例えばアプリケーション・セキュリティ脆弱性スキャン、アプリケーション侵入テスト、静的分析と手動コードレビュー）を含みます。&lt;br /&gt;
この検証は、アプリケーションがありそうな攻撃からきちんと保護されていると確信するようになるプロセスの重要な部分です。&lt;br /&gt;
これらの活動が一般的に含むものの更なる詳細は、http://www.owasp.org.で見つけることができます。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
______________（「顧客」）は、以下に示すアプリケーションとシステムのセキュリティ検証活動を運営するために、ここに______________（「会社」）の従業員に委任します。&lt;br /&gt;
&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .   ''（明確なアプリケーション/システム名と簡単な説明を提供します）''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''以下の制限がこの委任に適用されるものとします。'''&lt;br /&gt;
&lt;br /&gt;
* この委任状は____________から____________へと効果があるものとします。&lt;br /&gt;
&lt;br /&gt;
* （適切であるように、さらなる許可や制限を挿入します）&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''この認可を与えることに従って、顧客は以下を宣言します'''&lt;br /&gt;
&lt;br /&gt;
* 顧客はテストされるシステムを所有します、そして、署名者には会社がアプリケーション・セキュリティ検証活動を実行するのを許可するために適切な権限があります。&lt;br /&gt;
* 顧客はテストされる全システムのフルバックアップを作成して、バックアップ手順は顧客がシステムをテスト前の状態にリストアすることができることを確かめました。&lt;br /&gt;
* サービスは、必然的に、セキュリティ脆弱性を検知するために設計されたツールと技術の使用を必要とします。そして、これらのツールと技術の使用に関連したすべてのリスクを特定して除去することは不可能です。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''顧客'''&lt;br /&gt;
&lt;br /&gt;
誰によって:&lt;br /&gt;
&lt;br /&gt;
名前:&lt;br /&gt;
&lt;br /&gt;
タイトル:&lt;br /&gt;
&lt;br /&gt;
日付:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==参考文献==&lt;br /&gt;
&lt;br /&gt;
http://www.counterhack.net/permission_memo.html&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
[[Category:OWASP Testing Project]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Authorization_form&amp;diff=108971</id>
		<title>Authorization form</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Authorization_form&amp;diff=108971"/>
				<updated>2011-04-15T13:17:40Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Purpose==&lt;br /&gt;
&lt;br /&gt;
The following language should be provided as an addendum to an application security statement of work requiring application scanning, penetration testing, or other invasive techniques.  The goal is to protect those performing the work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Authorization Form==&lt;br /&gt;
&lt;br /&gt;
Application security verification involves techniques such as application security vulnerability scanning, application penetration testing, static analysis, and manual code review. This verification is an important part of the process of making sure that an application is properly protected against likely attacks. Additional details on what these activities typically involve can be found at http://www.owasp.org.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
______________ (&amp;quot;Customer&amp;quot;) hereby authorizes employees of ___________ (&amp;quot;Company&amp;quot;) to conduct security verification activities of the application(s) and system(s) described below.&lt;br /&gt;
  &lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .&lt;br /&gt;
  .   ''(provide unambiguous application/system names and brief descriptions)''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''The following restrictions shall apply to this authorization:'''&lt;br /&gt;
&lt;br /&gt;
* This authorization shall be in effect from ____________ to _____________&lt;br /&gt;
&lt;br /&gt;
* (Insert additional permissions and/or restrictions as appropriate)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Pursuant to granting this authorization, Customer declares that:'''&lt;br /&gt;
&lt;br /&gt;
* Customer owns the systems to be tested and the undersigned has the proper authority to allow Company to perform application security verification activities.&lt;br /&gt;
&lt;br /&gt;
* Customer has created a full backup all systems to be tested and has verified that the backup procedure will enable Customer to restore systems to their pretest state.&lt;br /&gt;
&lt;br /&gt;
* The service necessarily involves the use of network tools and techniques designed to detect security vulnerabilities, and that it is impossible to identify and eliminate all the risks involved with the use of these tools and techniques.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Customer'''&lt;br /&gt;
&lt;br /&gt;
By:		&lt;br /&gt;
&lt;br /&gt;
Name: 	&lt;br /&gt;
&lt;br /&gt;
Title: 		&lt;br /&gt;
&lt;br /&gt;
Date: 						&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
http://www.counterhack.net/permission_memo.html&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;br /&gt;
[[Category:OWASP Testing Project]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Secure_software_contracting_hypothetical_case_study/ja&amp;diff=108954</id>
		<title>Secure software contracting hypothetical case study/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Secure_software_contracting_hypothetical_case_study/ja&amp;diff=108954"/>
				<updated>2011-04-15T06:41:50Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: Created page with &amp;quot;==大ばか者を訴えよう -- セキュリティ、ソフトウェア、契約および弁護士== * Jeff Williams (Aspect Security, Inc.) により * 2004年1月13日に投...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==大ばか者を訴えよう -- セキュリティ、ソフトウェア、契約および弁護士==&lt;br /&gt;
* Jeff Williams (Aspect Security, Inc.) により&lt;br /&gt;
* 2004年1月13日に投稿された&lt;br /&gt;
&lt;br /&gt;
==序文==&lt;br /&gt;
&lt;br /&gt;
あなたが、彼らが生産したコードがセキュリティ・ホールに満ちていると数年後にわかるために、ソフトウェア・ショップにあなたのWebアプリケーション開発を外部調達するならば、あなたは何をするでしょうか？&lt;br /&gt;
あなたがコードを書いた開発者であるならば、あなたは何をするでしょうか？&lt;br /&gt;
聞き慣れたように聞こえます？&lt;br /&gt;
多くの組織において、ワンパターンの反応は契約違反または怠慢論に関して開発者を告訴することです、しかし、それはあなたができる最大の間違いです。&lt;br /&gt;
このコラムは、これらの論争がどのように起こるか、契約がどのように機能するか、双方におけるいくつかの議論について論じます。そして、うまくいけばあなたに微妙な状況を案内する助けになる妥協点を提案します。&lt;br /&gt;
&lt;br /&gt;
 あなたが書いたソフトウェアが脆弱性を持つかもしれないとわかるとき、あなたは何をしますか？&lt;br /&gt;
&lt;br /&gt;
==単にもう一つの外注化されたWebアプリケーション==&lt;br /&gt;
&lt;br /&gt;
National Widgetsのありさまを想像します。&lt;br /&gt;
2年前、Nationalは彼らのユーザーのためにウェブサイトを構築するために、優秀なFront End Associatesと契約しました。&lt;br /&gt;
契約は、実行される仕事、スケジュール、そして、多くの機能要求を詳述しました ― しかし、セキュリティについて完全に語られていなかった。&lt;br /&gt;
Front Endはサイトを構築しました、そして、Nationalは何事もなくおよそ18か月前にそれを配備しました。&lt;br /&gt;
サイトはよくうまくいっていました、そして、Nationalは大きな委託をFront Endに提供しました。&lt;br /&gt;
&lt;br /&gt;
近年では、一部のNational従業員はセキュリティ問題の可能性を持ち上げたので、NationalはFront Endへ行って、アプリケーションがセキュアかどうか、彼らに尋ねました。&lt;br /&gt;
Front End営業チームは、踊り始めて、彼らが彼らの契約上の義務を満たすと確信していると言って、これらの「新しい」要求事項を受けるという提案をして満足です。&lt;br /&gt;
Nationalは最初の契約を確信できなくて、最初の契約がセキュリティを必要としたかどうか確かめるために、彼らの弁護士のところへ行きました。&lt;br /&gt;
&lt;br /&gt;
==弁護士を送り出します==&lt;br /&gt;
&lt;br /&gt;
弁護士は問題に非常に興奮しているようになって、責任、権利、義務と過失推定則の標準について声明をし始めました。&lt;br /&gt;
Nationalは、契約がセキュリティを必要としたか、必要としなかったかどうかについて、はっきりした答えを決して得ませんでした。&lt;br /&gt;
それで、彼らはただFront Endに戻って、彼らに無料で問題を解決するよう頼みました。&lt;br /&gt;
そして、状況が崩壊させ始めた所で、それはそうです。&lt;br /&gt;
&lt;br /&gt;
Front Endは、彼らがコードに少しもセキュリティ問題がないと思っていると言いました。&lt;br /&gt;
納品の前に、彼らはアプリケーションのセキュリティ監査をするためにセキュリティ・テストの会社を雇いました。&lt;br /&gt;
彼らが雇った会社は、試験をして報告を準備するために、侵入テストを専門とすると主張しました。&lt;br /&gt;
残念なことに、同社がしたすべては、nmapとnessusのような2、3のスキャンツールを実行することでした。&lt;br /&gt;
彼らはツール出力をきれいにして、レポートを出しました。&lt;br /&gt;
Front Endがレポートをあげたとき、Nationalは笑って、彼らに彼らが開発したアプリケーションのためにアプリケーション・セキュリティ試験結果を生産するよう頼みました。&lt;br /&gt;
これに直面して、Front Endは素早く引き下がって、彼らのコードに関するセキュリティ問題がない、そして、たとえあったとしても、彼らはセキュアなコードを構築することを要求されていない、と再び主張しました。&lt;br /&gt;
&lt;br /&gt;
Nationalは、セキュアなコードを構築する要件が明らかである、そして、故意にセキュアではないコードを構築したどんなベンダーでも明らかに怠慢であると答えました。&lt;br /&gt;
ついで、明らかに、把握して、彼らは黙示の被保証人、厳格責任と集団訴訟のような用語をやたらと使い始めました。&lt;br /&gt;
彼らはOWASPトップ１０をWebアプリケーション・セキュリティのための事実上の標準とさえ呼んで、連邦取引委員会さえ標準を満たさない会社を求めていると言いました。&lt;br /&gt;
&lt;br /&gt;
==みんな専門家を雇う==&lt;br /&gt;
&lt;br /&gt;
静かに、Front Endは彼らのコードにはセキュリティ問題があったことを心配し始めました。&lt;br /&gt;
それで、彼らは彼ら自身の専門家を雇いました。&lt;br /&gt;
彼らは、Webアプリケーション・セキュリティを専門とした会社が彼らのコードをレビューして、いくらかのアプリケーション侵入テストをするとわかりました。&lt;br /&gt;
これらの専門家は非常にたくさんの問題を最初の数日で発見して、彼らにそれがどのように行っていたかについて知らせるために、Front Endを呼びました。&lt;br /&gt;
Front Endの上級マネージャーは、彼らの調査結果に対する報告書を彼らが必要としないということを彼らに知らせるために、数日後に専門家に後で電話しました。&lt;br /&gt;
むしろ、彼らは遠隔会議の間に口ですべての結論を受けるのを好みます。&lt;br /&gt;
&lt;br /&gt;
一方、Nationalは最初の業務予定が彼らのコードに関する本当に深刻なセキュリティ問題があるということを証明することになっていると決めました。&lt;br /&gt;
それで、彼らは彼ら自身のWebアプリケーション・セキュリティの専門家を雇って、アプリケーション・セキュリティ・チェックを手配しました。&lt;br /&gt;
これらの専門家は標準的なWebアプリケーション脆弱性スキャンツールから始めたが、多少の問題を見つけるだけでした。&lt;br /&gt;
専門家はコードレビューをしたくて、Nationalにアプリケーションのためにソースコードのコピーを送るよう頼みました。&lt;br /&gt;
しかし、Nationalは彼らのアプリケーションを決して請求しないで、ソースコードのコピーを持ちませんでした。&lt;br /&gt;
彼らがFront Endにコピーを要求したとき、彼らは手間どって、企業秘密と著作権問題に言及して、最終的に拒否されました。&lt;br /&gt;
Nationalにとって幸いにも、コードはJavaで記述されて、わかりにくくされませんでした。&lt;br /&gt;
それで、専門家はDigital Millennium著作権法（DMCA）をばかにして、Jadでコードを逆コンパイルして、なんとしても彼らのコードレビューを実行しました。&lt;br /&gt;
彼らも、彼らの結論を確認するために、コードレビューとともにいくらかの侵入テストをしました。&lt;br /&gt;
&lt;br /&gt;
残念なことに（しかし、もっともなことだが）、レビューは深刻な問題をトップ１０のカテゴリーのうちの6つで発見しました。&lt;br /&gt;
問題のいくつかは、設計レベルの問題で、修正するためにかなり多くの人月の努力を必要とします。&lt;br /&gt;
それで、NationalはFront Endに戻って、彼らに結論を示して、再び彼らに無料で問題を解決するよう頼みました。&lt;br /&gt;
Front End（今すっかり心配される）は、彼らの弁護士と問題に取り掛かると答えて、会議を去りました。&lt;br /&gt;
もっともなことだが、弁護士はNationalに決して反応しませんでした。&lt;br /&gt;
&lt;br /&gt;
==悪いからより悪いへ==&lt;br /&gt;
&lt;br /&gt;
そのため、NationalはFront Endを告訴する義務がありました。Front Endが契約において必要とされる作業を実施しておらず、そして、彼らは問題を修正して、Nationalの弁護料を払うべきだと主張しました。&lt;br /&gt;
Front Endは、コードが2年前にわたって開発されていたこと、彼らは支払いを受けていたこと、そして、それ故コードはNationalによって完全に受け入れられていたことという事実に基づき、棄却する反応を示しました。&lt;br /&gt;
彼らも、彼らが契約する時点で存在しなかった要件を満たさないことに対して責任があるとみなされることができないと択一的に主張しました。&lt;br /&gt;
&lt;br /&gt;
双方は、今や弁護料、失われた生産性と風評被害に多くの数万ドルをつぎ込みました。&lt;br /&gt;
実際の訴訟費用に加えて、双方は質問に答えていて、書類をつくり、証言録取書のために、そして、裁判に準備している重要な時間を使いました。&lt;br /&gt;
環境が劇的に変わったので、Nationalアプリケーションの最初の開発者の多くはFront Endを去りました、そして、彼らは崩壊の原因となりたくありませんでした。&lt;br /&gt;
&lt;br /&gt;
==より良い方法?==&lt;br /&gt;
&lt;br /&gt;
この哀れな物語は、この問題を取り扱わない方法の良い例です。&lt;br /&gt;
この状況にある多くの会社が明らかにあります、そして、法律制度は良いありません打開策でありません。&lt;br /&gt;
若干の善と悪が双方の上にあるので、この混乱をきれいにするより良い方法を見ましょう、それから、私たちはこれらの問題が将来起こるのを防ぐことについての若干の考えで終わります。&lt;br /&gt;
&lt;br /&gt;
最初に、双方に所属する誰でも、セキュアなWebアプリケーションを構築することがただきれいに見えるものを構築することより多くの努力をすると思う必要があります。&lt;br /&gt;
あなたが顧客であるならば、あなたはだまし取られる感覚を止めなければなりません。&lt;br /&gt;
あなたと構築者が問題を協議したならば、価格はほぼ間違いなくより高かったでしょう。&lt;br /&gt;
あなたは大多数の開発者にはセキュリティの大きな理解がない顧客にも取らなければならないので、それの代金を払うことなく脆弱性のないコードに期待することは合理的でありません。&lt;br /&gt;
結局のところ、あなたは多分、あなたが代金を払ったものを得たでしょう。&lt;br /&gt;
あなたがあなたのアプリケーションでセキュリティ問題を疑うならば、それらを無視しません。&lt;br /&gt;
&lt;br /&gt;
しかし、あなたが開発者であるならば、ここで無実のふりをしません。&lt;br /&gt;
顧客がコードが脆弱性を持つかどうか尋ねたならば、あなたはほぼ間違いなくいいえと言ったでしょう。そして、何かあるとすれば、あなたはあなたの努力に対してあまり多くを加えなかったでしょう。&lt;br /&gt;
あなたは、本当に、セキュリティ要件をする時間をとらなければならなかったということを知っていて、それを構築して、きちんとテストしてもらいます。&lt;br /&gt;
大部分のこれらの脆弱性は長年十分理解されました、そして、彼らは避けるのが難しくありません。&lt;br /&gt;
あなたはあなたの会社が書いたコードで脆弱性を発見するか、疑いさえするならば、信頼できる行いはあなたの顧客に知らせることになっています。&lt;br /&gt;
実際、あなたは顧客に警告する法的義務があってもよいです - ただ不完全なブレーキで車を彼らに売ったように &lt;br /&gt;
大部分の買い手は、あなたが進んでこの情報を提供したという事実を尊重して、問題を解決するために、あなたと努力します。&lt;br /&gt;
&lt;br /&gt;
 あなたが裁判所で終わるならば、誰も勝ちません。&lt;br /&gt;
 あなたの宿題をして、それを考え出します。&lt;br /&gt;
&lt;br /&gt;
この状況の当事者のために唯一の穏やかなものは、問題を解決することと関係している経費を共有する方法を見つけ出すことです。&lt;br /&gt;
あなたがこの状況にいるのに気づくならば、最初の行いはあなたの懸念を議論して、考えられるあらゆる問題を解決する計画を提案するために他の関係者に会うことです。&lt;br /&gt;
実のところ、あなたが仕事をすることに同意していたとき、どちらの関係者も考えなかったソフトウェアに脆弱性があります。&lt;br /&gt;
アプリケーションが修正するためにとりそうであるものの正確な評価を実行するために、独立した第三者について同意します。&lt;br /&gt;
双方が結論から利益を得るので、このレビューのコストを共有することは合理的です。&lt;br /&gt;
会議は、この状況で責任を割り当てる用語があるかどうか確かめるために、契約言語の慎重なレビューも含まなければなりません。&lt;br /&gt;
&lt;br /&gt;
完全性を確実にするために、第三者レビューは、コード分析といくらかの侵入テストを含まなければなりません。&lt;br /&gt;
理にかなった最低限度にWebアプリケーションのために基づいている結論を保つために、レビューがOWASPトップ１０に集中することは、合理的です。&lt;br /&gt;
レポートはどんな結論の詳細な記述でも含まなければなりません。そして、コードで間違っていることにちょうど集中します。&lt;br /&gt;
レビュアーは、これらの判断をするためにコードへのアクセスを必要として、大きなコードレビュー・スキルを必要とします。&lt;br /&gt;
そのうえ、第三者は顧客の企業の具体的な状況で、瑕疵と関連したリスクを推定しなければなりません。&lt;br /&gt;
&lt;br /&gt;
一旦あなたには独立した第三者から問題の正当と認められるリストがあるならば、双方は再び、彼らを修正させる計画をつくることに応じるべきです。&lt;br /&gt;
会議の目的は、開発者がどの問題を解決するか、修正がどれくらい難しいか、そして、誰が修正の代金を払いそうか確認しなければならないことになっています。&lt;br /&gt;
あなたが若干の見解の一致をここで見つけることができないならば、双方が裁判所で終わる、そして、弁護士だけが勝つことを肝に銘じます。&lt;br /&gt;
&lt;br /&gt;
==裁判所で起こること==&lt;br /&gt;
&lt;br /&gt;
仕事中にそれほど多くの可変部分があるので、これは難問です。&lt;br /&gt;
しかし、私の最高の推測は、裁判所が結局なんとしても中間をとることになるということです。&lt;br /&gt;
大部分の裁判所はこれらの脆弱性で技術的な問題を理解しそうでないので、彼らは外部標準と工業慣行に目を向けます。&lt;br /&gt;
これは専門家証人の闘争として終わります。そして、何人かがこれらの脆弱性が25年の間十分理解されたと言います。そして、他の人が大部分の開発者がセキュリティを理解しない、そして、標準がないと主張します。&lt;br /&gt;
最後に、裁判所は何に対して誰に責任があるかについて決定することができそうでありません。&lt;br /&gt;
彼らは開発者に有利な決定を下すかもしれません。そして、開発者をはっきりと定まっていなくて、工業慣行でない要件に保持することが不当であると思います。&lt;br /&gt;
他方、彼らは、開発者が知っていたか、これらの脆弱性について知っていなければならなかった理論に関して、顧客に簡単にあてはまることができて、したがって彼らのソフトウェアで彼らを防ぐための処置をとらなければなりませんでした。&lt;br /&gt;
&lt;br /&gt;
 いずれの方法でも、これらの問題を修正するためのコストは、問題について訴訟するためのコストにより小さく見えます。&lt;br /&gt;
 それで、あなたのパートナーのことをよく知るようになり、それを解決します。&lt;br /&gt;
&lt;br /&gt;
==契約に記載がないとき何を起こるべきでしょうか==&lt;br /&gt;
&lt;br /&gt;
契約が問題について語られていないとき、法律はそれが関係者が意味したと思うことで欠けている条件に記入します。&lt;br /&gt;
これらの「デフォルト」条件は、制定法、UCC、取引慣行と多くの他の出所から来ます。&lt;br /&gt;
しかし、アプリケーション・セキュリティは十分に新しくて、裁判所が事件を決定するためにもたれるかもしれないかは誰にもわからないことであることほど十分に速く動いています。&lt;br /&gt;
それで、ただしばらく、立法者帽子をかぶろうとして、起こるべきであることを決定しようとしましょう。&lt;br /&gt;
&lt;br /&gt;
デフォルト契約の条件がゼロ・セキュリティであるならば、世界はより良い場所であるでしょうか？&lt;br /&gt;
いいえ、これは適切な答えではありえません。&lt;br /&gt;
これは、あなたが特にそれを大声で呼ばない限り、開発者には彼らのコードをセキュアにする義務がないことを意味します。&lt;br /&gt;
開発者には、かなりよく理解されている脆弱性を避ける義務がありません。&lt;br /&gt;
これは買い手にすべての重荷を与えます。そして、その人はどんな脆弱性が起こるかもしれないかについてわかっているあまり良い立場にありません。&lt;br /&gt;
それで、このアプローチは、とても経済的に能率が悪いです。&lt;br /&gt;
&lt;br /&gt;
しかし、反対の極端を想像します、そこで、契約が静かであるならば、開発者は完全にセキュアなアプリケーションを生産するために必要とされます。&lt;br /&gt;
これも、適切な答えではありえません。&lt;br /&gt;
一般に、問題を避ける最もよい立場で関係者に義務を与えることは、最も効果的な結果を生産します。&lt;br /&gt;
しかし、完全にセキュアなコードを作成することが実質的に不可能であるので、これはソフトウェア構築者のために無限責任をつくります。&lt;br /&gt;
明らかに、これは彼らの技能を実践するソフトウェア・メーカーの能力に、劇的な影響を及ぼします。&lt;br /&gt;
したがって、裁判所は問題について語られていない契約に、なんらかの基本的なセキュリティ要件を読み取らなければなりません。&lt;br /&gt;
リストは、話題が議論されたならば、双方が同意しただろう要件を含まなければなりません。&lt;br /&gt;
OWASPトップ１０のそれらのようなかなりよく理解されているセキュリティ脆弱性は、理にかなった出発点です。&lt;br /&gt;
しかし、買い手と構築者がプロジェクトのために現実的なセキュリティ要件を考え出して、それらを契約書（あなたが問題を無視するならば裁判所が考え出すものに頼ることよりもむしろ）に取り込むならば、それははるかによりよいでしょう。&lt;br /&gt;
&lt;br /&gt;
==次は?==&lt;br /&gt;
&lt;br /&gt;
うまくいけば、大部分の読者は現在この状況になくて、ただそれが将来起こるのを防ぐのが好きです。&lt;br /&gt;
適切な方法は、プロジェクトのためにどれくらいよいセキュリティ・ニーズがあるかについて、具体的な契約の条件を準備することです。&lt;br /&gt;
&lt;br /&gt;
Dave Thomasは、品質はあなたが前もって顧客と協議する要件の一部でなければならないと書きました。&lt;br /&gt;
NASAは、コードの1行につきだいたい1,000ドルを使います。&lt;br /&gt;
非数学専攻のあなたにとって、それは取るに足らない1000行のプログラムのためでさえ100万ドルです。&lt;br /&gt;
そして、彼らがソフトウェア品質の上で素晴らしい記録をとるにもかかわらず、彼らはまだ時折調査を失うか、ソフトウェア問題のため、ロケットを衝突させます。&lt;br /&gt;
&lt;br /&gt;
Webアプリケーションの正当な業務理由がセキュリティの異なっているレベルで、セキュリティ（品質のような）はソフトウェア構築者と買い手が協議しなければならない何かです。&lt;br /&gt;
買い手は、もちろん、まず最初に、あらゆる脆弱性なしでソフトウェアを期待しそうです。&lt;br /&gt;
これは、もちろん、現実的でありません。&lt;br /&gt;
構築者、少なくとも、歴史があらゆるガイドであるならば、機能要求を満たすソフトウェアを構築して、まったくセキュリティについて心配したくなさそうです。&lt;br /&gt;
デフォルト法律規則が全く不明で、完全にセキュリティを交渉から省くことも適切でありません。&lt;br /&gt;
&lt;br /&gt;
ソフトウェア・構築者と買い手は、以下のような質問に取り組む率直な議論をする必要があります：*どんな種類のインシデントが、深刻である（例えば暴露、変造、サービス妨害）と思われますか？&lt;br /&gt;
*すべての開発者は、セキュリティの訓練をされなければなりませんか？&lt;br /&gt;
*あなたは、アプリケーションのために文書化されたセキュリティ方針やセキュリティ要求事項を望みますか？&lt;br /&gt;
*あなたは、セキュリティ設計とメカニズムの詳細なドキュメンテーションを望みますか？&lt;br /&gt;
*あなたは、デザインのセキュリティ・レビューを望みますか？&lt;br /&gt;
*あなたは、侵入テストが配備の前にされることを望みますか？&lt;br /&gt;
*あなたは、コードがセキュリティの専門家によってレビューされることを望みますか？&lt;br /&gt;
*誰が、道の下で発見されるセキュリティ問題を解決して、危険を引き受けますか？&lt;br /&gt;
&lt;br /&gt;
買い手は、強化されたセキュリティのために若干の追加料金があること、また、もしこれらのセキュリティ・サービスを断るならば、より安い価格を得ることができることを期待すべきです。&lt;br /&gt;
契約の出発点として、あなたはセキュリティに影響を及ぼすどんな種類のでもどんなバグのためにでも開発者にすべての重荷を与える厳罰を伴うコード完全性保証を考慮することを期待してもよいです。&lt;br /&gt;
少なくとも、用語は非常に明白です、しかし、開発者に対する潜在的責任はよろめいています。&lt;br /&gt;
&lt;br /&gt;
==結論==&lt;br /&gt;
&lt;br /&gt;
それで、あなたがソフトウェア開発を外部調達しているならば、あなたの開発者と話します。&lt;br /&gt;
彼らがあなたのセキュリティ・ニーズを理解することを確認します。&lt;br /&gt;
それを契約に入れることを確認します。&lt;br /&gt;
あなたは、ただあなたがどれくらいのセキュリティの代償を払う気があるかといういくらかの難しい質問に答えなければならないかもしれません。&lt;br /&gt;
あなたがソフトウェア開発者であるならば、あなたがどんなセキュリティを提供しているかについて明確にします、そして、それをします。&lt;br /&gt;
ソフトウェアが生産中である後、セキュリティ脆弱性が発見されるならば、それが誰の責任であるかについて理解します。&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Secure_software_contracting_hypothetical_case_study&amp;diff=108809</id>
		<title>Secure software contracting hypothetical case study</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Secure_software_contracting_hypothetical_case_study&amp;diff=108809"/>
				<updated>2011-04-14T14:05:01Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* Send In the Lawyers! */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Let's Sue the Idiots -- Security, Software, Contracts, and Lawyers==&lt;br /&gt;
* By Jeff Williams (Aspect Security, Inc.)&lt;br /&gt;
* Posted January 13, 2004&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
What would you do if you outsourced your web application development to a software shop, only to find out years later that the code they produced is full of security holes? What would you do if you were a developer who wrote the code? Sound familiar? In many organizations, the knee-jerk reaction is to sue the developers on a breach of contract or negligence theory, but that's about the biggest mistake you can make. This column discusses how these disputes happen, how the contracts work, some of the arguments on both sides, and suggests a middle ground that will hopefully help guide you through a delicate situation.&lt;br /&gt;
&lt;br /&gt;
 What do you do when you realize software you wrote might have vulnerabilities?&lt;br /&gt;
&lt;br /&gt;
==Just Another Outsourced Web Application==&lt;br /&gt;
&lt;br /&gt;
Imagine the plight of the National Widgets. Two years ago, National contracted with the talented Front End Associates to build a web site for their users. The contract detailed the work to be performed, the schedule, and many functional requirements - but was completely silent on security. Front End built the site and National deployed it about 18 months ago without incident. The site has been working well and National has provided strong references for Front End.&lt;br /&gt;
&lt;br /&gt;
Recently, some National employees raised the possibility of security problems, so National went to Front End and asked them whether the application is secure. The Front End sales team started dancing and said that they were confident that they met their contractual obligation and would be happy to submit a proposal to respond to these 'new' requirements. National was unsure about the original contract and went to their lawyers to see if the original contract required security. &lt;br /&gt;
&lt;br /&gt;
==Send In the Lawyers!==&lt;br /&gt;
&lt;br /&gt;
The lawyers got very excited about the issue, and started making statements about the standard of care, rights, duties, and res ipsa loquitur. National never did get a clear answer about whether the contract did or didn't require security. So they just went back to Front End and asked them to fix the problems for free. And that's where the situation started to unhinge. &lt;br /&gt;
&lt;br /&gt;
Front End said that they didn't believe that there were any security problems in their code. Before delivery, they had hired a security testing company to do a security audit of their application. The company they hired claimed to specialize in penetration testing to test and prepare a report. Unfortunately, all the company did was to run a few scanning tools like nmap and nessus. They cleaned up the tool output and delivered the report. National laughed when Front End brought up the report, and asked them to produce the application security test results for the application they developed. Confronted with this, Front End rapidly backed down and again claimed that there were no security problems with their code, and even if there were, they weren't required to build secure code. &lt;br /&gt;
&lt;br /&gt;
National responded that the requirement to build secure code is obvious, and that any vendor who knowingly built insecure code is clearly negligent. Then, obviously grasping, they started throwing around terms like implied warrantee, strict liability, and class action. They even called the OWASP Top Ten the de facto standard for web application security and mentioned that even the U.S. Federal Trade Commission is going after companies that don't meet the standard.&lt;br /&gt;
&lt;br /&gt;
==Everybody Hires Experts==&lt;br /&gt;
&lt;br /&gt;
Quietly, Front End began to worry that their code did have security problems. So they hired their own experts. They found a firm that specialized in web application security to review their code and do some application penetration testing. These experts found quite a lot of problems in the first few days, and called Front End to let them know how it was going. A senior manager at Front End called the experts back after a few days to let them know that they would not require a written report for their findings. Rather they would prefer to receive all the findings orally during teleconferences. &lt;br /&gt;
&lt;br /&gt;
In the meantime, National decided that the first order of business was to prove that there were indeed serious security problems with their code. So they hired their own web application security experts and arranged for an application security review. These experts started with the standard web application vulnerability scanning tools, but only found a few problems. The experts wanted to do a code review, and asked National to send a copy of the source code for the application. But National never asked for, and did not have a copy of the source code for their application. When they asked Front End for a copy, they were delayed and ultimately refused, mentioning trade secret and copyright issues. Fortunately for National, the code was written in Java and was not obfuscated. So the experts thumbed their noses at the Digital Millennium Copyright Act (DMCA), decompiled the code with Jad, and performed their code review anyway. They also did some penetration testing along with the code review to validate their findings. &lt;br /&gt;
&lt;br /&gt;
Unfortunately (but not surprisingly), the review found serious problems in six of the Top Ten categories. Several of the problems were design-level problems and would require quite a few man-months of effort to fix. So, National went back to Front End, showed them the findings, and asked them again to fix the problems for free. Front End, now quite worried, responded that they would take the matter up with their lawyers and left the meeting. Not surprisingly, the lawyers never did respond to National. &lt;br /&gt;
&lt;br /&gt;
==Bad to Worse==&lt;br /&gt;
&lt;br /&gt;
So, National felt obligated to file suit against Front End, claiming that Front End had not performed the work required under the contract and that they should fix the problems and pay National's legal fees. Front End responded with a motion to dismiss, based on the fact that the code was developed over two years prior, that they had been paid, and that the code had therefore been fully accepted by National. They also argued in the alternative that they could not be held liable for not meeting requirements that did not exist at the time of contracting. &lt;br /&gt;
&lt;br /&gt;
Both sides have now invested many tens of thousands of dollars in legal fees, lost productivity, and reputation damage. In addition to actual litigation costs, both parties spent a significant amount of time answering interrogatories, producing documents, getting ready for depositions, and in trial. Many of the original developers of the National application left Front End as the environment had changed dramatically, and they did not want to be blamed for the debacle. &lt;br /&gt;
&lt;br /&gt;
==A Better Way?==&lt;br /&gt;
&lt;br /&gt;
This miserable story is a good example of how NOT to handle this issue. There are clearly many companies who are in this situation, and the legal system is not a good way out. There is some right and wrong on both sides, so let's look at a better way to clean up this mess, and then we'll conclude with some ideas about preventing these problems from happening in the future. &lt;br /&gt;
&lt;br /&gt;
First, everyone on both sides needs to understand that building a secure web application takes more effort than just building one that looks pretty. If you're the customer, you should stop feeling ripped off. If you and the builder had discussed the issue, the price would have almost certainly been higher. You should also take into account that the vast majority of developers do not have a strong understanding of security, so it is not reasonable to expect vulnerability-free code without paying for it. At the end of the day, you probably got what you paid for. If you suspect security problems in your applications, don't ignore them.&lt;br /&gt;
&lt;br /&gt;
But, if you're the developer, don't pretend to be innocent here. If the customer had asked whether the code would have vulnerabilities you would have almost certainly said no. And you wouldn't have added very much, if anything, to your bid. You know that you really should have taken the time to do the security requirements and get it built and tested properly. Most of these vulnerabilities have been well understood for many years, and they are not difficult to avoid. If you uncover or even suspect vulnerabilities in code your company wrote, the responsible thing to do is to let your customers know. In fact, you may have a legal obligation to warn your customer - just as if you had sold them a car with faulty brakes. Most buyers will respect the fact that you've come forward with this information and work with you to resolve the issues. &lt;br /&gt;
&lt;br /&gt;
 Nobody wins if you end up in court.&lt;br /&gt;
 Do your homework and work it out.&lt;br /&gt;
&lt;br /&gt;
The only equitable thing for parties in this situation is to figure out a way to share the costs involved with fixing the problems. If you find yourself in this situation, the first thing to do is to meet with the other party to discuss your concerns and suggest a plan for resolving any possible issues. The fact is that there are vulnerabilities in the software that neither party thought of when you were agreeing to do the work. &lt;br /&gt;
Agree on an independent third party to perform an accurate assessment of what the application is going to take to fix. Sharing the costs of this review is reasonable, since both parties will benefit from the findings. The meeting should also include a careful review of the contract language to see if there are any terms that assign responsibility in this situation. &lt;br /&gt;
&lt;br /&gt;
To ensure completeness, the third party review should include code analysis and some penetration testing. It's reasonable for the review to focus on the OWASP Top Ten, in order to keep the findings grounded in a reasonable minimum standard for web applications. The report should include detailed descriptions of any findings, focused on exactly what is wrong with the code. The reviewers will need access to the code to make these judgments and will need strong code review skills. In addition, the third party should estimate the risk associated with the flaw in the specific context of the customer's enterprise. &lt;br /&gt;
&lt;br /&gt;
Once you have a justifiable list of problems from an independent third party, both parties should meet again to create a plan for getting them fixed. The purpose of the meeting should be to identify which problems the developer will fix, how difficult the fixes will be, and who is going to pay for the fixes. Remember that if you can't find some common ground here, both parties will end up in court and only the lawyers will win. &lt;br /&gt;
&lt;br /&gt;
==What Would Happen in Court?==&lt;br /&gt;
&lt;br /&gt;
This is a difficult question, since there are so many variables at work. But my best guess is that a court would end up splitting the difference anyway. Most courts are not going to understand the technical issues with these vulnerabilities, so they will look to external standards and industry practice. This will end up as a battle of expert witnesses, some saying that these vulnerabilities have been well understood for 25 years, the others arguing that most developers do not understand security and that there are no standards. &lt;br /&gt;
Ultimately, the court is not going to be able to decide who is responsible for what. They might decide for the developer, thinking that it is unfair to hold developers to requirements that are not explicitly stated and are not industry practice. On the other hand, they could easily hold for the customer, on the theory that the developer either knew or should have known about these vulnerabilities, and therefore should have taken measures to prevent them in their software. &lt;br /&gt;
&lt;br /&gt;
 Either way, the cost of fixing these problems will&lt;br /&gt;
 be dwarfed by the cost of litigating the issue.&lt;br /&gt;
 So get with your partner and work it out. &lt;br /&gt;
&lt;br /&gt;
==What Should Happen When the Contract Is Silent==&lt;br /&gt;
&lt;br /&gt;
When contracts are silent on an issue, the law fills in the missing terms with what it thinks the parties would have intended. These &amp;quot;default&amp;quot; terms come from statutes, the UCC, trade practices, and many other sources. But application security is new enough and moving fast enough that it's anybody's guess what sources a court might lean on to decide a case. So just for a moment, let's put on a lawmaker hat and try to decide what ought to happen. &lt;br /&gt;
&lt;br /&gt;
Would the world be a better place if the default contractual term were zero security? No, this can't be the right answer. This would mean that unless you specifically call it out, developers have no responsibility to make their code secure. Developers would have no responsibility to avoid well understood vulnerabilities. This puts all the burden on the buyer, who is not in a very good position to know what vulnerabilities might occur. So this approach would be extremely economically inefficient. &lt;br /&gt;
&lt;br /&gt;
But imagine the opposite extreme, where the developer is required to produce a perfectly secure application if the contract is silent. This can't be the right answer either. In general, putting liability on the party in the best position to avoid the problem will produce the most efficient results. However, since creating perfectly secure code is virtually impossible, this would create unlimited liability for software builders. Obviously, this would have a dramatic effect on the ability of software makers to practice their craft. &lt;br /&gt;
Therefore, courts should read in some basic security requirements into contracts that are silent on the issue. The list should include requirements that both parties would have agreed to if the topic had been discussed. Well understood security vulnerabilities like those in the OWASP Top Ten are a reasonable starting point. &lt;br /&gt;
But it would be far better if the buyer and builder work out the real security requirements for the project and capture them in the contract, rather than relying on what a court might dream up if you ignore the issue. &lt;br /&gt;
&lt;br /&gt;
==Next Time?==&lt;br /&gt;
&lt;br /&gt;
Hopefully, most readers are not currently in this situation, and would just like to prevent it from happening in the future. The right way is to set up specific contractual terms about how good the security needs to be for the project. &lt;br /&gt;
&lt;br /&gt;
Dave Thomas has written that quality should be a part of the requirements that you negotiate with the customer up front. NASA spends something like $1,000 per line of code. For you non-math majors, that's a million dollars for even a trivial 1000 line program. And although they have a fantastic record on software quality, they still occasionally lose a probe or crash a rocket because of software problems. &lt;br /&gt;
&lt;br /&gt;
Security, like quality, is something that software builders and buyers should discuss, as there are legitimate business reasons for web applications with differing levels of security. Buyers, of course, are initially going to expect software without any vulnerabilities. This, of course, is not realistic. Builders, at least if history is any guide, are going to want to build software that meets the functional requirements and not worry about security at all. Leaving security out of the negotiation entirely is also not appropriate, as the default legal rules are quite unclear. &lt;br /&gt;
&lt;br /&gt;
The software builder and buyer need to have a frank discussion that addresses questions like:&lt;br /&gt;
* What types of incidents would be considered serious (e.g. disclosure, corruption, denial of service)? &lt;br /&gt;
* Do all the developers have to be trained in security? &lt;br /&gt;
* Do you want a documented security policy and/or security requirements for the application? &lt;br /&gt;
* Do you want detailed documentation of the security design and mechanisms? &lt;br /&gt;
* Do you want a security review of the design? &lt;br /&gt;
* Do you want penetration testing done before deployment?&lt;br /&gt;
* Do you want the code reviewed by security experts? &lt;br /&gt;
* Who takes the risk on fixing security problems discovered down the road?&lt;br /&gt;
&lt;br /&gt;
Buyers should expect that there will be some additional charges for increased security, and that they can get a cheaper price if they decline these security services. As a contractual starting point, you may want to consider the draconian Code Integrity Warranty that puts all the burden on the developers for any bug of any kind that affects security. At least the terms are very clear, but the potential liability for developers is staggering.&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
&lt;br /&gt;
So, if you're outsourcing software development, talk with your developers. Make sure they understand your security needs. Make sure it gets in the contract. You may have to answer some hard questions about just how much security you're willing to pay for. If you're a software developer, be clear about what security you are providing, then do it. Make sure you understand whose responsibility it will be if a security vulnerability is uncovered after the software is in production.&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=OWASP_Legal_Project_Roadmap/ja&amp;diff=108571</id>
		<title>OWASP Legal Project Roadmap/ja</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=OWASP_Legal_Project_Roadmap/ja&amp;diff=108571"/>
				<updated>2011-04-11T11:36:16Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: Created page with &amp;quot;プロジェクトの全体的なゴールは以下である。    ソフトウェア・セキュリティの法律面で、開発者、ソフトウェア購入者および販売...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;プロジェクトの全体的なゴールは以下である。&lt;br /&gt;
&lt;br /&gt;
  ソフトウェア・セキュリティの法律面で、開発者、ソフトウェア購入者および販売者にサポートを提供すること&lt;br /&gt;
&lt;br /&gt;
当面の間、私たちは以下の戦術的な目標に集中する。&lt;br /&gt;
&lt;br /&gt;
# 契約書添付書類を開発することを続ける&lt;br /&gt;
# ソフトウェア・セキュリティを取り巻く、契約と取得に関するプロセス活動をつくる&lt;br /&gt;
# 法的なプロセス活動をすべてのOWASPプロセス資材に統合する&lt;br /&gt;
&lt;br /&gt;
私たちがこれらの目標を達成するのを助けるために定められた現在のタスクは次のとおりである。&lt;br /&gt;
&lt;br /&gt;
* プロセス活動「ソフトウェア・セキュリティに関する合意に達する」を下書きする&lt;br /&gt;
* 添付書類の有用性を評価するために事例研究をする&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP Legal Project]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Policy_Frameworks&amp;diff=27767</id>
		<title>Policy Frameworks</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Policy_Frameworks&amp;diff=27767"/>
				<updated>2008-04-06T13:57:18Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
Secure applications do not just happen – they are the result of an organization deciding that they will produce secure applications. OWASP does not wish to mandate a particular approach or require an organization to pick up compliance with laws that do not affect them - every organization is different.&lt;br /&gt;
&lt;br /&gt;
However, for a secure application, the following at a minimum are required:&lt;br /&gt;
&lt;br /&gt;
* Organizational management which champions security&lt;br /&gt;
&lt;br /&gt;
* A written information security policy properly derived from national standards&lt;br /&gt;
&lt;br /&gt;
* A development methodology with adequate security checkpoints and activities&lt;br /&gt;
&lt;br /&gt;
* Secure release and configuration management processes&lt;br /&gt;
&lt;br /&gt;
Many of the controls within OWASP Guide 2.0 are influenced by requirements of national standards or control frameworks such as COBIT; typically controls selected out of OWASP will satisfy relevant ISO 27002(17799) and COBIT controls. &lt;br /&gt;
&lt;br /&gt;
==Organizational commitment to security ==&lt;br /&gt;
&lt;br /&gt;
Organizations that have security buy-in from the highest levels will generally produce and procure applications that meet basic information security principles. This is the first of many steps along the range between ad hoc “possibly secure (but probably not)” to “best practices”. &lt;br /&gt;
&lt;br /&gt;
Organizations that do not have management buy-in, or simply do not care about security, are extraordinarily unlikely to produce secure applications. Each secure organization documents its “taste” for risk in their information security policy, thus making it easy to determine which risks will be accepted, mitigated, or assigned. &lt;br /&gt;
&lt;br /&gt;
Insecure organizations simply don’t know where this “taste” is set, and so when projects run by the insecure organization select controls, they will either end up implementing the wrong controls or not enough controls. Rare examples have been found where every control, including a kitchen sink tealeaf strainer has been implemented, usually at huge cost. &lt;br /&gt;
&lt;br /&gt;
Most organizations produce information security policies derived from ISO 27002(17799), or if in the US, from COBIT, or occasionally both or other standards. There is no hard and fast rule for how to produce information security policies, but in general:&lt;br /&gt;
&lt;br /&gt;
* If you’re publicly traded in most countries, you must have an information security policy&lt;br /&gt;
&lt;br /&gt;
* If you’re publicly traded in the US, you must have an information security policy which is compliant with SOX requirements, which generally means COBIT controls&lt;br /&gt;
&lt;br /&gt;
* If you’re privately held, but have more than a few employees or coders, you probably need one&lt;br /&gt;
&lt;br /&gt;
* Popular FOSS projects, which are not typical organizations, should also have an information security policy&lt;br /&gt;
&lt;br /&gt;
It is perfectly fine to mix and match controls from COBIT and ISO 27002(17799) and most any other respected information security standard; rarely do they disagree on the details. The method of production is sometimes tricky – if you “need” certified policy, you will need to engage qualified firms to help you. &lt;br /&gt;
&lt;br /&gt;
==OWASP’s Place at the Framework table ==&lt;br /&gt;
&lt;br /&gt;
The following diagram demonstrates where OWASP fits in (substitute your own country and its laws, regulations and standards if it does not appear):&lt;br /&gt;
&lt;br /&gt;
[[Image:Policy_frameworks.JPG]]&lt;br /&gt;
&lt;br /&gt;
Organizations need to establish information security policy informed by relevant national legislation, industry regulation, merchant agreements, and subsidiary best practice guides, such as OWASP. It is impossible to draw a small diagram containing all relevant laws and regulations, so you should assume all of the relevant laws, standards, regulations, and guidelines are missing – you need to find out which affect your organization, customers (as applicable), and where the application is deployed.&lt;br /&gt;
&lt;br /&gt;
IANAL: OWASP is not a qualified source of legal advice; you should seek your own legal advice. &lt;br /&gt;
&lt;br /&gt;
===''COBIT''===&lt;br /&gt;
&lt;br /&gt;
COBIT is a popular risk management framework structured around four domains:&lt;br /&gt;
&lt;br /&gt;
* Planning and organization&lt;br /&gt;
&lt;br /&gt;
* Acquisition and implementation&lt;br /&gt;
&lt;br /&gt;
* Delivery and support&lt;br /&gt;
&lt;br /&gt;
* Monitoring&lt;br /&gt;
&lt;br /&gt;
Each of the four domains has 13 high level objectives, such as DS5 ''Ensure Systems Security. ''Each high level objective has a number of detailed objectives, such as 5.2 ''Identification, Authentication, and Access''. Objectives can be fulfilled in a variety of methods that are likely to be different for each organization.&lt;br /&gt;
&lt;br /&gt;
COBIT is typically used as a SOX control framework, or as a complement to ISO 27002(17799) controls.&lt;br /&gt;
&lt;br /&gt;
OWASP does not dwell on the management and business risk aspects of COBIT. If you are implementing COBIT, OWASP is an excellent start for systems development risks and to ensure that custom and off the shelf applications comply with COBIT controls, but OWASP is not a COBIT compliance magic wand. &lt;br /&gt;
&lt;br /&gt;
Where a COBIT objective is achieved with an OWASP control in this book, you will see “COBIT XXy z.z” to help direct you to the relevant portion of COBIT control documentation. Such controls should be a part of all COBIT compliant applications.&lt;br /&gt;
&lt;br /&gt;
For more information about COBIT, please visit &amp;lt;u&amp;gt;http://www.isaca.org/&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===''ISO 27002(17799)''===&lt;br /&gt;
&lt;br /&gt;
ISO 27002(17799) is a risk-based Information Security Management framework directly derived from the AS/NZS 4444 and BS 7799 standards. It is an international standard and used heavily in most organizations, although not in the US. However, a few US organizations use ISO 27002(17799) as well, particularly if they have subsidiaries outside the US.&lt;br /&gt;
&lt;br /&gt;
ISO 27002(17799) dates back to the mid-1990s, and some of the control objectives reflect this age – for example referring to administrative interfaces as “diagnostic ports”.&lt;br /&gt;
&lt;br /&gt;
Organizations using ISO 27002(17799) can use OWASP for detailed guidance when selecting and implementing a wide range of ISO 17999 controls, particularly those in the Systems Development chapter, among others. Where a 27002(17799) objective is achieved with an OWASP control in this book, you will see “ISO 27002(17799) X.y.z” to help direct you to the relevant portion of ISO 27002(17799). Such controls should be a part of all ISO 27002(17799) compliant applications.&lt;br /&gt;
&lt;br /&gt;
For more information about ISO 27002(17799), please visit &amp;lt;u&amp;gt;http://www.computersecuritynow.com/&amp;lt;/u&amp;gt; and the relevant standards bodies, such as Standards Australia (&amp;lt;u&amp;gt;http://www.standards.com.au/&amp;lt;/u&amp;gt;), Standards New Zealand (&amp;lt;u&amp;gt;http://www.standards.co.nz/&amp;lt;/u&amp;gt;), or British Standards International (&amp;lt;u&amp;gt;http://www.bsi-global.com/&amp;lt;/u&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Note that ISO 17799 was renamed to ISO 27002 in July 2007, to achieve numerical alignment with ISO's overall security standards set (ref: &amp;lt;u&amp;gt;http://www.27000.org&amp;lt;/u&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
===''Sarbanes-Oxley''===&lt;br /&gt;
&lt;br /&gt;
A primary motivator for many US organizations in adopting OWASP controls is to assist with ongoing Sarbanes-Oxley compliance. If an organization followed every control in this book, it would not automatically grant the organization SOX compliance. Therefore, The Guide is useful as a suitable control for application procurement and in-house development, as part of a wider compliance program. &lt;br /&gt;
&lt;br /&gt;
However, SOX compliance is often used as a case for resource starved IT managers to implement long neglected security controls, so it is important to understand what SOX actually requires. A summary of SOX, section 404 obtained from AICPA’s web site at &amp;lt;u&amp;gt;http://www.aicpa.org/info/sarbanes_oxley_summary.htm&amp;lt;/u&amp;gt; states:&lt;br /&gt;
&lt;br /&gt;
Section 404: Management Assessment of Internal Controls&lt;br /&gt;
&lt;br /&gt;
Requires each annual report of an issuer to contain an &amp;quot;internal control report&amp;quot;, which shall:&lt;br /&gt;
&lt;br /&gt;
* state the responsibility of management for establishing and maintaining an adequate internal control structure and procedures for financial reporting; and&lt;br /&gt;
&lt;br /&gt;
* contain an assessment, as of the end of the issuer's fiscal year, of the effectiveness of the internal control structure and procedures of the issuer for financial reporting.&lt;br /&gt;
&lt;br /&gt;
This essentially states that management must establish and maintain internal ''financial control ''structures and procedures, and conduct an annual evaluation that verifies the controls are effective. As finance is no longer conducted using double entry ledger books, “SOX compliance” is often extended to mean IT. &lt;br /&gt;
&lt;br /&gt;
The Guide can facilitate SOX compliance by providing effective controls for all applications, and not just for the purposes of financial reporting. It allows organizations to buy products which claim they use OWASP controls, or allows organizations to mandate to software suppliers that they must use OWASP controls to provide more secure software. &lt;br /&gt;
&lt;br /&gt;
However, avoid using SOX as an excuse. SOX controls are intended to prevent another Enron, not to buy widgets that may or may not help. All controls, whether off the shelf widgets, training, code controls, or process changes, should be selected based on measurable results and ability to manage risk, and not just to “tick the boxes”.&lt;br /&gt;
&lt;br /&gt;
==Development Methodology ==&lt;br /&gt;
&lt;br /&gt;
High performing development shops employ a development methodology and some set of coding standards or conventions. As it turns out, the choice of development methodology is not as important as simply having one. &lt;br /&gt;
&lt;br /&gt;
Ad hoc development is too unstructured to produce secure applications. Therefore, organizations who wish to produce secure code consistently need to utilize a methodology that supports that goal. Choose carefully – small teams should never consider heavy weight methodologies that identify many different roles, while large teams must choose methodologies that will scale to their needs. &lt;br /&gt;
&lt;br /&gt;
Here are some key attributes to look for in selecting a development methodology:&lt;br /&gt;
&lt;br /&gt;
* Strong acceptance of design, testing, and documentation processes&lt;br /&gt;
&lt;br /&gt;
* Clear instances where security controls (such as threat risk analysis, peer reviews, code reviews, etc) can be slotted in&lt;br /&gt;
&lt;br /&gt;
* Works well for the organization’s size and maturity&lt;br /&gt;
&lt;br /&gt;
* Has the potential to reduce the current error rate and improve developer productivity&lt;br /&gt;
&lt;br /&gt;
* Will scale as the organization or product line grows&lt;br /&gt;
&lt;br /&gt;
==Coding Standards ==&lt;br /&gt;
&lt;br /&gt;
Methodologies alone are not coding standards; each team will either need to determine what to use based upon common practice, or simply lay down the law based upon known best practices. &lt;br /&gt;
&lt;br /&gt;
Inputs to consider:&lt;br /&gt;
&lt;br /&gt;
* Architectural guidance (i.e., “The web tier cannot call the database directly”)&lt;br /&gt;
&lt;br /&gt;
* Minimum documentation levels required&lt;br /&gt;
&lt;br /&gt;
* Mandatory testing and coverage requirements&lt;br /&gt;
&lt;br /&gt;
* Minimum levels of code commenting and the preferred comment style &lt;br /&gt;
&lt;br /&gt;
* Proper use of exception handling &lt;br /&gt;
&lt;br /&gt;
* Correct use of flow of control blocks (e.g., “All uses of conditional flow shall use explicit statement blocks”)&lt;br /&gt;
&lt;br /&gt;
* Preferred variable, function, class, and table naming styles&lt;br /&gt;
&lt;br /&gt;
* A preference for maintainable and readable code over clever or complex code&lt;br /&gt;
&lt;br /&gt;
Indentation style and tabbing are a holy war, and from a security perspective, they simply do not matter that much. However, it should be noted that we no longer use 80x24 terminals, so vertical space usage is not as important as it once was. Indent and tabbing can be “fixed” using automated tools or simply a style within a code editor, so do not get overly fussy on this issue.&lt;br /&gt;
&lt;br /&gt;
==Source Code Control ==&lt;br /&gt;
&lt;br /&gt;
High performance software engineering requires the use of regular improvements to code, along with associated testing regimes. All code and test changes must be able to be versioned and capable of being reverted. &lt;br /&gt;
&lt;br /&gt;
This could be done by copying folders on a file server, but it is better performed by source code revision tools, such as Subversion, CVS, SourceSafe, or ClearCase. &lt;br /&gt;
&lt;br /&gt;
Why include tests with a software revision? Most simply put, because tests for later builds will not necessarily match the tests required for earlier builds. So, it is vital that a test is applied to the build for which it was intended.&lt;br /&gt;
&lt;br /&gt;
==Summary ==&lt;br /&gt;
&lt;br /&gt;
The use of policy frameworks does not automatically guarantee secure applications or standards compliance. However, it is very difficult to produce secure applications consistently without some structure in place to do so.&lt;br /&gt;
&lt;br /&gt;
Select your policy framework carefully -- it should meet the needs of your organization today, while providing room for growth, too.&lt;br /&gt;
&lt;br /&gt;
Finally, get started today! Incorporating a security-conscious development process is a crucial first step to delivering secure applications. Your policy framework and development process should leverage your local conventions, risk management goals, and applicable standards to ensure a secure and quality result.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:Requirements]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Policy_Frameworks&amp;diff=27766</id>
		<title>Policy Frameworks</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Policy_Frameworks&amp;diff=27766"/>
				<updated>2008-04-06T13:54:48Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
Secure applications do not just happen – they are the result of an organization deciding that they will produce secure applications. OWASP does not wish to mandate a particular approach or require an organization to pick up compliance with laws that do not affect them - every organization is different.&lt;br /&gt;
&lt;br /&gt;
However, for a secure application, the following at a minimum are required:&lt;br /&gt;
&lt;br /&gt;
* Organizational management which champions security&lt;br /&gt;
&lt;br /&gt;
* A written information security policy properly derived from national standards&lt;br /&gt;
&lt;br /&gt;
* A development methodology with adequate security checkpoints and activities&lt;br /&gt;
&lt;br /&gt;
* Secure release and configuration management processes&lt;br /&gt;
&lt;br /&gt;
Many of the controls within OWASP Guide 2.0 are influenced by requirements of national standards or control frameworks such as COBIT; typically controls selected out of OWASP will satisfy relevant ISO 27002(17799) and COBIT controls. &lt;br /&gt;
&lt;br /&gt;
==Organizational commitment to security ==&lt;br /&gt;
&lt;br /&gt;
Organizations that have security buy-in from the highest levels will generally produce and procure applications that meet basic information security principles. This is the first of many steps along the range between ad hoc “possibly secure (but probably not)” to “best practices”. &lt;br /&gt;
&lt;br /&gt;
Organizations that do not have management buy-in, or simply do not care about security, are extraordinarily unlikely to produce secure applications. Each secure organization documents its “taste” for risk in their information security policy, thus making it easy to determine which risks will be accepted, mitigated, or assigned. &lt;br /&gt;
&lt;br /&gt;
Insecure organizations simply don’t know where this “taste” is set, and so when projects run by the insecure organization select controls, they will either end up implementing the wrong controls or not enough controls. Rare examples have been found where every control, including a kitchen sink tealeaf strainer has been implemented, usually at huge cost. &lt;br /&gt;
&lt;br /&gt;
Most organizations produce information security policies derived from ISO 27002(17799), or if in the US, from COBIT, or occasionally both or other standards. There is no hard and fast rule for how to produce information security policies, but in general:&lt;br /&gt;
&lt;br /&gt;
* If you’re publicly traded in most countries, you must have an information security policy&lt;br /&gt;
&lt;br /&gt;
* If you’re publicly traded in the US, you must have an information security policy which is compliant with SOX requirements, which generally means COBIT controls&lt;br /&gt;
&lt;br /&gt;
* If you’re privately held, but have more than a few employees or coders, you probably need one&lt;br /&gt;
&lt;br /&gt;
* Popular FOSS projects, which are not typical organizations, should also have an information security policy&lt;br /&gt;
&lt;br /&gt;
It is perfectly fine to mix and match controls from COBIT and ISO 27002(17799) and most any other respected information security standard; rarely do they disagree on the details. The method of production is sometimes tricky – if you “need” certified policy, you will need to engage qualified firms to help you. &lt;br /&gt;
&lt;br /&gt;
==OWASP’s Place at the Framework table ==&lt;br /&gt;
&lt;br /&gt;
The following diagram demonstrates where OWASP fits in (substitute your own country and its laws, regulations and standards if it does not appear):&lt;br /&gt;
&lt;br /&gt;
[[Image:Policy_frameworks.JPG]]&lt;br /&gt;
&lt;br /&gt;
Organizations need to establish information security policy informed by relevant national legislation, industry regulation, merchant agreements, and subsidiary best practice guides, such as OWASP. It is impossible to draw a small diagram containing all relevant laws and regulations, so you should assume all of the relevant laws, standards, regulations, and guidelines are missing – you need to find out which affect your organization, customers (as applicable), and where the application is deployed.&lt;br /&gt;
&lt;br /&gt;
IANAL: OWASP is not a qualified source of legal advice; you should seek your own legal advice. &lt;br /&gt;
&lt;br /&gt;
===''COBIT''===&lt;br /&gt;
&lt;br /&gt;
COBIT is a popular risk management framework structured around four domains:&lt;br /&gt;
&lt;br /&gt;
* Planning and organization&lt;br /&gt;
&lt;br /&gt;
* Acquisition and implementation&lt;br /&gt;
&lt;br /&gt;
* Delivery and support&lt;br /&gt;
&lt;br /&gt;
* Monitoring&lt;br /&gt;
&lt;br /&gt;
Each of the four domains has 13 high level objectives, such as DS5 ''Ensure Systems Security. ''Each high level objective has a number of detailed objectives, such as 5.2 ''Identification, Authentication, and Access''. Objectives can be fulfilled in a variety of methods that are likely to be different for each organization.&lt;br /&gt;
&lt;br /&gt;
COBIT is typically used as a SOX control framework, or as a complement to ISO 27002(17799) controls.&lt;br /&gt;
&lt;br /&gt;
OWASP does not dwell on the management and business risk aspects of COBIT. If you are implementing COBIT, OWASP is an excellent start for systems development risks and to ensure that custom and off the shelf applications comply with COBIT controls, but OWASP is not a COBIT compliance magic wand. &lt;br /&gt;
&lt;br /&gt;
Where a COBIT objective is achieved with an OWASP control in this book, you will see “COBIT XXy z.z” to help direct you to the relevant portion of COBIT control documentation. Such controls should be a part of all COBIT compliant applications.&lt;br /&gt;
&lt;br /&gt;
For more information about COBIT, please visit &amp;lt;u&amp;gt;http://www.isaca.org/&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===''ISO 27002(17799)''===&lt;br /&gt;
&lt;br /&gt;
ISO 27002(17799) is a risk-based Information Security Management framework directly derived from the AS/NZS 4444 and BS 7799 standards. It is an international standard and used heavily in most organizations, although not in the US. However, a few US organizations use ISO 27002(17799) as well, particularly if they have subsidiaries outside the US.&lt;br /&gt;
&lt;br /&gt;
ISO 27002(17799) dates back to the mid-1990s, and some of the control objectives reflect this age – for example referring to administrative interfaces as “diagnostic ports”.&lt;br /&gt;
&lt;br /&gt;
Organizations using ISO 27002(17799) can use OWASP for detailed guidance when selecting and implementing a wide range of ISO 17999 controls, particularly those in the Systems Development chapter, among others. Where a 27002(17799) objective is achieved with an OWASP control in this book, you will see “ISO 27002(17799) X.y.z” to help direct you to the relevant portion of ISO 27002(17799). Such controls should be a part of all ISO 27002(17799) compliant applications.&lt;br /&gt;
&lt;br /&gt;
For more information about ISO 27002(17799), please visit &amp;lt;u&amp;gt;http://www.computersecuritynow.com/&amp;lt;/u&amp;gt; and the relevant standards bodies, such as Standards Australia (&amp;lt;u&amp;gt;http://www.standards.com.au/&amp;lt;/u&amp;gt;), Standards New Zealand (&amp;lt;u&amp;gt;http://www.standards.co.nz/&amp;lt;/u&amp;gt;), or British Standards International (&amp;lt;u&amp;gt;http://www.bsi-global.com/&amp;lt;/u&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Note that ISO 17799 has been renamed to ISO 27002 in July 2007, to achieve numerical alignment with ISO's overall security standards set (ref: &amp;lt;u&amp;gt;http://www.27000.org&amp;lt;/u&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
===''Sarbanes-Oxley''===&lt;br /&gt;
&lt;br /&gt;
A primary motivator for many US organizations in adopting OWASP controls is to assist with ongoing Sarbanes-Oxley compliance. If an organization followed every control in this book, it would not automatically grant the organization SOX compliance. Therefore, The Guide is useful as a suitable control for application procurement and in-house development, as part of a wider compliance program. &lt;br /&gt;
&lt;br /&gt;
However, SOX compliance is often used as a case for resource starved IT managers to implement long neglected security controls, so it is important to understand what SOX actually requires. A summary of SOX, section 404 obtained from AICPA’s web site at &amp;lt;u&amp;gt;http://www.aicpa.org/info/sarbanes_oxley_summary.htm&amp;lt;/u&amp;gt; states:&lt;br /&gt;
&lt;br /&gt;
Section 404: Management Assessment of Internal Controls&lt;br /&gt;
&lt;br /&gt;
Requires each annual report of an issuer to contain an &amp;quot;internal control report&amp;quot;, which shall:&lt;br /&gt;
&lt;br /&gt;
* state the responsibility of management for establishing and maintaining an adequate internal control structure and procedures for financial reporting; and&lt;br /&gt;
&lt;br /&gt;
* contain an assessment, as of the end of the issuer's fiscal year, of the effectiveness of the internal control structure and procedures of the issuer for financial reporting.&lt;br /&gt;
&lt;br /&gt;
This essentially states that management must establish and maintain internal ''financial control ''structures and procedures, and conduct an annual evaluation that verifies the controls are effective. As finance is no longer conducted using double entry ledger books, “SOX compliance” is often extended to mean IT. &lt;br /&gt;
&lt;br /&gt;
The Guide can facilitate SOX compliance by providing effective controls for all applications, and not just for the purposes of financial reporting. It allows organizations to buy products which claim they use OWASP controls, or allows organizations to mandate to software suppliers that they must use OWASP controls to provide more secure software. &lt;br /&gt;
&lt;br /&gt;
However, avoid using SOX as an excuse. SOX controls are intended to prevent another Enron, not to buy widgets that may or may not help. All controls, whether off the shelf widgets, training, code controls, or process changes, should be selected based on measurable results and ability to manage risk, and not just to “tick the boxes”.&lt;br /&gt;
&lt;br /&gt;
==Development Methodology ==&lt;br /&gt;
&lt;br /&gt;
High performing development shops employ a development methodology and some set of coding standards or conventions. As it turns out, the choice of development methodology is not as important as simply having one. &lt;br /&gt;
&lt;br /&gt;
Ad hoc development is too unstructured to produce secure applications. Therefore, organizations who wish to produce secure code consistently need to utilize a methodology that supports that goal. Choose carefully – small teams should never consider heavy weight methodologies that identify many different roles, while large teams must choose methodologies that will scale to their needs. &lt;br /&gt;
&lt;br /&gt;
Here are some key attributes to look for in selecting a development methodology:&lt;br /&gt;
&lt;br /&gt;
* Strong acceptance of design, testing, and documentation processes&lt;br /&gt;
&lt;br /&gt;
* Clear instances where security controls (such as threat risk analysis, peer reviews, code reviews, etc) can be slotted in&lt;br /&gt;
&lt;br /&gt;
* Works well for the organization’s size and maturity&lt;br /&gt;
&lt;br /&gt;
* Has the potential to reduce the current error rate and improve developer productivity&lt;br /&gt;
&lt;br /&gt;
* Will scale as the organization or product line grows&lt;br /&gt;
&lt;br /&gt;
==Coding Standards ==&lt;br /&gt;
&lt;br /&gt;
Methodologies alone are not coding standards; each team will either need to determine what to use based upon common practice, or simply lay down the law based upon known best practices. &lt;br /&gt;
&lt;br /&gt;
Inputs to consider:&lt;br /&gt;
&lt;br /&gt;
* Architectural guidance (i.e., “The web tier cannot call the database directly”)&lt;br /&gt;
&lt;br /&gt;
* Minimum documentation levels required&lt;br /&gt;
&lt;br /&gt;
* Mandatory testing and coverage requirements&lt;br /&gt;
&lt;br /&gt;
* Minimum levels of code commenting and the preferred comment style &lt;br /&gt;
&lt;br /&gt;
* Proper use of exception handling &lt;br /&gt;
&lt;br /&gt;
* Correct use of flow of control blocks (e.g., “All uses of conditional flow shall use explicit statement blocks”)&lt;br /&gt;
&lt;br /&gt;
* Preferred variable, function, class, and table naming styles&lt;br /&gt;
&lt;br /&gt;
* A preference for maintainable and readable code over clever or complex code&lt;br /&gt;
&lt;br /&gt;
Indentation style and tabbing are a holy war, and from a security perspective, they simply do not matter that much. However, it should be noted that we no longer use 80x24 terminals, so vertical space usage is not as important as it once was. Indent and tabbing can be “fixed” using automated tools or simply a style within a code editor, so do not get overly fussy on this issue.&lt;br /&gt;
&lt;br /&gt;
==Source Code Control ==&lt;br /&gt;
&lt;br /&gt;
High performance software engineering requires the use of regular improvements to code, along with associated testing regimes. All code and test changes must be able to be versioned and capable of being reverted. &lt;br /&gt;
&lt;br /&gt;
This could be done by copying folders on a file server, but it is better performed by source code revision tools, such as Subversion, CVS, SourceSafe, or ClearCase. &lt;br /&gt;
&lt;br /&gt;
Why include tests with a software revision? Most simply put, because tests for later builds will not necessarily match the tests required for earlier builds. So, it is vital that a test is applied to the build for which it was intended.&lt;br /&gt;
&lt;br /&gt;
==Summary ==&lt;br /&gt;
&lt;br /&gt;
The use of policy frameworks does not automatically guarantee secure applications or standards compliance. However, it is very difficult to produce secure applications consistently without some structure in place to do so.&lt;br /&gt;
&lt;br /&gt;
Select your policy framework carefully -- it should meet the needs of your organization today, while providing room for growth, too.&lt;br /&gt;
&lt;br /&gt;
Finally, get started today! Incorporating a security-conscious development process is a crucial first step to delivering secure applications. Your policy framework and development process should leverage your local conventions, risk management goals, and applicable standards to ensure a secure and quality result.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:Requirements]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=What_are_web_applications%3F&amp;diff=27765</id>
		<title>What are web applications?</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=What_are_web_applications%3F&amp;diff=27765"/>
				<updated>2008-04-06T13:07:59Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
In the early days of the web, web sites consisted of static pages, which severely limited interaction with the user. In the early 1990’s, this limitation was removed when web servers were modified to allow communication with server-side custom scripts. No longer were applications just static brochure-ware, edited only by those who knew the arcane mysteries of HTML; with this single change, normal users could interact with the application for the first time.&lt;br /&gt;
&lt;br /&gt;
[[Image:What are web applications.JPG]]&lt;br /&gt;
&lt;br /&gt;
This is a huge and fundamental step towards the web as we know it today. Without interactivity, there would be no e-commerce (such as Amazon), no web e-mail (Hotmail or Gmail), no Internet Banking, no blogs, no online share trading, and no web forums or communities like Orkut or Friendster. The static Internet would have been vastly different to today. &lt;br /&gt;
&lt;br /&gt;
The trend towards increased interactivity has continued apace, with the advent of “Web 2.0”, a term that encompasses many existing technologies, but heavily features highly interactive, user centric, web-aware applications. &lt;br /&gt;
&lt;br /&gt;
==Technologies ==&lt;br /&gt;
&lt;br /&gt;
Initially, it was quite difficult to write sophisticated applications. The first generation web applications were primitive, usually little more than form submissions and search applications. Even these basic applications took quite a great deal of skill to craft. &lt;br /&gt;
&lt;br /&gt;
Over time, the arcane knowledge required to write applications has been reduced. Today, it is relatively easy to write sophisticated applications with modern platforms and simpler languages, like PHP or VB.NET. &lt;br /&gt;
&lt;br /&gt;
However, this push to make applications as easy to write as possible has a downside – many entry-level programmers are completely unaware of the security implications of their code. This is discussed further in the “Security Principles” chapter.&lt;br /&gt;
&lt;br /&gt;
Let’s look at the various generations of web application technology. &lt;br /&gt;
&lt;br /&gt;
==First generation – CGI ==&lt;br /&gt;
&lt;br /&gt;
Common Gateway Interface (CGI) reigned supreme from approximately 1993 through to the late 1990’s when scripting languages took over in a big way.&lt;br /&gt;
&lt;br /&gt;
CGI works by encapsulating user supplied data in environment variables. These are inherited by the custom written scripts or programs, usually developed in Perl or C. The custom programs process the supplied user data, and send fully formed HTML to the “standard out” (stdout), which is captured by the web server and passed back to the user. &lt;br /&gt;
&lt;br /&gt;
Examples of complex CGI include Hotmail, which was essentially Perl scripts running on top of FreeBSD boxes and Slashdot, again a large Perl script running under Linux&lt;br /&gt;
&lt;br /&gt;
As few sites today write new CGI applications, the techniques to secure CGI applications are not discussed within the Guide. However, many of the techniques discussed can be used with few or no changes.&lt;br /&gt;
&lt;br /&gt;
==Filters ==&lt;br /&gt;
&lt;br /&gt;
Filters can be used to control access to a web site, implement a different web application framework (such as Perl, PHP, or ASP), or to provide a security check. &lt;br /&gt;
Because filters live within the execution context of the web server itself, they can be high performance. Typical examples of a filter interface include Apache web server modules, SunONE’s NSAPI, and Microsoft’s ISAPI. Filters can be written in C/C++ in order to integrate with the web/app server at a low-level. However, more recently, filters are being implemented in higher level languages, using interfaces like the J2EE filter API.&lt;br /&gt;
&lt;br /&gt;
==Scripting ==&lt;br /&gt;
&lt;br /&gt;
CGI’s lack of session management and authorization controls hampered the development of commercially useful web applications. &lt;br /&gt;
&lt;br /&gt;
Web developers turned to scripting languages, such as PHP and Ruby to solve these problems. Scripting languages run script code within the web server without being compiled.&lt;br /&gt;
&amp;lt;!-- because the scripts are not compiled, they are more quickly developed and implemented. &lt;br /&gt;
dkaplan: this is what this line used to say.  This is a very controversial statement and an argument that is still raging today.  Due to a lack of scientific evidence, this can not be proven so I removed it.  --&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Unlike low-level languages, scripting languages rarely suffer from buffer overflows or resource leaks. Thus, programmers who use them can avoid two of the most common security issues. However, they do have their disadvantages:&lt;br /&gt;
&lt;br /&gt;
* Most scripting languages aren’t strongly typed and do not promote good programming practices&lt;br /&gt;
&lt;br /&gt;
* Scripting languages are generally slower than their compiled counterparts (sometimes as much as 100 times slower)&lt;br /&gt;
&lt;br /&gt;
* Scripts often lead to unmanageable code bases that perform poorly as their size grows&lt;br /&gt;
&lt;br /&gt;
* It’s difficult (but not impossible) to write multi-tier large scale applications in scripting languages, because often the presentation, application and data tiers reside on the same machine, thus limiting scalability and security&lt;br /&gt;
&lt;br /&gt;
* Most scripting languages do not natively support remote method or web service calls, which makes it difficult to communicate with application servers and external web services. &lt;br /&gt;
&lt;br /&gt;
Despite their disadvantages, many large and useful applications have been written with scripting languages, such as eGroupWare (egroupware.org), which is written in PHP. Too, many older Internet banking sites are written in ASP. &lt;br /&gt;
&lt;br /&gt;
Scripting frameworks include ASP, Perl, ColdFusion, and PHP. However, many of these would be considered interpreted hybrids now, particularly later versions of PHP and ColdFusion, which pre-tokenize and optimize scripts.&lt;br /&gt;
&lt;br /&gt;
==Web application frameworks – J2EE and ASP.NET ==&lt;br /&gt;
&lt;br /&gt;
As scripting languages reached the boundaries of performance and scalability, many larger vendors jumped on Sun’s J2EE web development platform. There are many J2EE implementations, including Tomcat from the Apache Foundation, JBoss and Glassfish. &lt;br /&gt;
&amp;lt;!-- dkaplan: I would remove Tomcat from this list.  It is not a complete J2EE implementation, it is only a webserver.  --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
J2EE:&lt;br /&gt;
&lt;br /&gt;
* Uses the Java language to produce applications which run nearly as quickly as C++ based ones, and that do not easily suffer from buffer overflows and memory leaks&lt;br /&gt;
&lt;br /&gt;
* Allowed large distributed applications to run acceptably for the first time&lt;br /&gt;
&lt;br /&gt;
* Possesses good session and authorization controls&lt;br /&gt;
&lt;br /&gt;
* Enabled relatively transparent multi-tier applications via various remote component invocation mechanisms, and &lt;br /&gt;
&lt;br /&gt;
* Is strongly typed to prevent many common security and programming issues before the program even runs&lt;br /&gt;
&lt;br /&gt;
J2EE’s downside is that it has a steep learning curve which  makes it difficult for web designers and entry-level programmers to use it to write applications. While certain graphical development tools make it somewhat easier to program with J2EE, a scripting language like PHP is still much easier to use.&lt;br /&gt;
&lt;br /&gt;
When Microsoft updated their ASP technology to ASP.NET. which mimics the J2EE framework in many ways, they offered several improvements on the development process. For example, .NET: &lt;br /&gt;
&lt;br /&gt;
* Makes it easy for entry level programmers and web designers to whip up smaller applications &lt;br /&gt;
&lt;br /&gt;
* Allows large distributed applications &lt;br /&gt;
&lt;br /&gt;
* Offers good session and authorization controls&lt;br /&gt;
&lt;br /&gt;
* Allows programmers to use their favorite language, which is compiled to native code for excellent performance (near C++ speeds), along with buffer overflow and resource garbage collection &lt;br /&gt;
&lt;br /&gt;
* Permits transparent communication with remote and external components&lt;br /&gt;
&lt;br /&gt;
* Is strongly typed to prevent many common security and programming issues before the program even runs&lt;br /&gt;
&lt;br /&gt;
The choice of J2EE or ASP.NET frameworks is largely dependent upon platform. There is little reason to choose one over the other from a security perspective.&lt;br /&gt;
&lt;br /&gt;
Applications targeting J2EE theoretically can run with few (if any) changes between any of the major vendors and on many platforms from Linux, to AIX, MacOS X, or Windows. (While in practice, some tweaking is required, complete re-writes are not required. )&lt;br /&gt;
&lt;br /&gt;
# ''ASP.NET is primarily available for Microsoft Windows. The Mono project (http://www.go-mono.com/) can run ASP.NET applications on many platforms including Solaris, Netware, and Linux. ''&lt;br /&gt;
&lt;br /&gt;
==Small to medium scale applications ==&lt;br /&gt;
&lt;br /&gt;
Most applications are either small or medium scale. The usual architecture is a simple linear procedural script. This is the most common form of coding for ASP, ColdFusion and PHP scripts, but rarer (but not impossible) for ASP.NET and J2EE applications. &lt;br /&gt;
&lt;br /&gt;
The reason for this architecture is that it is easy to write, and few skills are required to maintain the code. For smaller applications, any perceived performance benefit from moving to a more scalable architecture will never be recovered in the development time for those applications. For example, if it takes an additional three weeks of developer time to re-factor the scripts into an MVC approach, the three weeks will never be recovered (or noticed by end users) from the improvements in scalability.&lt;br /&gt;
&lt;br /&gt;
It is typical to find many security issues in such applications, including dynamic database queries constructed from insufficiently validated data input, poor error handling and weak authorization controls. &lt;br /&gt;
&lt;br /&gt;
This Guide provides advice throughout to help improve the security of these applications.&lt;br /&gt;
&lt;br /&gt;
==Large scale applications ==&lt;br /&gt;
&lt;br /&gt;
Larger applications need a different architecture to that of a simple survey or feedback form. As applications get larger, it becomes ever more difficult to implement and maintain features and to keep scalability high. Using scalable application architectures becomes a necessity rather than a luxury when an application needs more than about three database tables or presents more than approximately 20 - 50 functions to a user.&lt;br /&gt;
&lt;br /&gt;
Scalable application architecture is often divided into tiers, and if design patterns are used, often broken down into re-usable chunks using specific guidelines to enforce modularity, interface requirements and object re-use. Breaking the application into tiers allows the application to be distributed to various servers, thus improving the scalability of the application at the expense of complexity. &lt;br /&gt;
&lt;br /&gt;
One of the most common web application architectures is model-view-controller (MVC).  &amp;lt;!-- dkaplan: I removed the following detail because it doesn't add any important details and IMO makes it harder to understand:  which implements the Smalltalk 80 application architecture.--&amp;gt;  The main concept of MVC is to keep the code that displays content (the view) completely separate from the data and business logic (the model).  The controller exists to handle user input.   Lets use an order form as an example to solidify these terms.  The html of the form, its layout and anything you *see* that is not data should be generated by the view.  You type your information into the form and click the &amp;quot;purchase&amp;quot; button.  Behind the scenes, the controller receives this information and passes it on to the model.  The model either accepts the data or rejects it (if, for example, you forgot to enter your name).  If the data is accepted, the controller forwards you to the next view (perhaps a view that says you successfully ordered the product).  If the data is rejected, the controller may forward you back to the order form view with error messages on the page saying you need to enter your name.&lt;br /&gt;
&lt;br /&gt;
MVC is typical of most Apache Foundation Jakarta Struts applications, and the code-behind ASP.NET can be considered a partial implementation of this approach. For PHP, the WACT project (http://wact.sourceforge.net) aims to implement the MVC paradigm in a PHP friendly fashion.&lt;br /&gt;
&lt;br /&gt;
==View ==&lt;br /&gt;
&lt;br /&gt;
The front-end rendering code, often called the presentation tier, should aim to produce the HTML output for the user with little to no application logic.&lt;br /&gt;
&lt;br /&gt;
As many applications will be internationalized (i.e. contain no localized strings or culture information in the presentation layer), they must use calls into the model (application logic) to obtain the data required to render useful information to the user in their preferred language and culture, script direction, and units.&lt;br /&gt;
&lt;br /&gt;
All user input is directed back to controllers in the application logic.&lt;br /&gt;
&lt;br /&gt;
==Controller ==&lt;br /&gt;
&lt;br /&gt;
The controller (or application logic) takes input from the users and gates it through various workflows that call on the application’s model objects to retrieve, process, or store the data. &lt;br /&gt;
&lt;br /&gt;
Well written controllers centrally server-side validate input data against common security issues before passing the data to the model for processing, and ensure that output is safe or in a ready form for safe output by the view code.&lt;br /&gt;
&lt;br /&gt;
As the application is likely to be internationalized and accessible, the data needs to be in the local language and culture. For example, dates cannot only be in different orders, but an entirely different calendar could be in use. Applications need to be flexible about presenting and storing data. Simply displaying “7/4/2005” is ambiguous to anyone outside a few countries. &lt;br /&gt;
&lt;br /&gt;
==Model ==&lt;br /&gt;
&lt;br /&gt;
Models encapsulate functionality, such as “Account” or “User”. A good model should be transparent to the caller, and provide a method to deal with high-level business processes rather than a thin shim to the data store. For example, a good model will allow pseudo code such as this to exist in the controller:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
oAccount-&amp;gt;TransferFunds(fromAcct, ToAcct, Amount)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
rather than writing it such as this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if ( oAccount-&amp;gt;isMyAcct(fromAcct) &amp;amp;&amp;amp;&lt;br /&gt;
     amount &amp;lt; oAccount-&amp;gt;getMaxTransferLimit() &amp;amp;&amp;amp;&lt;br /&gt;
     oAccount-&amp;gt;getBalance(fromAcct) &amp;gt; amount &amp;amp;&amp;amp;&lt;br /&gt;
     oAccount-&amp;gt;ToAccountExists(ToAcct) )&lt;br /&gt;
then&lt;br /&gt;
     if oAccount-&amp;gt;withdraw(fromAcct, Amount) == OK &lt;br /&gt;
     then oAccount-&amp;gt;deposit(ToAcct, Amount)&lt;br /&gt;
     end if&lt;br /&gt;
end if&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The idea is to encapsulate the actual dirty work into the model code, rather than exposing primitives. If the controller and model are on different machines, the performance difference will be staggering, so it is important for the model to be useful at a high level. &lt;br /&gt;
&lt;br /&gt;
The model is responsible for checking data against business rules, and any residual risks unique to the data store in use. For example, if a model stores data in a flat file, the code needs to check for OS injection commands if the flat files are named by the user. If the model stores data in an interpreted language, such as SQL, then the model is responsible for preventing SQL injection. If it uses a message queue interface to a mainframe, the message queue data format (typically XML) needs to be well formed and compliant with a DTD. &lt;br /&gt;
&lt;br /&gt;
The contract between the controller and the model needs to be carefully considered to ensure that data is strongly typed, with reasonable structure (syntax), and appropriate length, whilst allowing flexibility to allow for internationalization and future needs.&lt;br /&gt;
&lt;br /&gt;
Calls by the model to the data store should be through the most secure method possible. Often the weakest possibility is dynamic queries, where a string is built up from unverified user input. This leads directly to SQL injection and is frowned upon. For more information, see the Interpreter Injections chapter. &lt;br /&gt;
&lt;br /&gt;
The best performance and highest security is often obtained through parameterized stored procedures, followed by parameterized queries (also known as prepared statements) with strong typing of the parameters and schema. The major reason for using stored procedures is to minimize network traffic for a multi-stage transaction or to remove security sensitive information from traversing the network. &lt;br /&gt;
&lt;br /&gt;
Stored procedures are not always a good idea – they tie you to a particular database vendor and many implementations are not fast for numeric computation. If you use the 80/20 rule for optimization and move the slow and high-risk transactions to stored procedures, the wins can be worthwhile from a security and performance perspective.&lt;br /&gt;
&lt;br /&gt;
==Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Web applications can be written in many different ways, and in many different languages. Although the Guide concentrates upon three common choices for its examples (PHP, J2EE and ASP.NET), the Guide can be used with any web application technology.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Guide_Frontispiece&amp;diff=27764</id>
		<title>Guide Frontispiece</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Guide_Frontispiece&amp;diff=27764"/>
				<updated>2008-04-06T12:45:53Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''A Guide to Building Secure Web Applications and Web Services'''&lt;br /&gt;
&lt;br /&gt;
2.1 	(DRAFT 3) &lt;br /&gt;
February 2006 &lt;br /&gt;
OWASP Foundation&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
__TOC__&lt;br /&gt;
==Dedication ==&lt;br /&gt;
To my fellow procrastinators and TiVo addicts, this book proves that given enough “tomorrows,” anything is possible. --Andrew van der Stock&lt;br /&gt;
&lt;br /&gt;
==Copyright and license ==&lt;br /&gt;
© 2001 – 2006 OWASP Foundation. &lt;br /&gt;
The Guide is licensed under the GNU Free Documentation License, a copy of which is found in the Appendix. PERMISSION IS GRANTED TO COPY, DISTRIBUTE, AND/OR MODIFY THIS DOCUMENT PROVIDED THIS COPYRIGHT NOTICE AND ATTRIBUTION TO OWASP IS RETAINED. &lt;br /&gt;
==Editors ==&lt;br /&gt;
The Guide has had several editors over various editions, all of whom have contributed immensely as authors, project managers, and editors over the lengthy period of the Guide’s gestation. &lt;br /&gt;
Guide 2.x series editors:&lt;br /&gt;
 &lt;br /&gt;
Andrew van der Stock&lt;br /&gt;
Adrian Wiesmann&lt;br /&gt;
 &lt;br /&gt;
==Authors and Reviewers ==&lt;br /&gt;
The Guide would not be where it is today without the generous gift of volunteer time and effort from many individuals. The following people helped develop Guide 2.x:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; &lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
*Ernesto Arroyo&lt;br /&gt;
*José Pedro Arroyo&lt;br /&gt;
*Derek Browne&lt;br /&gt;
*Izhar By-Gad&lt;br /&gt;
*Daniel Cornell&lt;br /&gt;
*Martin Eizner&lt;br /&gt;
*David Endler&lt;br /&gt;
*Raoul Endres&lt;br /&gt;
*Brian Greidanus&lt;br /&gt;
*Dennis Groves&lt;br /&gt;
*Darrel Grundy&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
*Robert Hansen&lt;br /&gt;
*William Hau&lt;br /&gt;
*Michael Howard&lt;br /&gt;
*Sverre Huseby&lt;br /&gt;
*Abraham Kang&lt;br /&gt;
*Eoin Keary&lt;br /&gt;
*Amit Klein&lt;br /&gt;
*Neal Krawetz&lt;br /&gt;
*Erik Lee&lt;br /&gt;
*Frank Lemmon&lt;br /&gt;
*Hal Lockhart&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
*Gene McKenna&lt;br /&gt;
*Kevin McLaughlin&lt;br /&gt;
*Roy McNamara&lt;br /&gt;
*K.K. Mookhey&lt;br /&gt;
*Richard Parke&lt;br /&gt;
*Denis Pilipchuk&lt;br /&gt;
*Jeremy Poteet&lt;br /&gt;
*Michael Scovetta&lt;br /&gt;
*Mikael Simonsson&lt;br /&gt;
*Tim Smith&lt;br /&gt;
*Ray Stirbei&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
*Steve Taylor&lt;br /&gt;
*Christopher Todd&lt;br /&gt;
*Nigel Tranter&lt;br /&gt;
*Andrew van der Stock&lt;br /&gt;
*Adrian Wiesmann&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Revision History ==&lt;br /&gt;
&lt;br /&gt;
{| border=1&lt;br /&gt;
 || '''Date''' || '''Version''' || '''Pages''' || '''Notes'''&lt;br /&gt;
|-&lt;br /&gt;
 || July 26, 2005 || 2.0 Blackhat Edition || 280 pages || Andrew van der Stock, Guide Lead&lt;br /&gt;
|-&lt;br /&gt;
 || July 27, 2005 || 2.0.1 Blackhat Edition++ || 293 pages || Cryptography chapter review&lt;br /&gt;
from Michael Howard incorporated&lt;br /&gt;
|-&lt;br /&gt;
 || September 12, 2005 || 2.1 DRAFT 1 || X pages || Changes from many sources&lt;br /&gt;
New SQA chapter from Frank Lemmon&lt;br /&gt;
|-&lt;br /&gt;
 || January 2006 || 2.1 DRAFT 2 || X pages || Changes from Bill Pollock&lt;br /&gt;
New chapters from Erick Lee&lt;br /&gt;
New revisions from Dan Cornell&lt;br /&gt;
|-&lt;br /&gt;
 || February 2006 || 2.1 DRAFT 3 || X pages || Ajax chapter&lt;br /&gt;
Many chapters back from reviewers&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Configuration&amp;diff=27763</id>
		<title>Configuration</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Configuration&amp;diff=27763"/>
				<updated>2008-04-06T12:41:24Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* Best Practices */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]__TOC__&lt;br /&gt;
&lt;br /&gt;
==Objective ==&lt;br /&gt;
&lt;br /&gt;
To produce applications which are secure out of the box.&lt;br /&gt;
&lt;br /&gt;
==Platforms Affected ==&lt;br /&gt;
&lt;br /&gt;
All.&lt;br /&gt;
&lt;br /&gt;
==Relevant COBIT Topics ==&lt;br /&gt;
&lt;br /&gt;
DS6 – Manage Changes – All sections should be reviewed&lt;br /&gt;
&lt;br /&gt;
==Best Practices ==&lt;br /&gt;
&lt;br /&gt;
Turn off all unnecessary features by default&lt;br /&gt;
&lt;br /&gt;
* Ensure that all switches and configuration for every feature is configured initially to be the safest possible choice&lt;br /&gt;
&lt;br /&gt;
* Inspect the design to see if the less safe choices could be designed in another way. For example, password reset systems are intrinsically unsound from a security point of view. If you do not ship this component, your application’s users will be safer.&lt;br /&gt;
&lt;br /&gt;
* Do not rely on optionally installed features in the base code&lt;br /&gt;
&lt;br /&gt;
* Do not configure anything in preparation for an optionally deployable feature.&lt;br /&gt;
&lt;br /&gt;
==Default passwords ==&lt;br /&gt;
&lt;br /&gt;
Applications often ship with well-known passwords. In a particularly excellent effort, NGS Software determined that Oracle’s “Unbreakable” database server contained 168 default passwords out of the box. Obviously, changing this many credentials every time an application server is deployed it out of the question, nor should it be necessary.&lt;br /&gt;
&lt;br /&gt;
===How to identify if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Inspect the application’s manifest and ensure that no passwords are included in any form, whether within the source files, compiled into the code, or as part of the configuration&lt;br /&gt;
&lt;br /&gt;
* Inspect the application for usernames and passwords. Ensure that diagrams also do not have any &lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Do not ship the product with any configured accounts &lt;br /&gt;
&lt;br /&gt;
* Do not hard code any backdoor accounts or special access mechanisms&lt;br /&gt;
&lt;br /&gt;
==Secure connection strings ==&lt;br /&gt;
&lt;br /&gt;
Connection strings to the database are rarely encrypted. However, they allow a remote attacker who has shell access to perform direct operations against the database or back end systems, thus providing a leap point for total compromise. &lt;br /&gt;
&lt;br /&gt;
===How to identify if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Check your framework’s configuration file, registry settings, and any application based configuration file (usually config.php, etc) for clear text connection strings to the database.&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Sometimes, no password is just as good as a clear text password&lt;br /&gt;
&lt;br /&gt;
* On the Win32 platform, use “TrustedConnection=yes”, and create the DSN with a stored credential. The credential is stored as a LSA Secret, which is not perfect, but is better than clear text passwords&lt;br /&gt;
&lt;br /&gt;
* Develop a method to obfuscate the password in some form, such as “encrypting” the name using the hostname or similar within code in a non-obvious way.&lt;br /&gt;
&lt;br /&gt;
* Ask the database developer to provide a library which allows remote connections using a password hash instead of a clear text credential. &lt;br /&gt;
&lt;br /&gt;
==Secure network transmission ==&lt;br /&gt;
&lt;br /&gt;
By default, no unencrypted data should transit the network. &lt;br /&gt;
&lt;br /&gt;
===How to identify if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Use a packet capture tool, such as Ethereal and mirror a switch port near the database or application servers.&lt;br /&gt;
&lt;br /&gt;
* Sniff the traffic for a while and determine your exposure to an attacker performing this exact same task&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Use SSL, SSH and other forms of encryption (such as encrypted database connections) to prevent data from being intercepted or interfered with over the wire.&lt;br /&gt;
&lt;br /&gt;
==Encrypted data ==&lt;br /&gt;
&lt;br /&gt;
Some information security policies and standards require the database on-disk data to be encrypted. However, this is essentially useless if the database connection allows clear text access to the data. What is more important is the obfuscation and one-way encryption of sensitive data.&lt;br /&gt;
&lt;br /&gt;
===How to identify if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
Highly protected applications:&lt;br /&gt;
&lt;br /&gt;
* Is there a requirement to encrypt certain data?&lt;br /&gt;
&lt;br /&gt;
* If so, is it “encrypted” in such a fashion that allows a database administrator to read it without knowing the key?&lt;br /&gt;
&lt;br /&gt;
If so, the “encryption” is useless and another approach is required &lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
Highly protected applications and any application that has a requirement to encrypt data:&lt;br /&gt;
&lt;br /&gt;
* Passwords should only be stored in a non-reversible format, such as SHA-256 or similar&lt;br /&gt;
&lt;br /&gt;
* Sensitive data like credit cards should be carefully considered – do they have to be stored at all? '''The PCI guidelines are very strict''' '''on the storage of credit card data'''. '''We strongly recommend against it. '''&lt;br /&gt;
&lt;br /&gt;
* Encrypted data should not have the key on the database server. &lt;br /&gt;
&lt;br /&gt;
The last requirement requires the attacker to take control of two machines to bulk decrypt data. The encryption key should be able to be changed on a regular basis, and the algorithm should be sufficient to protect the data in a temporal timeframe. For example, there is no point in using 40 bit DES today; data should be encrypted using AES-128 or better.&lt;br /&gt;
&lt;br /&gt;
==PHP Configuration ==&lt;br /&gt;
&lt;br /&gt;
==Global variables  ==&lt;br /&gt;
&lt;br /&gt;
	Variables declared outside of functions are considered global by PHP. The opposite is that a variable declared inside a function, is considered to be in local function scope. PHP handles global variables quite differently that say languages like C. In C, a global variable is always available in local scope as well as global, as long as it is not overridden by a local definition. In PHP things are different; to access a global variable from local scope you have to declare it global in that scope. The following example shows this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''$sTitle = 'Page title'; // Global scope''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''function printTitle()''&lt;br /&gt;
&lt;br /&gt;
''{''&lt;br /&gt;
&lt;br /&gt;
''global $sTitle; // Declare the variable as global''&lt;br /&gt;
&lt;br /&gt;
''	echo $sTitle; // Now we can access it just like it was a local variable''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	All variables in PHP are represented by a dollar sign followed by the name of the variable. The names are case-sensitive and must start with a letter or underscore, followed by any number of letters, numbers, or underscores.&lt;br /&gt;
&lt;br /&gt;
==register_globals ==&lt;br /&gt;
&lt;br /&gt;
The register_globals directive makes input from GET, POST and COOKIE, as well as session variables and uploaded files, directly accessible as global variables in PHP. This single directive, if set in php.ini, is the root of many vulnerabilities in web applications. 	 &lt;br /&gt;
&lt;br /&gt;
Let's start by having a look at an example:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''if ($bIsAlwaysFalse) ''&lt;br /&gt;
&lt;br /&gt;
''{ ''&lt;br /&gt;
&lt;br /&gt;
''	// This is never executed:''&lt;br /&gt;
&lt;br /&gt;
''	$sFilename = 'somefile.php';''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
''//       ...''&lt;br /&gt;
&lt;br /&gt;
''if ( $sFilename != '' )   ''&lt;br /&gt;
&lt;br /&gt;
''{''&lt;br /&gt;
&lt;br /&gt;
''	// Open $sFilename and send it's contents to the browser  ''&lt;br /&gt;
&lt;br /&gt;
''	//		... ''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
If we were to call this page like: '''''page.php?sFilename=/etc/passwd''''' with register_globals set, it would be the same as to write the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''$sFilename = '/etc/passwd'; // This is done internally by PHP       ''&lt;br /&gt;
&lt;br /&gt;
''if ( $bIsAlwaysFalse )''&lt;br /&gt;
&lt;br /&gt;
''{       // This is never executed:         ''&lt;br /&gt;
&lt;br /&gt;
''	$sFilename = 'somefile.php';''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
''// ...''&lt;br /&gt;
&lt;br /&gt;
''if ( $sFilename != '' )''&lt;br /&gt;
&lt;br /&gt;
''{''&lt;br /&gt;
&lt;br /&gt;
''	// Open $sFilename and send it's contents to the browser''&lt;br /&gt;
&lt;br /&gt;
''	// ...''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PHP takes care of the '''''$sFilename = '/etc/passwd';''''' part for us. What this means is that a malicious user could inject his/her own value for $sFilename and view any file readable under the current security context. &lt;br /&gt;
&lt;br /&gt;
We should always think of that “what if” when writing code. So turning off register_globals might be a solution but what if our code ends up on a server with register_globals on. We must bear in mind that all variables in global scope could have been tampered with. The correct way to write the above code would be to make sure that we always assign a value to '''''$sFilename''''': &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''// We initialize $sFilename to an empty string''&lt;br /&gt;
&lt;br /&gt;
''$sFilename = '';''&lt;br /&gt;
&lt;br /&gt;
''if ( $bIsAlwaysFalse ) { 	    ''&lt;br /&gt;
&lt;br /&gt;
''// This is never executed:     ''&lt;br /&gt;
&lt;br /&gt;
''$sFilename = 'somefile.php';''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
''...''&lt;br /&gt;
&lt;br /&gt;
''if ( $sFilename != '' ) {     ''&lt;br /&gt;
&lt;br /&gt;
''// Open $sFilename and send it's contents to the browser''&lt;br /&gt;
&lt;br /&gt;
''...''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another solution would be to have as little code as possible in global scope. Object oriented programming (OOP) is a real beauty when done right and I would highly recommend you to take that approach. We could write almost all our code in classes that is generally safer and promotes reuse. Like we never should assume that register_globals is off we should never assume it is on. The correct way to get input from GET, POST, COOKIE etc is to use the superglobals that were added in PHP version 4.1.0. These are the $_GET, $_POST, $_ENV, $_SERVER, $_COOKIE, $_REQUEST $_FILES, and $_SESSION arrays. The term superglobals is used since they are always available without regard to scope.&lt;br /&gt;
&lt;br /&gt;
'''register_globals '''&lt;br /&gt;
&lt;br /&gt;
If set PHP will create global variables from all user input coming from get, post and cookie. If you have the opportunity to turn off this directive you should definitely do so. Unfortunately there is so much code out there that uses it so you are lucky if you can get away with it. &lt;br /&gt;
&lt;br /&gt;
Recommended: off &lt;br /&gt;
&lt;br /&gt;
'''safe_mode '''&lt;br /&gt;
&lt;br /&gt;
The PHP safe mode includes a set of restrictions for PHP scripts and can really increase the security in a shared server environment. To name a few of these restrictions: A script can only access/modify files and folders which has the same owner as the script itself. Some functions/operators are completely disabled or restricted, like the backtick operator. &lt;br /&gt;
&lt;br /&gt;
'''disable_functions '''&lt;br /&gt;
&lt;br /&gt;
This directive can be used to disable functions of our choosing. &lt;br /&gt;
&lt;br /&gt;
'''open_basedir '''&lt;br /&gt;
&lt;br /&gt;
Restricts PHP so that all file operations are limited to the directory set here and its subdirectories. &lt;br /&gt;
&lt;br /&gt;
'''allow_url_fopen '''&lt;br /&gt;
&lt;br /&gt;
With this option set PHP can operate on remote files with functions like include and fopen. &lt;br /&gt;
&lt;br /&gt;
Recommended: off &lt;br /&gt;
&lt;br /&gt;
'''error_reporting '''&lt;br /&gt;
&lt;br /&gt;
We want to write as clean code as possible and thus we want PHP to throw all warnings etc at us. &lt;br /&gt;
&lt;br /&gt;
Recommended: E_ALL &lt;br /&gt;
&lt;br /&gt;
'''log_errors '''&lt;br /&gt;
&lt;br /&gt;
Logs all errors to a location specified in php.ini. &lt;br /&gt;
&lt;br /&gt;
Recommended: on &lt;br /&gt;
&lt;br /&gt;
'''display_errors '''&lt;br /&gt;
&lt;br /&gt;
With this directive set, all errors that occur during the execution of scripts, with respect to error_reporting, will be sent to the browser. This is desired in a development environment but not on a production server, since it could expose sensitive information about our code, database or web server. &lt;br /&gt;
&lt;br /&gt;
Recommended: off (production), on (development) &lt;br /&gt;
&lt;br /&gt;
'''magic_quotes_gpc '''&lt;br /&gt;
&lt;br /&gt;
Escapes all input coming in from post, get and cookie. This is something we should handle on our own. &lt;br /&gt;
&lt;br /&gt;
This also applies to '''magic_quotes_runtime'''. &lt;br /&gt;
&lt;br /&gt;
Recommended: off &lt;br /&gt;
&lt;br /&gt;
'''post_max_size, upload_max_filesize and memory_limit '''&lt;br /&gt;
&lt;br /&gt;
These directives should be set at a reasonable level to reduce the risk of resource starvation attacks. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Database security ==&lt;br /&gt;
&lt;br /&gt;
Data obtained from the user needs to be stored securely. In nearly every application, insufficient care is taken to ensure that data cannot be obtained from the database itself.&lt;br /&gt;
&lt;br /&gt;
===How to identify if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application connect to the database using low privilege users? &lt;br /&gt;
&lt;br /&gt;
* Are there different database connection users for application administration and normal user activities? If not, why not?&lt;br /&gt;
&lt;br /&gt;
* Does the application make use of safer constructs, such as stored procedures which do not require direct table access?&lt;br /&gt;
&lt;br /&gt;
* Highly protected applications: &lt;br /&gt;
** Is the database is on another host? Is that host locked down? &lt;br /&gt;
** All patches deployed and latest database software in use?&lt;br /&gt;
** Does the application connect to the database using an encrypted link? If not, is the application server and database server in a restricted network with minimal other hosts, particularly untrusted hosts like desktop workstations?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* The application should connect to the database using as low privilege user as is possible &lt;br /&gt;
&lt;br /&gt;
* The application should connect to the database with different credentials for every trust distinction (eg, user, read-only user, guest, administrators) and permissions applied to those tables and databases to prevent unauthorized access and modification&lt;br /&gt;
&lt;br /&gt;
* The application should prefer safer constructs, such as stored procedures which do not require direct table access. Once all access is through stored procedures, access to the tables should be revoked&lt;br /&gt;
&lt;br /&gt;
* Highly protected applications: &lt;br /&gt;
** The database should be on another host, which should be locked down with all current patches deployed and latest database software in use.&lt;br /&gt;
** The application should connect to the database using an encrypted link. If not, the application server and database server must reside in a restricted network with minimal other hosts. &lt;br /&gt;
** Do not deploy the database server in the main office network.&lt;br /&gt;
&lt;br /&gt;
==Further Reading ==&lt;br /&gt;
&lt;br /&gt;
* ITIL – Change Management http://www.itil.org.uk/&lt;br /&gt;
&lt;br /&gt;
==ColdFusion Components (CFCs) ==&lt;br /&gt;
&lt;br /&gt;
This section provides guidance on using ColdFusion components (CFCs) without exposing your web application to unnecessary risk.  ColdFusion provides two ways of restricting access to CFCs; role-based security and access control.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Role-based security is implemented by the '''''roles''''' attribute of the &amp;lt;cffunction&amp;gt; tag.  The attribute contains a comma-delimited list of security roles that can call this method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Access control is implemented by the '''''access''''' attribute of the &amp;lt;cffunction&amp;gt; tag.  The possible values of the attribute in order of most restricted behavior are: private (strongest), package, public (default), and remote (weakest).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Private: The method is accessible only to methods within the same component. This is similar to the Object Oriented Programming (OOP) private identifier.&lt;br /&gt;
&lt;br /&gt;
Package:  The method is accessible only to other methods within the same package. This is similar to the OOP protected static identifier.&lt;br /&gt;
&lt;br /&gt;
Public: The method is accessible to any CFC or CFM on the same server. This is similar to the OOP public static identifier.&lt;br /&gt;
&lt;br /&gt;
Remote: Allows all the privileges of public, in addition to accepting remote requests from HTML forms, Flash, or a web services. This option is required, to publish the function as a web service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Best Practices'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do not use THIS scope inside a component to expose properties. Use a getter or setter function instead.  For example, instead of using THIS.myVar create a public function that sets the variable (i.e. setMyVar(value)).&lt;br /&gt;
&lt;br /&gt;
Do not omit the role attribute as ColdFusion will not restrict user access to the function.&lt;br /&gt;
&lt;br /&gt;
Avoid using Access=”Remote” if you do not intend to call the component directly from a URL.&lt;br /&gt;
&lt;br /&gt;
==Configuration ==&lt;br /&gt;
&lt;br /&gt;
The following section describes some of the server-wide security-related options available to a ColdFusion administrator via the ColdFusion MX 7 Administrator console web application (http://servername:port/CFIDE/administrator/index.cfm). If the console application is unavailable, you can modify these options by editing the XML files in the cf_root/lib/ (Server configuration) or cf_web_root/WEB-INF/cfusion/lib (J2EE configuration) directory; however, editing these files directly is not recommended.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Best Practice '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CF Admin Password screen&lt;br /&gt;
&lt;br /&gt;
Enable a strong Administrator password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''The ColdFusion Administrator is the default interface for configuring the ColdFusion application server. It is secured by a single password. Ensure that the Administrator security is enabled and the password is strong and stored in a secure place.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ensure the checkbox is filled&lt;br /&gt;
&lt;br /&gt;
Enter and confirm a strong password string of 8 characters or more&lt;br /&gt;
&lt;br /&gt;
Click Submit Changes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sandbox Security screen'''&lt;br /&gt;
&lt;br /&gt;
Enable Sandbox Security&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''The ColdFusion Sandbox allows you to place access security restrictions on files, directories, methods, and data sources.  Sandboxes make the most sense for a hosting provider or corporate intranet where multiple applications share the same server. Enable this option.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Next, a sandbox needs to be configured, because if not all code in all directories will execute without restriction.  Code in a directory and its subdirectories inherits the access controls defined for the sandbox.  For example, if ABC Company creates multiple applications within their directory all applications will have the same permissions as the parent.  A sandbox applied to ABC-apps will apply to app1 and app2.  A sample directory structure is shown below:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''D:\inetpub\wwwroot\ABC-apps\app1'''&lt;br /&gt;
&lt;br /&gt;
'''D:\inetpub\wwwroot\ABC-apps\app2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Note: if a new sandbox is created for app2 then it will not inherit settings from ABC-apps.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Sandbox security configurations are application specific; however, there are general guidelines that should be followed:'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create a default restricted sandbox and copy setting to each subsequent sandbox removing restrictions as needed by the application.  Except in the case of files/directories where access is granted rather than restricted.&lt;br /&gt;
&lt;br /&gt;
Restrict access to data sources that should not be accessed by the sandboxed application.&lt;br /&gt;
&lt;br /&gt;
Restrict access to powerful tags, for example CFREGISTRY and CFEXECUTE.&lt;br /&gt;
&lt;br /&gt;
Restrict file and directory access to limit the ability of tags and functions to perform actions to specified paths.&lt;br /&gt;
&lt;br /&gt;
'''''Every''''' application should have a sandbox.&lt;br /&gt;
&lt;br /&gt;
In multi-homed environments disable Java Server Pages (JSP) as ColdFusion is unable to restrict the functionality of the underlying Java server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''RDS Password screen'''&lt;br /&gt;
&lt;br /&gt;
Enable a strong RDS password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Developers can access ColdFusion resources (files and data sources) over HTTP from Macromedia Dreamweaver MX and HomeSite+ through ColdFusion’s Remote Development Services (RDS). This feature is password protected should only be enabled in secure development environments.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ensure the checkbox is filled&lt;br /&gt;
&lt;br /&gt;
Enter and confirm a strong password string of 8 characters or more&lt;br /&gt;
&lt;br /&gt;
Click Submit Changes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use RDS over SSL - During development, you should use SSL v3 to encrypt all RDS communications between Dreamweaver MX and the ColdFusion server. This includes remote access to server data sources and drives, provided that both are accessed through RDS.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Disable RDS in Production&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''In production environments, you should not use RDS. In earlier versions of ColdFusion, RDS ran as a separate service or process and could be disabled by disabling the service. In ColdFusion MX, RDS is integrated into the main service. To disable it, you must disable the RDSServlet mapping in the web.xml file. The following procedure assumes that ColdFusion is installed in the default location.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.	Back up the C:\CFusionMX7\wwwroot\WEB-INF\web.xml file.'''&lt;br /&gt;
&lt;br /&gt;
'''2.	Open the web.xml file for editing.'''&lt;br /&gt;
&lt;br /&gt;
'''3.	Comment out the RDSServlet mapping, as follows:'''&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;!—'''&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;servlet-mapping&amp;gt; '''&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;servlet-name&amp;gt;RDSServlet&amp;lt;/servlet-name&amp;gt; '''&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;url-pattern&amp;gt;/CFIDE/main/ide.cfm&amp;lt;/url-pattern&amp;gt; '''&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;/servlet-mapping&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
'''--&amp;gt; '''&lt;br /&gt;
&lt;br /&gt;
'''4.	Save the file.'''&lt;br /&gt;
&lt;br /&gt;
'''5.	Restart ColdFusion.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Settings Screen&lt;br /&gt;
&lt;br /&gt;
Enable a Request Timeout&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''ColdFusion processes requests simultaneously and queues all requests above the configured maximum number of simultaneous requests. If requests run abnormally long, this can tie up server resources and lead to DoS attacks. This setting will terminate requests when the configured timeout is reached.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Fill the checkbox next to “Timeout Request after (seconds)”&lt;br /&gt;
&lt;br /&gt;
Enter the number of seconds for ColdFusion to allow threads to run&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''To allow a valid template request to run beyond the configured timeout, place a &amp;lt;cfsetting&amp;gt; atop the base ColdFusion template and configure the RequestTimeout attribute for the necessary amount of time (in seconds).'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use UUID for cftoken&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Best practice calls for J2EE session management. In the event that only ColdFusion session management is available, strong security identifiers must be used. Enable this setting to change the default 8-character CFToken security token string to a UUID.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enable Global Script Protection - This is a new security feature in ColdFusion MX 7 that isn’t available in other web application platforms. It helps protect Form, URL, CGI, and Cookie scope variables from cross-site scripting attacks. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Specify a Site-wide Error Handler &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Prevent information leaks through verbose error messages. Specifying a site-wide error handler covers you when cftry/cfcatch are not used. This page should be a generic error message that you return to the user. Also, if the error handler displays user-input, it should be reviewed for potential cross-site scripting issues.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Specify a Missing Template Handler &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Provide a custom message page for HTTP 404 errors when the server cannot find the requested ColdFusion template.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Configure a memory throttling &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''To prevent file upload DoS attacks, Macromedia added new configuration settings to ColdFusion MX 7.0.1 that allow administrators to restrict the total upload size of HTTP POST operations. Configure these settings accordingly.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
maximum size for post data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''This is the total size that ColdFusion will accept for any single HTTP POST request (including file uploads). ColdFusion will reject any request whose Content-size header exceeds this setting.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Request Throttle Threshold &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''HTTP POST requests larger than this setting (default is 4MB) are included in the total concurrent request memory size and get queued if they exceed the Request Throttle Memory setting.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Request Throttle Memory &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''This sets the total amount of memory (MB) ColdFusion reserves for concurrent HTTP POST requests. Any requests exceeding this limit are queued until enough memory is available. '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Memory Variables screen'''&lt;br /&gt;
&lt;br /&gt;
Enable J2EE Session Management and Use J2EE session variables.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Best practice requires J2EE sessions because they are more secure than regular ColdFusion sessions. (See Session Management section)&lt;br /&gt;
&lt;br /&gt;
Select checkbox next to “Enable Session Variables”&lt;br /&gt;
&lt;br /&gt;
Select checkbox next to “Enable J2EE session variables”&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Set the maximum session timeout to 20 minutes to limit the window of opportunity for session hijacking.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Set the default session timeout to 20 minutes to limit the window of opportunity for session hijacking. (The default value is 20 minutes.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The session-timeout parameter in the cf_root/WEB-INF/web.xml file establishes the maximum J2EE session timeout. This setting should always be greater-than or equal-to ColdFusion’s Maximum Session Timeout value.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Set the maximum application timeout to 24 hours.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Set the default application timeout to 8 hours.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Data Sources screen'''&lt;br /&gt;
&lt;br /&gt;
Do not use an administrative account to connect ColdFusion to a data source. For example, do not use SA account to connect to a MS SQL Server. The account accessing the database should be granted specific privileges to the objects it needs to access. In addition, the account created to connect the database should be an OS-based, not a SQL account. Operating system accounts have many more auditing, password, and other security controls associated with them.  For example, account lockouts and password complexity requirements are built into the Windows operating system; however, a database would need custom code to handle these security-related tasks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Disable the following Allowed SQL options for all data sources:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create&lt;br /&gt;
&lt;br /&gt;
Drop&lt;br /&gt;
&lt;br /&gt;
Grant&lt;br /&gt;
&lt;br /&gt;
Revoke&lt;br /&gt;
&lt;br /&gt;
Alter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''As an administrator, you do not have control over what a developer sends to the database; however, there should be no circumstance where the previous commands need to be sent to a database from a web application.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Debugging Settings screen'''&lt;br /&gt;
&lt;br /&gt;
Disable Robust Exception for production servers. (Default)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Disable Debugging for production servers. (Default)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Debugging IP Addresses'''&lt;br /&gt;
&lt;br /&gt;
Ensure only the addresses of trusted clients are in the IP list.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Only allow the localhost IP (127.0.0.1) in the list on production machines&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Mail screen'''&lt;br /&gt;
&lt;br /&gt;
Require a user name and password to authenticate to your mail server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Set the connection timeout to 60 seconds (The default value is 60 seconds.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:Activity|Secure Lifecycle]]&lt;br /&gt;
[[category:Deployment]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27756</id>
		<title>Guide to Authorization</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27756"/>
				<updated>2008-04-06T10:03:53Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* Further Reading */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]__TOC__&lt;br /&gt;
&lt;br /&gt;
Authorization ensures that the authenticated user has the appropriate privileges to access resources. The resources a user has access to depend on his/her role. &lt;br /&gt;
&lt;br /&gt;
==Objectives ==&lt;br /&gt;
&lt;br /&gt;
* To ensure only authorized users can perform allowed actions within their privilege level&lt;br /&gt;
&lt;br /&gt;
* To control access to protected resources using decisions based upon role or privilege level&lt;br /&gt;
&lt;br /&gt;
* To prevent privilege escalation attacks, for example using administration functions whilst only an anonymous user or even an authenticated user.&lt;br /&gt;
&lt;br /&gt;
==Environments Affected ==&lt;br /&gt;
&lt;br /&gt;
All applications. &lt;br /&gt;
&lt;br /&gt;
==Relevant COBIT Topics ==&lt;br /&gt;
&lt;br /&gt;
DS5 – All sections should be reviewed. This section covers nearly all COBIT detailed control objectives.&lt;br /&gt;
&lt;br /&gt;
==Best Practices ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your application allows users to be logged in for long periods of time ensure that controls are in place to revalidate a user’s authorization to a resource. For example, if Bob has the role of “Top Secret” at 1:00, and at 2:00 while he is logged in his role is reduced to Secret he should not be able to access “Top Secret” data any more. &lt;br /&gt;
&lt;br /&gt;
Architect your services (i.e., data source, web service) to query a user’s role directly from the credential store instead of trusting the user to provide accurate listing of their roles.&lt;br /&gt;
&lt;br /&gt;
==Best Practices in Action ==&lt;br /&gt;
&lt;br /&gt;
Continuing with the previous code, the following extends the code in the dbLogin method of the auth.cfc to return the user’s roles. The roles are passed to the &amp;lt;cfloginuser&amp;gt; to provide authentication to ColdFusion’s built-in login structure. The roles are also used to provide authorization to ColdFusion Components. &lt;br /&gt;
&lt;br /&gt;
Auth.cfc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cffunction name=&amp;quot;dblogin&amp;quot; access=&amp;quot;public&amp;quot; output=&amp;quot;false&amp;quot; returntype=&amp;quot;struct&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strUserName&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strPassword&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset var retargs = StructNew()&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif IsValid(&amp;quot;regex&amp;quot;, strUserName, &amp;quot;[A-Za-z0-9%]*&amp;quot;) AND IsValid(&amp;quot;regex&amp;quot;, strPassword, &amp;quot;[A-Za-z0-9%]*&amp;quot;)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;loginQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT userid, hashed_password, salt&lt;br /&gt;
&lt;br /&gt;
FROM UserTable&lt;br /&gt;
&lt;br /&gt;
WHERE UserName =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfqueryparam value=&amp;quot;#strUserName#&amp;quot; cfsqltype=&amp;quot;CF_SQL_VARCHAR&amp;quot; maxlength=&amp;quot;25&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif loginQuery.hashed_password EQ Hash(strPassword &amp;amp; loginQuery.salt, &amp;quot;SHA-256&amp;quot; )&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;YES&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset Session.UserName = strUserName&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add code to get roles from database --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;authQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT roles.role&lt;br /&gt;
&lt;br /&gt;
FROM roles INNER JOIN (users INNER JOIN userroles ON users.userid = userroles.userid) ON roles.roleid = userroles.roleid&lt;br /&gt;
&lt;br /&gt;
WHERE (((users.usersid)='&amp;lt;cfqueryparam value=“#loginQuery.userid#” cfsqltype=”CF_SQL_INTEGER”&amp;gt;'))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif authQuery.recordCount&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = valueList(authQuery.role)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = “user”&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt; ---&amp;gt;&amp;lt;cfset retargs.authenticated = true&amp;gt;&amp;lt;cfset retargs.roles = &amp;quot;Admin&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfreturn retargs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cffunction&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Principle of least privilege ==&lt;br /&gt;
&lt;br /&gt;
In security, the Principle of Least Privilege encourages system designers and implementers to allow running code only the permissions needed to complete the required tasks and no more. When designing web applications, the capabilities attached to running code should be limited in this manner. This spans the configuration of the web and application servers through the business capabilities of business logic components.&lt;br /&gt;
&lt;br /&gt;
Far too often, web and application servers run at too great a permission level. They execute using privileged accounts such as root in UNIX environment or LOCALSYSTEM in Windows environments. When web and application servers run as root or LOCALSYSTEM, the processes and the code on top of these processes run with all of the rights of these users. Malicious code will execute with the authority of the privileged account, thus increasing the possible damage from an exploit. Web and application servers should be executed under accounts with minimal permissions.&lt;br /&gt;
&lt;br /&gt;
The database accounts used by web applications often have privileges beyond those actually required or advisable. Allowing web applications to use sa or other privileged database accounts destroys the database server’s ability to defend against access to or modification of unauthorized resources. Accounts with db_owner equivalent privileges such as schema modification or unlimited data access typically have far more access to the database than is required to implement application functionality. Web applications should use one or more lesser-privileged accounts that are prevented from making schema changes or sweeping changes to or requests for data.&lt;br /&gt;
&lt;br /&gt;
The J2EE and .NET platforms provide developers the ability to limit the capabilities of code running inside of their virtual machines. Often web applications run in environments with AllPermission (Java) or FullTrust (.NET) turned on. This limits the ability of the virtual machine to control the actions of code running under its control. Implementing code access security measures is not only useful for mitigating risk when running untrusted code – it can also be used to limit the damage caused by compromises to otherwise trusted code.&lt;br /&gt;
&lt;br /&gt;
Finally, the business logic of web applications must be written with authorization controls in mind. Once a user has authenticated to the running system, their access to resources should be limited based on their identity and roles. In addition, users’ attempts to perform actions should also be authorized. Both the J2EE and ASP.NET web application platforms provide the ability to declaratively limit a user’s access to web resources by their identity and roles (as configured in web.xml and web.config respectively). The J2EE platform provides controls down to the method-level for limiting user access to the capabilities of EJB components. By designing file resource layouts and components APIs with authorization in mind, these powerful capabilities of the J2EE and .NET platforms can be used to enhance security.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Do the web and application server processes run as root, Administrator, LOCALSYSTEM or other privileged accounts?&lt;br /&gt;
&lt;br /&gt;
* Does the web application access the database via sa or other administrative account?&lt;br /&gt;
&lt;br /&gt;
* Does the web application access the database via accounts using more privileges than required?&lt;br /&gt;
&lt;br /&gt;
* In J2EE and .NET environments, do the application server virtual machines run with AllPermission or FullTrust security capabilities?&lt;br /&gt;
&lt;br /&gt;
* Are platform capabilities being used to limit access to web resources?&lt;br /&gt;
&lt;br /&gt;
* Are platform capabilities being used to limit what users can make calls to component methods?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Development, test and staging environments must be set up to function with the lowest possible privilege so that production will also work with lowest possible privileges.&lt;br /&gt;
&lt;br /&gt;
* Ensure that system level accounts (those that run the environment) have privileges limited to the greatest degree possible. Web and application servers should never execute as “Administrator”, “root”, “sa”, “sysman”, “Supervisor”, or any other privileged account.&lt;br /&gt;
&lt;br /&gt;
* User accounts should possess just enough privileges within the application to perform their assigned tasks. These user accounts should be created unprivileged and be given permissions incrementally until they have the full capabilities required. They should not be created with high privileges and then arbitrarily limited.&lt;br /&gt;
&lt;br /&gt;
* Business user accounts should not be administrator accounts and vice versa. Separate accounts should be used to perform these different sets of tasks even if the same user needs to be able to perform tasks in both realms.&lt;br /&gt;
&lt;br /&gt;
* Web application should access the database through one or more limited accounts that do not have schema-modification privileges unless required. If the web application requires the ability to modify the database schema then the design should be analyzed to determine if and why functionality must be implemented in such a potentially hazardous manner.&lt;br /&gt;
&lt;br /&gt;
* Database access should be performed through parameterized stored procedures (or similar) to allow all table access to be revoked (i.e. select, drop, update, insert, etc). This should be done using a low privilege database account. This account should not hold any SQL roles above “user” (or similar)&lt;br /&gt;
&lt;br /&gt;
* Code access security should be evaluated and implemented if possible. If a component only needs the ability to perform DNS queries, it should only be granted the code access permissions to permit this. That way if the code attempts to read from the file system or make arbitrary network connections, this will not be allowed and an error will be raised.&lt;br /&gt;
&lt;br /&gt;
==Centralized authorization routines ==&lt;br /&gt;
&lt;br /&gt;
A common mistake is to perform an authorization check by cutting and pasting an authorization code snippet into every page containing sensitive information. Worse yet would be re-writing this code for every page. Well written applications centralize access control routines, so if any bugs are found, they can be fixed once and the results apply throughout the application immediately. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application implement authorization controls by including a file or web control or code snippet on every page in the application?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Minimize the use of custom authorization code&lt;br /&gt;
&lt;br /&gt;
* Use built-in platform or framework authorization facilities.&lt;br /&gt;
&lt;br /&gt;
==Authorization matrix ==&lt;br /&gt;
&lt;br /&gt;
Access controlled applications must check that users are allowed to view a page or use an action before performing the rendering or action. If these checks are not performed then users who are able to learn or guess the URLs of sensitive resources will be able to view these resources without proper controls being applied.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does each non-anonymous entry point have an access control check?&lt;br /&gt;
&lt;br /&gt;
* Is an authorization check at or near the beginning of code implementing sensitive activities?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
Either use the built in authorization facilities of the framework, or place the call to a centralized authorization check at the beginning of sensitive resource views or actions.&lt;br /&gt;
&lt;br /&gt;
==Controlling access to protected resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications check to see if a user is able to undertake a particular action, but then do not check if access to all resources required to complete the requested action is allowed. For example, forum software may check to see if a user is allowed to reply to a previous message, but then fails to check that the requested message is not within a protected or hidden forum or thread. Another example would be an Internet Banking application that checks to see if a user is allowed to transfer money, but does not validate that the “from account” is one of the user’s accounts. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application verify all resources required to complete a user-requested action should be accessible to the user?&lt;br /&gt;
&lt;br /&gt;
* Is your application divided into distinct logical tiers? Code that uses resources directly, such as dynamic SQL queries, are often more at risk than code that uses a model-view-controller or other separation-of-responsibilities paradigm. It is easier to implement consistent authorization controls in logically tiered systems versus systems making ad hoc SQL queries and other resource requests.&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Use logical tier separation and patterns such as Model View Controller instead of directly accessing protected resources from the web tier.&lt;br /&gt;
&lt;br /&gt;
* Ensure that Model code checks to ensure that the requesting user should have access to the protected resource.&lt;br /&gt;
&lt;br /&gt;
* Ensure that the code requesting the resource has adequate error checking and does not assume that access will always be granted. Failure cases should be accounted for.&lt;br /&gt;
&lt;br /&gt;
==Protecting access to static resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications generate static content such as a PDF transaction report and allow the underlying static web server to provide access to these files. Often this means a confidential report may be available to unauthorized access if a malicious user is able to determine a valid filename for a sensitive yet static resource.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application generate or allow access to static content that also contains sensitive information?&lt;br /&gt;
&lt;br /&gt;
* Is access to the static content controlled based on the current authenticated user? &lt;br /&gt;
&lt;br /&gt;
* Could an anonymous user with knowledge of resource naming retrieve that protected content?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Ideally generate sensitive content on the fly and send directly to the browser rather than saving to the web server’s file system.&lt;br /&gt;
&lt;br /&gt;
* If protecting static sensitive content, implement authorization checks to prevent anonymous access. &lt;br /&gt;
&lt;br /&gt;
* If you have to save to disk (not recommended), use random filenames (such as a GUID) and clean up temporary files regularly.&lt;br /&gt;
&lt;br /&gt;
* Do not store sensitive static content in web-accessible directory paths. Rather, store this content in non-web accessible directories and proxy access to this content through a handler that will implement proper authorization, logging, and other security functions. On the ASP.NET platform, the HTTPResponse.WriteFile() method can be used to implement this functionality. NOTE: Whenever accessing the file system from web-facing code be sure to guard against potential injection attacks.&lt;br /&gt;
&lt;br /&gt;
==Reauthorization for high value activities or after idle out ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Time based authorization ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Be cautious of custom authorization controls ==&lt;br /&gt;
&lt;br /&gt;
Most of the major application frameworks have a well developed authorization mechanism (such as Java’s JAAS or .NET’s built in authorization capabilities configured in web.config).&lt;br /&gt;
&lt;br /&gt;
However, many applications contain their own custom authorization code. This adds complexity and potentially creates flaws where attackers are able to bypass ad hoc authorization controls. Unless there is a specific reason to override the built in functionality, web applications should leverage the framework support.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the code leverage the build in authorization capabilities of the framework? &lt;br /&gt;
&lt;br /&gt;
* Could the application be simplified by moving to the built in authentication / authorization model?&lt;br /&gt;
&lt;br /&gt;
* If custom code is used to provide authorization controls, consider positive authentication issues and exception handling. Does the system fail in a closed manner or can a user be “authorized” if an exception occurs?&lt;br /&gt;
&lt;br /&gt;
* What coverage is obtained by the use of the custom authentication controls? Are all code and resources protected by this mechanism? If the authorization capabilities are implemented as a file or web control that must be included in every page do all pages contain this control? Are there process measures in place to ensure that all new pages include this feature?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Always prefer to write less code in applications, particularly when frameworks provide presumably high quality and well-tested alternatives. &lt;br /&gt;
&lt;br /&gt;
* If custom code is required to perform authorization functions, consider fail-safe authentication and exception handling – ensure that if an exception is thrown, the user is logged out or at least prevented from accessing the protected resource or function.&lt;br /&gt;
&lt;br /&gt;
* Ensure that coverage approaches 100% by default.&lt;br /&gt;
&lt;br /&gt;
==Never implement client-side authorization tokens ==&lt;br /&gt;
&lt;br /&gt;
Many web application developers wish to avoid server-side session storage. Instead, they rely on client-side state maintenance mechanisms such as cookies, hidden form fields, or request/response headers. Often this is misguided when applied to access control and secrets because any information transmitted from the client is open to manipulation unless properly secured using cryptographic techniques. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
Does the application retrieve security-sensitive data such as user identification or user role information from client-controlled facilities such as cookies, hidden form parameters, or request headers?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
When your application is satisfied that a user is authenticated, associate the session ID with the authentication tokens, flags or state. For example, once the user is logged in, a flag with their authorization levels is set in the session object. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
Java&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	request.getSession(true).setValue(“AUTHLEVEL”) = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.NET (C#)&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	Session[“AUTHLEVEL”] = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PHP&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	$_SESSION[‘authlevel’] = X_USER; 	// X_USER is defined elsewhere as meaning, the user is authorized&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Check your application:&lt;br /&gt;
&lt;br /&gt;
* Do not trust any client-side authentication or authorization tokens in headers, cookies, hidden form fields, or in URL arguments unless they have been cryptographically secured via signing or encryption. &lt;br /&gt;
&lt;br /&gt;
* If your application uses an SSO agent, such as IBM’s Tivoli Access Manager, Netegrity’s SiteMinder, or RSA’s ClearTrust, ensure your application validates the agent tokens rather than simply accepting them, and ensure these tokens are not visible to the end user in any form (header, cookie, hidden fields, etc). If the tokens are visible to the end user, ensure that all the properties of a cryptographically secure session handler as per chapter 12 are taken into account.&lt;br /&gt;
&lt;br /&gt;
==Further Reading ==&lt;br /&gt;
&lt;br /&gt;
* ASP.Net Authorization:&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetauthorization.asp &lt;br /&gt;
&lt;br /&gt;
* J2EE Authorization: &lt;br /&gt;
&lt;br /&gt;
http://www.devarticles.com/c/a/Java/JAAS-Securing-J2EE-Applications-Securing-Web-Components/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:Access Control]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27754</id>
		<title>Guide to Authorization</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27754"/>
				<updated>2008-04-06T10:03:01Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* Never implement client-side authorization tokens */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]__TOC__&lt;br /&gt;
&lt;br /&gt;
Authorization ensures that the authenticated user has the appropriate privileges to access resources. The resources a user has access to depend on his/her role. &lt;br /&gt;
&lt;br /&gt;
==Objectives ==&lt;br /&gt;
&lt;br /&gt;
* To ensure only authorized users can perform allowed actions within their privilege level&lt;br /&gt;
&lt;br /&gt;
* To control access to protected resources using decisions based upon role or privilege level&lt;br /&gt;
&lt;br /&gt;
* To prevent privilege escalation attacks, for example using administration functions whilst only an anonymous user or even an authenticated user.&lt;br /&gt;
&lt;br /&gt;
==Environments Affected ==&lt;br /&gt;
&lt;br /&gt;
All applications. &lt;br /&gt;
&lt;br /&gt;
==Relevant COBIT Topics ==&lt;br /&gt;
&lt;br /&gt;
DS5 – All sections should be reviewed. This section covers nearly all COBIT detailed control objectives.&lt;br /&gt;
&lt;br /&gt;
==Best Practices ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your application allows users to be logged in for long periods of time ensure that controls are in place to revalidate a user’s authorization to a resource. For example, if Bob has the role of “Top Secret” at 1:00, and at 2:00 while he is logged in his role is reduced to Secret he should not be able to access “Top Secret” data any more. &lt;br /&gt;
&lt;br /&gt;
Architect your services (i.e., data source, web service) to query a user’s role directly from the credential store instead of trusting the user to provide accurate listing of their roles.&lt;br /&gt;
&lt;br /&gt;
==Best Practices in Action ==&lt;br /&gt;
&lt;br /&gt;
Continuing with the previous code, the following extends the code in the dbLogin method of the auth.cfc to return the user’s roles. The roles are passed to the &amp;lt;cfloginuser&amp;gt; to provide authentication to ColdFusion’s built-in login structure. The roles are also used to provide authorization to ColdFusion Components. &lt;br /&gt;
&lt;br /&gt;
Auth.cfc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cffunction name=&amp;quot;dblogin&amp;quot; access=&amp;quot;public&amp;quot; output=&amp;quot;false&amp;quot; returntype=&amp;quot;struct&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strUserName&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strPassword&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset var retargs = StructNew()&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif IsValid(&amp;quot;regex&amp;quot;, strUserName, &amp;quot;[A-Za-z0-9%]*&amp;quot;) AND IsValid(&amp;quot;regex&amp;quot;, strPassword, &amp;quot;[A-Za-z0-9%]*&amp;quot;)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;loginQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT userid, hashed_password, salt&lt;br /&gt;
&lt;br /&gt;
FROM UserTable&lt;br /&gt;
&lt;br /&gt;
WHERE UserName =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfqueryparam value=&amp;quot;#strUserName#&amp;quot; cfsqltype=&amp;quot;CF_SQL_VARCHAR&amp;quot; maxlength=&amp;quot;25&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif loginQuery.hashed_password EQ Hash(strPassword &amp;amp; loginQuery.salt, &amp;quot;SHA-256&amp;quot; )&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;YES&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset Session.UserName = strUserName&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add code to get roles from database --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;authQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT roles.role&lt;br /&gt;
&lt;br /&gt;
FROM roles INNER JOIN (users INNER JOIN userroles ON users.userid = userroles.userid) ON roles.roleid = userroles.roleid&lt;br /&gt;
&lt;br /&gt;
WHERE (((users.usersid)='&amp;lt;cfqueryparam value=“#loginQuery.userid#” cfsqltype=”CF_SQL_INTEGER”&amp;gt;'))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif authQuery.recordCount&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = valueList(authQuery.role)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = “user”&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt; ---&amp;gt;&amp;lt;cfset retargs.authenticated = true&amp;gt;&amp;lt;cfset retargs.roles = &amp;quot;Admin&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfreturn retargs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cffunction&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Principle of least privilege ==&lt;br /&gt;
&lt;br /&gt;
In security, the Principle of Least Privilege encourages system designers and implementers to allow running code only the permissions needed to complete the required tasks and no more. When designing web applications, the capabilities attached to running code should be limited in this manner. This spans the configuration of the web and application servers through the business capabilities of business logic components.&lt;br /&gt;
&lt;br /&gt;
Far too often, web and application servers run at too great a permission level. They execute using privileged accounts such as root in UNIX environment or LOCALSYSTEM in Windows environments. When web and application servers run as root or LOCALSYSTEM, the processes and the code on top of these processes run with all of the rights of these users. Malicious code will execute with the authority of the privileged account, thus increasing the possible damage from an exploit. Web and application servers should be executed under accounts with minimal permissions.&lt;br /&gt;
&lt;br /&gt;
The database accounts used by web applications often have privileges beyond those actually required or advisable. Allowing web applications to use sa or other privileged database accounts destroys the database server’s ability to defend against access to or modification of unauthorized resources. Accounts with db_owner equivalent privileges such as schema modification or unlimited data access typically have far more access to the database than is required to implement application functionality. Web applications should use one or more lesser-privileged accounts that are prevented from making schema changes or sweeping changes to or requests for data.&lt;br /&gt;
&lt;br /&gt;
The J2EE and .NET platforms provide developers the ability to limit the capabilities of code running inside of their virtual machines. Often web applications run in environments with AllPermission (Java) or FullTrust (.NET) turned on. This limits the ability of the virtual machine to control the actions of code running under its control. Implementing code access security measures is not only useful for mitigating risk when running untrusted code – it can also be used to limit the damage caused by compromises to otherwise trusted code.&lt;br /&gt;
&lt;br /&gt;
Finally, the business logic of web applications must be written with authorization controls in mind. Once a user has authenticated to the running system, their access to resources should be limited based on their identity and roles. In addition, users’ attempts to perform actions should also be authorized. Both the J2EE and ASP.NET web application platforms provide the ability to declaratively limit a user’s access to web resources by their identity and roles (as configured in web.xml and web.config respectively). The J2EE platform provides controls down to the method-level for limiting user access to the capabilities of EJB components. By designing file resource layouts and components APIs with authorization in mind, these powerful capabilities of the J2EE and .NET platforms can be used to enhance security.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Do the web and application server processes run as root, Administrator, LOCALSYSTEM or other privileged accounts?&lt;br /&gt;
&lt;br /&gt;
* Does the web application access the database via sa or other administrative account?&lt;br /&gt;
&lt;br /&gt;
* Does the web application access the database via accounts using more privileges than required?&lt;br /&gt;
&lt;br /&gt;
* In J2EE and .NET environments, do the application server virtual machines run with AllPermission or FullTrust security capabilities?&lt;br /&gt;
&lt;br /&gt;
* Are platform capabilities being used to limit access to web resources?&lt;br /&gt;
&lt;br /&gt;
* Are platform capabilities being used to limit what users can make calls to component methods?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Development, test and staging environments must be set up to function with the lowest possible privilege so that production will also work with lowest possible privileges.&lt;br /&gt;
&lt;br /&gt;
* Ensure that system level accounts (those that run the environment) have privileges limited to the greatest degree possible. Web and application servers should never execute as “Administrator”, “root”, “sa”, “sysman”, “Supervisor”, or any other privileged account.&lt;br /&gt;
&lt;br /&gt;
* User accounts should possess just enough privileges within the application to perform their assigned tasks. These user accounts should be created unprivileged and be given permissions incrementally until they have the full capabilities required. They should not be created with high privileges and then arbitrarily limited.&lt;br /&gt;
&lt;br /&gt;
* Business user accounts should not be administrator accounts and vice versa. Separate accounts should be used to perform these different sets of tasks even if the same user needs to be able to perform tasks in both realms.&lt;br /&gt;
&lt;br /&gt;
* Web application should access the database through one or more limited accounts that do not have schema-modification privileges unless required. If the web application requires the ability to modify the database schema then the design should be analyzed to determine if and why functionality must be implemented in such a potentially hazardous manner.&lt;br /&gt;
&lt;br /&gt;
* Database access should be performed through parameterized stored procedures (or similar) to allow all table access to be revoked (i.e. select, drop, update, insert, etc). This should be done using a low privilege database account. This account should not hold any SQL roles above “user” (or similar)&lt;br /&gt;
&lt;br /&gt;
* Code access security should be evaluated and implemented if possible. If a component only needs the ability to perform DNS queries, it should only be granted the code access permissions to permit this. That way if the code attempts to read from the file system or make arbitrary network connections, this will not be allowed and an error will be raised.&lt;br /&gt;
&lt;br /&gt;
==Centralized authorization routines ==&lt;br /&gt;
&lt;br /&gt;
A common mistake is to perform an authorization check by cutting and pasting an authorization code snippet into every page containing sensitive information. Worse yet would be re-writing this code for every page. Well written applications centralize access control routines, so if any bugs are found, they can be fixed once and the results apply throughout the application immediately. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application implement authorization controls by including a file or web control or code snippet on every page in the application?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Minimize the use of custom authorization code&lt;br /&gt;
&lt;br /&gt;
* Use built-in platform or framework authorization facilities.&lt;br /&gt;
&lt;br /&gt;
==Authorization matrix ==&lt;br /&gt;
&lt;br /&gt;
Access controlled applications must check that users are allowed to view a page or use an action before performing the rendering or action. If these checks are not performed then users who are able to learn or guess the URLs of sensitive resources will be able to view these resources without proper controls being applied.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does each non-anonymous entry point have an access control check?&lt;br /&gt;
&lt;br /&gt;
* Is an authorization check at or near the beginning of code implementing sensitive activities?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
Either use the built in authorization facilities of the framework, or place the call to a centralized authorization check at the beginning of sensitive resource views or actions.&lt;br /&gt;
&lt;br /&gt;
==Controlling access to protected resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications check to see if a user is able to undertake a particular action, but then do not check if access to all resources required to complete the requested action is allowed. For example, forum software may check to see if a user is allowed to reply to a previous message, but then fails to check that the requested message is not within a protected or hidden forum or thread. Another example would be an Internet Banking application that checks to see if a user is allowed to transfer money, but does not validate that the “from account” is one of the user’s accounts. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application verify all resources required to complete a user-requested action should be accessible to the user?&lt;br /&gt;
&lt;br /&gt;
* Is your application divided into distinct logical tiers? Code that uses resources directly, such as dynamic SQL queries, are often more at risk than code that uses a model-view-controller or other separation-of-responsibilities paradigm. It is easier to implement consistent authorization controls in logically tiered systems versus systems making ad hoc SQL queries and other resource requests.&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Use logical tier separation and patterns such as Model View Controller instead of directly accessing protected resources from the web tier.&lt;br /&gt;
&lt;br /&gt;
* Ensure that Model code checks to ensure that the requesting user should have access to the protected resource.&lt;br /&gt;
&lt;br /&gt;
* Ensure that the code requesting the resource has adequate error checking and does not assume that access will always be granted. Failure cases should be accounted for.&lt;br /&gt;
&lt;br /&gt;
==Protecting access to static resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications generate static content such as a PDF transaction report and allow the underlying static web server to provide access to these files. Often this means a confidential report may be available to unauthorized access if a malicious user is able to determine a valid filename for a sensitive yet static resource.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application generate or allow access to static content that also contains sensitive information?&lt;br /&gt;
&lt;br /&gt;
* Is access to the static content controlled based on the current authenticated user? &lt;br /&gt;
&lt;br /&gt;
* Could an anonymous user with knowledge of resource naming retrieve that protected content?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Ideally generate sensitive content on the fly and send directly to the browser rather than saving to the web server’s file system.&lt;br /&gt;
&lt;br /&gt;
* If protecting static sensitive content, implement authorization checks to prevent anonymous access. &lt;br /&gt;
&lt;br /&gt;
* If you have to save to disk (not recommended), use random filenames (such as a GUID) and clean up temporary files regularly.&lt;br /&gt;
&lt;br /&gt;
* Do not store sensitive static content in web-accessible directory paths. Rather, store this content in non-web accessible directories and proxy access to this content through a handler that will implement proper authorization, logging, and other security functions. On the ASP.NET platform, the HTTPResponse.WriteFile() method can be used to implement this functionality. NOTE: Whenever accessing the file system from web-facing code be sure to guard against potential injection attacks.&lt;br /&gt;
&lt;br /&gt;
==Reauthorization for high value activities or after idle out ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Time based authorization ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Be cautious of custom authorization controls ==&lt;br /&gt;
&lt;br /&gt;
Most of the major application frameworks have a well developed authorization mechanism (such as Java’s JAAS or .NET’s built in authorization capabilities configured in web.config).&lt;br /&gt;
&lt;br /&gt;
However, many applications contain their own custom authorization code. This adds complexity and potentially creates flaws where attackers are able to bypass ad hoc authorization controls. Unless there is a specific reason to override the built in functionality, web applications should leverage the framework support.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the code leverage the build in authorization capabilities of the framework? &lt;br /&gt;
&lt;br /&gt;
* Could the application be simplified by moving to the built in authentication / authorization model?&lt;br /&gt;
&lt;br /&gt;
* If custom code is used to provide authorization controls, consider positive authentication issues and exception handling. Does the system fail in a closed manner or can a user be “authorized” if an exception occurs?&lt;br /&gt;
&lt;br /&gt;
* What coverage is obtained by the use of the custom authentication controls? Are all code and resources protected by this mechanism? If the authorization capabilities are implemented as a file or web control that must be included in every page do all pages contain this control? Are there process measures in place to ensure that all new pages include this feature?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Always prefer to write less code in applications, particularly when frameworks provide presumably high quality and well-tested alternatives. &lt;br /&gt;
&lt;br /&gt;
* If custom code is required to perform authorization functions, consider fail-safe authentication and exception handling – ensure that if an exception is thrown, the user is logged out or at least prevented from accessing the protected resource or function.&lt;br /&gt;
&lt;br /&gt;
* Ensure that coverage approaches 100% by default.&lt;br /&gt;
&lt;br /&gt;
==Never implement client-side authorization tokens ==&lt;br /&gt;
&lt;br /&gt;
Many web application developers wish to avoid server-side session storage. Instead, they rely on client-side state maintenance mechanisms such as cookies, hidden form fields, or request/response headers. Often this is misguided when applied to access control and secrets because any information transmitted from the client is open to manipulation unless properly secured using cryptographic techniques. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
Does the application retrieve security-sensitive data such as user identification or user role information from client-controlled facilities such as cookies, hidden form parameters, or request headers?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
When your application is satisfied that a user is authenticated, associate the session ID with the authentication tokens, flags or state. For example, once the user is logged in, a flag with their authorization levels is set in the session object. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
Java&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	request.getSession(true).setValue(“AUTHLEVEL”) = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.NET (C#)&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	Session[“AUTHLEVEL”] = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PHP&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	$_SESSION[‘authlevel’] = X_USER; 	// X_USER is defined elsewhere as meaning, the user is authorized&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Check your application:&lt;br /&gt;
&lt;br /&gt;
* Do not trust any client-side authentication or authorization tokens in headers, cookies, hidden form fields, or in URL arguments unless they have been cryptographically secured via signing or encryption. &lt;br /&gt;
&lt;br /&gt;
* If your application uses an SSO agent, such as IBM’s Tivoli Access Manager, Netegrity’s SiteMinder, or RSA’s ClearTrust, ensure your application validates the agent tokens rather than simply accepting them, and ensure these tokens are not visible to the end user in any form (header, cookie, hidden fields, etc). If the tokens are visible to the end user, ensure that all the properties of a cryptographically secure session handler as per chapter 12 are taken into account.&lt;br /&gt;
&lt;br /&gt;
==Further Reading ==&lt;br /&gt;
&lt;br /&gt;
•	ASP.Net Authorization:&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetauthorization.asp &lt;br /&gt;
&lt;br /&gt;
•	J2EE Authorization: &lt;br /&gt;
&lt;br /&gt;
http://www.devarticles.com/c/a/Java/JAAS-Securing-J2EE-Applications-Securing-Web-Components/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:Access Control]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27753</id>
		<title>Guide to Authorization</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27753"/>
				<updated>2008-04-06T10:02:05Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* Be cautious of custom authorization controls */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]__TOC__&lt;br /&gt;
&lt;br /&gt;
Authorization ensures that the authenticated user has the appropriate privileges to access resources. The resources a user has access to depend on his/her role. &lt;br /&gt;
&lt;br /&gt;
==Objectives ==&lt;br /&gt;
&lt;br /&gt;
* To ensure only authorized users can perform allowed actions within their privilege level&lt;br /&gt;
&lt;br /&gt;
* To control access to protected resources using decisions based upon role or privilege level&lt;br /&gt;
&lt;br /&gt;
* To prevent privilege escalation attacks, for example using administration functions whilst only an anonymous user or even an authenticated user.&lt;br /&gt;
&lt;br /&gt;
==Environments Affected ==&lt;br /&gt;
&lt;br /&gt;
All applications. &lt;br /&gt;
&lt;br /&gt;
==Relevant COBIT Topics ==&lt;br /&gt;
&lt;br /&gt;
DS5 – All sections should be reviewed. This section covers nearly all COBIT detailed control objectives.&lt;br /&gt;
&lt;br /&gt;
==Best Practices ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your application allows users to be logged in for long periods of time ensure that controls are in place to revalidate a user’s authorization to a resource. For example, if Bob has the role of “Top Secret” at 1:00, and at 2:00 while he is logged in his role is reduced to Secret he should not be able to access “Top Secret” data any more. &lt;br /&gt;
&lt;br /&gt;
Architect your services (i.e., data source, web service) to query a user’s role directly from the credential store instead of trusting the user to provide accurate listing of their roles.&lt;br /&gt;
&lt;br /&gt;
==Best Practices in Action ==&lt;br /&gt;
&lt;br /&gt;
Continuing with the previous code, the following extends the code in the dbLogin method of the auth.cfc to return the user’s roles. The roles are passed to the &amp;lt;cfloginuser&amp;gt; to provide authentication to ColdFusion’s built-in login structure. The roles are also used to provide authorization to ColdFusion Components. &lt;br /&gt;
&lt;br /&gt;
Auth.cfc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cffunction name=&amp;quot;dblogin&amp;quot; access=&amp;quot;public&amp;quot; output=&amp;quot;false&amp;quot; returntype=&amp;quot;struct&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strUserName&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strPassword&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset var retargs = StructNew()&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif IsValid(&amp;quot;regex&amp;quot;, strUserName, &amp;quot;[A-Za-z0-9%]*&amp;quot;) AND IsValid(&amp;quot;regex&amp;quot;, strPassword, &amp;quot;[A-Za-z0-9%]*&amp;quot;)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;loginQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT userid, hashed_password, salt&lt;br /&gt;
&lt;br /&gt;
FROM UserTable&lt;br /&gt;
&lt;br /&gt;
WHERE UserName =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfqueryparam value=&amp;quot;#strUserName#&amp;quot; cfsqltype=&amp;quot;CF_SQL_VARCHAR&amp;quot; maxlength=&amp;quot;25&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif loginQuery.hashed_password EQ Hash(strPassword &amp;amp; loginQuery.salt, &amp;quot;SHA-256&amp;quot; )&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;YES&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset Session.UserName = strUserName&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add code to get roles from database --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;authQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT roles.role&lt;br /&gt;
&lt;br /&gt;
FROM roles INNER JOIN (users INNER JOIN userroles ON users.userid = userroles.userid) ON roles.roleid = userroles.roleid&lt;br /&gt;
&lt;br /&gt;
WHERE (((users.usersid)='&amp;lt;cfqueryparam value=“#loginQuery.userid#” cfsqltype=”CF_SQL_INTEGER”&amp;gt;'))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif authQuery.recordCount&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = valueList(authQuery.role)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = “user”&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt; ---&amp;gt;&amp;lt;cfset retargs.authenticated = true&amp;gt;&amp;lt;cfset retargs.roles = &amp;quot;Admin&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfreturn retargs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cffunction&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Principle of least privilege ==&lt;br /&gt;
&lt;br /&gt;
In security, the Principle of Least Privilege encourages system designers and implementers to allow running code only the permissions needed to complete the required tasks and no more. When designing web applications, the capabilities attached to running code should be limited in this manner. This spans the configuration of the web and application servers through the business capabilities of business logic components.&lt;br /&gt;
&lt;br /&gt;
Far too often, web and application servers run at too great a permission level. They execute using privileged accounts such as root in UNIX environment or LOCALSYSTEM in Windows environments. When web and application servers run as root or LOCALSYSTEM, the processes and the code on top of these processes run with all of the rights of these users. Malicious code will execute with the authority of the privileged account, thus increasing the possible damage from an exploit. Web and application servers should be executed under accounts with minimal permissions.&lt;br /&gt;
&lt;br /&gt;
The database accounts used by web applications often have privileges beyond those actually required or advisable. Allowing web applications to use sa or other privileged database accounts destroys the database server’s ability to defend against access to or modification of unauthorized resources. Accounts with db_owner equivalent privileges such as schema modification or unlimited data access typically have far more access to the database than is required to implement application functionality. Web applications should use one or more lesser-privileged accounts that are prevented from making schema changes or sweeping changes to or requests for data.&lt;br /&gt;
&lt;br /&gt;
The J2EE and .NET platforms provide developers the ability to limit the capabilities of code running inside of their virtual machines. Often web applications run in environments with AllPermission (Java) or FullTrust (.NET) turned on. This limits the ability of the virtual machine to control the actions of code running under its control. Implementing code access security measures is not only useful for mitigating risk when running untrusted code – it can also be used to limit the damage caused by compromises to otherwise trusted code.&lt;br /&gt;
&lt;br /&gt;
Finally, the business logic of web applications must be written with authorization controls in mind. Once a user has authenticated to the running system, their access to resources should be limited based on their identity and roles. In addition, users’ attempts to perform actions should also be authorized. Both the J2EE and ASP.NET web application platforms provide the ability to declaratively limit a user’s access to web resources by their identity and roles (as configured in web.xml and web.config respectively). The J2EE platform provides controls down to the method-level for limiting user access to the capabilities of EJB components. By designing file resource layouts and components APIs with authorization in mind, these powerful capabilities of the J2EE and .NET platforms can be used to enhance security.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Do the web and application server processes run as root, Administrator, LOCALSYSTEM or other privileged accounts?&lt;br /&gt;
&lt;br /&gt;
* Does the web application access the database via sa or other administrative account?&lt;br /&gt;
&lt;br /&gt;
* Does the web application access the database via accounts using more privileges than required?&lt;br /&gt;
&lt;br /&gt;
* In J2EE and .NET environments, do the application server virtual machines run with AllPermission or FullTrust security capabilities?&lt;br /&gt;
&lt;br /&gt;
* Are platform capabilities being used to limit access to web resources?&lt;br /&gt;
&lt;br /&gt;
* Are platform capabilities being used to limit what users can make calls to component methods?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Development, test and staging environments must be set up to function with the lowest possible privilege so that production will also work with lowest possible privileges.&lt;br /&gt;
&lt;br /&gt;
* Ensure that system level accounts (those that run the environment) have privileges limited to the greatest degree possible. Web and application servers should never execute as “Administrator”, “root”, “sa”, “sysman”, “Supervisor”, or any other privileged account.&lt;br /&gt;
&lt;br /&gt;
* User accounts should possess just enough privileges within the application to perform their assigned tasks. These user accounts should be created unprivileged and be given permissions incrementally until they have the full capabilities required. They should not be created with high privileges and then arbitrarily limited.&lt;br /&gt;
&lt;br /&gt;
* Business user accounts should not be administrator accounts and vice versa. Separate accounts should be used to perform these different sets of tasks even if the same user needs to be able to perform tasks in both realms.&lt;br /&gt;
&lt;br /&gt;
* Web application should access the database through one or more limited accounts that do not have schema-modification privileges unless required. If the web application requires the ability to modify the database schema then the design should be analyzed to determine if and why functionality must be implemented in such a potentially hazardous manner.&lt;br /&gt;
&lt;br /&gt;
* Database access should be performed through parameterized stored procedures (or similar) to allow all table access to be revoked (i.e. select, drop, update, insert, etc). This should be done using a low privilege database account. This account should not hold any SQL roles above “user” (or similar)&lt;br /&gt;
&lt;br /&gt;
* Code access security should be evaluated and implemented if possible. If a component only needs the ability to perform DNS queries, it should only be granted the code access permissions to permit this. That way if the code attempts to read from the file system or make arbitrary network connections, this will not be allowed and an error will be raised.&lt;br /&gt;
&lt;br /&gt;
==Centralized authorization routines ==&lt;br /&gt;
&lt;br /&gt;
A common mistake is to perform an authorization check by cutting and pasting an authorization code snippet into every page containing sensitive information. Worse yet would be re-writing this code for every page. Well written applications centralize access control routines, so if any bugs are found, they can be fixed once and the results apply throughout the application immediately. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application implement authorization controls by including a file or web control or code snippet on every page in the application?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Minimize the use of custom authorization code&lt;br /&gt;
&lt;br /&gt;
* Use built-in platform or framework authorization facilities.&lt;br /&gt;
&lt;br /&gt;
==Authorization matrix ==&lt;br /&gt;
&lt;br /&gt;
Access controlled applications must check that users are allowed to view a page or use an action before performing the rendering or action. If these checks are not performed then users who are able to learn or guess the URLs of sensitive resources will be able to view these resources without proper controls being applied.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does each non-anonymous entry point have an access control check?&lt;br /&gt;
&lt;br /&gt;
* Is an authorization check at or near the beginning of code implementing sensitive activities?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
Either use the built in authorization facilities of the framework, or place the call to a centralized authorization check at the beginning of sensitive resource views or actions.&lt;br /&gt;
&lt;br /&gt;
==Controlling access to protected resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications check to see if a user is able to undertake a particular action, but then do not check if access to all resources required to complete the requested action is allowed. For example, forum software may check to see if a user is allowed to reply to a previous message, but then fails to check that the requested message is not within a protected or hidden forum or thread. Another example would be an Internet Banking application that checks to see if a user is allowed to transfer money, but does not validate that the “from account” is one of the user’s accounts. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application verify all resources required to complete a user-requested action should be accessible to the user?&lt;br /&gt;
&lt;br /&gt;
* Is your application divided into distinct logical tiers? Code that uses resources directly, such as dynamic SQL queries, are often more at risk than code that uses a model-view-controller or other separation-of-responsibilities paradigm. It is easier to implement consistent authorization controls in logically tiered systems versus systems making ad hoc SQL queries and other resource requests.&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Use logical tier separation and patterns such as Model View Controller instead of directly accessing protected resources from the web tier.&lt;br /&gt;
&lt;br /&gt;
* Ensure that Model code checks to ensure that the requesting user should have access to the protected resource.&lt;br /&gt;
&lt;br /&gt;
* Ensure that the code requesting the resource has adequate error checking and does not assume that access will always be granted. Failure cases should be accounted for.&lt;br /&gt;
&lt;br /&gt;
==Protecting access to static resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications generate static content such as a PDF transaction report and allow the underlying static web server to provide access to these files. Often this means a confidential report may be available to unauthorized access if a malicious user is able to determine a valid filename for a sensitive yet static resource.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application generate or allow access to static content that also contains sensitive information?&lt;br /&gt;
&lt;br /&gt;
* Is access to the static content controlled based on the current authenticated user? &lt;br /&gt;
&lt;br /&gt;
* Could an anonymous user with knowledge of resource naming retrieve that protected content?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Ideally generate sensitive content on the fly and send directly to the browser rather than saving to the web server’s file system.&lt;br /&gt;
&lt;br /&gt;
* If protecting static sensitive content, implement authorization checks to prevent anonymous access. &lt;br /&gt;
&lt;br /&gt;
* If you have to save to disk (not recommended), use random filenames (such as a GUID) and clean up temporary files regularly.&lt;br /&gt;
&lt;br /&gt;
* Do not store sensitive static content in web-accessible directory paths. Rather, store this content in non-web accessible directories and proxy access to this content through a handler that will implement proper authorization, logging, and other security functions. On the ASP.NET platform, the HTTPResponse.WriteFile() method can be used to implement this functionality. NOTE: Whenever accessing the file system from web-facing code be sure to guard against potential injection attacks.&lt;br /&gt;
&lt;br /&gt;
==Reauthorization for high value activities or after idle out ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Time based authorization ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Be cautious of custom authorization controls ==&lt;br /&gt;
&lt;br /&gt;
Most of the major application frameworks have a well developed authorization mechanism (such as Java’s JAAS or .NET’s built in authorization capabilities configured in web.config).&lt;br /&gt;
&lt;br /&gt;
However, many applications contain their own custom authorization code. This adds complexity and potentially creates flaws where attackers are able to bypass ad hoc authorization controls. Unless there is a specific reason to override the built in functionality, web applications should leverage the framework support.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the code leverage the build in authorization capabilities of the framework? &lt;br /&gt;
&lt;br /&gt;
* Could the application be simplified by moving to the built in authentication / authorization model?&lt;br /&gt;
&lt;br /&gt;
* If custom code is used to provide authorization controls, consider positive authentication issues and exception handling. Does the system fail in a closed manner or can a user be “authorized” if an exception occurs?&lt;br /&gt;
&lt;br /&gt;
* What coverage is obtained by the use of the custom authentication controls? Are all code and resources protected by this mechanism? If the authorization capabilities are implemented as a file or web control that must be included in every page do all pages contain this control? Are there process measures in place to ensure that all new pages include this feature?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Always prefer to write less code in applications, particularly when frameworks provide presumably high quality and well-tested alternatives. &lt;br /&gt;
&lt;br /&gt;
* If custom code is required to perform authorization functions, consider fail-safe authentication and exception handling – ensure that if an exception is thrown, the user is logged out or at least prevented from accessing the protected resource or function.&lt;br /&gt;
&lt;br /&gt;
* Ensure that coverage approaches 100% by default.&lt;br /&gt;
&lt;br /&gt;
==Never implement client-side authorization tokens ==&lt;br /&gt;
&lt;br /&gt;
Many web application developers wish to avoid server-side session storage. Instead, they rely on client-side state maintenance mechanisms such as cookies, hidden form fields, or request/response headers. Often this is misguided when applied to access control and secrets because any information transmitted from the client is open to manipulation unless properly secured using cryptographic techniques. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application retrieve security-sensitive data such as user identification or user role information from client-controlled facilities such as cookies, hidden form parameters, or request headers?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
When your application is satisfied that a user is authenticated, associate the session ID with the authentication tokens, flags or state. For example, once the user is logged in, a flag with their authorization levels is set in the session object. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
Java&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	request.getSession(true).setValue(“AUTHLEVEL”) = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.NET (C#)&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	Session[“AUTHLEVEL”] = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PHP&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	$_SESSION[‘authlevel’] = X_USER; 	// X_USER is defined elsewhere as meaning, the user is authorized&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Check your application:&lt;br /&gt;
&lt;br /&gt;
•	Do not trust any client-side authentication or authorization tokens in headers, cookies, hidden form fields, or in URL arguments unless they have been cryptographically secured via signing or encryption. &lt;br /&gt;
&lt;br /&gt;
•	If your application uses an SSO agent, such as IBM’s Tivoli Access Manager, Netegrity’s SiteMinder, or RSA’s ClearTrust, ensure your application validates the agent tokens rather than simply accepting them, and ensure these tokens are not visible to the end user in any form (header, cookie, hidden fields, etc). If the tokens are visible to the end user, ensure that all the properties of a cryptographically secure session handler as per chapter 12 are taken into account.&lt;br /&gt;
&lt;br /&gt;
==Further Reading ==&lt;br /&gt;
&lt;br /&gt;
•	ASP.Net Authorization:&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetauthorization.asp &lt;br /&gt;
&lt;br /&gt;
•	J2EE Authorization: &lt;br /&gt;
&lt;br /&gt;
http://www.devarticles.com/c/a/Java/JAAS-Securing-J2EE-Applications-Securing-Web-Components/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:Access Control]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27752</id>
		<title>Guide to Authorization</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27752"/>
				<updated>2008-04-06T10:01:07Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* Protecting access to static resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]__TOC__&lt;br /&gt;
&lt;br /&gt;
Authorization ensures that the authenticated user has the appropriate privileges to access resources. The resources a user has access to depend on his/her role. &lt;br /&gt;
&lt;br /&gt;
==Objectives ==&lt;br /&gt;
&lt;br /&gt;
* To ensure only authorized users can perform allowed actions within their privilege level&lt;br /&gt;
&lt;br /&gt;
* To control access to protected resources using decisions based upon role or privilege level&lt;br /&gt;
&lt;br /&gt;
* To prevent privilege escalation attacks, for example using administration functions whilst only an anonymous user or even an authenticated user.&lt;br /&gt;
&lt;br /&gt;
==Environments Affected ==&lt;br /&gt;
&lt;br /&gt;
All applications. &lt;br /&gt;
&lt;br /&gt;
==Relevant COBIT Topics ==&lt;br /&gt;
&lt;br /&gt;
DS5 – All sections should be reviewed. This section covers nearly all COBIT detailed control objectives.&lt;br /&gt;
&lt;br /&gt;
==Best Practices ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your application allows users to be logged in for long periods of time ensure that controls are in place to revalidate a user’s authorization to a resource. For example, if Bob has the role of “Top Secret” at 1:00, and at 2:00 while he is logged in his role is reduced to Secret he should not be able to access “Top Secret” data any more. &lt;br /&gt;
&lt;br /&gt;
Architect your services (i.e., data source, web service) to query a user’s role directly from the credential store instead of trusting the user to provide accurate listing of their roles.&lt;br /&gt;
&lt;br /&gt;
==Best Practices in Action ==&lt;br /&gt;
&lt;br /&gt;
Continuing with the previous code, the following extends the code in the dbLogin method of the auth.cfc to return the user’s roles. The roles are passed to the &amp;lt;cfloginuser&amp;gt; to provide authentication to ColdFusion’s built-in login structure. The roles are also used to provide authorization to ColdFusion Components. &lt;br /&gt;
&lt;br /&gt;
Auth.cfc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cffunction name=&amp;quot;dblogin&amp;quot; access=&amp;quot;public&amp;quot; output=&amp;quot;false&amp;quot; returntype=&amp;quot;struct&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strUserName&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strPassword&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset var retargs = StructNew()&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif IsValid(&amp;quot;regex&amp;quot;, strUserName, &amp;quot;[A-Za-z0-9%]*&amp;quot;) AND IsValid(&amp;quot;regex&amp;quot;, strPassword, &amp;quot;[A-Za-z0-9%]*&amp;quot;)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;loginQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT userid, hashed_password, salt&lt;br /&gt;
&lt;br /&gt;
FROM UserTable&lt;br /&gt;
&lt;br /&gt;
WHERE UserName =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfqueryparam value=&amp;quot;#strUserName#&amp;quot; cfsqltype=&amp;quot;CF_SQL_VARCHAR&amp;quot; maxlength=&amp;quot;25&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif loginQuery.hashed_password EQ Hash(strPassword &amp;amp; loginQuery.salt, &amp;quot;SHA-256&amp;quot; )&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;YES&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset Session.UserName = strUserName&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add code to get roles from database --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;authQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT roles.role&lt;br /&gt;
&lt;br /&gt;
FROM roles INNER JOIN (users INNER JOIN userroles ON users.userid = userroles.userid) ON roles.roleid = userroles.roleid&lt;br /&gt;
&lt;br /&gt;
WHERE (((users.usersid)='&amp;lt;cfqueryparam value=“#loginQuery.userid#” cfsqltype=”CF_SQL_INTEGER”&amp;gt;'))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif authQuery.recordCount&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = valueList(authQuery.role)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = “user”&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt; ---&amp;gt;&amp;lt;cfset retargs.authenticated = true&amp;gt;&amp;lt;cfset retargs.roles = &amp;quot;Admin&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfreturn retargs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cffunction&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Principle of least privilege ==&lt;br /&gt;
&lt;br /&gt;
In security, the Principle of Least Privilege encourages system designers and implementers to allow running code only the permissions needed to complete the required tasks and no more. When designing web applications, the capabilities attached to running code should be limited in this manner. This spans the configuration of the web and application servers through the business capabilities of business logic components.&lt;br /&gt;
&lt;br /&gt;
Far too often, web and application servers run at too great a permission level. They execute using privileged accounts such as root in UNIX environment or LOCALSYSTEM in Windows environments. When web and application servers run as root or LOCALSYSTEM, the processes and the code on top of these processes run with all of the rights of these users. Malicious code will execute with the authority of the privileged account, thus increasing the possible damage from an exploit. Web and application servers should be executed under accounts with minimal permissions.&lt;br /&gt;
&lt;br /&gt;
The database accounts used by web applications often have privileges beyond those actually required or advisable. Allowing web applications to use sa or other privileged database accounts destroys the database server’s ability to defend against access to or modification of unauthorized resources. Accounts with db_owner equivalent privileges such as schema modification or unlimited data access typically have far more access to the database than is required to implement application functionality. Web applications should use one or more lesser-privileged accounts that are prevented from making schema changes or sweeping changes to or requests for data.&lt;br /&gt;
&lt;br /&gt;
The J2EE and .NET platforms provide developers the ability to limit the capabilities of code running inside of their virtual machines. Often web applications run in environments with AllPermission (Java) or FullTrust (.NET) turned on. This limits the ability of the virtual machine to control the actions of code running under its control. Implementing code access security measures is not only useful for mitigating risk when running untrusted code – it can also be used to limit the damage caused by compromises to otherwise trusted code.&lt;br /&gt;
&lt;br /&gt;
Finally, the business logic of web applications must be written with authorization controls in mind. Once a user has authenticated to the running system, their access to resources should be limited based on their identity and roles. In addition, users’ attempts to perform actions should also be authorized. Both the J2EE and ASP.NET web application platforms provide the ability to declaratively limit a user’s access to web resources by their identity and roles (as configured in web.xml and web.config respectively). The J2EE platform provides controls down to the method-level for limiting user access to the capabilities of EJB components. By designing file resource layouts and components APIs with authorization in mind, these powerful capabilities of the J2EE and .NET platforms can be used to enhance security.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Do the web and application server processes run as root, Administrator, LOCALSYSTEM or other privileged accounts?&lt;br /&gt;
&lt;br /&gt;
* Does the web application access the database via sa or other administrative account?&lt;br /&gt;
&lt;br /&gt;
* Does the web application access the database via accounts using more privileges than required?&lt;br /&gt;
&lt;br /&gt;
* In J2EE and .NET environments, do the application server virtual machines run with AllPermission or FullTrust security capabilities?&lt;br /&gt;
&lt;br /&gt;
* Are platform capabilities being used to limit access to web resources?&lt;br /&gt;
&lt;br /&gt;
* Are platform capabilities being used to limit what users can make calls to component methods?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Development, test and staging environments must be set up to function with the lowest possible privilege so that production will also work with lowest possible privileges.&lt;br /&gt;
&lt;br /&gt;
* Ensure that system level accounts (those that run the environment) have privileges limited to the greatest degree possible. Web and application servers should never execute as “Administrator”, “root”, “sa”, “sysman”, “Supervisor”, or any other privileged account.&lt;br /&gt;
&lt;br /&gt;
* User accounts should possess just enough privileges within the application to perform their assigned tasks. These user accounts should be created unprivileged and be given permissions incrementally until they have the full capabilities required. They should not be created with high privileges and then arbitrarily limited.&lt;br /&gt;
&lt;br /&gt;
* Business user accounts should not be administrator accounts and vice versa. Separate accounts should be used to perform these different sets of tasks even if the same user needs to be able to perform tasks in both realms.&lt;br /&gt;
&lt;br /&gt;
* Web application should access the database through one or more limited accounts that do not have schema-modification privileges unless required. If the web application requires the ability to modify the database schema then the design should be analyzed to determine if and why functionality must be implemented in such a potentially hazardous manner.&lt;br /&gt;
&lt;br /&gt;
* Database access should be performed through parameterized stored procedures (or similar) to allow all table access to be revoked (i.e. select, drop, update, insert, etc). This should be done using a low privilege database account. This account should not hold any SQL roles above “user” (or similar)&lt;br /&gt;
&lt;br /&gt;
* Code access security should be evaluated and implemented if possible. If a component only needs the ability to perform DNS queries, it should only be granted the code access permissions to permit this. That way if the code attempts to read from the file system or make arbitrary network connections, this will not be allowed and an error will be raised.&lt;br /&gt;
&lt;br /&gt;
==Centralized authorization routines ==&lt;br /&gt;
&lt;br /&gt;
A common mistake is to perform an authorization check by cutting and pasting an authorization code snippet into every page containing sensitive information. Worse yet would be re-writing this code for every page. Well written applications centralize access control routines, so if any bugs are found, they can be fixed once and the results apply throughout the application immediately. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application implement authorization controls by including a file or web control or code snippet on every page in the application?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Minimize the use of custom authorization code&lt;br /&gt;
&lt;br /&gt;
* Use built-in platform or framework authorization facilities.&lt;br /&gt;
&lt;br /&gt;
==Authorization matrix ==&lt;br /&gt;
&lt;br /&gt;
Access controlled applications must check that users are allowed to view a page or use an action before performing the rendering or action. If these checks are not performed then users who are able to learn or guess the URLs of sensitive resources will be able to view these resources without proper controls being applied.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does each non-anonymous entry point have an access control check?&lt;br /&gt;
&lt;br /&gt;
* Is an authorization check at or near the beginning of code implementing sensitive activities?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
Either use the built in authorization facilities of the framework, or place the call to a centralized authorization check at the beginning of sensitive resource views or actions.&lt;br /&gt;
&lt;br /&gt;
==Controlling access to protected resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications check to see if a user is able to undertake a particular action, but then do not check if access to all resources required to complete the requested action is allowed. For example, forum software may check to see if a user is allowed to reply to a previous message, but then fails to check that the requested message is not within a protected or hidden forum or thread. Another example would be an Internet Banking application that checks to see if a user is allowed to transfer money, but does not validate that the “from account” is one of the user’s accounts. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application verify all resources required to complete a user-requested action should be accessible to the user?&lt;br /&gt;
&lt;br /&gt;
* Is your application divided into distinct logical tiers? Code that uses resources directly, such as dynamic SQL queries, are often more at risk than code that uses a model-view-controller or other separation-of-responsibilities paradigm. It is easier to implement consistent authorization controls in logically tiered systems versus systems making ad hoc SQL queries and other resource requests.&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Use logical tier separation and patterns such as Model View Controller instead of directly accessing protected resources from the web tier.&lt;br /&gt;
&lt;br /&gt;
* Ensure that Model code checks to ensure that the requesting user should have access to the protected resource.&lt;br /&gt;
&lt;br /&gt;
* Ensure that the code requesting the resource has adequate error checking and does not assume that access will always be granted. Failure cases should be accounted for.&lt;br /&gt;
&lt;br /&gt;
==Protecting access to static resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications generate static content such as a PDF transaction report and allow the underlying static web server to provide access to these files. Often this means a confidential report may be available to unauthorized access if a malicious user is able to determine a valid filename for a sensitive yet static resource.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application generate or allow access to static content that also contains sensitive information?&lt;br /&gt;
&lt;br /&gt;
* Is access to the static content controlled based on the current authenticated user? &lt;br /&gt;
&lt;br /&gt;
* Could an anonymous user with knowledge of resource naming retrieve that protected content?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Ideally generate sensitive content on the fly and send directly to the browser rather than saving to the web server’s file system.&lt;br /&gt;
&lt;br /&gt;
* If protecting static sensitive content, implement authorization checks to prevent anonymous access. &lt;br /&gt;
&lt;br /&gt;
* If you have to save to disk (not recommended), use random filenames (such as a GUID) and clean up temporary files regularly.&lt;br /&gt;
&lt;br /&gt;
* Do not store sensitive static content in web-accessible directory paths. Rather, store this content in non-web accessible directories and proxy access to this content through a handler that will implement proper authorization, logging, and other security functions. On the ASP.NET platform, the HTTPResponse.WriteFile() method can be used to implement this functionality. NOTE: Whenever accessing the file system from web-facing code be sure to guard against potential injection attacks.&lt;br /&gt;
&lt;br /&gt;
==Reauthorization for high value activities or after idle out ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Time based authorization ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Be cautious of custom authorization controls ==&lt;br /&gt;
&lt;br /&gt;
Most of the major application frameworks have a well developed authorization mechanism (such as Java’s JAAS or .NET’s built in authorization capabilities configured in web.config).&lt;br /&gt;
&lt;br /&gt;
However, many applications contain their own custom authorization code. This adds complexity and potentially creates flaws where attackers are able to bypass ad hoc authorization controls. Unless there is a specific reason to override the built in functionality, web applications should leverage the framework support.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the code leverage the build in authorization capabilities of the framework? &lt;br /&gt;
&lt;br /&gt;
•	Could the application be simplified by moving to the built in authentication / authorization model?&lt;br /&gt;
&lt;br /&gt;
•	If custom code is used to provide authorization controls, consider positive authentication issues and exception handling. Does the system fail in a closed manner or can a user be “authorized” if an exception occurs?&lt;br /&gt;
&lt;br /&gt;
•	What coverage is obtained by the use of the custom authentication controls? Are all code and resources protected by this mechanism? If the authorization capabilities are implemented as a file or web control that must be included in every page do all pages contain this control? Are there process measures in place to ensure that all new pages include this feature?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Always prefer to write less code in applications, particularly when frameworks provide presumably high quality and well-tested alternatives. &lt;br /&gt;
&lt;br /&gt;
•	If custom code is required to perform authorization functions, consider fail-safe authentication and exception handling – ensure that if an exception is thrown, the user is logged out or at least prevented from accessing the protected resource or function.&lt;br /&gt;
&lt;br /&gt;
•	Ensure that coverage approaches 100% by default.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Never implement client-side authorization tokens ==&lt;br /&gt;
&lt;br /&gt;
Many web application developers wish to avoid server-side session storage. Instead, they rely on client-side state maintenance mechanisms such as cookies, hidden form fields, or request/response headers. Often this is misguided when applied to access control and secrets because any information transmitted from the client is open to manipulation unless properly secured using cryptographic techniques. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application retrieve security-sensitive data such as user identification or user role information from client-controlled facilities such as cookies, hidden form parameters, or request headers?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
When your application is satisfied that a user is authenticated, associate the session ID with the authentication tokens, flags or state. For example, once the user is logged in, a flag with their authorization levels is set in the session object. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
Java&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	request.getSession(true).setValue(“AUTHLEVEL”) = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.NET (C#)&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	Session[“AUTHLEVEL”] = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PHP&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	$_SESSION[‘authlevel’] = X_USER; 	// X_USER is defined elsewhere as meaning, the user is authorized&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Check your application:&lt;br /&gt;
&lt;br /&gt;
•	Do not trust any client-side authentication or authorization tokens in headers, cookies, hidden form fields, or in URL arguments unless they have been cryptographically secured via signing or encryption. &lt;br /&gt;
&lt;br /&gt;
•	If your application uses an SSO agent, such as IBM’s Tivoli Access Manager, Netegrity’s SiteMinder, or RSA’s ClearTrust, ensure your application validates the agent tokens rather than simply accepting them, and ensure these tokens are not visible to the end user in any form (header, cookie, hidden fields, etc). If the tokens are visible to the end user, ensure that all the properties of a cryptographically secure session handler as per chapter 12 are taken into account.&lt;br /&gt;
&lt;br /&gt;
==Further Reading ==&lt;br /&gt;
&lt;br /&gt;
•	ASP.Net Authorization:&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetauthorization.asp &lt;br /&gt;
&lt;br /&gt;
•	J2EE Authorization: &lt;br /&gt;
&lt;br /&gt;
http://www.devarticles.com/c/a/Java/JAAS-Securing-J2EE-Applications-Securing-Web-Components/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:Access Control]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27751</id>
		<title>Guide to Authorization</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27751"/>
				<updated>2008-04-06T10:00:10Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* Controlling access to protected resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]__TOC__&lt;br /&gt;
&lt;br /&gt;
Authorization ensures that the authenticated user has the appropriate privileges to access resources. The resources a user has access to depend on his/her role. &lt;br /&gt;
&lt;br /&gt;
==Objectives ==&lt;br /&gt;
&lt;br /&gt;
* To ensure only authorized users can perform allowed actions within their privilege level&lt;br /&gt;
&lt;br /&gt;
* To control access to protected resources using decisions based upon role or privilege level&lt;br /&gt;
&lt;br /&gt;
* To prevent privilege escalation attacks, for example using administration functions whilst only an anonymous user or even an authenticated user.&lt;br /&gt;
&lt;br /&gt;
==Environments Affected ==&lt;br /&gt;
&lt;br /&gt;
All applications. &lt;br /&gt;
&lt;br /&gt;
==Relevant COBIT Topics ==&lt;br /&gt;
&lt;br /&gt;
DS5 – All sections should be reviewed. This section covers nearly all COBIT detailed control objectives.&lt;br /&gt;
&lt;br /&gt;
==Best Practices ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your application allows users to be logged in for long periods of time ensure that controls are in place to revalidate a user’s authorization to a resource. For example, if Bob has the role of “Top Secret” at 1:00, and at 2:00 while he is logged in his role is reduced to Secret he should not be able to access “Top Secret” data any more. &lt;br /&gt;
&lt;br /&gt;
Architect your services (i.e., data source, web service) to query a user’s role directly from the credential store instead of trusting the user to provide accurate listing of their roles.&lt;br /&gt;
&lt;br /&gt;
==Best Practices in Action ==&lt;br /&gt;
&lt;br /&gt;
Continuing with the previous code, the following extends the code in the dbLogin method of the auth.cfc to return the user’s roles. The roles are passed to the &amp;lt;cfloginuser&amp;gt; to provide authentication to ColdFusion’s built-in login structure. The roles are also used to provide authorization to ColdFusion Components. &lt;br /&gt;
&lt;br /&gt;
Auth.cfc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cffunction name=&amp;quot;dblogin&amp;quot; access=&amp;quot;public&amp;quot; output=&amp;quot;false&amp;quot; returntype=&amp;quot;struct&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strUserName&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strPassword&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset var retargs = StructNew()&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif IsValid(&amp;quot;regex&amp;quot;, strUserName, &amp;quot;[A-Za-z0-9%]*&amp;quot;) AND IsValid(&amp;quot;regex&amp;quot;, strPassword, &amp;quot;[A-Za-z0-9%]*&amp;quot;)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;loginQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT userid, hashed_password, salt&lt;br /&gt;
&lt;br /&gt;
FROM UserTable&lt;br /&gt;
&lt;br /&gt;
WHERE UserName =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfqueryparam value=&amp;quot;#strUserName#&amp;quot; cfsqltype=&amp;quot;CF_SQL_VARCHAR&amp;quot; maxlength=&amp;quot;25&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif loginQuery.hashed_password EQ Hash(strPassword &amp;amp; loginQuery.salt, &amp;quot;SHA-256&amp;quot; )&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;YES&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset Session.UserName = strUserName&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add code to get roles from database --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;authQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT roles.role&lt;br /&gt;
&lt;br /&gt;
FROM roles INNER JOIN (users INNER JOIN userroles ON users.userid = userroles.userid) ON roles.roleid = userroles.roleid&lt;br /&gt;
&lt;br /&gt;
WHERE (((users.usersid)='&amp;lt;cfqueryparam value=“#loginQuery.userid#” cfsqltype=”CF_SQL_INTEGER”&amp;gt;'))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif authQuery.recordCount&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = valueList(authQuery.role)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = “user”&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt; ---&amp;gt;&amp;lt;cfset retargs.authenticated = true&amp;gt;&amp;lt;cfset retargs.roles = &amp;quot;Admin&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfreturn retargs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cffunction&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Principle of least privilege ==&lt;br /&gt;
&lt;br /&gt;
In security, the Principle of Least Privilege encourages system designers and implementers to allow running code only the permissions needed to complete the required tasks and no more. When designing web applications, the capabilities attached to running code should be limited in this manner. This spans the configuration of the web and application servers through the business capabilities of business logic components.&lt;br /&gt;
&lt;br /&gt;
Far too often, web and application servers run at too great a permission level. They execute using privileged accounts such as root in UNIX environment or LOCALSYSTEM in Windows environments. When web and application servers run as root or LOCALSYSTEM, the processes and the code on top of these processes run with all of the rights of these users. Malicious code will execute with the authority of the privileged account, thus increasing the possible damage from an exploit. Web and application servers should be executed under accounts with minimal permissions.&lt;br /&gt;
&lt;br /&gt;
The database accounts used by web applications often have privileges beyond those actually required or advisable. Allowing web applications to use sa or other privileged database accounts destroys the database server’s ability to defend against access to or modification of unauthorized resources. Accounts with db_owner equivalent privileges such as schema modification or unlimited data access typically have far more access to the database than is required to implement application functionality. Web applications should use one or more lesser-privileged accounts that are prevented from making schema changes or sweeping changes to or requests for data.&lt;br /&gt;
&lt;br /&gt;
The J2EE and .NET platforms provide developers the ability to limit the capabilities of code running inside of their virtual machines. Often web applications run in environments with AllPermission (Java) or FullTrust (.NET) turned on. This limits the ability of the virtual machine to control the actions of code running under its control. Implementing code access security measures is not only useful for mitigating risk when running untrusted code – it can also be used to limit the damage caused by compromises to otherwise trusted code.&lt;br /&gt;
&lt;br /&gt;
Finally, the business logic of web applications must be written with authorization controls in mind. Once a user has authenticated to the running system, their access to resources should be limited based on their identity and roles. In addition, users’ attempts to perform actions should also be authorized. Both the J2EE and ASP.NET web application platforms provide the ability to declaratively limit a user’s access to web resources by their identity and roles (as configured in web.xml and web.config respectively). The J2EE platform provides controls down to the method-level for limiting user access to the capabilities of EJB components. By designing file resource layouts and components APIs with authorization in mind, these powerful capabilities of the J2EE and .NET platforms can be used to enhance security.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Do the web and application server processes run as root, Administrator, LOCALSYSTEM or other privileged accounts?&lt;br /&gt;
&lt;br /&gt;
* Does the web application access the database via sa or other administrative account?&lt;br /&gt;
&lt;br /&gt;
* Does the web application access the database via accounts using more privileges than required?&lt;br /&gt;
&lt;br /&gt;
* In J2EE and .NET environments, do the application server virtual machines run with AllPermission or FullTrust security capabilities?&lt;br /&gt;
&lt;br /&gt;
* Are platform capabilities being used to limit access to web resources?&lt;br /&gt;
&lt;br /&gt;
* Are platform capabilities being used to limit what users can make calls to component methods?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Development, test and staging environments must be set up to function with the lowest possible privilege so that production will also work with lowest possible privileges.&lt;br /&gt;
&lt;br /&gt;
* Ensure that system level accounts (those that run the environment) have privileges limited to the greatest degree possible. Web and application servers should never execute as “Administrator”, “root”, “sa”, “sysman”, “Supervisor”, or any other privileged account.&lt;br /&gt;
&lt;br /&gt;
* User accounts should possess just enough privileges within the application to perform their assigned tasks. These user accounts should be created unprivileged and be given permissions incrementally until they have the full capabilities required. They should not be created with high privileges and then arbitrarily limited.&lt;br /&gt;
&lt;br /&gt;
* Business user accounts should not be administrator accounts and vice versa. Separate accounts should be used to perform these different sets of tasks even if the same user needs to be able to perform tasks in both realms.&lt;br /&gt;
&lt;br /&gt;
* Web application should access the database through one or more limited accounts that do not have schema-modification privileges unless required. If the web application requires the ability to modify the database schema then the design should be analyzed to determine if and why functionality must be implemented in such a potentially hazardous manner.&lt;br /&gt;
&lt;br /&gt;
* Database access should be performed through parameterized stored procedures (or similar) to allow all table access to be revoked (i.e. select, drop, update, insert, etc). This should be done using a low privilege database account. This account should not hold any SQL roles above “user” (or similar)&lt;br /&gt;
&lt;br /&gt;
* Code access security should be evaluated and implemented if possible. If a component only needs the ability to perform DNS queries, it should only be granted the code access permissions to permit this. That way if the code attempts to read from the file system or make arbitrary network connections, this will not be allowed and an error will be raised.&lt;br /&gt;
&lt;br /&gt;
==Centralized authorization routines ==&lt;br /&gt;
&lt;br /&gt;
A common mistake is to perform an authorization check by cutting and pasting an authorization code snippet into every page containing sensitive information. Worse yet would be re-writing this code for every page. Well written applications centralize access control routines, so if any bugs are found, they can be fixed once and the results apply throughout the application immediately. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application implement authorization controls by including a file or web control or code snippet on every page in the application?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Minimize the use of custom authorization code&lt;br /&gt;
&lt;br /&gt;
* Use built-in platform or framework authorization facilities.&lt;br /&gt;
&lt;br /&gt;
==Authorization matrix ==&lt;br /&gt;
&lt;br /&gt;
Access controlled applications must check that users are allowed to view a page or use an action before performing the rendering or action. If these checks are not performed then users who are able to learn or guess the URLs of sensitive resources will be able to view these resources without proper controls being applied.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does each non-anonymous entry point have an access control check?&lt;br /&gt;
&lt;br /&gt;
* Is an authorization check at or near the beginning of code implementing sensitive activities?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
Either use the built in authorization facilities of the framework, or place the call to a centralized authorization check at the beginning of sensitive resource views or actions.&lt;br /&gt;
&lt;br /&gt;
==Controlling access to protected resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications check to see if a user is able to undertake a particular action, but then do not check if access to all resources required to complete the requested action is allowed. For example, forum software may check to see if a user is allowed to reply to a previous message, but then fails to check that the requested message is not within a protected or hidden forum or thread. Another example would be an Internet Banking application that checks to see if a user is allowed to transfer money, but does not validate that the “from account” is one of the user’s accounts. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application verify all resources required to complete a user-requested action should be accessible to the user?&lt;br /&gt;
&lt;br /&gt;
* Is your application divided into distinct logical tiers? Code that uses resources directly, such as dynamic SQL queries, are often more at risk than code that uses a model-view-controller or other separation-of-responsibilities paradigm. It is easier to implement consistent authorization controls in logically tiered systems versus systems making ad hoc SQL queries and other resource requests.&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Use logical tier separation and patterns such as Model View Controller instead of directly accessing protected resources from the web tier.&lt;br /&gt;
&lt;br /&gt;
* Ensure that Model code checks to ensure that the requesting user should have access to the protected resource.&lt;br /&gt;
&lt;br /&gt;
* Ensure that the code requesting the resource has adequate error checking and does not assume that access will always be granted. Failure cases should be accounted for.&lt;br /&gt;
&lt;br /&gt;
==Protecting access to static resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications generate static content such as a PDF transaction report and allow the underlying static web server to provide access to these files. Often this means a confidential report may be available to unauthorized access if a malicious user is able to determine a valid filename for a sensitive yet static resource.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application generate or allow access to static content that also contains sensitive information?&lt;br /&gt;
&lt;br /&gt;
•	Is access to the static content controlled based on the current authenticated user? &lt;br /&gt;
&lt;br /&gt;
•	Could an anonymous user with knowledge of resource naming retrieve that protected content?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Ideally generate sensitive content on the fly and send directly to the browser rather than saving to the web server’s file system.&lt;br /&gt;
&lt;br /&gt;
•	If protecting static sensitive content, implement authorization checks to prevent anonymous access. &lt;br /&gt;
&lt;br /&gt;
•	If you have to save to disk (not recommended), use random filenames (such as a GUID) and clean up temporary files regularly.&lt;br /&gt;
&lt;br /&gt;
•	Do not store sensitive static content in web-accessible directory paths. Rather, store this content in non-web accessible directories and proxy access to this content through a handler that will implement proper authorization, logging, and other security functions. On the ASP.NET platform, the HTTPResponse.WriteFile() method can be used to implement this functionality. NOTE: Whenever accessing the file system from web-facing code be sure to guard against potential injection attacks.&lt;br /&gt;
&lt;br /&gt;
==Reauthorization for high value activities or after idle out ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Time based authorization ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Be cautious of custom authorization controls ==&lt;br /&gt;
&lt;br /&gt;
Most of the major application frameworks have a well developed authorization mechanism (such as Java’s JAAS or .NET’s built in authorization capabilities configured in web.config).&lt;br /&gt;
&lt;br /&gt;
However, many applications contain their own custom authorization code. This adds complexity and potentially creates flaws where attackers are able to bypass ad hoc authorization controls. Unless there is a specific reason to override the built in functionality, web applications should leverage the framework support.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the code leverage the build in authorization capabilities of the framework? &lt;br /&gt;
&lt;br /&gt;
•	Could the application be simplified by moving to the built in authentication / authorization model?&lt;br /&gt;
&lt;br /&gt;
•	If custom code is used to provide authorization controls, consider positive authentication issues and exception handling. Does the system fail in a closed manner or can a user be “authorized” if an exception occurs?&lt;br /&gt;
&lt;br /&gt;
•	What coverage is obtained by the use of the custom authentication controls? Are all code and resources protected by this mechanism? If the authorization capabilities are implemented as a file or web control that must be included in every page do all pages contain this control? Are there process measures in place to ensure that all new pages include this feature?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Always prefer to write less code in applications, particularly when frameworks provide presumably high quality and well-tested alternatives. &lt;br /&gt;
&lt;br /&gt;
•	If custom code is required to perform authorization functions, consider fail-safe authentication and exception handling – ensure that if an exception is thrown, the user is logged out or at least prevented from accessing the protected resource or function.&lt;br /&gt;
&lt;br /&gt;
•	Ensure that coverage approaches 100% by default.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Never implement client-side authorization tokens ==&lt;br /&gt;
&lt;br /&gt;
Many web application developers wish to avoid server-side session storage. Instead, they rely on client-side state maintenance mechanisms such as cookies, hidden form fields, or request/response headers. Often this is misguided when applied to access control and secrets because any information transmitted from the client is open to manipulation unless properly secured using cryptographic techniques. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application retrieve security-sensitive data such as user identification or user role information from client-controlled facilities such as cookies, hidden form parameters, or request headers?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
When your application is satisfied that a user is authenticated, associate the session ID with the authentication tokens, flags or state. For example, once the user is logged in, a flag with their authorization levels is set in the session object. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
Java&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	request.getSession(true).setValue(“AUTHLEVEL”) = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.NET (C#)&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	Session[“AUTHLEVEL”] = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PHP&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	$_SESSION[‘authlevel’] = X_USER; 	// X_USER is defined elsewhere as meaning, the user is authorized&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Check your application:&lt;br /&gt;
&lt;br /&gt;
•	Do not trust any client-side authentication or authorization tokens in headers, cookies, hidden form fields, or in URL arguments unless they have been cryptographically secured via signing or encryption. &lt;br /&gt;
&lt;br /&gt;
•	If your application uses an SSO agent, such as IBM’s Tivoli Access Manager, Netegrity’s SiteMinder, or RSA’s ClearTrust, ensure your application validates the agent tokens rather than simply accepting them, and ensure these tokens are not visible to the end user in any form (header, cookie, hidden fields, etc). If the tokens are visible to the end user, ensure that all the properties of a cryptographically secure session handler as per chapter 12 are taken into account.&lt;br /&gt;
&lt;br /&gt;
==Further Reading ==&lt;br /&gt;
&lt;br /&gt;
•	ASP.Net Authorization:&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetauthorization.asp &lt;br /&gt;
&lt;br /&gt;
•	J2EE Authorization: &lt;br /&gt;
&lt;br /&gt;
http://www.devarticles.com/c/a/Java/JAAS-Securing-J2EE-Applications-Securing-Web-Components/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:Access Control]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27750</id>
		<title>Guide to Authorization</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27750"/>
				<updated>2008-04-06T09:58:21Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* Authorization matrix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]__TOC__&lt;br /&gt;
&lt;br /&gt;
Authorization ensures that the authenticated user has the appropriate privileges to access resources. The resources a user has access to depend on his/her role. &lt;br /&gt;
&lt;br /&gt;
==Objectives ==&lt;br /&gt;
&lt;br /&gt;
* To ensure only authorized users can perform allowed actions within their privilege level&lt;br /&gt;
&lt;br /&gt;
* To control access to protected resources using decisions based upon role or privilege level&lt;br /&gt;
&lt;br /&gt;
* To prevent privilege escalation attacks, for example using administration functions whilst only an anonymous user or even an authenticated user.&lt;br /&gt;
&lt;br /&gt;
==Environments Affected ==&lt;br /&gt;
&lt;br /&gt;
All applications. &lt;br /&gt;
&lt;br /&gt;
==Relevant COBIT Topics ==&lt;br /&gt;
&lt;br /&gt;
DS5 – All sections should be reviewed. This section covers nearly all COBIT detailed control objectives.&lt;br /&gt;
&lt;br /&gt;
==Best Practices ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your application allows users to be logged in for long periods of time ensure that controls are in place to revalidate a user’s authorization to a resource. For example, if Bob has the role of “Top Secret” at 1:00, and at 2:00 while he is logged in his role is reduced to Secret he should not be able to access “Top Secret” data any more. &lt;br /&gt;
&lt;br /&gt;
Architect your services (i.e., data source, web service) to query a user’s role directly from the credential store instead of trusting the user to provide accurate listing of their roles.&lt;br /&gt;
&lt;br /&gt;
==Best Practices in Action ==&lt;br /&gt;
&lt;br /&gt;
Continuing with the previous code, the following extends the code in the dbLogin method of the auth.cfc to return the user’s roles. The roles are passed to the &amp;lt;cfloginuser&amp;gt; to provide authentication to ColdFusion’s built-in login structure. The roles are also used to provide authorization to ColdFusion Components. &lt;br /&gt;
&lt;br /&gt;
Auth.cfc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cffunction name=&amp;quot;dblogin&amp;quot; access=&amp;quot;public&amp;quot; output=&amp;quot;false&amp;quot; returntype=&amp;quot;struct&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strUserName&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strPassword&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset var retargs = StructNew()&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif IsValid(&amp;quot;regex&amp;quot;, strUserName, &amp;quot;[A-Za-z0-9%]*&amp;quot;) AND IsValid(&amp;quot;regex&amp;quot;, strPassword, &amp;quot;[A-Za-z0-9%]*&amp;quot;)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;loginQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT userid, hashed_password, salt&lt;br /&gt;
&lt;br /&gt;
FROM UserTable&lt;br /&gt;
&lt;br /&gt;
WHERE UserName =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfqueryparam value=&amp;quot;#strUserName#&amp;quot; cfsqltype=&amp;quot;CF_SQL_VARCHAR&amp;quot; maxlength=&amp;quot;25&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif loginQuery.hashed_password EQ Hash(strPassword &amp;amp; loginQuery.salt, &amp;quot;SHA-256&amp;quot; )&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;YES&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset Session.UserName = strUserName&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add code to get roles from database --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;authQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT roles.role&lt;br /&gt;
&lt;br /&gt;
FROM roles INNER JOIN (users INNER JOIN userroles ON users.userid = userroles.userid) ON roles.roleid = userroles.roleid&lt;br /&gt;
&lt;br /&gt;
WHERE (((users.usersid)='&amp;lt;cfqueryparam value=“#loginQuery.userid#” cfsqltype=”CF_SQL_INTEGER”&amp;gt;'))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif authQuery.recordCount&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = valueList(authQuery.role)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = “user”&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt; ---&amp;gt;&amp;lt;cfset retargs.authenticated = true&amp;gt;&amp;lt;cfset retargs.roles = &amp;quot;Admin&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfreturn retargs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cffunction&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Principle of least privilege ==&lt;br /&gt;
&lt;br /&gt;
In security, the Principle of Least Privilege encourages system designers and implementers to allow running code only the permissions needed to complete the required tasks and no more. When designing web applications, the capabilities attached to running code should be limited in this manner. This spans the configuration of the web and application servers through the business capabilities of business logic components.&lt;br /&gt;
&lt;br /&gt;
Far too often, web and application servers run at too great a permission level. They execute using privileged accounts such as root in UNIX environment or LOCALSYSTEM in Windows environments. When web and application servers run as root or LOCALSYSTEM, the processes and the code on top of these processes run with all of the rights of these users. Malicious code will execute with the authority of the privileged account, thus increasing the possible damage from an exploit. Web and application servers should be executed under accounts with minimal permissions.&lt;br /&gt;
&lt;br /&gt;
The database accounts used by web applications often have privileges beyond those actually required or advisable. Allowing web applications to use sa or other privileged database accounts destroys the database server’s ability to defend against access to or modification of unauthorized resources. Accounts with db_owner equivalent privileges such as schema modification or unlimited data access typically have far more access to the database than is required to implement application functionality. Web applications should use one or more lesser-privileged accounts that are prevented from making schema changes or sweeping changes to or requests for data.&lt;br /&gt;
&lt;br /&gt;
The J2EE and .NET platforms provide developers the ability to limit the capabilities of code running inside of their virtual machines. Often web applications run in environments with AllPermission (Java) or FullTrust (.NET) turned on. This limits the ability of the virtual machine to control the actions of code running under its control. Implementing code access security measures is not only useful for mitigating risk when running untrusted code – it can also be used to limit the damage caused by compromises to otherwise trusted code.&lt;br /&gt;
&lt;br /&gt;
Finally, the business logic of web applications must be written with authorization controls in mind. Once a user has authenticated to the running system, their access to resources should be limited based on their identity and roles. In addition, users’ attempts to perform actions should also be authorized. Both the J2EE and ASP.NET web application platforms provide the ability to declaratively limit a user’s access to web resources by their identity and roles (as configured in web.xml and web.config respectively). The J2EE platform provides controls down to the method-level for limiting user access to the capabilities of EJB components. By designing file resource layouts and components APIs with authorization in mind, these powerful capabilities of the J2EE and .NET platforms can be used to enhance security.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Do the web and application server processes run as root, Administrator, LOCALSYSTEM or other privileged accounts?&lt;br /&gt;
&lt;br /&gt;
* Does the web application access the database via sa or other administrative account?&lt;br /&gt;
&lt;br /&gt;
* Does the web application access the database via accounts using more privileges than required?&lt;br /&gt;
&lt;br /&gt;
* In J2EE and .NET environments, do the application server virtual machines run with AllPermission or FullTrust security capabilities?&lt;br /&gt;
&lt;br /&gt;
* Are platform capabilities being used to limit access to web resources?&lt;br /&gt;
&lt;br /&gt;
* Are platform capabilities being used to limit what users can make calls to component methods?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Development, test and staging environments must be set up to function with the lowest possible privilege so that production will also work with lowest possible privileges.&lt;br /&gt;
&lt;br /&gt;
* Ensure that system level accounts (those that run the environment) have privileges limited to the greatest degree possible. Web and application servers should never execute as “Administrator”, “root”, “sa”, “sysman”, “Supervisor”, or any other privileged account.&lt;br /&gt;
&lt;br /&gt;
* User accounts should possess just enough privileges within the application to perform their assigned tasks. These user accounts should be created unprivileged and be given permissions incrementally until they have the full capabilities required. They should not be created with high privileges and then arbitrarily limited.&lt;br /&gt;
&lt;br /&gt;
* Business user accounts should not be administrator accounts and vice versa. Separate accounts should be used to perform these different sets of tasks even if the same user needs to be able to perform tasks in both realms.&lt;br /&gt;
&lt;br /&gt;
* Web application should access the database through one or more limited accounts that do not have schema-modification privileges unless required. If the web application requires the ability to modify the database schema then the design should be analyzed to determine if and why functionality must be implemented in such a potentially hazardous manner.&lt;br /&gt;
&lt;br /&gt;
* Database access should be performed through parameterized stored procedures (or similar) to allow all table access to be revoked (i.e. select, drop, update, insert, etc). This should be done using a low privilege database account. This account should not hold any SQL roles above “user” (or similar)&lt;br /&gt;
&lt;br /&gt;
* Code access security should be evaluated and implemented if possible. If a component only needs the ability to perform DNS queries, it should only be granted the code access permissions to permit this. That way if the code attempts to read from the file system or make arbitrary network connections, this will not be allowed and an error will be raised.&lt;br /&gt;
&lt;br /&gt;
==Centralized authorization routines ==&lt;br /&gt;
&lt;br /&gt;
A common mistake is to perform an authorization check by cutting and pasting an authorization code snippet into every page containing sensitive information. Worse yet would be re-writing this code for every page. Well written applications centralize access control routines, so if any bugs are found, they can be fixed once and the results apply throughout the application immediately. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application implement authorization controls by including a file or web control or code snippet on every page in the application?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Minimize the use of custom authorization code&lt;br /&gt;
&lt;br /&gt;
* Use built-in platform or framework authorization facilities.&lt;br /&gt;
&lt;br /&gt;
==Authorization matrix ==&lt;br /&gt;
&lt;br /&gt;
Access controlled applications must check that users are allowed to view a page or use an action before performing the rendering or action. If these checks are not performed then users who are able to learn or guess the URLs of sensitive resources will be able to view these resources without proper controls being applied.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does each non-anonymous entry point have an access control check?&lt;br /&gt;
&lt;br /&gt;
* Is an authorization check at or near the beginning of code implementing sensitive activities?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
Either use the built in authorization facilities of the framework, or place the call to a centralized authorization check at the beginning of sensitive resource views or actions.&lt;br /&gt;
&lt;br /&gt;
==Controlling access to protected resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications check to see if a user is able to undertake a particular action, but then do not check if access to all resources required to complete the requested action is allowed. For example, forum software may check to see if a user is allowed to reply to a previous message, but then fails to check that the requested message is not within a protected or hidden forum or thread. Another example would be an Internet Banking application that checks to see if a user is allowed to transfer money, but does not validate that the “from account” is one of the user’s accounts. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application verify all resources required to complete a user-requested action should be accessible to the user?&lt;br /&gt;
&lt;br /&gt;
•	Is your application divided into distinct logical tiers? Code that uses resources directly, such as dynamic SQL queries, are often more at risk than code that uses a model-view-controller or other separation-of-responsibilities paradigm. It is easier to implement consistent authorization controls in logically tiered systems versus systems making ad hoc SQL queries and other resource requests.&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Use logical tier separation and patterns such as Model View Controller instead of directly accessing protected resources from the web tier.&lt;br /&gt;
&lt;br /&gt;
•	Ensure that Model code checks to ensure that the requesting user should have access to the protected resource.&lt;br /&gt;
&lt;br /&gt;
•	Ensure that the code requesting the resource has adequate error checking and does not assume that access will always be granted. Failure cases should be accounted for.&lt;br /&gt;
&lt;br /&gt;
==Protecting access to static resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications generate static content such as a PDF transaction report and allow the underlying static web server to provide access to these files. Often this means a confidential report may be available to unauthorized access if a malicious user is able to determine a valid filename for a sensitive yet static resource.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application generate or allow access to static content that also contains sensitive information?&lt;br /&gt;
&lt;br /&gt;
•	Is access to the static content controlled based on the current authenticated user? &lt;br /&gt;
&lt;br /&gt;
•	Could an anonymous user with knowledge of resource naming retrieve that protected content?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Ideally generate sensitive content on the fly and send directly to the browser rather than saving to the web server’s file system.&lt;br /&gt;
&lt;br /&gt;
•	If protecting static sensitive content, implement authorization checks to prevent anonymous access. &lt;br /&gt;
&lt;br /&gt;
•	If you have to save to disk (not recommended), use random filenames (such as a GUID) and clean up temporary files regularly.&lt;br /&gt;
&lt;br /&gt;
•	Do not store sensitive static content in web-accessible directory paths. Rather, store this content in non-web accessible directories and proxy access to this content through a handler that will implement proper authorization, logging, and other security functions. On the ASP.NET platform, the HTTPResponse.WriteFile() method can be used to implement this functionality. NOTE: Whenever accessing the file system from web-facing code be sure to guard against potential injection attacks.&lt;br /&gt;
&lt;br /&gt;
==Reauthorization for high value activities or after idle out ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Time based authorization ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Be cautious of custom authorization controls ==&lt;br /&gt;
&lt;br /&gt;
Most of the major application frameworks have a well developed authorization mechanism (such as Java’s JAAS or .NET’s built in authorization capabilities configured in web.config).&lt;br /&gt;
&lt;br /&gt;
However, many applications contain their own custom authorization code. This adds complexity and potentially creates flaws where attackers are able to bypass ad hoc authorization controls. Unless there is a specific reason to override the built in functionality, web applications should leverage the framework support.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the code leverage the build in authorization capabilities of the framework? &lt;br /&gt;
&lt;br /&gt;
•	Could the application be simplified by moving to the built in authentication / authorization model?&lt;br /&gt;
&lt;br /&gt;
•	If custom code is used to provide authorization controls, consider positive authentication issues and exception handling. Does the system fail in a closed manner or can a user be “authorized” if an exception occurs?&lt;br /&gt;
&lt;br /&gt;
•	What coverage is obtained by the use of the custom authentication controls? Are all code and resources protected by this mechanism? If the authorization capabilities are implemented as a file or web control that must be included in every page do all pages contain this control? Are there process measures in place to ensure that all new pages include this feature?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Always prefer to write less code in applications, particularly when frameworks provide presumably high quality and well-tested alternatives. &lt;br /&gt;
&lt;br /&gt;
•	If custom code is required to perform authorization functions, consider fail-safe authentication and exception handling – ensure that if an exception is thrown, the user is logged out or at least prevented from accessing the protected resource or function.&lt;br /&gt;
&lt;br /&gt;
•	Ensure that coverage approaches 100% by default.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Never implement client-side authorization tokens ==&lt;br /&gt;
&lt;br /&gt;
Many web application developers wish to avoid server-side session storage. Instead, they rely on client-side state maintenance mechanisms such as cookies, hidden form fields, or request/response headers. Often this is misguided when applied to access control and secrets because any information transmitted from the client is open to manipulation unless properly secured using cryptographic techniques. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application retrieve security-sensitive data such as user identification or user role information from client-controlled facilities such as cookies, hidden form parameters, or request headers?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
When your application is satisfied that a user is authenticated, associate the session ID with the authentication tokens, flags or state. For example, once the user is logged in, a flag with their authorization levels is set in the session object. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
Java&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	request.getSession(true).setValue(“AUTHLEVEL”) = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.NET (C#)&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	Session[“AUTHLEVEL”] = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PHP&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	$_SESSION[‘authlevel’] = X_USER; 	// X_USER is defined elsewhere as meaning, the user is authorized&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Check your application:&lt;br /&gt;
&lt;br /&gt;
•	Do not trust any client-side authentication or authorization tokens in headers, cookies, hidden form fields, or in URL arguments unless they have been cryptographically secured via signing or encryption. &lt;br /&gt;
&lt;br /&gt;
•	If your application uses an SSO agent, such as IBM’s Tivoli Access Manager, Netegrity’s SiteMinder, or RSA’s ClearTrust, ensure your application validates the agent tokens rather than simply accepting them, and ensure these tokens are not visible to the end user in any form (header, cookie, hidden fields, etc). If the tokens are visible to the end user, ensure that all the properties of a cryptographically secure session handler as per chapter 12 are taken into account.&lt;br /&gt;
&lt;br /&gt;
==Further Reading ==&lt;br /&gt;
&lt;br /&gt;
•	ASP.Net Authorization:&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetauthorization.asp &lt;br /&gt;
&lt;br /&gt;
•	J2EE Authorization: &lt;br /&gt;
&lt;br /&gt;
http://www.devarticles.com/c/a/Java/JAAS-Securing-J2EE-Applications-Securing-Web-Components/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:Access Control]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27749</id>
		<title>Guide to Authorization</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27749"/>
				<updated>2008-04-06T09:55:41Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* Centralized authorization routines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]__TOC__&lt;br /&gt;
&lt;br /&gt;
Authorization ensures that the authenticated user has the appropriate privileges to access resources. The resources a user has access to depend on his/her role. &lt;br /&gt;
&lt;br /&gt;
==Objectives ==&lt;br /&gt;
&lt;br /&gt;
* To ensure only authorized users can perform allowed actions within their privilege level&lt;br /&gt;
&lt;br /&gt;
* To control access to protected resources using decisions based upon role or privilege level&lt;br /&gt;
&lt;br /&gt;
* To prevent privilege escalation attacks, for example using administration functions whilst only an anonymous user or even an authenticated user.&lt;br /&gt;
&lt;br /&gt;
==Environments Affected ==&lt;br /&gt;
&lt;br /&gt;
All applications. &lt;br /&gt;
&lt;br /&gt;
==Relevant COBIT Topics ==&lt;br /&gt;
&lt;br /&gt;
DS5 – All sections should be reviewed. This section covers nearly all COBIT detailed control objectives.&lt;br /&gt;
&lt;br /&gt;
==Best Practices ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your application allows users to be logged in for long periods of time ensure that controls are in place to revalidate a user’s authorization to a resource. For example, if Bob has the role of “Top Secret” at 1:00, and at 2:00 while he is logged in his role is reduced to Secret he should not be able to access “Top Secret” data any more. &lt;br /&gt;
&lt;br /&gt;
Architect your services (i.e., data source, web service) to query a user’s role directly from the credential store instead of trusting the user to provide accurate listing of their roles.&lt;br /&gt;
&lt;br /&gt;
==Best Practices in Action ==&lt;br /&gt;
&lt;br /&gt;
Continuing with the previous code, the following extends the code in the dbLogin method of the auth.cfc to return the user’s roles. The roles are passed to the &amp;lt;cfloginuser&amp;gt; to provide authentication to ColdFusion’s built-in login structure. The roles are also used to provide authorization to ColdFusion Components. &lt;br /&gt;
&lt;br /&gt;
Auth.cfc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cffunction name=&amp;quot;dblogin&amp;quot; access=&amp;quot;public&amp;quot; output=&amp;quot;false&amp;quot; returntype=&amp;quot;struct&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strUserName&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strPassword&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset var retargs = StructNew()&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif IsValid(&amp;quot;regex&amp;quot;, strUserName, &amp;quot;[A-Za-z0-9%]*&amp;quot;) AND IsValid(&amp;quot;regex&amp;quot;, strPassword, &amp;quot;[A-Za-z0-9%]*&amp;quot;)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;loginQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT userid, hashed_password, salt&lt;br /&gt;
&lt;br /&gt;
FROM UserTable&lt;br /&gt;
&lt;br /&gt;
WHERE UserName =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfqueryparam value=&amp;quot;#strUserName#&amp;quot; cfsqltype=&amp;quot;CF_SQL_VARCHAR&amp;quot; maxlength=&amp;quot;25&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif loginQuery.hashed_password EQ Hash(strPassword &amp;amp; loginQuery.salt, &amp;quot;SHA-256&amp;quot; )&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;YES&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset Session.UserName = strUserName&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add code to get roles from database --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;authQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT roles.role&lt;br /&gt;
&lt;br /&gt;
FROM roles INNER JOIN (users INNER JOIN userroles ON users.userid = userroles.userid) ON roles.roleid = userroles.roleid&lt;br /&gt;
&lt;br /&gt;
WHERE (((users.usersid)='&amp;lt;cfqueryparam value=“#loginQuery.userid#” cfsqltype=”CF_SQL_INTEGER”&amp;gt;'))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif authQuery.recordCount&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = valueList(authQuery.role)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = “user”&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt; ---&amp;gt;&amp;lt;cfset retargs.authenticated = true&amp;gt;&amp;lt;cfset retargs.roles = &amp;quot;Admin&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfreturn retargs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cffunction&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Principle of least privilege ==&lt;br /&gt;
&lt;br /&gt;
In security, the Principle of Least Privilege encourages system designers and implementers to allow running code only the permissions needed to complete the required tasks and no more. When designing web applications, the capabilities attached to running code should be limited in this manner. This spans the configuration of the web and application servers through the business capabilities of business logic components.&lt;br /&gt;
&lt;br /&gt;
Far too often, web and application servers run at too great a permission level. They execute using privileged accounts such as root in UNIX environment or LOCALSYSTEM in Windows environments. When web and application servers run as root or LOCALSYSTEM, the processes and the code on top of these processes run with all of the rights of these users. Malicious code will execute with the authority of the privileged account, thus increasing the possible damage from an exploit. Web and application servers should be executed under accounts with minimal permissions.&lt;br /&gt;
&lt;br /&gt;
The database accounts used by web applications often have privileges beyond those actually required or advisable. Allowing web applications to use sa or other privileged database accounts destroys the database server’s ability to defend against access to or modification of unauthorized resources. Accounts with db_owner equivalent privileges such as schema modification or unlimited data access typically have far more access to the database than is required to implement application functionality. Web applications should use one or more lesser-privileged accounts that are prevented from making schema changes or sweeping changes to or requests for data.&lt;br /&gt;
&lt;br /&gt;
The J2EE and .NET platforms provide developers the ability to limit the capabilities of code running inside of their virtual machines. Often web applications run in environments with AllPermission (Java) or FullTrust (.NET) turned on. This limits the ability of the virtual machine to control the actions of code running under its control. Implementing code access security measures is not only useful for mitigating risk when running untrusted code – it can also be used to limit the damage caused by compromises to otherwise trusted code.&lt;br /&gt;
&lt;br /&gt;
Finally, the business logic of web applications must be written with authorization controls in mind. Once a user has authenticated to the running system, their access to resources should be limited based on their identity and roles. In addition, users’ attempts to perform actions should also be authorized. Both the J2EE and ASP.NET web application platforms provide the ability to declaratively limit a user’s access to web resources by their identity and roles (as configured in web.xml and web.config respectively). The J2EE platform provides controls down to the method-level for limiting user access to the capabilities of EJB components. By designing file resource layouts and components APIs with authorization in mind, these powerful capabilities of the J2EE and .NET platforms can be used to enhance security.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Do the web and application server processes run as root, Administrator, LOCALSYSTEM or other privileged accounts?&lt;br /&gt;
&lt;br /&gt;
* Does the web application access the database via sa or other administrative account?&lt;br /&gt;
&lt;br /&gt;
* Does the web application access the database via accounts using more privileges than required?&lt;br /&gt;
&lt;br /&gt;
* In J2EE and .NET environments, do the application server virtual machines run with AllPermission or FullTrust security capabilities?&lt;br /&gt;
&lt;br /&gt;
* Are platform capabilities being used to limit access to web resources?&lt;br /&gt;
&lt;br /&gt;
* Are platform capabilities being used to limit what users can make calls to component methods?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Development, test and staging environments must be set up to function with the lowest possible privilege so that production will also work with lowest possible privileges.&lt;br /&gt;
&lt;br /&gt;
* Ensure that system level accounts (those that run the environment) have privileges limited to the greatest degree possible. Web and application servers should never execute as “Administrator”, “root”, “sa”, “sysman”, “Supervisor”, or any other privileged account.&lt;br /&gt;
&lt;br /&gt;
* User accounts should possess just enough privileges within the application to perform their assigned tasks. These user accounts should be created unprivileged and be given permissions incrementally until they have the full capabilities required. They should not be created with high privileges and then arbitrarily limited.&lt;br /&gt;
&lt;br /&gt;
* Business user accounts should not be administrator accounts and vice versa. Separate accounts should be used to perform these different sets of tasks even if the same user needs to be able to perform tasks in both realms.&lt;br /&gt;
&lt;br /&gt;
* Web application should access the database through one or more limited accounts that do not have schema-modification privileges unless required. If the web application requires the ability to modify the database schema then the design should be analyzed to determine if and why functionality must be implemented in such a potentially hazardous manner.&lt;br /&gt;
&lt;br /&gt;
* Database access should be performed through parameterized stored procedures (or similar) to allow all table access to be revoked (i.e. select, drop, update, insert, etc). This should be done using a low privilege database account. This account should not hold any SQL roles above “user” (or similar)&lt;br /&gt;
&lt;br /&gt;
* Code access security should be evaluated and implemented if possible. If a component only needs the ability to perform DNS queries, it should only be granted the code access permissions to permit this. That way if the code attempts to read from the file system or make arbitrary network connections, this will not be allowed and an error will be raised.&lt;br /&gt;
&lt;br /&gt;
==Centralized authorization routines ==&lt;br /&gt;
&lt;br /&gt;
A common mistake is to perform an authorization check by cutting and pasting an authorization code snippet into every page containing sensitive information. Worse yet would be re-writing this code for every page. Well written applications centralize access control routines, so if any bugs are found, they can be fixed once and the results apply throughout the application immediately. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Does the application implement authorization controls by including a file or web control or code snippet on every page in the application?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Minimize the use of custom authorization code&lt;br /&gt;
&lt;br /&gt;
* Use built-in platform or framework authorization facilities.&lt;br /&gt;
&lt;br /&gt;
==Authorization matrix ==&lt;br /&gt;
&lt;br /&gt;
Access controlled applications must check that users are allowed to view a page or use an action before performing the rendering or action. If these checks are not performed then users who are able to learn or guess the URLs of sensitive resources will be able to view these resources without proper controls being applied.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does each non-anonymous entry point have an access control check?&lt;br /&gt;
&lt;br /&gt;
•	Is an authorization check at or near the beginning of code implementing sensitive activities?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
Either use the built in authorization facilities of the framework, or place the call to a centralized authorization check at the beginning of sensitive resource views or actions. &lt;br /&gt;
&lt;br /&gt;
==Controlling access to protected resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications check to see if a user is able to undertake a particular action, but then do not check if access to all resources required to complete the requested action is allowed. For example, forum software may check to see if a user is allowed to reply to a previous message, but then fails to check that the requested message is not within a protected or hidden forum or thread. Another example would be an Internet Banking application that checks to see if a user is allowed to transfer money, but does not validate that the “from account” is one of the user’s accounts. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application verify all resources required to complete a user-requested action should be accessible to the user?&lt;br /&gt;
&lt;br /&gt;
•	Is your application divided into distinct logical tiers? Code that uses resources directly, such as dynamic SQL queries, are often more at risk than code that uses a model-view-controller or other separation-of-responsibilities paradigm. It is easier to implement consistent authorization controls in logically tiered systems versus systems making ad hoc SQL queries and other resource requests.&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Use logical tier separation and patterns such as Model View Controller instead of directly accessing protected resources from the web tier.&lt;br /&gt;
&lt;br /&gt;
•	Ensure that Model code checks to ensure that the requesting user should have access to the protected resource.&lt;br /&gt;
&lt;br /&gt;
•	Ensure that the code requesting the resource has adequate error checking and does not assume that access will always be granted. Failure cases should be accounted for.&lt;br /&gt;
&lt;br /&gt;
==Protecting access to static resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications generate static content such as a PDF transaction report and allow the underlying static web server to provide access to these files. Often this means a confidential report may be available to unauthorized access if a malicious user is able to determine a valid filename for a sensitive yet static resource.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application generate or allow access to static content that also contains sensitive information?&lt;br /&gt;
&lt;br /&gt;
•	Is access to the static content controlled based on the current authenticated user? &lt;br /&gt;
&lt;br /&gt;
•	Could an anonymous user with knowledge of resource naming retrieve that protected content?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Ideally generate sensitive content on the fly and send directly to the browser rather than saving to the web server’s file system.&lt;br /&gt;
&lt;br /&gt;
•	If protecting static sensitive content, implement authorization checks to prevent anonymous access. &lt;br /&gt;
&lt;br /&gt;
•	If you have to save to disk (not recommended), use random filenames (such as a GUID) and clean up temporary files regularly.&lt;br /&gt;
&lt;br /&gt;
•	Do not store sensitive static content in web-accessible directory paths. Rather, store this content in non-web accessible directories and proxy access to this content through a handler that will implement proper authorization, logging, and other security functions. On the ASP.NET platform, the HTTPResponse.WriteFile() method can be used to implement this functionality. NOTE: Whenever accessing the file system from web-facing code be sure to guard against potential injection attacks.&lt;br /&gt;
&lt;br /&gt;
==Reauthorization for high value activities or after idle out ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Time based authorization ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Be cautious of custom authorization controls ==&lt;br /&gt;
&lt;br /&gt;
Most of the major application frameworks have a well developed authorization mechanism (such as Java’s JAAS or .NET’s built in authorization capabilities configured in web.config).&lt;br /&gt;
&lt;br /&gt;
However, many applications contain their own custom authorization code. This adds complexity and potentially creates flaws where attackers are able to bypass ad hoc authorization controls. Unless there is a specific reason to override the built in functionality, web applications should leverage the framework support.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the code leverage the build in authorization capabilities of the framework? &lt;br /&gt;
&lt;br /&gt;
•	Could the application be simplified by moving to the built in authentication / authorization model?&lt;br /&gt;
&lt;br /&gt;
•	If custom code is used to provide authorization controls, consider positive authentication issues and exception handling. Does the system fail in a closed manner or can a user be “authorized” if an exception occurs?&lt;br /&gt;
&lt;br /&gt;
•	What coverage is obtained by the use of the custom authentication controls? Are all code and resources protected by this mechanism? If the authorization capabilities are implemented as a file or web control that must be included in every page do all pages contain this control? Are there process measures in place to ensure that all new pages include this feature?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Always prefer to write less code in applications, particularly when frameworks provide presumably high quality and well-tested alternatives. &lt;br /&gt;
&lt;br /&gt;
•	If custom code is required to perform authorization functions, consider fail-safe authentication and exception handling – ensure that if an exception is thrown, the user is logged out or at least prevented from accessing the protected resource or function.&lt;br /&gt;
&lt;br /&gt;
•	Ensure that coverage approaches 100% by default.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Never implement client-side authorization tokens ==&lt;br /&gt;
&lt;br /&gt;
Many web application developers wish to avoid server-side session storage. Instead, they rely on client-side state maintenance mechanisms such as cookies, hidden form fields, or request/response headers. Often this is misguided when applied to access control and secrets because any information transmitted from the client is open to manipulation unless properly secured using cryptographic techniques. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application retrieve security-sensitive data such as user identification or user role information from client-controlled facilities such as cookies, hidden form parameters, or request headers?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
When your application is satisfied that a user is authenticated, associate the session ID with the authentication tokens, flags or state. For example, once the user is logged in, a flag with their authorization levels is set in the session object. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
Java&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	request.getSession(true).setValue(“AUTHLEVEL”) = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.NET (C#)&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	Session[“AUTHLEVEL”] = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PHP&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	$_SESSION[‘authlevel’] = X_USER; 	// X_USER is defined elsewhere as meaning, the user is authorized&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Check your application:&lt;br /&gt;
&lt;br /&gt;
•	Do not trust any client-side authentication or authorization tokens in headers, cookies, hidden form fields, or in URL arguments unless they have been cryptographically secured via signing or encryption. &lt;br /&gt;
&lt;br /&gt;
•	If your application uses an SSO agent, such as IBM’s Tivoli Access Manager, Netegrity’s SiteMinder, or RSA’s ClearTrust, ensure your application validates the agent tokens rather than simply accepting them, and ensure these tokens are not visible to the end user in any form (header, cookie, hidden fields, etc). If the tokens are visible to the end user, ensure that all the properties of a cryptographically secure session handler as per chapter 12 are taken into account.&lt;br /&gt;
&lt;br /&gt;
==Further Reading ==&lt;br /&gt;
&lt;br /&gt;
•	ASP.Net Authorization:&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetauthorization.asp &lt;br /&gt;
&lt;br /&gt;
•	J2EE Authorization: &lt;br /&gt;
&lt;br /&gt;
http://www.devarticles.com/c/a/Java/JAAS-Securing-J2EE-Applications-Securing-Web-Components/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:Access Control]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27748</id>
		<title>Guide to Authorization</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27748"/>
				<updated>2008-04-06T09:54:05Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* Principle of least privilege */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]__TOC__&lt;br /&gt;
&lt;br /&gt;
Authorization ensures that the authenticated user has the appropriate privileges to access resources. The resources a user has access to depend on his/her role. &lt;br /&gt;
&lt;br /&gt;
==Objectives ==&lt;br /&gt;
&lt;br /&gt;
* To ensure only authorized users can perform allowed actions within their privilege level&lt;br /&gt;
&lt;br /&gt;
* To control access to protected resources using decisions based upon role or privilege level&lt;br /&gt;
&lt;br /&gt;
* To prevent privilege escalation attacks, for example using administration functions whilst only an anonymous user or even an authenticated user.&lt;br /&gt;
&lt;br /&gt;
==Environments Affected ==&lt;br /&gt;
&lt;br /&gt;
All applications. &lt;br /&gt;
&lt;br /&gt;
==Relevant COBIT Topics ==&lt;br /&gt;
&lt;br /&gt;
DS5 – All sections should be reviewed. This section covers nearly all COBIT detailed control objectives.&lt;br /&gt;
&lt;br /&gt;
==Best Practices ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your application allows users to be logged in for long periods of time ensure that controls are in place to revalidate a user’s authorization to a resource. For example, if Bob has the role of “Top Secret” at 1:00, and at 2:00 while he is logged in his role is reduced to Secret he should not be able to access “Top Secret” data any more. &lt;br /&gt;
&lt;br /&gt;
Architect your services (i.e., data source, web service) to query a user’s role directly from the credential store instead of trusting the user to provide accurate listing of their roles.&lt;br /&gt;
&lt;br /&gt;
==Best Practices in Action ==&lt;br /&gt;
&lt;br /&gt;
Continuing with the previous code, the following extends the code in the dbLogin method of the auth.cfc to return the user’s roles. The roles are passed to the &amp;lt;cfloginuser&amp;gt; to provide authentication to ColdFusion’s built-in login structure. The roles are also used to provide authorization to ColdFusion Components. &lt;br /&gt;
&lt;br /&gt;
Auth.cfc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cffunction name=&amp;quot;dblogin&amp;quot; access=&amp;quot;public&amp;quot; output=&amp;quot;false&amp;quot; returntype=&amp;quot;struct&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strUserName&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strPassword&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset var retargs = StructNew()&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif IsValid(&amp;quot;regex&amp;quot;, strUserName, &amp;quot;[A-Za-z0-9%]*&amp;quot;) AND IsValid(&amp;quot;regex&amp;quot;, strPassword, &amp;quot;[A-Za-z0-9%]*&amp;quot;)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;loginQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT userid, hashed_password, salt&lt;br /&gt;
&lt;br /&gt;
FROM UserTable&lt;br /&gt;
&lt;br /&gt;
WHERE UserName =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfqueryparam value=&amp;quot;#strUserName#&amp;quot; cfsqltype=&amp;quot;CF_SQL_VARCHAR&amp;quot; maxlength=&amp;quot;25&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif loginQuery.hashed_password EQ Hash(strPassword &amp;amp; loginQuery.salt, &amp;quot;SHA-256&amp;quot; )&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;YES&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset Session.UserName = strUserName&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add code to get roles from database --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;authQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT roles.role&lt;br /&gt;
&lt;br /&gt;
FROM roles INNER JOIN (users INNER JOIN userroles ON users.userid = userroles.userid) ON roles.roleid = userroles.roleid&lt;br /&gt;
&lt;br /&gt;
WHERE (((users.usersid)='&amp;lt;cfqueryparam value=“#loginQuery.userid#” cfsqltype=”CF_SQL_INTEGER”&amp;gt;'))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif authQuery.recordCount&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = valueList(authQuery.role)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = “user”&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt; ---&amp;gt;&amp;lt;cfset retargs.authenticated = true&amp;gt;&amp;lt;cfset retargs.roles = &amp;quot;Admin&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfreturn retargs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cffunction&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Principle of least privilege ==&lt;br /&gt;
&lt;br /&gt;
In security, the Principle of Least Privilege encourages system designers and implementers to allow running code only the permissions needed to complete the required tasks and no more. When designing web applications, the capabilities attached to running code should be limited in this manner. This spans the configuration of the web and application servers through the business capabilities of business logic components.&lt;br /&gt;
&lt;br /&gt;
Far too often, web and application servers run at too great a permission level. They execute using privileged accounts such as root in UNIX environment or LOCALSYSTEM in Windows environments. When web and application servers run as root or LOCALSYSTEM, the processes and the code on top of these processes run with all of the rights of these users. Malicious code will execute with the authority of the privileged account, thus increasing the possible damage from an exploit. Web and application servers should be executed under accounts with minimal permissions.&lt;br /&gt;
&lt;br /&gt;
The database accounts used by web applications often have privileges beyond those actually required or advisable. Allowing web applications to use sa or other privileged database accounts destroys the database server’s ability to defend against access to or modification of unauthorized resources. Accounts with db_owner equivalent privileges such as schema modification or unlimited data access typically have far more access to the database than is required to implement application functionality. Web applications should use one or more lesser-privileged accounts that are prevented from making schema changes or sweeping changes to or requests for data.&lt;br /&gt;
&lt;br /&gt;
The J2EE and .NET platforms provide developers the ability to limit the capabilities of code running inside of their virtual machines. Often web applications run in environments with AllPermission (Java) or FullTrust (.NET) turned on. This limits the ability of the virtual machine to control the actions of code running under its control. Implementing code access security measures is not only useful for mitigating risk when running untrusted code – it can also be used to limit the damage caused by compromises to otherwise trusted code.&lt;br /&gt;
&lt;br /&gt;
Finally, the business logic of web applications must be written with authorization controls in mind. Once a user has authenticated to the running system, their access to resources should be limited based on their identity and roles. In addition, users’ attempts to perform actions should also be authorized. Both the J2EE and ASP.NET web application platforms provide the ability to declaratively limit a user’s access to web resources by their identity and roles (as configured in web.xml and web.config respectively). The J2EE platform provides controls down to the method-level for limiting user access to the capabilities of EJB components. By designing file resource layouts and components APIs with authorization in mind, these powerful capabilities of the J2EE and .NET platforms can be used to enhance security.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
* Do the web and application server processes run as root, Administrator, LOCALSYSTEM or other privileged accounts?&lt;br /&gt;
&lt;br /&gt;
* Does the web application access the database via sa or other administrative account?&lt;br /&gt;
&lt;br /&gt;
* Does the web application access the database via accounts using more privileges than required?&lt;br /&gt;
&lt;br /&gt;
* In J2EE and .NET environments, do the application server virtual machines run with AllPermission or FullTrust security capabilities?&lt;br /&gt;
&lt;br /&gt;
* Are platform capabilities being used to limit access to web resources?&lt;br /&gt;
&lt;br /&gt;
* Are platform capabilities being used to limit what users can make calls to component methods?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Development, test and staging environments must be set up to function with the lowest possible privilege so that production will also work with lowest possible privileges.&lt;br /&gt;
&lt;br /&gt;
* Ensure that system level accounts (those that run the environment) have privileges limited to the greatest degree possible. Web and application servers should never execute as “Administrator”, “root”, “sa”, “sysman”, “Supervisor”, or any other privileged account.&lt;br /&gt;
&lt;br /&gt;
* User accounts should possess just enough privileges within the application to perform their assigned tasks. These user accounts should be created unprivileged and be given permissions incrementally until they have the full capabilities required. They should not be created with high privileges and then arbitrarily limited.&lt;br /&gt;
&lt;br /&gt;
* Business user accounts should not be administrator accounts and vice versa. Separate accounts should be used to perform these different sets of tasks even if the same user needs to be able to perform tasks in both realms.&lt;br /&gt;
&lt;br /&gt;
* Web application should access the database through one or more limited accounts that do not have schema-modification privileges unless required. If the web application requires the ability to modify the database schema then the design should be analyzed to determine if and why functionality must be implemented in such a potentially hazardous manner.&lt;br /&gt;
&lt;br /&gt;
* Database access should be performed through parameterized stored procedures (or similar) to allow all table access to be revoked (i.e. select, drop, update, insert, etc). This should be done using a low privilege database account. This account should not hold any SQL roles above “user” (or similar)&lt;br /&gt;
&lt;br /&gt;
* Code access security should be evaluated and implemented if possible. If a component only needs the ability to perform DNS queries, it should only be granted the code access permissions to permit this. That way if the code attempts to read from the file system or make arbitrary network connections, this will not be allowed and an error will be raised.&lt;br /&gt;
&lt;br /&gt;
==Centralized authorization routines ==&lt;br /&gt;
&lt;br /&gt;
A common mistake is to perform an authorization check by cutting and pasting an authorization code snippet into every page containing sensitive information. Worse yet would be re-writing this code for every page. Well written applications centralize access control routines, so if any bugs are found, they can be fixed once and the results apply throughout the application immediately. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application implement authorization controls by including a file or web control or code snippet on every page in the application?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Minimize the use of custom authorization code&lt;br /&gt;
&lt;br /&gt;
•	Use built-in platform or framework authorization facilities.&lt;br /&gt;
&lt;br /&gt;
==Authorization matrix ==&lt;br /&gt;
&lt;br /&gt;
Access controlled applications must check that users are allowed to view a page or use an action before performing the rendering or action. If these checks are not performed then users who are able to learn or guess the URLs of sensitive resources will be able to view these resources without proper controls being applied.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does each non-anonymous entry point have an access control check?&lt;br /&gt;
&lt;br /&gt;
•	Is an authorization check at or near the beginning of code implementing sensitive activities?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
Either use the built in authorization facilities of the framework, or place the call to a centralized authorization check at the beginning of sensitive resource views or actions. &lt;br /&gt;
&lt;br /&gt;
==Controlling access to protected resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications check to see if a user is able to undertake a particular action, but then do not check if access to all resources required to complete the requested action is allowed. For example, forum software may check to see if a user is allowed to reply to a previous message, but then fails to check that the requested message is not within a protected or hidden forum or thread. Another example would be an Internet Banking application that checks to see if a user is allowed to transfer money, but does not validate that the “from account” is one of the user’s accounts. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application verify all resources required to complete a user-requested action should be accessible to the user?&lt;br /&gt;
&lt;br /&gt;
•	Is your application divided into distinct logical tiers? Code that uses resources directly, such as dynamic SQL queries, are often more at risk than code that uses a model-view-controller or other separation-of-responsibilities paradigm. It is easier to implement consistent authorization controls in logically tiered systems versus systems making ad hoc SQL queries and other resource requests.&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Use logical tier separation and patterns such as Model View Controller instead of directly accessing protected resources from the web tier.&lt;br /&gt;
&lt;br /&gt;
•	Ensure that Model code checks to ensure that the requesting user should have access to the protected resource.&lt;br /&gt;
&lt;br /&gt;
•	Ensure that the code requesting the resource has adequate error checking and does not assume that access will always be granted. Failure cases should be accounted for.&lt;br /&gt;
&lt;br /&gt;
==Protecting access to static resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications generate static content such as a PDF transaction report and allow the underlying static web server to provide access to these files. Often this means a confidential report may be available to unauthorized access if a malicious user is able to determine a valid filename for a sensitive yet static resource.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application generate or allow access to static content that also contains sensitive information?&lt;br /&gt;
&lt;br /&gt;
•	Is access to the static content controlled based on the current authenticated user? &lt;br /&gt;
&lt;br /&gt;
•	Could an anonymous user with knowledge of resource naming retrieve that protected content?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Ideally generate sensitive content on the fly and send directly to the browser rather than saving to the web server’s file system.&lt;br /&gt;
&lt;br /&gt;
•	If protecting static sensitive content, implement authorization checks to prevent anonymous access. &lt;br /&gt;
&lt;br /&gt;
•	If you have to save to disk (not recommended), use random filenames (such as a GUID) and clean up temporary files regularly.&lt;br /&gt;
&lt;br /&gt;
•	Do not store sensitive static content in web-accessible directory paths. Rather, store this content in non-web accessible directories and proxy access to this content through a handler that will implement proper authorization, logging, and other security functions. On the ASP.NET platform, the HTTPResponse.WriteFile() method can be used to implement this functionality. NOTE: Whenever accessing the file system from web-facing code be sure to guard against potential injection attacks.&lt;br /&gt;
&lt;br /&gt;
==Reauthorization for high value activities or after idle out ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Time based authorization ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Be cautious of custom authorization controls ==&lt;br /&gt;
&lt;br /&gt;
Most of the major application frameworks have a well developed authorization mechanism (such as Java’s JAAS or .NET’s built in authorization capabilities configured in web.config).&lt;br /&gt;
&lt;br /&gt;
However, many applications contain their own custom authorization code. This adds complexity and potentially creates flaws where attackers are able to bypass ad hoc authorization controls. Unless there is a specific reason to override the built in functionality, web applications should leverage the framework support.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the code leverage the build in authorization capabilities of the framework? &lt;br /&gt;
&lt;br /&gt;
•	Could the application be simplified by moving to the built in authentication / authorization model?&lt;br /&gt;
&lt;br /&gt;
•	If custom code is used to provide authorization controls, consider positive authentication issues and exception handling. Does the system fail in a closed manner or can a user be “authorized” if an exception occurs?&lt;br /&gt;
&lt;br /&gt;
•	What coverage is obtained by the use of the custom authentication controls? Are all code and resources protected by this mechanism? If the authorization capabilities are implemented as a file or web control that must be included in every page do all pages contain this control? Are there process measures in place to ensure that all new pages include this feature?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Always prefer to write less code in applications, particularly when frameworks provide presumably high quality and well-tested alternatives. &lt;br /&gt;
&lt;br /&gt;
•	If custom code is required to perform authorization functions, consider fail-safe authentication and exception handling – ensure that if an exception is thrown, the user is logged out or at least prevented from accessing the protected resource or function.&lt;br /&gt;
&lt;br /&gt;
•	Ensure that coverage approaches 100% by default.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Never implement client-side authorization tokens ==&lt;br /&gt;
&lt;br /&gt;
Many web application developers wish to avoid server-side session storage. Instead, they rely on client-side state maintenance mechanisms such as cookies, hidden form fields, or request/response headers. Often this is misguided when applied to access control and secrets because any information transmitted from the client is open to manipulation unless properly secured using cryptographic techniques. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application retrieve security-sensitive data such as user identification or user role information from client-controlled facilities such as cookies, hidden form parameters, or request headers?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
When your application is satisfied that a user is authenticated, associate the session ID with the authentication tokens, flags or state. For example, once the user is logged in, a flag with their authorization levels is set in the session object. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
Java&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	request.getSession(true).setValue(“AUTHLEVEL”) = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.NET (C#)&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	Session[“AUTHLEVEL”] = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PHP&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	$_SESSION[‘authlevel’] = X_USER; 	// X_USER is defined elsewhere as meaning, the user is authorized&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Check your application:&lt;br /&gt;
&lt;br /&gt;
•	Do not trust any client-side authentication or authorization tokens in headers, cookies, hidden form fields, or in URL arguments unless they have been cryptographically secured via signing or encryption. &lt;br /&gt;
&lt;br /&gt;
•	If your application uses an SSO agent, such as IBM’s Tivoli Access Manager, Netegrity’s SiteMinder, or RSA’s ClearTrust, ensure your application validates the agent tokens rather than simply accepting them, and ensure these tokens are not visible to the end user in any form (header, cookie, hidden fields, etc). If the tokens are visible to the end user, ensure that all the properties of a cryptographically secure session handler as per chapter 12 are taken into account.&lt;br /&gt;
&lt;br /&gt;
==Further Reading ==&lt;br /&gt;
&lt;br /&gt;
•	ASP.Net Authorization:&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetauthorization.asp &lt;br /&gt;
&lt;br /&gt;
•	J2EE Authorization: &lt;br /&gt;
&lt;br /&gt;
http://www.devarticles.com/c/a/Java/JAAS-Securing-J2EE-Applications-Securing-Web-Components/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:Access Control]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27746</id>
		<title>Guide to Authorization</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Guide_to_Authorization&amp;diff=27746"/>
				<updated>2008-04-06T09:52:07Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* Objectives */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]__TOC__&lt;br /&gt;
&lt;br /&gt;
Authorization ensures that the authenticated user has the appropriate privileges to access resources. The resources a user has access to depend on his/her role. &lt;br /&gt;
&lt;br /&gt;
==Objectives ==&lt;br /&gt;
&lt;br /&gt;
* To ensure only authorized users can perform allowed actions within their privilege level&lt;br /&gt;
&lt;br /&gt;
* To control access to protected resources using decisions based upon role or privilege level&lt;br /&gt;
&lt;br /&gt;
* To prevent privilege escalation attacks, for example using administration functions whilst only an anonymous user or even an authenticated user.&lt;br /&gt;
&lt;br /&gt;
==Environments Affected ==&lt;br /&gt;
&lt;br /&gt;
All applications. &lt;br /&gt;
&lt;br /&gt;
==Relevant COBIT Topics ==&lt;br /&gt;
&lt;br /&gt;
DS5 – All sections should be reviewed. This section covers nearly all COBIT detailed control objectives.&lt;br /&gt;
&lt;br /&gt;
==Best Practices ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your application allows users to be logged in for long periods of time ensure that controls are in place to revalidate a user’s authorization to a resource. For example, if Bob has the role of “Top Secret” at 1:00, and at 2:00 while he is logged in his role is reduced to Secret he should not be able to access “Top Secret” data any more. &lt;br /&gt;
&lt;br /&gt;
Architect your services (i.e., data source, web service) to query a user’s role directly from the credential store instead of trusting the user to provide accurate listing of their roles.&lt;br /&gt;
&lt;br /&gt;
==Best Practices in Action ==&lt;br /&gt;
&lt;br /&gt;
Continuing with the previous code, the following extends the code in the dbLogin method of the auth.cfc to return the user’s roles. The roles are passed to the &amp;lt;cfloginuser&amp;gt; to provide authentication to ColdFusion’s built-in login structure. The roles are also used to provide authorization to ColdFusion Components. &lt;br /&gt;
&lt;br /&gt;
Auth.cfc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cffunction name=&amp;quot;dblogin&amp;quot; access=&amp;quot;public&amp;quot; output=&amp;quot;false&amp;quot; returntype=&amp;quot;struct&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strUserName&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfargument name=&amp;quot;strPassword&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset var retargs = StructNew()&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif IsValid(&amp;quot;regex&amp;quot;, strUserName, &amp;quot;[A-Za-z0-9%]*&amp;quot;) AND IsValid(&amp;quot;regex&amp;quot;, strPassword, &amp;quot;[A-Za-z0-9%]*&amp;quot;)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;loginQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT userid, hashed_password, salt&lt;br /&gt;
&lt;br /&gt;
FROM UserTable&lt;br /&gt;
&lt;br /&gt;
WHERE UserName =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfqueryparam value=&amp;quot;#strUserName#&amp;quot; cfsqltype=&amp;quot;CF_SQL_VARCHAR&amp;quot; maxlength=&amp;quot;25&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif loginQuery.hashed_password EQ Hash(strPassword &amp;amp; loginQuery.salt, &amp;quot;SHA-256&amp;quot; )&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;YES&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset Session.UserName = strUserName&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add code to get roles from database --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfquery name=&amp;quot;authQuery&amp;quot; dataSource=&amp;quot;#Request.DSN#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT roles.role&lt;br /&gt;
&lt;br /&gt;
FROM roles INNER JOIN (users INNER JOIN userroles ON users.userid = userroles.userid) ON roles.roleid = userroles.roleid&lt;br /&gt;
&lt;br /&gt;
WHERE (((users.usersid)='&amp;lt;cfqueryparam value=“#loginQuery.userid#” cfsqltype=”CF_SQL_INTEGER”&amp;gt;'))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfif authQuery.recordCount&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = valueList(authQuery.role)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.roles = “user”&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cfif&amp;gt; ---&amp;gt;&amp;lt;cfset retargs.authenticated = true&amp;gt;&amp;lt;cfset retargs.roles = &amp;quot;Admin&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cfreturn retargs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/cffunction&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Principle of least privilege ==&lt;br /&gt;
&lt;br /&gt;
In security, the Principle of Least Privilege encourages system designers and implementers to allow running code only the permissions needed to complete the required tasks and no more. When designing web applications, the capabilities attached to running code should be limited in this manner. This spans the configuration of the web and application servers through the business capabilities of business logic components.&lt;br /&gt;
&lt;br /&gt;
Far too often, web and application servers run at too great a permission level. They execute using privileged accounts such as root in UNIX environment or LOCALSYSTEM in Windows environments. When web and application servers run as root or LOCALSYSTEM, the processes and the code on top of these processes run with all of the rights of these users. Malicious code will execute with the authority of the privileged account, thus increasing the possible damage from an exploit. Web and application servers should be executed under accounts with minimal permissions.&lt;br /&gt;
&lt;br /&gt;
The database accounts used by web applications often have privileges beyond those actually required or advisable. Allowing web applications to use sa or other privileged database accounts destroys the database server’s ability to defend against access to or modification of unauthorized resources. Accounts with db_owner equivalent privileges such as schema modification or unlimited data access typically have far more access to the database than is required to implement application functionality. Web applications should use one or more lesser-privileged accounts that are prevented from making schema changes or sweeping changes to or requests for data.&lt;br /&gt;
&lt;br /&gt;
The J2EE and .NET platforms provide developers the ability to limit the capabilities of code running inside of their virtual machines. Often web applications run in environments with AllPermission (Java) or FullTrust (.NET) turned on. This limits the ability of the virtual machine to control the actions of code running under its control. Implementing code access security measures is not only useful for mitigating risk when running untrusted code – it can also be used to limit the damage caused by compromises to otherwise trusted code.&lt;br /&gt;
&lt;br /&gt;
Finally, the business logic of web applications must be written with authorization controls in mind. Once a user has authenticated to the running system, their access to resources should be limited based on their identity and roles. In addition, users’ attempts to perform actions should also be authorized. Both the J2EE and ASP.NET web application platforms provide the ability to declaratively limit a user’s access to web resources by their identity and roles (as configured in web.xml and web.config respectively). The J2EE platform provides controls down to the method-level for limiting user access to the capabilities of EJB components. By designing file resource layouts and components APIs with authorization in mind, these powerful capabilities of the J2EE and .NET platforms can be used to enhance security.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Do the web and application server processes run as root, Administrator, LOCALSYSTEM or other privileged accounts?&lt;br /&gt;
&lt;br /&gt;
•	Does the web application access the database via sa or other administrative account?&lt;br /&gt;
&lt;br /&gt;
•	Does the web application access the database via accounts using more privileges than required?&lt;br /&gt;
&lt;br /&gt;
•	In J2EE and .NET environments, do the application server virtual machines run with AllPermission or FullTrust security capabilities?&lt;br /&gt;
&lt;br /&gt;
•	Are platform capabilities being used to limit access to web resources?&lt;br /&gt;
&lt;br /&gt;
•	Are platform capabilities being used to limit what users can make calls to component methods?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Development, test and staging environments must be set up to function with the lowest possible privilege so that production will also work with lowest possible privileges.&lt;br /&gt;
&lt;br /&gt;
•	Ensure that system level accounts (those that run the environment) have privileges limited to the greatest degree possible. Web and application servers should never execute as “Administrator”, “root”, “sa”, “sysman”, “Supervisor”, or any other privileged account.&lt;br /&gt;
&lt;br /&gt;
•	User accounts should possess just enough privileges within the application to perform their assigned tasks. These user accounts should be created unprivileged and be given permissions incrementally until they have the full capabilities required. They should not be created with high privileges and then arbitrarily limited.&lt;br /&gt;
&lt;br /&gt;
•	Business user accounts should not be administrator accounts and vice versa. Separate accounts should be used to perform these different sets of tasks even if the same user needs to be able to perform tasks in both realms.&lt;br /&gt;
&lt;br /&gt;
•	Web application should access the database through one or more limited accounts that do not have schema-modification privileges unless required. If the web application requires the ability to modify the database schema then the design should be analyzed to determine if and why functionality must be implemented in such a potentially hazardous manner.&lt;br /&gt;
&lt;br /&gt;
•	Database access should be performed through parameterized stored procedures (or similar) to allow all table access to be revoked (i.e. select, drop, update, insert, etc). This should be done using a low privilege database account. This account should not hold any SQL roles above “user” (or similar)&lt;br /&gt;
&lt;br /&gt;
•	Code access security should be evaluated and implemented if possible. If a component only needs the ability to perform DNS queries, it should only be granted the code access permissions to permit this. That way if the code attempts to read from the file system or make arbitrary network connections, this will not be allowed and an error will be raised.&lt;br /&gt;
&lt;br /&gt;
==Centralized authorization routines ==&lt;br /&gt;
&lt;br /&gt;
A common mistake is to perform an authorization check by cutting and pasting an authorization code snippet into every page containing sensitive information. Worse yet would be re-writing this code for every page. Well written applications centralize access control routines, so if any bugs are found, they can be fixed once and the results apply throughout the application immediately. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application implement authorization controls by including a file or web control or code snippet on every page in the application?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Minimize the use of custom authorization code&lt;br /&gt;
&lt;br /&gt;
•	Use built-in platform or framework authorization facilities.&lt;br /&gt;
&lt;br /&gt;
==Authorization matrix ==&lt;br /&gt;
&lt;br /&gt;
Access controlled applications must check that users are allowed to view a page or use an action before performing the rendering or action. If these checks are not performed then users who are able to learn or guess the URLs of sensitive resources will be able to view these resources without proper controls being applied.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does each non-anonymous entry point have an access control check?&lt;br /&gt;
&lt;br /&gt;
•	Is an authorization check at or near the beginning of code implementing sensitive activities?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
Either use the built in authorization facilities of the framework, or place the call to a centralized authorization check at the beginning of sensitive resource views or actions. &lt;br /&gt;
&lt;br /&gt;
==Controlling access to protected resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications check to see if a user is able to undertake a particular action, but then do not check if access to all resources required to complete the requested action is allowed. For example, forum software may check to see if a user is allowed to reply to a previous message, but then fails to check that the requested message is not within a protected or hidden forum or thread. Another example would be an Internet Banking application that checks to see if a user is allowed to transfer money, but does not validate that the “from account” is one of the user’s accounts. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application verify all resources required to complete a user-requested action should be accessible to the user?&lt;br /&gt;
&lt;br /&gt;
•	Is your application divided into distinct logical tiers? Code that uses resources directly, such as dynamic SQL queries, are often more at risk than code that uses a model-view-controller or other separation-of-responsibilities paradigm. It is easier to implement consistent authorization controls in logically tiered systems versus systems making ad hoc SQL queries and other resource requests.&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Use logical tier separation and patterns such as Model View Controller instead of directly accessing protected resources from the web tier.&lt;br /&gt;
&lt;br /&gt;
•	Ensure that Model code checks to ensure that the requesting user should have access to the protected resource.&lt;br /&gt;
&lt;br /&gt;
•	Ensure that the code requesting the resource has adequate error checking and does not assume that access will always be granted. Failure cases should be accounted for.&lt;br /&gt;
&lt;br /&gt;
==Protecting access to static resources ==&lt;br /&gt;
&lt;br /&gt;
Some applications generate static content such as a PDF transaction report and allow the underlying static web server to provide access to these files. Often this means a confidential report may be available to unauthorized access if a malicious user is able to determine a valid filename for a sensitive yet static resource.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application generate or allow access to static content that also contains sensitive information?&lt;br /&gt;
&lt;br /&gt;
•	Is access to the static content controlled based on the current authenticated user? &lt;br /&gt;
&lt;br /&gt;
•	Could an anonymous user with knowledge of resource naming retrieve that protected content?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Ideally generate sensitive content on the fly and send directly to the browser rather than saving to the web server’s file system.&lt;br /&gt;
&lt;br /&gt;
•	If protecting static sensitive content, implement authorization checks to prevent anonymous access. &lt;br /&gt;
&lt;br /&gt;
•	If you have to save to disk (not recommended), use random filenames (such as a GUID) and clean up temporary files regularly.&lt;br /&gt;
&lt;br /&gt;
•	Do not store sensitive static content in web-accessible directory paths. Rather, store this content in non-web accessible directories and proxy access to this content through a handler that will implement proper authorization, logging, and other security functions. On the ASP.NET platform, the HTTPResponse.WriteFile() method can be used to implement this functionality. NOTE: Whenever accessing the file system from web-facing code be sure to guard against potential injection attacks.&lt;br /&gt;
&lt;br /&gt;
==Reauthorization for high value activities or after idle out ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Time based authorization ==&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
==Be cautious of custom authorization controls ==&lt;br /&gt;
&lt;br /&gt;
Most of the major application frameworks have a well developed authorization mechanism (such as Java’s JAAS or .NET’s built in authorization capabilities configured in web.config).&lt;br /&gt;
&lt;br /&gt;
However, many applications contain their own custom authorization code. This adds complexity and potentially creates flaws where attackers are able to bypass ad hoc authorization controls. Unless there is a specific reason to override the built in functionality, web applications should leverage the framework support.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the code leverage the build in authorization capabilities of the framework? &lt;br /&gt;
&lt;br /&gt;
•	Could the application be simplified by moving to the built in authentication / authorization model?&lt;br /&gt;
&lt;br /&gt;
•	If custom code is used to provide authorization controls, consider positive authentication issues and exception handling. Does the system fail in a closed manner or can a user be “authorized” if an exception occurs?&lt;br /&gt;
&lt;br /&gt;
•	What coverage is obtained by the use of the custom authentication controls? Are all code and resources protected by this mechanism? If the authorization capabilities are implemented as a file or web control that must be included in every page do all pages contain this control? Are there process measures in place to ensure that all new pages include this feature?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
•	Always prefer to write less code in applications, particularly when frameworks provide presumably high quality and well-tested alternatives. &lt;br /&gt;
&lt;br /&gt;
•	If custom code is required to perform authorization functions, consider fail-safe authentication and exception handling – ensure that if an exception is thrown, the user is logged out or at least prevented from accessing the protected resource or function.&lt;br /&gt;
&lt;br /&gt;
•	Ensure that coverage approaches 100% by default.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Never implement client-side authorization tokens ==&lt;br /&gt;
&lt;br /&gt;
Many web application developers wish to avoid server-side session storage. Instead, they rely on client-side state maintenance mechanisms such as cookies, hidden form fields, or request/response headers. Often this is misguided when applied to access control and secrets because any information transmitted from the client is open to manipulation unless properly secured using cryptographic techniques. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
•	Does the application retrieve security-sensitive data such as user identification or user role information from client-controlled facilities such as cookies, hidden form parameters, or request headers?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
When your application is satisfied that a user is authenticated, associate the session ID with the authentication tokens, flags or state. For example, once the user is logged in, a flag with their authorization levels is set in the session object. &lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
Java&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	request.getSession(true).setValue(“AUTHLEVEL”) = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
.NET (C#)&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	Session[“AUTHLEVEL”] = X_USER;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PHP&lt;br /&gt;
&lt;br /&gt;
if ( authenticated ) {&lt;br /&gt;
&lt;br /&gt;
	$_SESSION[‘authlevel’] = X_USER; 	// X_USER is defined elsewhere as meaning, the user is authorized&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Check your application:&lt;br /&gt;
&lt;br /&gt;
•	Do not trust any client-side authentication or authorization tokens in headers, cookies, hidden form fields, or in URL arguments unless they have been cryptographically secured via signing or encryption. &lt;br /&gt;
&lt;br /&gt;
•	If your application uses an SSO agent, such as IBM’s Tivoli Access Manager, Netegrity’s SiteMinder, or RSA’s ClearTrust, ensure your application validates the agent tokens rather than simply accepting them, and ensure these tokens are not visible to the end user in any form (header, cookie, hidden fields, etc). If the tokens are visible to the end user, ensure that all the properties of a cryptographically secure session handler as per chapter 12 are taken into account.&lt;br /&gt;
&lt;br /&gt;
==Further Reading ==&lt;br /&gt;
&lt;br /&gt;
•	ASP.Net Authorization:&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetauthorization.asp &lt;br /&gt;
&lt;br /&gt;
•	J2EE Authorization: &lt;br /&gt;
&lt;br /&gt;
http://www.devarticles.com/c/a/Java/JAAS-Securing-J2EE-Applications-Securing-Web-Components/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:Access Control]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Ajax_and_Other_%22Rich%22_Interface_Technologies&amp;diff=27742</id>
		<title>Ajax and Other &quot;Rich&quot; Interface Technologies</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Ajax_and_Other_%22Rich%22_Interface_Technologies&amp;diff=27742"/>
				<updated>2008-04-06T09:44:03Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
'''''Style is time’s fool. Form is time’s student – Stewart Brand '''''&lt;br /&gt;
&lt;br /&gt;
Ajax applications, often styled as “Web 2.0”, are not a form of magic security pixie dust. Instead, there are two classes of applications: secure and insecure. This is independent of the use of Ajax or similar technologies that preceded it, such as Flash, applets, or ActiveX. With some effort, Ajax applications can be secure. Unfortunately, many are not, which is the '''''raison d’être''''' of this chapter.&lt;br /&gt;
&lt;br /&gt;
The acronym AJAX stands for Asynchronous JavaScript and XML. Whilst these technologies underpinning Ajax are not new – they first appeared in 1998 with Microsoft Outlook Web Access in Exchange Server 5.5, “Web 2.0” was defined by Tim O’Reilly to mean highly peer-to-peer dynamic applications. Such applications include del.icio.us library that allows users to share their libraries’ details, or Flickr that allows users to share their photos in a highly interactive way. We define “Ajax applications” as those that use the XMLHttpRequest object to asynchronously call the server and receive replies, regardless of how they handle or display the received data, or if they are public peer-to-peer low value applications such as forum software or highly sensitive private data, such as a tax return lodgment application.&lt;br /&gt;
&lt;br /&gt;
Ajax enabled applications aim to increase the interactivity and richness of the web interface. Secure Ajax applications are achievable at minimal cost increase as long as security is considered during design and tested throughout development. &lt;br /&gt;
&lt;br /&gt;
Compliance with disability laws is mandatory for all government and most corporate organizations. Ajax framework developers who wish to be used by these types of organizations must ensure their code supports common accessibility aides. Ajax framework users should select frameworks that produce accessible output and design their applications to be accessible and test regularly. In most countries, to do otherwise is simply deliberate negligence, and is often harshly punished by the courts. &lt;br /&gt;
&lt;br /&gt;
Ajax applications face '''''exactly the same '''''security issues as all other web applications, plus they add their own particular set of risks that must be correctly managed. By their complex, bidirectional, and asynchronous nature, Ajax applications increase attack surface area. &lt;br /&gt;
&lt;br /&gt;
Use of Ajax (or any rich interface) requires careful consideration of architecture, server-side access control, state management, and strong validation to prevent attacks. Without considering these basic controls, even brochure-ware websites, such as car manufacturer websites, can be a hazard to both the user and the web site owner’s reputation and thus sales.&lt;br /&gt;
&lt;br /&gt;
At the time of writing, there is a multitude of Ajax frameworks and add-ons, and many more being written every day. Users of Ajax frameworks should ensure that their chosen framework meets the security risks of their particular application, and does not impose an unsecurable architecture upon them. &lt;br /&gt;
&lt;br /&gt;
Developers of Ajax frameworks should investigate the controls presented in this chapter, and associated controls documented throughout the rest of this book to ensure that their approach is simple, accessible, and secure.&lt;br /&gt;
&lt;br /&gt;
==Objective ==&lt;br /&gt;
&lt;br /&gt;
To ensure that AJAX (and all “rich” interactive interfaces, such as Flash and Shockwave) have adequate:&lt;br /&gt;
&lt;br /&gt;
* Secure Communications&lt;br /&gt;
&lt;br /&gt;
* Authentication and Session Management&lt;br /&gt;
&lt;br /&gt;
* Access Control &lt;br /&gt;
&lt;br /&gt;
* Input Validation&lt;br /&gt;
&lt;br /&gt;
* Error Handling and Logging&lt;br /&gt;
&lt;br /&gt;
To prevent applications from being attacked using known attack vectors, such as unauthorized access, injection attacks, and so on.&lt;br /&gt;
&lt;br /&gt;
==Platforms Affected ==&lt;br /&gt;
&lt;br /&gt;
* All Server Platforms&lt;br /&gt;
&lt;br /&gt;
* Web applications which use Ajax, ActiveX, Flash or Shockwave&lt;br /&gt;
&lt;br /&gt;
* Clients which are required to use such applications&lt;br /&gt;
&lt;br /&gt;
==Architecture ==&lt;br /&gt;
&lt;br /&gt;
Appropriate security architecture should be considered when implementing Ajax front ends. Some Ajax frameworks will proudly display that they are 100% client based, with no server side controls, such as Tibco and Atlas (an Ajax framework for .NET). &lt;br /&gt;
&lt;br /&gt;
Strong security architecture provides adequate defense in depth, and architecturally correct placement of key security controls. For more details, see the Security Architecture chapter.&lt;br /&gt;
&lt;br /&gt;
For some types of applications, such as brochure-ware and non-interactive applications, such as stock tickers, this is acceptable security architecture as the risks are low – it would be hard to obviate the security controls to lose actual money. However, as the risk of the application increases, the threats and countermeasures required also increase. &lt;br /&gt;
&lt;br /&gt;
'''Architecture by example '''&lt;br /&gt;
&lt;br /&gt;
For the purposes of this section, irs.gov.ex, a taxation department of a fictitious country, has decided to implement an Ajax enabled electronic lodgment and tracking service for all of its 100 million taxpayers. A key reason to move to the new system is to reduce the workload on existing staff for the 90+% of tax returns that could be processed automatically … as long as the taxpayers do not deliberately lie, deceive, or cheat the system. Which of course, they do regularly. &lt;br /&gt;
&lt;br /&gt;
They bought a fancy new Enterprise Service Bus (ESB), to which they hooked up their old but incredibly reliable mainframe backend, their SAP R/3 implementation that writes the checks and tax invoices, and several other key systems. &lt;br /&gt;
&lt;br /&gt;
This particular ESB, like many on the market today, has no data validation, authentication, or authorization controls of its own; it is a simple web-service integration layer. The ESB expects that the underlying systems will perform adequate validation and authorization to prevent abuse, as the software company that wrote the ESB expected that all calling systems would be trusted, internal systems. Hooking up a dynamic web site where the users are known to be relentless, eager, and motivated tax avoiders changes the risk profile of a previously internal system with trusted staff.&lt;br /&gt;
&lt;br /&gt;
The tax department does not want to change existing systems as they are in production and stable. More to the point, they cannot change their mainframe code easily - their skilled mainframe programmers either were promoted to senior management or retired 15 years ago, and it would be extremely costly to hire new mainframe developers, and impossible to change how the third party systems work, like SAP or their anti-fraud system. &lt;br /&gt;
&lt;br /&gt;
Old code, such as COBOL CICS transactions, or previously internal only systems such as SAP R/3, have a different trust model than highly dynamic Internet connected websites. It is highly likely such systems have never been tested against now common attacks, such as HTML injection (XSS), DOM injection, XML query attacks, or similar. Without any intermediate code to protect these older systems, they are at immense risk.&lt;br /&gt;
&lt;br /&gt;
The tax department selected a simple solution in the belief it will save money. In this first example, the bulk of the business logic is contained in deployed JavaScript applications. All of the business logic, validation, and state are contained in the client’s browser, and it makes direct calls to the enterprise service bus. &lt;br /&gt;
&lt;br /&gt;
However, this model is simply broken: the previously generic process orchestration service will need to become far more aware of the caller’s identity (to provide authentication and enforce authorization), maintain secure state, and provide validation services that have previously been performed on the client. &lt;br /&gt;
&lt;br /&gt;
[[Image:Insecure Security and state maintained on the client.gif]]&lt;br /&gt;
&lt;br /&gt;
This security model is akin to leaving the keys to the Reserve Bank at the train station notice board. There is no method of protecting this model without significant replication of the business logic and re-validating all the state at the enterprise service bus, or similar web service endpoints. &lt;br /&gt;
&lt;br /&gt;
Many enterprises, including irs.gov.ex, have taken to service oriented architecture (SOA), which uses web services enabling re-use of pre-existing transactions and systems, such as SAP or Siebel, or custom transactions running on mainframes. If an Ajax framework is connected to such SOA endpoints, such as an enterprise service bus, or directly to a backend data warehouse or other persistent store, there is no ability to validate the calling identity, authorize the transaction, validate the data, or any other normal security activity. So this model will not do. &lt;br /&gt;
&lt;br /&gt;
In the next model, which is how most PHP application frameworks work today, the Ajax xmlrpc endpoint is not necessarily well integrated with the main application. &lt;br /&gt;
&lt;br /&gt;
[[Image: Insecure Ajax Web Service Endpoint separate from the main application.gif]]&lt;br /&gt;
&lt;br /&gt;
In this model, if the Ajax endpoint cannot or does not access secure state, or associate the call with the active session, a hostile caller could emulate an active session and call protected resources with minimal skills or tools. This vulnerability has already been demonstrated with several popular Ajax PHP toolkits on Bugtraq, and probably applies to other less well-known toolkits for other languages and platforms.&lt;br /&gt;
&lt;br /&gt;
The best way to protect both of these models is to bring them back to the normal three-tier application model:&lt;br /&gt;
&lt;br /&gt;
[[Image: Better Shared business logic in the middle tier with different front ends.gif]]&lt;br /&gt;
&lt;br /&gt;
In this model, which is akin to how GMail works, the application is still significantly Ajax enabled, and provides a rich experience to the user. However, this code is backed by:&lt;br /&gt;
&lt;br /&gt;
* A solid session management scheme to ensure that authentication and authorization is performed in a trusted part of the architecture&lt;br /&gt;
&lt;br /&gt;
* Data validation is performed in both directions on the server-side at various layers to limit or prevent injection and other attacks&lt;br /&gt;
&lt;br /&gt;
* All calls to the backend services are performed by trusted server-side business logic&lt;br /&gt;
&lt;br /&gt;
* The layered architecture allows reasonable trust of the caller at the ESB level as the data has been significantly authorized and validated&lt;br /&gt;
&lt;br /&gt;
This means that the ESB and its published services, such as 40 year old COBOL code, do not need to be particularly aware of the implications of being made available to the Internet. This enables higher levels of re-use and reduces costs.&lt;br /&gt;
&lt;br /&gt;
Although more complex to the project implementing the Ajax enabled application, to the funding business, this architecture is the cheapest way of maintaining security whilst avoiding updating or maintaining ancient or third party code.&lt;br /&gt;
&lt;br /&gt;
Selecting the correct architecture is unfortunately not a checklist – it is a balance of risk versus cost. However, as demonstrated in this section, client-side heavy architecture models are completely untrustworthy for transactional systems and should be avoided.&lt;br /&gt;
&lt;br /&gt;
==Access control: Authentication and Authorization ==&lt;br /&gt;
&lt;br /&gt;
Ajax code uses the XMLHttpRequest object, which will send the cookies of the current browser context through with each request. For applications which have user sessions, it is vital that normal authentication paths are used to ensure that the caller is known to the application. Brochure-ware applications can skip this section as they allow anonymous calling.&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
If you have transactions or calls that are not to be used by anonymous callers, check that client-side code cannot call them without an established user context.&lt;br /&gt;
&lt;br /&gt;
To do this: &lt;br /&gt;
&lt;br /&gt;
* Fire up your favorite proxy tool, such as WebScarab&lt;br /&gt;
&lt;br /&gt;
* Generate an authenticated XMLHttpRequest using the browser&lt;br /&gt;
&lt;br /&gt;
* Right click on the resulting entry in WebScarab, click “Re-send” &lt;br /&gt;
&lt;br /&gt;
* Edit out the cookie&lt;br /&gt;
&lt;br /&gt;
See if a valid result is returned. If yes, you are vulnerable. Repeat for every Ajax enabled server-side service.&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
Ensure that every Ajax callable function, whether XMLRPC, custom code, or a web service verify the session and authorization. &lt;br /&gt;
&lt;br /&gt;
For example, in typical Ajax style, CPaint uses this insecure example:&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;?php?  ''&lt;br /&gt;
&lt;br /&gt;
''function calculate_tax($sales_amount)''&lt;br /&gt;
&lt;br /&gt;
''{''&lt;br /&gt;
&lt;br /&gt;
''return($sales_amount * 0.075);?''&lt;br /&gt;
&lt;br /&gt;
''}?''&lt;br /&gt;
&lt;br /&gt;
''?&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
Let’s add some session authentication, authorization and data validation, and business rule validation: &lt;br /&gt;
&lt;br /&gt;
''&amp;lt;?php?  ''&lt;br /&gt;
&lt;br /&gt;
''function calculate_tax($sales_amount)''&lt;br /&gt;
&lt;br /&gt;
''{''&lt;br /&gt;
&lt;br /&gt;
''// check that the session is logged in ?''&lt;br /&gt;
&lt;br /&gt;
''	assert_login();''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''	// check that the user has the USER role to prevent ''&lt;br /&gt;
&lt;br /&gt;
''// guest and admin access''&lt;br /&gt;
&lt;br /&gt;
''	assert_role(‘USER’);''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''// Validate data and business rules''&lt;br /&gt;
&lt;br /&gt;
''if ( is_numeric($sales_amount) &amp;amp;&amp;amp; $sales_amount &amp;gt; 0 )''&lt;br /&gt;
&lt;br /&gt;
''{''&lt;br /&gt;
&lt;br /&gt;
''// Perform the calculation and return''&lt;br /&gt;
&lt;br /&gt;
''return($sales_amount * 0.075);?''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
''// Data failed validation and business rules''&lt;br /&gt;
&lt;br /&gt;
''return -1;''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
''?&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
With these simple changes, we ensure that:&lt;br /&gt;
&lt;br /&gt;
* (Authentication) Enforce that the user is logged on&lt;br /&gt;
&lt;br /&gt;
* (Authorization and Compliance) Enforce role authorization and provide SOX-compliant segregation of duties&lt;br /&gt;
&lt;br /&gt;
* (Data Validation) Ensure that the data is safe to perform our calculation&lt;br /&gt;
&lt;br /&gt;
* (Business Rule Validation) Lastly, check the data is within acceptable business rule boundaries as it is not a good idea to calculate tax for negative and zero values&lt;br /&gt;
&lt;br /&gt;
Obviously, performing a tax rate calculation is not that important, but if it was an insurance premium calculator (which uses highly sensitive actuary data) this is the minimum you would expect to see for sensitive code.&lt;br /&gt;
&lt;br /&gt;
==Silent transactional authorization ==&lt;br /&gt;
&lt;br /&gt;
Any system that silently processes transactions using a single submission is dangerous to the client. For example, if a normal web application allows a simple URL submission, a preset session attack will allow the attacker to complete a transaction without the user’s authorization. In Ajax, it gets worse: the transaction is silent; it happens with no user feedback on the page, so an injected attack script may be able to steal money from the client without authorization. &lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
Determine if the application:&lt;br /&gt;
&lt;br /&gt;
* Is vulnerable to DOM injection and can run arbitrary JavaScript&lt;br /&gt;
&lt;br /&gt;
* If the browser allows execution of loaded JavaScript via URL entry, by navigating to the transaction submission page, and then typing in javascript:function(args). If the JavaScript is executed, it is likely that spyware will also be able to execute this code via the DOM model&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
Ensure that all transactions are conducted with appropriate authorization, including transaction signing as necessary&lt;br /&gt;
&lt;br /&gt;
==Untrusted or absent session data ==&lt;br /&gt;
&lt;br /&gt;
A common mis-implementation with Ajax is the desire to call a second server. &lt;br /&gt;
&lt;br /&gt;
[[Image:Ajax Second Server.gif]]&lt;br /&gt;
&lt;br /&gt;
Session data on the first server usually contains relatively trustworthy authentication and authorization information, as well as sensitive state, but in general, the second server cannot access this information in a timely or safe fashion. &lt;br /&gt;
&lt;br /&gt;
An example includes running an Ajax application on &amp;lt;u&amp;gt;http://www.example.com&amp;lt;/u&amp;gt;, and the Ajax code is able to directly process share trades on &amp;lt;u&amp;gt;http://market.somebiginvestmentfirm.com/&amp;lt;/u&amp;gt; via the use of embedded trust or embedded credentials. &lt;br /&gt;
&lt;br /&gt;
Attackers will be able to fraudulently perform transactions if there is no shared state between the two systems. This attack only requires that the attackers can tamper with embedded state on the client and if market.somebiginvestmentfirm.com foolishly trusts calls from Ajax callers without first checking with example.com. However, if example.com is simply one of hundreds of brokers, then this scenario is very unlikely to be secure no matter how it’s sliced or diced. This particular scenario requires federated identity, which is discussed further in the Authentication chapter.&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
You are vulnerable to this issue if:&lt;br /&gt;
&lt;br /&gt;
* Sensitive state is passed through the client to the second server in the foolish hope it will be trusted by the second server&lt;br /&gt;
&lt;br /&gt;
* The Ajax endpoints are hosted on a different server with unsharable session state&lt;br /&gt;
&lt;br /&gt;
* The second server is addressed by a URL that would prevent the cookies from the first session being used by the second server. Most browsers do not allow an application running on &amp;lt;u&amp;gt;ws.example.com&amp;lt;/u&amp;gt; to read cookies from &amp;lt;u&amp;gt;www.example.com&amp;lt;/u&amp;gt;. However, browsers will allow cookies to be read from &amp;lt;u&amp;gt;http://example.com&amp;lt;/u&amp;gt; but you should not rely on this as an attacker may spoof another URL such as attack.example.com and set cookies for example.com. &lt;br /&gt;
&lt;br /&gt;
* If the web service or other endpoint cannot obtain data from the first server’s session state for any other reason (such as incompatible technologies, like running a PHP web application and the Ajax application is trying to consume ASP.NET web services).&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
There are at least three methods to get around this issue:&lt;br /&gt;
&lt;br /&gt;
* Do not host the receiving end point on a different server; simply scale the entire application up (web services and all) on the same host. This allows trivially easy access to the trusted session state.&lt;br /&gt;
&lt;br /&gt;
* Stash the state in a database, and pass a cryptographically strong random key from the first server to the second server via the client. This method is far slower, more code intensive, and less scalable than the first solution.&lt;br /&gt;
&lt;br /&gt;
* Use federated authentication to provide a shared authorization context and verify it on the second server. This is usually very slow, but it is safe as long as the single sign-on (SSO) implementation is relatively secure and does not allow replay attacks.&lt;br /&gt;
&lt;br /&gt;
A solution that will not work is to simply pass the sensitive state via the client. A hostile client can tamper with the username, role, or any other sensitive state, so it cannot be trusted to transmit such data safely.&lt;br /&gt;
&lt;br /&gt;
==State management ==&lt;br /&gt;
&lt;br /&gt;
The DOM is designed to be manipulated and visible within the browser. It was never designed to be a secure storage area, but rather as a method of controlling how the page looks and behaves. Therefore, secure applications need to take care with client side storage of secure state.&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
==Tamper resistance  ==&lt;br /&gt;
&lt;br /&gt;
If state is stored on the client, the attacker is able to easily manipulate this state using a DOM inspection tool, or simply by re-writing to their own API. &lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable: '''&lt;br /&gt;
&lt;br /&gt;
* Use DOM inspection tools like FireBug (https://addons.mozilla.org/firefox/1843/) – can you see client side state?&lt;br /&gt;
&lt;br /&gt;
* Can you change the state?&lt;br /&gt;
&lt;br /&gt;
* Use proxy tools, such as Paros, Spike Proxy, or WebScarab. When you see client-side state, can you modify it or inject interesting traffic? Does the server-side code detect the change in a reasonable way? &lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
* Do not obfuscate client side state for no purpose – this requires more code and is trivially bypassed by advanced attackers&lt;br /&gt;
&lt;br /&gt;
* Applications should maintain a copy of all client-side state, and only accept back state that the user is authorized to change, such as a form fields or settings which they can change in the web UI&lt;br /&gt;
&lt;br /&gt;
* Ensure that the action is authorized before performing any activity on submitted data&lt;br /&gt;
&lt;br /&gt;
* Include server-side validation, preferring white listing to blacklisting.&lt;br /&gt;
&lt;br /&gt;
==Privacy  ==&lt;br /&gt;
&lt;br /&gt;
Almost all Ajax clients use XMLHttpRequest with GET requests. These embed the data in the “URL”, and even though the data is generally not visible to the user, it is available in the browser history. &lt;br /&gt;
&lt;br /&gt;
Phishers favor GET requests. They love to use links embedded in e-mails. If coupled with poorly written code that does not assert authorization, such code will allow the phisher to commit an unauthorized transaction.&lt;br /&gt;
&lt;br /&gt;
Even if POSTs are used, private data can be cached in intermediate untrusted caches if the application uses HTTP rather than HTTPS connections. &lt;br /&gt;
&lt;br /&gt;
Most browsers have GET data limits, which can be as little as 2 KB. POSTs do not have this limitation, allowing far more data to be sent in any one request. &lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are at risk '''&lt;br /&gt;
&lt;br /&gt;
* Use a proxy tool, like Paros, Spike, or WebScarab to determine the mode of the Ajax interaction. If it is GET, you are potentially at risk.&lt;br /&gt;
&lt;br /&gt;
* Look at the data – does it contain details such as usernames, passwords, names, addresses, medical history, bank account, tax or other private details? If so, you are at risk.&lt;br /&gt;
&lt;br /&gt;
* If you are sending sensitive data, can you access the Ajax endpoint via HTTP? If so, you are at risk from privacy breaches.&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
Generally, regardless of data value, use only POST requests. &lt;br /&gt;
&lt;br /&gt;
''CPaint POST transfer mode client example''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''var cp = new cpaint();''&lt;br /&gt;
&lt;br /&gt;
''cp.set_transfer_mode(‘POST’);''&lt;br /&gt;
&lt;br /&gt;
''…''&lt;br /&gt;
&lt;br /&gt;
''cp.call(‘processCreditCard.php’, ‘setCCDetail’, document.getElementById(‘creditcardnumber’), document.getElementById(‘creditcardexpiry’),''&lt;br /&gt;
&lt;br /&gt;
''document.getElementById(‘ccv’));''&lt;br /&gt;
&lt;br /&gt;
''CPaint POST transfer mode server example''&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;?php?  ''&lt;br /&gt;
&lt;br /&gt;
''function setCCDetail($cc, $expiry, $ccv)''&lt;br /&gt;
&lt;br /&gt;
''{''&lt;br /&gt;
&lt;br /&gt;
''// check that the session is logged in ?''&lt;br /&gt;
&lt;br /&gt;
''	assert_login();''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''	// check that the user has the USER role to prevent ''&lt;br /&gt;
&lt;br /&gt;
''// guest and admin access''&lt;br /&gt;
&lt;br /&gt;
''	assert_role(‘USER’);''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''// Validate data and business rules''&lt;br /&gt;
&lt;br /&gt;
''if ( is_credit_card($cc) &amp;amp;&amp;amp; is_expiry_date($expiry) &amp;amp;&amp;amp; is_numeric($ccv) )''&lt;br /&gt;
&lt;br /&gt;
''{''&lt;br /&gt;
&lt;br /&gt;
''// Set the credit card details''&lt;br /&gt;
&lt;br /&gt;
''$this-&amp;gt;cc = $cc;''&lt;br /&gt;
&lt;br /&gt;
''$this-&amp;gt;exp = $expiry;''&lt;br /&gt;
&lt;br /&gt;
''$this-&amp;gt;ccv = $ccv;''&lt;br /&gt;
&lt;br /&gt;
''return true;''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
''// Data failed validation and business rules''&lt;br /&gt;
&lt;br /&gt;
''return false;''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
''?&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Include server-side code that enforces the source of the data, so that it only comes from the POST, not from the request, GET, environment, or cookie data.&lt;br /&gt;
&lt;br /&gt;
If data transiting Ajax endpoints is protected by the users’ privacy laws, ensure that the data transits only over HTTPS using SSLv3 or TLS 1.0 or better and block HTTP communications.&lt;br /&gt;
&lt;br /&gt;
==Proxy Façade  ==&lt;br /&gt;
&lt;br /&gt;
Many toolkits, particularly PHP toolkits, allow you to register a class or file with the Ajax toolkit and thus call that method. CPaint for example works in this manner. However, some toolkits are worse than others – they allow '''any''' in context PHP function to be called, including system() and eval(). Others are not robust against PHP code injection – see below for more details.&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
If your toolkit works by registering classes or functions, try:&lt;br /&gt;
&lt;br /&gt;
* Calling a system call, such as system() or printf()&lt;br /&gt;
&lt;br /&gt;
* Calling another function in your code, but one which has not been registered&lt;br /&gt;
&lt;br /&gt;
* Try using some of the language features, such as ` for PHP for example &lt;br /&gt;
&lt;br /&gt;
If any of these attacks work, your code (and any code using this framework) is vulnerable to attack.&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
In general, such methods of calling server side code are fraught with danger. It’s better to provide a limited interface, called a proxy façade, to only allow access to permitted functions. &lt;br /&gt;
&lt;br /&gt;
This would also allow authorization checks and basic validation to be performed before calling previously internal code. &lt;br /&gt;
&lt;br /&gt;
==SOAP Injection Attacks ==&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==XMLRPC Injection Attacks ==&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==DOM Injection Attacks ==&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==XML Injection Attacks ==&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==JSON (JavaScript Object Notation) Injection Attacks ==&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Encoding safety ==&lt;br /&gt;
&lt;br /&gt;
Ajax applications are particularly prone to encoding attacks as JavaScript understands several encodings (depending on the browser, locale and code page), whilst the scripting language itself is primitive when it comes to providing robust encoding and decoding utilities. &lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
Do not rely heavily upon JavaScript processing the encoding or decoding capabilities for the client. Send data pre-encoded to the client, and receive data and handle it correctly. &lt;br /&gt;
&lt;br /&gt;
For more details, see the Canonicalization chapter later in this book.&lt;br /&gt;
&lt;br /&gt;
==Auditing ==&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Error Handling ==&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Accessibility ==&lt;br /&gt;
&lt;br /&gt;
Almost all Ajax toolkits and applications are inaccessible. Rarely do they pass even basic W3C WAI validation, do not have accessible alternative paths. Some toolkits, such as Tibco General Interface, crash the browser if a larger text size is chosen. This is completely unacceptable and worse, completely preventable. Being a “rich” interface does not excuse disability requirements. Based upon the US Census conducted in 2000, around 19.1% of the total US population has a disability of some kind (with similar levels elsewhere on the planet). Locking out 20% of your potential users from using your application is unacceptable and is in fact, illegal in most countries. &lt;br /&gt;
&lt;br /&gt;
Nearly all Western disability discrimination laws are the same – they require accessibility unless it is a justifiable hardship. They do not distinguish between open source or closed source, for profit or charitable, government or corporate – their application is universal.&lt;br /&gt;
&lt;br /&gt;
The techniques for creating accessible applications are widely known and have been documented for more than ten years. Accessibility evaluation tools are included or available as an option in every web development environment. As it does not cost a great deal to write new software to be accessible (the primary cost is in the testing), it is never a justifiable hardship to be accessible. &lt;br /&gt;
&lt;br /&gt;
Over the last few years, case law has firmly solidified upon the side of the disabled (see the references, particularly the SOCOG / IBM decision). If you now deliberately write inaccessible software, it would be negligent in the same way that building new buildings without accessibility aides such as ramps and lifts to allow wheelchair access. This stuff is not rocket science, it does not cost a lot of money to do, and lastly, you may need it one day.&lt;br /&gt;
&lt;br /&gt;
'''How to identify if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
* Read the W3C WAI guidelines and ensure your application has alternate accessible paths, and adheres to basic accessibility guidelines&lt;br /&gt;
&lt;br /&gt;
* Identify suitable evaluation tools for your development environment if it does not already contain them. Fix issues found by these tools and re-test&lt;br /&gt;
&lt;br /&gt;
* Try using the basic accessibility tools built into your operating system to see if your code works in high contrast, different color schemes, resize the text elements in your browser (in Firefox use Control-+ key to do this, Text Size -&amp;gt; Larger in Internet Explorer 6.0 or use the zoom control on the bottom right of the screen in IE 7), (Windows specific) set the font resolution to high DPI to emulate large fonts, choose big default fonts in the browser, use the screen magnification tool, and test various basic screen readers. If your application fails any of these tests, you are vulnerable. &lt;br /&gt;
&lt;br /&gt;
* Once you are satisfied your application should have a reasonable shot at passing full testing, identify a suitable accredited accessibility test firms or similarly qualified resources who can test your application using actual disability tools and provide qualified feedback. In general, unless your application is very simple, you should fix any issues found.&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
* Develop with accessibility in mind. Just like security, the sooner you do it, the cheaper this activity becomes and the more likely your application will be accessible&lt;br /&gt;
&lt;br /&gt;
* Test in house regularly. If possible, employ staff or volunteers who require such accessibility; they will let you know the best choices for full featured screen readers, Braille devices, and magnification and other accessibility aides. Let them test your application and provide feedback. &lt;br /&gt;
&lt;br /&gt;
* If you are likely to sell to corporate or government organizations, ensure that all applications are tested by an accredited accessibility testing firm. Fix all the issues they identify. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Further Reading ==&lt;br /&gt;
&lt;br /&gt;
AJAX Spell Command Injection Vulnerability&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.securityfocus.com/bid/13986/discuss&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CPaint Command Injection Vulnerability&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.securityfocus.com/bid/14565/discuss&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
XML-RPC Command Injection Vulnerability&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.securityfocus.com/bid/14088/discuss&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maguire vs SOCOG/IBM, Nublog&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.contenu.nu/socog.html&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
W3C, Existing accessibility tools&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.w3.org/WAI/ER/existingtools.html&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
US Census 2000: Disability Status 2000&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.census.gov/prod/2003pubs/c2kbr-17.pdf&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Reference==&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:OWASP AJAX Security Project]]&lt;br /&gt;
[[Category:AJAX]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Ajax_and_Other_%22Rich%22_Interface_Technologies&amp;diff=27741</id>
		<title>Ajax and Other &quot;Rich&quot; Interface Technologies</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Ajax_and_Other_%22Rich%22_Interface_Technologies&amp;diff=27741"/>
				<updated>2008-04-06T09:33:18Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
'''''Style is time’s fool. Form is time’s student – Stewart Brand '''''&lt;br /&gt;
&lt;br /&gt;
Ajax applications, often styled as “Web 2.0”, are not a form of magic security pixie dust. Instead, there are two classes of applications: secure and insecure. This is independent of the use of Ajax or similar technologies that preceded it, such as Flash, applets, or ActiveX. With some effort, Ajax applications can be secure. Unfortunately, many are not, which is the '''''raison d’être''''' of this chapter.&lt;br /&gt;
&lt;br /&gt;
The acronym AJAX stands for Asynchronous JavaScript and XML. Whilst these technologies underpinning Ajax are not new – they first appeared in 1998 with Microsoft Outlook Web Access in Exchange Server 5.5, “Web 2.0” was defined by Tim O’Reilly to mean highly peer-to-peer dynamic applications. Such applications include del.icio.us library that allows users to share their libraries’ details, or Flickr that allows users to share their photos in a highly interactive way. We define “Ajax applications” as those that use the XMLHttpRequest object to asynchronously call the server and receive replies, regardless of how they handle or display the received data, or if they are public peer-to-peer low value applications such as forum software or highly sensitive private data, such as a tax return lodgment application.&lt;br /&gt;
&lt;br /&gt;
Ajax enabled applications aim to increase the interactivity and richness of the web interface. Secure Ajax applications are achievable at minimal cost increase as long as security is considered during design and tested throughout development. &lt;br /&gt;
&lt;br /&gt;
Compliance with disability laws is mandatory for all government and most corporate organizations. Ajax framework developers who wish to be used by these types of organizations must ensure their code supports common accessibility aides. Ajax framework users should select frameworks that produce accessible output and design their applications to be accessible and test regularly. In most countries, to do otherwise is simply deliberate negligence, and is often harshly punished by the courts. &lt;br /&gt;
&lt;br /&gt;
Ajax applications face '''''exactly the same '''''security issues as all other web applications, plus they add their own particular set of risks that must be correctly managed. By their complex, bidirectional, and asynchronous nature, Ajax applications increase attack surface area. &lt;br /&gt;
&lt;br /&gt;
Use of Ajax (or any rich interface) requires careful consideration of architecture, server-side access control, state management, and strong validation to prevent attacks. Without considering these basic controls, even brochure-ware websites, such as car manufacturer websites, can be a hazard to both the user and the web site owner’s reputation and thus sales.&lt;br /&gt;
&lt;br /&gt;
At the time of writing, there is a multitude of Ajax frameworks and add-ons, and many more being written every day. Users of Ajax frameworks should ensure that their chosen framework meets the security risks of their particular application, and does not impose an unsecurable architecture upon them. &lt;br /&gt;
&lt;br /&gt;
Developers of Ajax frameworks should investigate the controls presented in this chapter, and associated controls documented throughout the rest of this book to ensure that their approach is simple, accessible, and secure.&lt;br /&gt;
&lt;br /&gt;
==Objective ==&lt;br /&gt;
&lt;br /&gt;
To ensure that AJAX (and all “rich” interactive interfaces, such as Flash and Shockwave) have adequate:&lt;br /&gt;
&lt;br /&gt;
* Secure Communications&lt;br /&gt;
&lt;br /&gt;
* Authentication and Session Management&lt;br /&gt;
&lt;br /&gt;
* Access Control &lt;br /&gt;
&lt;br /&gt;
* Input Validation&lt;br /&gt;
&lt;br /&gt;
* Error Handling and Logging&lt;br /&gt;
&lt;br /&gt;
To prevent applications from being attacked using known attack vectors, such as unauthorized access, injection attacks, and so on.&lt;br /&gt;
&lt;br /&gt;
==Platforms Affected ==&lt;br /&gt;
&lt;br /&gt;
* All Server Platforms&lt;br /&gt;
&lt;br /&gt;
* Web applications which use Ajax, ActiveX, Flash or Shockwave&lt;br /&gt;
&lt;br /&gt;
* Clients which are required to use such applications&lt;br /&gt;
&lt;br /&gt;
==Architecture ==&lt;br /&gt;
&lt;br /&gt;
Appropriate security architecture should be considered when implementing Ajax front ends. Some Ajax frameworks will proudly display that they are 100% client based, with no server side controls, such as Tibco and Atlas (an Ajax framework for .NET). &lt;br /&gt;
&lt;br /&gt;
Strong security architecture provides adequate defense in depth, and architecturally correct placement of key security controls. For more details, see the Security Architecture chapter.&lt;br /&gt;
&lt;br /&gt;
For some types of applications, such as brochure-ware and non-interactive applications, such as stock tickers, this is acceptable security architecture as the risks are low – it would be hard to obviate the security controls to lose actual money. However, as the risk of the application increases, the threats and countermeasures required also increase. &lt;br /&gt;
&lt;br /&gt;
'''Architecture by example '''&lt;br /&gt;
&lt;br /&gt;
For the purposes of this section, irs.gov.ex, a taxation department of a fictitious country, has decided to implement an Ajax enabled electronic lodgment and tracking service for all of its 100 million taxpayers. A key reason to move to the new system is to reduce the workload on existing staff for the 90+% of tax returns that could be processed automatically … as long as the taxpayers do not deliberately lie, deceive, or cheat the system. Which of course, they do regularly. &lt;br /&gt;
&lt;br /&gt;
They bought a fancy new Enterprise Service Bus (ESB), to which they hooked up their old but incredibly reliable mainframe backend, their SAP R/3 implementation that writes the checks and tax invoices, and several other key systems. &lt;br /&gt;
&lt;br /&gt;
This particular ESB, like many on the market today, has no data validation, authentication, or authorization controls of its own; it is a simple web-service integration layer. The ESB expects that the underlying systems will perform adequate validation and authorization to prevent abuse, as the software company that wrote the ESB expected that all calling systems would be trusted, internal systems. Hooking up a dynamic web site where the users are known to be relentless, eager, and motivated tax avoiders changes the risk profile of a previously internal system with trusted staff.&lt;br /&gt;
&lt;br /&gt;
The tax department does not want to change existing systems as they are in production and stable. More to the point, they cannot change their mainframe code easily - their skilled mainframe programmers either were promoted to senior management or retired 15 years ago, and it would be extremely costly to hire new mainframe developers, and impossible to change how the third party systems work, like SAP or their anti-fraud system. &lt;br /&gt;
&lt;br /&gt;
Old code, such as COBOL CICS transactions, or previously internal only systems such as SAP R/3, have a different trust model than highly dynamic Internet connected websites. It is highly likely such systems have never been tested against now common attacks, such as HTML injection (XSS), DOM injection, XML query attacks, or similar. Without any intermediate code to protect these older systems, they are at immense risk.&lt;br /&gt;
&lt;br /&gt;
The tax department selected a simple solution in the belief it will save money. In this first example, the bulk of the business logic is contained in deployed JavaScript applications. All of the business logic, validation, and state are contained in the client’s browser, and it makes direct calls to the enterprise service bus. &lt;br /&gt;
&lt;br /&gt;
However, this model is simply broken: the previously generic process orchestration service will need to become far more aware of the caller’s identity (to provide authentication and enforce authorization), maintain secure state, and provide validation services that have previously been performed on the client. &lt;br /&gt;
&lt;br /&gt;
[[Image:Insecure Security and state maintained on the client.gif]]&lt;br /&gt;
&lt;br /&gt;
This security model is akin to leaving the keys to the Reserve Bank at the train station notice board. There is no method of protecting this model without significant replication of the business logic and re-validating all the state at the enterprise service bus, or similar web service endpoints. &lt;br /&gt;
&lt;br /&gt;
Many enterprises, including irs.gov.ex, have taken to service oriented architecture (SOA), which uses web services enabling re-use of pre-existing transactions and systems, such as SAP or Siebel, or custom transactions running on mainframes. If an Ajax framework is connected to such SOA endpoints, such as an enterprise service bus, or directly to a backend data warehouse or other persistent store, there is no ability to validate the calling identity, authorize the transaction, validate the data, or any other normal security activity. So this model will not do. &lt;br /&gt;
&lt;br /&gt;
In the next model, which is how most PHP application frameworks work today, the Ajax xmlrpc endpoint is not necessarily well integrated with the main application. &lt;br /&gt;
&lt;br /&gt;
[[Image: Insecure Ajax Web Service Endpoint separate from the main application.gif]]&lt;br /&gt;
&lt;br /&gt;
In this model, if the Ajax endpoint cannot or does not access secure state, or associate the call with the active session, a hostile caller could emulate an active session and call protected resources with minimal skills or tools. This vulnerability has already been demonstrated with several popular Ajax PHP toolkits on Bugtraq, and probably applies to other less well-known toolkits for other languages and platforms.&lt;br /&gt;
&lt;br /&gt;
The best way to protect both of these models is to bring them back to the normal three-tier application model:&lt;br /&gt;
&lt;br /&gt;
[[Image: Better Shared business logic in the middle tier with different front ends.gif]]&lt;br /&gt;
&lt;br /&gt;
In this model, which is akin to how GMail works, the application is still significantly Ajax enabled, and provides a rich experience to the user. However, this code is backed by:&lt;br /&gt;
&lt;br /&gt;
* A solid session management scheme to ensure that authentication and authorization is performed in a trusted part of the architecture&lt;br /&gt;
&lt;br /&gt;
* Data validation is performed in both directions on the server-side at various layers to limit or prevent injection and other attacks&lt;br /&gt;
&lt;br /&gt;
* All calls to the backend services are performed by trusted server-side business logic&lt;br /&gt;
&lt;br /&gt;
* The layered architecture allows reasonable trust of the caller at the ESB level as the data has been significantly authorized and validated&lt;br /&gt;
&lt;br /&gt;
This means that the ESB and its published services, such as 40 year old COBOL code, do not need to be particularly aware of the implications of being made available to the Internet. This enables higher levels of re-use and reduces costs.&lt;br /&gt;
&lt;br /&gt;
Although more complex to the project implementing the Ajax enabled application, to the funding business, this architecture is the cheapest way of maintaining security whilst avoiding updating or maintaining ancient or third party code.&lt;br /&gt;
&lt;br /&gt;
Selecting the correct architecture is unfortunately not a checklist – it is a balance of risk versus cost. However, as demonstrated in this section, client-side heavy architecture models are completely untrustworthy for transactional systems and should be avoided.&lt;br /&gt;
&lt;br /&gt;
==Access control: Authentication and Authorization ==&lt;br /&gt;
&lt;br /&gt;
Ajax code uses the XMLHttpRequest object, which will send the cookies of the current browser context through with each request. For applications which have user sessions, it is vital that normal authentication paths are used to ensure that the caller is known to the application. Brochure-ware applications can skip this section as they allow anonymous calling.&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
If you have transactions or calls that are not to be used by anonymous callers, check that client-side code cannot call them without an established user context.&lt;br /&gt;
&lt;br /&gt;
To do this: &lt;br /&gt;
&lt;br /&gt;
* Fire up your favorite proxy tool, such as WebScarab&lt;br /&gt;
&lt;br /&gt;
* Generate an authenticated XMLHttpRequest using the browser&lt;br /&gt;
&lt;br /&gt;
* Right click on the resulting entry in WebScarab, click “Re-send” &lt;br /&gt;
&lt;br /&gt;
* Edit out the cookie&lt;br /&gt;
&lt;br /&gt;
See if a valid result is returned. If yes, you are vulnerable. Repeat for every Ajax enabled server-side service.&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
Ensure that every Ajax callable function, whether XMLRPC, custom code, or a web service verify the session and authorization. &lt;br /&gt;
&lt;br /&gt;
For example, in typical Ajax style, CPaint uses this insecure example:&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;?php?  ''&lt;br /&gt;
&lt;br /&gt;
''function calculate_tax($sales_amount)''&lt;br /&gt;
&lt;br /&gt;
''{''&lt;br /&gt;
&lt;br /&gt;
''return($sales_amount * 0.075);?''&lt;br /&gt;
&lt;br /&gt;
''}?''&lt;br /&gt;
&lt;br /&gt;
''?&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
Let’s add some session authentication, authorization and data validation, and business rule validation: &lt;br /&gt;
&lt;br /&gt;
''&amp;lt;?php?  ''&lt;br /&gt;
&lt;br /&gt;
''function calculate_tax($sales_amount)''&lt;br /&gt;
&lt;br /&gt;
''{''&lt;br /&gt;
&lt;br /&gt;
''// check that the session is logged in ?''&lt;br /&gt;
&lt;br /&gt;
''	assert_login();''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''	// check that the user has the USER role to prevent ''&lt;br /&gt;
&lt;br /&gt;
''// guest and admin access''&lt;br /&gt;
&lt;br /&gt;
''	assert_role(‘USER’);''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''// Validate data and business rules''&lt;br /&gt;
&lt;br /&gt;
''if ( is_numeric($sales_amount) &amp;amp;&amp;amp; $sales_amount &amp;gt; 0 )''&lt;br /&gt;
&lt;br /&gt;
''{''&lt;br /&gt;
&lt;br /&gt;
''// Perform the calculation and return''&lt;br /&gt;
&lt;br /&gt;
''return($sales_amount * 0.075);?''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
''// Data failed validation and business rules''&lt;br /&gt;
&lt;br /&gt;
''return -1;''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
''?&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
With these simple changes, we ensure that:&lt;br /&gt;
&lt;br /&gt;
* (Authentication) Enforce that the user is logged on&lt;br /&gt;
&lt;br /&gt;
* (Authorization and Compliance) Enforce role authorization and provide SOX-compliant segregation of duties&lt;br /&gt;
&lt;br /&gt;
* (Data Validation) Ensure that the data is safe to perform our calculation&lt;br /&gt;
&lt;br /&gt;
* (Business Rule Validation) Lastly, check the data is within acceptable business rule boundaries as it is not a good idea to calculate tax for negative and zero values&lt;br /&gt;
&lt;br /&gt;
Obviously, performing a tax rate calculation is not that important, but if it was an insurance premium calculator (which uses highly sensitive actuary data) this is the minimum you would expect to see for sensitive code.&lt;br /&gt;
&lt;br /&gt;
==Silent transactional authorization ==&lt;br /&gt;
&lt;br /&gt;
Any system that silently processes transactions using a single submission is dangerous to the client. For example, if a normal web application allows a simple URL submission, a preset session attack will allow the attacker to complete a transaction without the user’s authorization. In Ajax, it gets worse: the transaction is silent; it happens with no user feedback on the page, so an injected attack script may be able to steal money from the client without authorization. &lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
Determine if the application:&lt;br /&gt;
&lt;br /&gt;
* Is vulnerable to DOM injection and can run arbitrary Javascript&lt;br /&gt;
&lt;br /&gt;
* If the browser allows execution of loaded Javascript via URL entry, by navigating to the transaction submission page, and then typing in javascript:function(args). If the Javascript is executed, it is likely that spyware will also be able to execute this code via the DOM model&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
Ensure that all transactions are conducted with appropriate authorization, including transaction signing as necessary&lt;br /&gt;
&lt;br /&gt;
==Untrusted or absent session data ==&lt;br /&gt;
&lt;br /&gt;
A common mis-implementation with Ajax is the desire to call a second server. &lt;br /&gt;
&lt;br /&gt;
[[Image:Ajax Second Server.gif]]&lt;br /&gt;
&lt;br /&gt;
Session data on the first server usually contains relatively trustworthy authentication and authorization information, as well as sensitive state, but in general, the second server cannot access this information in a timely or safe fashion. &lt;br /&gt;
&lt;br /&gt;
An example includes running an Ajax application on &amp;lt;u&amp;gt;http://www.example.com&amp;lt;/u&amp;gt;, and the Ajax code is able to directly process share trades on &amp;lt;u&amp;gt;http://market.somebiginvestmentfirm.com/&amp;lt;/u&amp;gt; via the use of embedded trust or embedded credentials. &lt;br /&gt;
&lt;br /&gt;
Attackers will be able to fraudulently perform transactions if there is no shared state between the two systems. This attack only requires that the attackers can tamper with embedded state on the client and if market.somebiginvestmentfirm.com foolishly trusts calls from Ajax callers without first checking with example.com. However, if example.com is simply one of hundreds of brokers, then this scenario is very unlikely to be secure no matter how it’s sliced or diced. This particular scenario requires federated identity, which is discussed further in the Authentication chapter.&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
You are vulnerable to this issue if:&lt;br /&gt;
&lt;br /&gt;
* Sensitive state is passed through the client to the second server in the foolish hope it will be trusted by the second server&lt;br /&gt;
&lt;br /&gt;
* The Ajax endpoints are hosted on a different server with unsharable session state&lt;br /&gt;
&lt;br /&gt;
* The second server is addressed by a URL that would prevent the cookies from the first session being used by the second server. Most browsers do not allow an application running on &amp;lt;u&amp;gt;ws.example.com&amp;lt;/u&amp;gt; to read cookies from &amp;lt;u&amp;gt;www.example.com&amp;lt;/u&amp;gt;. However, browsers will allow cookies to be read from &amp;lt;u&amp;gt;http://example.com&amp;lt;/u&amp;gt; but you should not rely on this as an attacker may spoof another URL such as attack.example.com and set cookies for example.com. &lt;br /&gt;
&lt;br /&gt;
* If the web service or other endpoint cannot obtain data from the first server’s session state for any other reason (such as incompatible technologies, like running a PHP web application and the Ajax application is trying to consume ASP.NET web services).&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
There are at least three methods to get around this issue:&lt;br /&gt;
&lt;br /&gt;
* Do not host the receiving end point on a different server; simply scale the entire application up (web services and all) on the same host. This allows trivially easy access to the trusted session state.&lt;br /&gt;
&lt;br /&gt;
* Stash the state in a database, and pass a cryptographically strong random key from the first server to the second server via the client. This method is far slower, more code intensive, and less scalable than the first solution.&lt;br /&gt;
&lt;br /&gt;
* Use federated authentication to provide a shared authorization context and verify it on the second server. This is usually very slow, but it is safe as long as the single sign-on (SSO) implementation is relatively secure and does not allow replay attacks.&lt;br /&gt;
&lt;br /&gt;
A solution that will not work is to simply pass the sensitive state via the client. A hostile client can tamper with the username, role, or any other sensitive state, so it cannot be trusted to transmit such data safely.&lt;br /&gt;
&lt;br /&gt;
==State management ==&lt;br /&gt;
&lt;br /&gt;
The DOM is designed to be manipulated and visible within the browser. It was never designed to be a secure storage area, but rather as a method of controlling how the page looks and behaves. Therefore, secure applications need to take care with client side storage of secure state.&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
==Tamper resistance  ==&lt;br /&gt;
&lt;br /&gt;
If state is stored on the client, the attacker is able to easily manipulate this state using a DOM inspection tool, or simply by re-writing to their own API. &lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable: '''&lt;br /&gt;
&lt;br /&gt;
* Use DOM inspection tools like FireBug (https://addons.mozilla.org/firefox/1843/) – can you see client side state?&lt;br /&gt;
&lt;br /&gt;
* Can you change the state?&lt;br /&gt;
&lt;br /&gt;
* Use proxy tools, such as Paros, Spike Proxy, or WebScarab. When you see client-side state, can you modify it or inject interesting traffic? Does the server-side code detect the change in a reasonable way? &lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
* Do not obfuscate client side state for no purpose – this requires more code and is trivially bypassed by advanced attackers&lt;br /&gt;
&lt;br /&gt;
* Applications should maintain a copy of all client-side state, and only accept back state that the user is authorized to change, such as a form fields or settings which they can change in the web UI&lt;br /&gt;
&lt;br /&gt;
* Ensure that the action is authorized before performing any activity on submitted data&lt;br /&gt;
&lt;br /&gt;
* Include server-side validation, preferring white listing to blacklisting.&lt;br /&gt;
&lt;br /&gt;
==Privacy  ==&lt;br /&gt;
&lt;br /&gt;
Almost all Ajax clients use XMLHttpRequest with GET requests. These embed the data in the “URL”, and even though the data is generally not visible to the user, it is available in the browser history. &lt;br /&gt;
&lt;br /&gt;
Phishers favor GET requests. They love to use links embedded in e-mails. If coupled with poorly written code that does not assert authorization, such code will allow the phisher to commit an unauthorized transaction.&lt;br /&gt;
&lt;br /&gt;
Even if POSTs are used, private data can be cached in intermediate untrusted caches if the application uses HTTP rather than HTTPS connections. &lt;br /&gt;
&lt;br /&gt;
Most browsers have GET data limits, which can be as little as 2 KB. POSTs do not have this limitation, allowing far more data to be sent in any one request. &lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are at risk '''&lt;br /&gt;
&lt;br /&gt;
* Use a proxy tool, like Paros, Spike, or WebScarab to determine the mode of the Ajax interaction. If it is GET, you are potentially at risk.&lt;br /&gt;
&lt;br /&gt;
* Look at the data – does it contain details such as usernames, passwords, names, addresses, medical history, bank account, tax or other private details? If so, you are at risk.&lt;br /&gt;
&lt;br /&gt;
* If you are sending sensitive data, can you access the Ajax endpoint via HTTP? If so, you are at risk from privacy breaches.&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
Generally, regardless of data value, use only POST requests. &lt;br /&gt;
&lt;br /&gt;
''CPaint POST transfer mode client example''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''var cp = new cpaint();''&lt;br /&gt;
&lt;br /&gt;
''cp.set_transfer_mode(‘POST’);''&lt;br /&gt;
&lt;br /&gt;
''…''&lt;br /&gt;
&lt;br /&gt;
''cp.call(‘processCreditCard.php’, ‘setCCDetail’, document.getElementById(‘creditcardnumber’), document.getElementById(‘creditcardexpiry’),''&lt;br /&gt;
&lt;br /&gt;
''document.getElementById(‘ccv’));''&lt;br /&gt;
&lt;br /&gt;
''CPaint POST transfer mode server example''&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;?php?  ''&lt;br /&gt;
&lt;br /&gt;
''function setCCDetail($cc, $expiry, $ccv)''&lt;br /&gt;
&lt;br /&gt;
''{''&lt;br /&gt;
&lt;br /&gt;
''// check that the session is logged in ?''&lt;br /&gt;
&lt;br /&gt;
''	assert_login();''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''	// check that the user has the USER role to prevent ''&lt;br /&gt;
&lt;br /&gt;
''// guest and admin access''&lt;br /&gt;
&lt;br /&gt;
''	assert_role(‘USER’);''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''// Validate data and business rules''&lt;br /&gt;
&lt;br /&gt;
''if ( is_credit_card($cc) &amp;amp;&amp;amp; is_expiry_date($expiry) &amp;amp;&amp;amp; is_numeric($ccv) )''&lt;br /&gt;
&lt;br /&gt;
''{''&lt;br /&gt;
&lt;br /&gt;
''// Set the credit card details''&lt;br /&gt;
&lt;br /&gt;
''$this-&amp;gt;cc = $cc;''&lt;br /&gt;
&lt;br /&gt;
''$this-&amp;gt;exp = $expiry;''&lt;br /&gt;
&lt;br /&gt;
''$this-&amp;gt;ccv = $ccv;''&lt;br /&gt;
&lt;br /&gt;
''return true;''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
''// Data failed validation and business rules''&lt;br /&gt;
&lt;br /&gt;
''return false;''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
''?&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Include server-side code that enforces the source of the data, so that it only comes from the POST, not from the request, GET, environment, or cookie data.&lt;br /&gt;
&lt;br /&gt;
If data transiting Ajax endpoints is protected by the users’ privacy laws, ensure that the data transits only over HTTPS using SSLv3 or TLS 1.0 or better and block HTTP communications.&lt;br /&gt;
&lt;br /&gt;
==Proxy Façade  ==&lt;br /&gt;
&lt;br /&gt;
Many toolkits, particularly PHP toolkits, allow you to register a class or file with the Ajax toolkit and thus call that method. CPaint for example works in this manner. However, some toolkits are worse than others – they allow '''any''' in context PHP function to be called, including system() and eval(). Others are not robust against PHP code injection – see below for more details.&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
If your toolkit works by registering classes or functions, try:&lt;br /&gt;
&lt;br /&gt;
* Calling a system call, such as system() or printf()&lt;br /&gt;
&lt;br /&gt;
* Calling another function in your code, but one which has not been registered&lt;br /&gt;
&lt;br /&gt;
* Try using some of the language features, such as ` for PHP for example &lt;br /&gt;
&lt;br /&gt;
If any of these attacks work, your code (and any code using this framework) is vulnerable to attack.&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
In general, such methods of calling server side code are fraught with danger. It’s better to provide a limited interface, called a proxy façade, to only allow access to permitted functions. &lt;br /&gt;
&lt;br /&gt;
This would also allow authorization checks and basic validation to be performed before calling previously internal code. &lt;br /&gt;
&lt;br /&gt;
==SOAP Injection Attacks ==&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==XMLRPC Injection Attacks ==&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==DOM Injection Attacks ==&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==XML Injection Attacks ==&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==JSON (Javascript Object Notation) Injection Attacks ==&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Encoding safety ==&lt;br /&gt;
&lt;br /&gt;
Ajax applications are particularly prone to encoding attacks as JavaScript understands several encodings (depending on the browser, locale and code page), whilst the scripting language itself is primitive when it comes to providing robust encoding and decoding utilities. &lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
Do not rely heavily upon Javascript processing the encoding or decoding capabilities for the client. Send data pre-encoded to the client, and receive data and handle it correctly. &lt;br /&gt;
&lt;br /&gt;
For more details, see the Canonicalization chapter later in this book.&lt;br /&gt;
&lt;br /&gt;
==Auditing ==&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Error Handling ==&lt;br /&gt;
&lt;br /&gt;
'''How to determine if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Accessibility ==&lt;br /&gt;
&lt;br /&gt;
Almost all Ajax toolkits and applications are inaccessible. Rarely do they pass even basic W3C WAI validation, do not have accessible alternative paths. Some toolkits, such as Tibco General Interface, crash the browser if a larger text size is chosen. This is completely unacceptable and worse, completely preventable. Being a “rich” interface does not excuse disability requirements. Based upon the US Census conducted in 2000, around 19.1% of the total US population has a disability of some kind (with similar levels elsewhere on the planet). Locking out 20% of your potential users from using your application is unacceptable and is in fact, illegal in most countries. &lt;br /&gt;
&lt;br /&gt;
Nearly all Western disability discrimination laws are the same – they require accessibility unless it is a justifiable hardship. They do not distinguish between open source or closed source, for profit or charitable, government or corporate – their application is universal.&lt;br /&gt;
&lt;br /&gt;
The techniques for creating accessible applications are widely known and have been documented for more than ten years. Accessibility evaluation tools are included or available as an option in every web development environment. As it does not cost a great deal to write new software to be accessible (the primary cost is in the testing), it is never a justifiable hardship to be accessible. &lt;br /&gt;
&lt;br /&gt;
Over the last few years, case law has firmly solidified upon the side of the disabled (see the references, particularly the SOCOG / IBM decision). If you now deliberately write inaccessible software, it would be negligent in the same way that building new buildings without accessibility aides such as ramps and lifts to allow wheelchair access. This stuff is not rocket science, it does not cost a lot of money to do, and lastly, you may need it one day.&lt;br /&gt;
&lt;br /&gt;
'''How to identify if you are vulnerable '''&lt;br /&gt;
&lt;br /&gt;
* Read the W3C WAI guidelines and ensure your application has alternate accessible paths, and adheres to basic accessibility guidelines&lt;br /&gt;
&lt;br /&gt;
* Identify suitable evaluation tools for your development environment if it does not already contain them. Fix issues found by these tools and re-test&lt;br /&gt;
&lt;br /&gt;
* Try using the basic accessibility tools built into your operating system to see if your code works in high contrast, different color schemes, resize the text elements in your browser (in Firefox use Control-+ key to do this, Text Size -&amp;gt; Larger in Internet Explorer 6.0 or use the zoom control on the bottom right of the screen in IE 7), (Windows specific) set the font resolution to high DPI to emulate large fonts, choose big default fonts in the browser, use the screen magnification tool, and test various basic screen readers. If your application fails any of these tests, you are vulnerable. &lt;br /&gt;
&lt;br /&gt;
* Once you are satisfied your application should have a reasonable shot at passing full testing, identify a suitable accredited accessibility test firms or similarly qualified resources who can test your application using actual disability tools and provide qualified feedback. In general, unless your application is very simple, you should fix any issues found.&lt;br /&gt;
&lt;br /&gt;
'''Countermeasures '''&lt;br /&gt;
&lt;br /&gt;
* Develop with accessibility in mind. Just like security, the sooner you do it, the cheaper this activity becomes and the more likely your application will be accessible&lt;br /&gt;
&lt;br /&gt;
* Test in house regularly. If possible, employ staff or volunteers who require such accessibility; they will let you know the best choices for full featured screen readers, Braille devices, and magnification and other accessibility aides. Let them test your application and provide feedback. &lt;br /&gt;
&lt;br /&gt;
* If you are likely to sell to corporate or government organizations, ensure that all applications are tested by an accredited accessibility testing firm. Fix all the issues they identify. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Further Reading ==&lt;br /&gt;
&lt;br /&gt;
AJAX Spell Command Injection Vulnerability&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.securityfocus.com/bid/13986/discuss&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CPaint Command Injection Vulnerability&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.securityfocus.com/bid/14565/discuss&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
XML-RPC Command Injection Vulnerability&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.securityfocus.com/bid/14088/discuss&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maguire vs SOCOG/IBM, Nublog&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.contenu.nu/socog.html&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
W3C, Existing accessibility tools&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.w3.org/WAI/ER/existingtools.html&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
US Census 2000: Disability Status 2000&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.census.gov/prod/2003pubs/c2kbr-17.pdf&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Reference==&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:OWASP AJAX Security Project]]&lt;br /&gt;
[[Category:AJAX]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Web_Services&amp;diff=27740</id>
		<title>Web Services</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Web_Services&amp;diff=27740"/>
				<updated>2008-04-06T09:08:26Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* Java toolkits */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
This section of the Guide details the common issues facing Web services developers, and methods to address common issues. Due to the space limitations, it cannot look at all of the surrounding issues in great detail, since each of them deserves a separate book of its own. Instead, an attempt is made to steer the reader to the appropriate usage patterns, and warn about potential roadblocks on the way.&lt;br /&gt;
&lt;br /&gt;
Web Services have received a lot of press, and with that comes a great deal of confusion over what they really are. Some are heralding Web Services as the biggest technology breakthrough since the web itself; others are more skeptical that they are nothing more than evolved web applications. In either case, the issues of web application security apply to web services just as they do to web applications. &lt;br /&gt;
&lt;br /&gt;
==What are Web Services?==&lt;br /&gt;
&lt;br /&gt;
Suppose you were making an application that you wanted other applications to be able to communicate with.  For example, your Java application has stock information updated every 5 minutes and you would like other applications, ones that may not even exist yet, to be able to use the data.&lt;br /&gt;
&lt;br /&gt;
One way you can do this is to serialize your Java objects and send them over the wire to the application that requests them.  The problem with this approach is that a C# application would not be able to use these objects because it serializes and deserializes objects differently than Java.  &lt;br /&gt;
&lt;br /&gt;
Another approach you could take is to send a text file filled with data to the application that requests it.  This is better because a C# application could read the data.  But this has another flaw:  Lets assume your stock application is not the only one the C# application needs to interact with.  Maybe it needs weather data, local restaurant data, movie data, etc.  If every one of these applications uses its own unique file format, it would take considerable research to get the C# application to a working state.  &lt;br /&gt;
&lt;br /&gt;
The solution to both of these problems is to send a standard file format.  A format that any application can use, regardless of the data being transported.  Web Services are this solution.  They let any application communicate with any other application without having to consider the language it was developed in or the format of the data.  &lt;br /&gt;
&lt;br /&gt;
At the simplest level, web services can be seen as a specialized web application that differs mainly at the presentation tier level. While web applications typically are HTML-based, web services are XML-based. Interactive users for B2C (business to consumer) transactions normally access web applications, while web services are employed as building blocks by other web applications for forming B2B (business to business) chains using the so-called SOA model. Web services typically present a public functional interface, callable in a programmatic fashion, while web applications tend to deal with a richer set of features and are content-driven in most cases. &lt;br /&gt;
&lt;br /&gt;
==Securing Web Services ==&lt;br /&gt;
&lt;br /&gt;
Web services, like other distributed applications, require protection at multiple levels:&lt;br /&gt;
&lt;br /&gt;
* SOAP messages that are sent on the wire should be delivered confidentially and without tampering&lt;br /&gt;
&lt;br /&gt;
* The server needs to be confident who it is talking to and what the clients are entitled to&lt;br /&gt;
&lt;br /&gt;
* The clients need to know that they are talking to the right server, and not a phishing site (see the Phishing chapter for more information)&lt;br /&gt;
&lt;br /&gt;
* System message logs should contain sufficient information to reliably reconstruct the chain of events and track those back to the authenticated callers&lt;br /&gt;
&lt;br /&gt;
Correspondingly, the high-level approaches to solutions, discussed in the following sections, are valid for pretty much any distributed application, with some variations in the implementation details.&lt;br /&gt;
&lt;br /&gt;
The good news for Web Services developers is that these are infrastructure-level tasks, so, theoretically, it is only the system administrators who should be worrying about these issues. However, for a number of reasons discussed later in this chapter, WS developers usually have to be at least aware of all these risks, and oftentimes they still have to resort to manually coding or tweaking the protection components.&lt;br /&gt;
&lt;br /&gt;
==Communication security ==&lt;br /&gt;
&lt;br /&gt;
There is a commonly cited statement, and even more often implemented approach – “we are using SSL to protect all communication, we are secure”. At the same time, there have been so many articles published on the topic of “channel security vs. token security” that it hardly makes sense to repeat those arguments here. Therefore, listed below is just a brief rundown of most common pitfalls when using channel security alone:&lt;br /&gt;
&lt;br /&gt;
* It provides only “point-to-point” security&lt;br /&gt;
&lt;br /&gt;
Any communication with multiple “hops” requires establishing separate channels (and trusts) between each communicating node along the way. There is also a subtle issue of trust transitivity, as trusts between node pairs {A,B} and {B,C} do not automatically imply {A,C} trust relationship.&lt;br /&gt;
&lt;br /&gt;
* Storage issue&lt;br /&gt;
&lt;br /&gt;
After messages are received on the server (even if it is not the intended recipient), they exist in the clear-text form, at least – temporarily. Storing the transmitted information at the intermediate aggravates the problem or destination servers in log files (where it can be browsed by anybody) and local caches.&lt;br /&gt;
&lt;br /&gt;
* Lack of interoperability&lt;br /&gt;
&lt;br /&gt;
While SSL provides a standard mechanism for transport protection, applications then have to utilize highly proprietary mechanisms for transmitting credentials, ensuring freshness, integrity, and confidentiality of data sent over the secure channel. Using a different server, which is semantically equivalent, but accepts a different format of the same credentials, would require altering the client and prevent forming automatic B2B service chains. &lt;br /&gt;
&lt;br /&gt;
Standards-based token protection in many cases provides a superior alternative for message-oriented Web Service SOAP communication model.&lt;br /&gt;
&lt;br /&gt;
That said – the reality is that the most Web Services today are still protected by some form of channel security mechanism, which alone might suffice for a simple internal application. However, one should clearly realize the limitations of such approach, and make conscious trade-offs at the design time, whether channel, token, or combined protection would work better for each specific case.&lt;br /&gt;
&lt;br /&gt;
==Passing credentials ==&lt;br /&gt;
&lt;br /&gt;
In order to enable credentials exchange and authentication for Web Services, their developers must address the following issues.&lt;br /&gt;
&lt;br /&gt;
First, since SOAP messages are XML-based, all passed credentials have to be converted to text format. This is not a problem for username/password types of credentials, but binary ones (like X.509 certificates or Kerberos tokens) require converting them into text prior to sending and unambiguously restoring them upon receiving, which is usually done via a procedure called Base64 encoding and decoding.&lt;br /&gt;
&lt;br /&gt;
Second, passing credentials carries an inherited risk of their disclosure – either by sniffing them during the wire transmission, or by analyzing the server logs. Therefore, things like passwords and private keys need to be either encrypted, or just never sent “in the clear”. Usual ways to avoid sending sensitive credentials are using cryptographic hashing and/or signatures.&lt;br /&gt;
&lt;br /&gt;
==Ensuring message freshness ==&lt;br /&gt;
&lt;br /&gt;
Even a valid message may present a danger if it is utilized in a “replay attack” – i.e. it is sent multiple times to the server to make it repeat the requested operation. This may be achieved by capturing an entire message, even if it is sufficiently protected against tampering, since it is the message itself that is used for attack now (see the XML Injection section of the Interpreter Injection chapter).&lt;br /&gt;
&lt;br /&gt;
Usual means to protect against replayed messages is either using unique identifiers (nonces) on messages and keeping track of processed ones, or using a relatively short validity time window. In the Web Services world, information about the message creation time is usually communicated by inserting timestamps, which may just tell the instant the message was created, or have additional information, like its expiration time, or certain conditions.&lt;br /&gt;
&lt;br /&gt;
The latter solution, although easier to implement, requires clock synchronization and is sensitive to “server time skew,” whereas server or clients clocks drift too much, preventing timely message delivery, although this usually does not present significant problems with modern-day computers. A greater issue lies with message queuing at the servers, where messages may be expiring while waiting to be processed in the queue of an especially busy or non-responsive server. &lt;br /&gt;
&lt;br /&gt;
==Protecting message integrity ==&lt;br /&gt;
&lt;br /&gt;
When a message is received by a web service, it must always ask two questions: “whether I trust the caller,” “whether it created this message.” Assuming that the caller trust has been established one way or another, the server has to be assured that the message it is looking at was indeed issued by the caller, and not altered along the way (intentionally or not). This may affect technical qualities of a SOAP message, such as the message’s timestamp, or business content, such as the amount to be withdrawn from the bank account. Obviously, neither change should go undetected by the server.&lt;br /&gt;
&lt;br /&gt;
In communication protocols, there are usually some mechanisms like checksum applied to ensure packet’s integrity. This would not be sufficient, however, in the realm of publicly exposed Web Services, since checksums (or digests, their cryptographic equivalents) are easily replaceable and cannot be reliably tracked back to the issuer. The required association may be established by utilizing HMAC, or by combining message digests with either cryptographic signatures or with secret key-encryption (assuming the keys are only known to the two communicating parties) to ensure that any change will immediately result in a cryptographic error.&lt;br /&gt;
&lt;br /&gt;
==Protecting message confidentiality ==&lt;br /&gt;
&lt;br /&gt;
Oftentimes, it is not sufficient to ensure the integrity – in many cases it is also desirable that nobody can see the data that is passed around and/or stored locally. It may apply to the entire message being processed, or only to certain parts of it – in either case, some type of encryption is required to conceal the content. Normally, symmetric encryption algorithms are used to encrypt bulk data, since it is significantly faster than the asymmetric ones. Asymmetric encryption is then applied to protect the symmetric session keys, which, in many implementations, are valid for one communication only and are subsequently discarded.&lt;br /&gt;
&lt;br /&gt;
Applying encryption requires conducting an extensive setup work, since the communicating parties now have to be aware of which keys they can trust, deal with certificate and key validation, and know which keys should be used for communication.&lt;br /&gt;
&lt;br /&gt;
In many cases, encryption is combined with signatures to provide both integrity and confidentiality. Normally, signing keys are different from the encrypting ones, primarily because of their different lifecycles – signing keys are permanently associated with their owners, while encryption keys may be invalidated after the message exchange. Another reason may be separation of business responsibilities - the signing authority (and the corresponding key) may belong to one department or person, while encryption keys are generated by the server controlled by members of IT department. &lt;br /&gt;
&lt;br /&gt;
==Access control ==&lt;br /&gt;
&lt;br /&gt;
After message has been received and successfully validated, the server must decide:&lt;br /&gt;
&lt;br /&gt;
* Does it know who is requesting the operation (Identification)&lt;br /&gt;
&lt;br /&gt;
* Does it trust the caller’s identity claim (Authentication)&lt;br /&gt;
&lt;br /&gt;
* Does it allow the caller to perform this operation (Authorization)&lt;br /&gt;
&lt;br /&gt;
There is not much WS-specific activity that takes place at this stage – just several new ways of passing the credentials for authentication. Most often, authorization (or entitlement) tasks occur completely outside of the Web Service implementation, at the Policy Server that protects the whole domain.&lt;br /&gt;
&lt;br /&gt;
There is another significant problem here – the traditional HTTP firewalls do not help at stopping attacks at the Web Services. An organization would need a XML/SOAP firewall, which is capable of conducting application-level analysis of the web server’s traffic and make intelligent decision about passing SOAP messages to their destination. The reader would need to refer to other books and publications on this very important topic, as it is impossible to cover it within just one chapter.&lt;br /&gt;
&lt;br /&gt;
==Audit ==&lt;br /&gt;
&lt;br /&gt;
A common task, typically required from the audits, is reconstructing the chain of events that led to a certain problem. Normally, this would be achieved by saving server logs in a secure location, available only to the IT administrators and system auditors, in order to create what is commonly referred to as “audit trail”. Web Services are no exception to this practice, and follow the general approach of other types of Web Applications.&lt;br /&gt;
&lt;br /&gt;
Another auditing goal is non-repudiation, meaning that a message can be verifiably traced back to the caller. Following the standard legal practice, electronic documents now require some form of an “electronic signature”, but its definition is extremely broad and can mean practically anything – in many cases, entering your name and birthday qualifies as an e-signature.&lt;br /&gt;
&lt;br /&gt;
As far as the WS are concerned, such level of protection would be insufficient and easily forgeable. The standard practice is to require cryptographic digital signatures over any content that has to be legally binding – if a document with such a signature is saved in the audit log, it can be reliably traced to the owner of the signing key. &lt;br /&gt;
&lt;br /&gt;
==Web Services Security Hierarchy ==&lt;br /&gt;
&lt;br /&gt;
Technically speaking, Web Services themselves are very simple and versatile – XML-based communication, described by an XML-based grammar, called Web Services Description Language (WSDL, see &amp;lt;u&amp;gt;http://www.w3.org/TR/2005/WD-wsdl20-20050510&amp;lt;/u&amp;gt;), which binds abstract service interfaces, consisting of messages, expressed as XML Schema, and operations, to the underlying wire format. Although it is by no means a requirement, the format of choice is currently SOAP over HTTP. This means that Web Service interfaces are described in terms of the incoming and outgoing SOAP messages, transmitted over HTTP protocol.&lt;br /&gt;
&lt;br /&gt;
===Standards committees ===&lt;br /&gt;
&lt;br /&gt;
Before reviewing the individual standards, it is worth taking a brief look at the organizations, which are developing and promoting them. There are quite a few industry-wide groups and consortiums working in this area, most important of which are listed below. &lt;br /&gt;
&lt;br /&gt;
W3C (see &amp;lt;u&amp;gt;http://www.w3.org&amp;lt;/u&amp;gt;) is the most well known industry group, which owns many Web-related standards and develops them in Working Group format. Of particular interest to this chapter are XML Schema, SOAP, XML-dsig, XML-enc, and WSDL standards (called recommendations in the W3C’s jargon).&lt;br /&gt;
&lt;br /&gt;
OASIS (see &amp;lt;u&amp;gt;http://www.oasis-open.org&amp;lt;/u&amp;gt;) mostly deals with Web Service-specific standards, not necessarily security-related. It also operates on a committee basis, forming so-called Technical Committees (TC) for the standards that it is going to be developing. Of interest for this discussion, OASIS owns WS-Security and SAML standards. &lt;br /&gt;
&lt;br /&gt;
Web Services Interoperability Organization (WS-I, see &amp;lt;u&amp;gt;http://www.ws-i.org/&amp;lt;/u&amp;gt;) was formed to promote general framework for interoperable Web Services. Mostly its work consists of taking other broadly accepted standards, and develop so-called profiles, or set of requirements for conforming Web Service implementations. In particular, its Basic Security Profile (BSP) relies on the OASIS’ WS-Security standard and specifies sets of optional and required security features in Web Services that claim interoperability.&lt;br /&gt;
&lt;br /&gt;
Liberty Alliance (LA, see &amp;lt;u&amp;gt;http://projectliberty.org&amp;lt;/u&amp;gt;) consortium was formed to develop and promote an interoperable Identity Federation framework. Although this framework is not strictly Web Service-specific, but rather general, it is important for this topic because of its close relation with the SAML standard developed by OASIS. &lt;br /&gt;
&lt;br /&gt;
Besides the previously listed organizations, there are other industry associations, both permanently established and short-lived, which push forward various Web Service security activities. They are usually made up of software industry’s leading companies, such as Microsoft, IBM, Verisign, BEA, Sun, and others, that join them to work on a particular issue or proposal. Results of these joint activities, once they reach certain maturity, are often submitted to standardizations committees as a basis for new industry standards.&lt;br /&gt;
&lt;br /&gt;
==SOAP ==&lt;br /&gt;
&lt;br /&gt;
Simple Object Access Protocol (SOAP, see &amp;lt;u&amp;gt;http://www.w3.org/TR/2003/REC-soap12-part1-20030624/&amp;lt;/u&amp;gt;) provides an XML-based framework for exchanging structured and typed information between peer services. This information, formatted into Header and Body, can theoretically be transmitted over a number of transport protocols, but only HTTP binding has been formally defined and is in active use today. SOAP provides for Remote Procedure Call-style (RPC) interactions, similar to remote function calls, and Document-style communication, with message contents based exclusively on XML Schema definitions in the Web Service’s WSDL. Invocation results may be optionally returned in the response message, or a Fault may be raised, which is roughly equivalent to using exceptions in traditional programming languages.&lt;br /&gt;
&lt;br /&gt;
SOAP protocol, while defining the communication framework, provides no help in terms of securing message exchanges – the communications must either happen over secure channels, or use protection mechanisms described later in this chapter. &lt;br /&gt;
&lt;br /&gt;
===XML security specifications (XML-dsig &amp;amp; Encryption) ===&lt;br /&gt;
&lt;br /&gt;
XML Signature (XML-dsig, see &amp;lt;u&amp;gt;http://www.w3.org/TR/2002/REC-xmldsig-core-20020212&amp;lt;/u&amp;gt;/), and XML Encryption (XML-enc, see &amp;lt;u&amp;gt;http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/&amp;lt;/u&amp;gt;) add cryptographic protection to plain XML documents. These specifications add integrity, message and signer authentication, as well as support for encryption/decryption of whole XML documents or only of some elements inside them. &lt;br /&gt;
&lt;br /&gt;
The real value of those standards comes from the highly flexible framework developed to reference the data being processed (both internal and external relative to the XML document), refer to the secret keys and key pairs, and to represent results of signing/encrypting operations as XML, which is added to/substituted in the original document.&lt;br /&gt;
&lt;br /&gt;
However, by themselves, XML-dsig and XML-enc do not solve the problem of securing SOAP-based Web Service interactions, since the client and service first have to agree on the order of those operations, where to look for the signature, how to retrieve cryptographic tokens, which message elements should be signed and encrypted, how long a message is considered to be valid, and so on. These issues are addressed by the higher-level specifications, reviewed in the following sections.&lt;br /&gt;
&lt;br /&gt;
===Security specifications ===&lt;br /&gt;
&lt;br /&gt;
In addition to the above standards, there is a broad set of security-related specifications being currently developed for various aspects of Web Service operations. &lt;br /&gt;
&lt;br /&gt;
One of them is SAML, which defines how identity, attribute, and authorization assertions should be exchanged among participating services in a secure and interoperable way. &lt;br /&gt;
&lt;br /&gt;
A broad consortium, headed by Microsoft and IBM, with the input from Verisign, RSA Security, and other participants, developed a family of specifications, collectively known as “Web Services Roadmap”. Its foundation, WS-Security, has been submitted to OASIS and became an OASIS standard in 2004. Other important specifications from this family are still found in different development stages, and plans for their submission have not yet been announced, although they cover such important issues as security policies (WS-Policy et al), trust issues and security token exchange (WS-Trust), establishing context for secure conversation (WS-SecureConversation). One of the specifications in this family, WS-Federation, directly competes with the work being done by the LA consortium, and, although it is supposed to be incorporated into the Longhorn release of Windows, its future is not clear at the moment, since it has been significantly delayed and presently does not have industry momentum behind it.&lt;br /&gt;
&lt;br /&gt;
==WS-Security Standard ==&lt;br /&gt;
&lt;br /&gt;
WS-Security specification (WSS) was originally developed by Microsoft, IBM, and Verisign as part of a “Roadmap”, which was later renamed to Web Services Architecture, or WSA. WSS served as the foundation for all other specifications in this domain, creating a basic infrastructure for developing message-based security exchange. Because of its importance for establishing interoperable Web Services, it was submitted to OASIS and, after undergoing the required committee process, became an officially accepted standard. Current version is 1.0, and the work on the version 1.1 of the specification is under way and is expected to be finishing in the second half of 2005.&lt;br /&gt;
&lt;br /&gt;
===Organization of the standard ===&lt;br /&gt;
&lt;br /&gt;
The WSS standard itself deals with several core security areas, leaving many details to so-called profile documents. The core areas, broadly defined by the standard, are: &lt;br /&gt;
&lt;br /&gt;
* Ways to add security headers (WSSE Header) to SOAP Envelopes&lt;br /&gt;
&lt;br /&gt;
* Attachment of security tokens and credentials to the message &lt;br /&gt;
&lt;br /&gt;
* Inserting a timestamp&lt;br /&gt;
&lt;br /&gt;
* Signing the message&lt;br /&gt;
&lt;br /&gt;
* Encrypting the message	&lt;br /&gt;
&lt;br /&gt;
* Extensibility&lt;br /&gt;
&lt;br /&gt;
Flexibility of the WS-Security standard lies in its extensibility, so that it remains adaptable to new types of security tokens and protocols that are being developed. This flexibility is achieved by defining additional profiles for inserting new types of security tokens into the WSS framework. While the signing and encrypting parts of the standards are not expected to require significant changes (only when the underlying XML-dsig and XML-enc are updated), the types of tokens, passed in WSS messages, and ways of attaching them to the message may vary substantially. At the high level the WSS standard defines three types of security tokens, attachable to a WSS Header: Username/password, Binary, and XML tokens. Each of those types is further specified in one (or more) profile document, which defines additional token’s attributes and elements, needed to represent a particular type of security token. &lt;br /&gt;
&lt;br /&gt;
[[Image:WSS_Specification_Hierarchy.gif|Figure 4: WSS specification hierarchy]]&lt;br /&gt;
&lt;br /&gt;
===Purpose ===&lt;br /&gt;
&lt;br /&gt;
The primary goal of the WSS standard is providing tools for message-level communication protection, whereas each message represents an isolated piece of information, carrying enough security data to verify all important message properties, such as: authenticity, integrity, freshness, and to initiate decryption of any encrypted message parts. This concept is a stark contrast to the traditional channel security, which methodically applies pre-negotiated security context to the whole stream, as opposed to the selective process of securing individual messages in WSS. In the Roadmap, that type of service is eventually expected to be provided by implementations of standards like WS-SecureConversation.&lt;br /&gt;
&lt;br /&gt;
From the beginning, the WSS standard was conceived as a message-level toolkit for securely delivering data for higher level protocols. Those protocols, based on the standards like WS-Policy, WS-Trust, Liberty Alliance, rely on the transmitted tokens to implement access control policies, token exchange, and other types of protection and integration. However, taken alone, the WSS standard does not mandate any specific security properties, and an ad-hoc application of its constructs can lead to subtle security vulnerabilities and hard to detect problems, as is also discussed in later sections of this chapter.&lt;br /&gt;
&lt;br /&gt;
==WS-Security Building Blocks ==&lt;br /&gt;
&lt;br /&gt;
The WSS standard actually consists of a number of documents – one core document, which defines how security headers may be included into SOAP envelope and describes all high-level blocks, which must be present in a valid security header. Profile documents have the dual task of extending definitions for the token types they are dealing with, providing additional attributes, elements, as well as defining relationships left out of the core specification, such as using attachments.&lt;br /&gt;
&lt;br /&gt;
Core WSS 1.1 specification, located at &amp;lt;u&amp;gt;http://www.oasis-open.org/committees/download.php/16790/wss-v1.1-spec-os-SOAPMessageSecurity.pdf&amp;lt;/u&amp;gt;, defines several types of security tokens (discussed later in this section – see 0), ways to reference them, timestamps, and ways to apply XML-dsig and XML-enc in the security headers – see the XML Dsig section for more details about their general structure.&lt;br /&gt;
&lt;br /&gt;
Associated specifications are:&lt;br /&gt;
&lt;br /&gt;
* Username token profile 1.1, located at &amp;lt;u&amp;gt;http://www.oasis-open.org/committees/download.php/16782/wss-v1.1-spec-os-UsernameTokenProfile.pdf&amp;lt;/u&amp;gt;, which adds various password-related extensions to the basic UsernameToken from the core specification&lt;br /&gt;
&lt;br /&gt;
* X.509 token profile 1.1, located at &amp;lt;u&amp;gt;http://www.oasis-open.org/committees/download.php/16785/wss-v1.1-spec-os-x509TokenProfile.pdf&amp;lt;/u&amp;gt; which specifies, how X.509 certificates may be passed in the BinarySecurityToken, specified by the core document&lt;br /&gt;
&lt;br /&gt;
* SAML Token profile 1.1, located at &amp;lt;u&amp;gt;http://www.oasis-open.org/committees/download.php/16768/wss-v1.1-spec-os-SAMLTokenProfile.pdf&amp;lt;/u&amp;gt; that specifies how XML-based SAML tokens can be inserted into WSS headers.&lt;br /&gt;
&lt;br /&gt;
*  Kerberos Token Profile 1.1, located at &amp;lt;u&amp;gt;http://www.oasis-open.org/committees/download.php/16788/wss-v1.1-spec-os-KerberosTokenProfile.pdf&amp;lt;/u&amp;gt; that defines how to encode Kerberos tickets and attach them to SOAP messages.&lt;br /&gt;
&lt;br /&gt;
* Rights Expression Language (REL) Token Profile 1.1, located at &amp;lt;u&amp;gt;http://www.oasis-open.org/committees/download.php/16687/oasis-wss-rel-token-profile-1.1.pdf&amp;lt;/u&amp;gt; that describes the use of ISO/IEC 21000-5 Rights Expressions with respect to the WS-Security specification.&lt;br /&gt;
&lt;br /&gt;
* SOAP with Attachments (SWA) Profile 1.1, located at &amp;lt;u&amp;gt;http://www.oasis-open.org/committees/download.php/16672/wss-v1.1-spec-os-SwAProfile.pdf&amp;lt;/u&amp;gt; that describes how to use WSS-Sec with SOAP Messages with Attachments.&lt;br /&gt;
&lt;br /&gt;
===How data is passed ===&lt;br /&gt;
&lt;br /&gt;
WSS security specification deals with two distinct types of data: security information, which includes security tokens, signatures, digests, etc; and message data, i.e. everything else that is passed in the SOAP message. Being an XML-based standard, WSS works with textual information grouped into XML elements. Any binary data, such as cryptographic signatures or Kerberos tokens, has to go through a special transform, called Base64 encoding/decoding, which provides straightforward conversion from binary to ASCII formats and back. Example below demonstrates how binary data looks like in the encoded format:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''cCBDQTAeFw0wNDA1MTIxNjIzMDRaFw0wNTA1MTIxNjIzMDRaMG8xCz''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After encoding a binary element, an attribute with the algorithm’s identifier is added to the XML element carrying the data, so that the receiver would know to apply the correct decoder to read it. These identifiers are defined in the WSS specification documents.&lt;br /&gt;
&lt;br /&gt;
===Security header’s structure ===&lt;br /&gt;
&lt;br /&gt;
A security header in a message is used as a sort of an envelope around a letter – it seals and protects the letter, but does not care about its content. This “indifference” works in the other direction as well, as the letter (SOAP message) should not know, nor should it care about its envelope (WSS Header), since the different units of information, carried on the envelope and in the letter, are presumably targeted at different people or applications.&lt;br /&gt;
&lt;br /&gt;
A SOAP Header may actually contain multiple security headers, as long as they are addressed to different actors (for SOAP 1.1), or roles (for SOAP 1.2). Their contents may also be referring to each other, but such references present a very complicated logistical problem for determining the proper order of decryptions/signature verifications, and should generally be avoided. WSS security header itself has a loose structure, as the specification itself does not require any elements to be present – so, the minimalist header with an empty message will look like:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;soap:Envelope xmlns:soap=&amp;quot;http://schemas.xmlsoap.org/soap/envelope/&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''    &amp;lt;soap:Header&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''        &amp;lt;wsse:Security xmlns:wsse=&amp;quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd&amp;quot; xmlns:wsu=&amp;quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd&amp;quot; soap:mustUnderstand=&amp;quot;1&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''        ''&lt;br /&gt;
&lt;br /&gt;
''        &amp;lt;/wsse:Security&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''    &amp;lt;/soap:Header&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''    &amp;lt;soap:Body&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''    &amp;lt;/soap:Body&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;/soap:Envelope&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, to be useful, it must carry some information, which is going to help securing the message. It means including one or more security tokens (see 0) with references, XML Signature, and XML Encryption elements, if the message is signed and/or encrypted. So, a typical header will look more like the following picture: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;soap:Envelope xmlns:soap=&amp;quot;http://schemas.xmlsoap.org/soap/envelope/&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''  &amp;lt;soap:Header&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''    &amp;lt;wsse:Security xmlns=&amp;quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd&amp;quot; xmlns:wsse=&amp;quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd&amp;quot; xmlns:wsu=&amp;quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd&amp;quot; soap:mustUnderstand=&amp;quot;1&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;wsse:BinarySecurityToken EncodingType=&amp;quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary&amp;quot; ValueType=&amp;quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3&amp;quot; wsu:Id=&amp;quot;aXhOJ5&amp;quot;&amp;gt;MIICtzCCAi... ''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;/wsse:BinarySecurityToken&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;xenc:EncryptedKey xmlns:xenc=&amp;quot;http://www.w3.org/2001/04/xmlenc#&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''        &amp;lt;xenc:EncryptionMethod Algorithm=&amp;quot;http://www.w3.org/2001/04/xmlenc#rsa-1_5&amp;quot;/&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	&amp;lt;dsig:KeyInfo xmlns:dsig=&amp;quot;http://www.w3.org/2000/09/xmldsig#&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	  &amp;lt;wsse:SecurityTokenReference&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	    &amp;lt;wsse:Reference URI=&amp;quot;#aXhOJ5&amp;quot; ValueType=&amp;quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3&amp;quot;/&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	  &amp;lt;/wsse:SecurityTokenReference&amp;gt;  ''&lt;br /&gt;
&lt;br /&gt;
''	&amp;lt;/dsig:KeyInfo&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''  	&amp;lt;xenc:CipherData&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''  	  &amp;lt;xenc:CipherValue&amp;gt;Nb0Mf...&amp;lt;/xenc:CipherValue&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''  	&amp;lt;/xenc:CipherData&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''  	&amp;lt;xenc:ReferenceList&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''  	  &amp;lt;xenc:DataReference URI=&amp;quot;#aDNa2iD&amp;quot;/&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''  	&amp;lt;/xenc:ReferenceList&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;/xenc:EncryptedKey&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;wsse:SecurityTokenReference wsu:Id=&amp;quot;aZG0sG&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	&amp;lt;wsse:KeyIdentifier ValueType=&amp;quot;http://docs.oasis-open.org/wss/2004/XX/oasis-2004XX-wss-saml-token-profile-1.0#SAMLAssertionID&amp;quot; wsu:Id=&amp;quot;a2tv1Uz&amp;quot;&amp;gt; 1106844369755&amp;lt;/wsse:KeyIdentifier&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;/wsse:SecurityTokenReference&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;saml:Assertion AssertionID=&amp;quot;1106844369755&amp;quot; IssueInstant=&amp;quot;2005-01-27T16:46:09.755Z&amp;quot; Issuer=&amp;quot;www.my.com&amp;quot; MajorVersion=&amp;quot;1&amp;quot; MinorVersion=&amp;quot;1&amp;quot; xmlns:saml=&amp;quot;urn:oasis:names:tc:SAML:1.0:assertion&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''		...				''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;/saml:Assertion&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;wsu:Timestamp wsu:Id=&amp;quot;afc6fbe-a7d8-fbf3-9ac4-f884f435a9c1&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	&amp;lt;wsu:Created&amp;gt;2005-01-27T16:46:10Z&amp;lt;/wsu:Created&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	&amp;lt;wsu:Expires&amp;gt;2005-01-27T18:46:10Z&amp;lt;/wsu:Expires&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;/wsu:Timestamp&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;dsig:Signature xmlns:dsig=&amp;quot;http://www.w3.org/2000/09/xmldsig#&amp;quot; Id=&amp;quot;sb738c7&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	&amp;lt;dsig:SignedInfo Id=&amp;quot;obLkHzaCOrAW4kxC9az0bLA22&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''		...''&lt;br /&gt;
&lt;br /&gt;
''	  &amp;lt;dsig:Reference URI=&amp;quot;#s91397860&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''		...									''&lt;br /&gt;
&lt;br /&gt;
''            &amp;lt;dsig:DigestValue&amp;gt;5R3GSp+OOn17lSdE0knq4GXqgYM=&amp;lt;/dsig:DigestValue&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	  &amp;lt;/dsig:Reference&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	  &amp;lt;/dsig:SignedInfo&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	  &amp;lt;dsig:SignatureValue Id=&amp;quot;a9utKU9UZk&amp;quot;&amp;gt;LIkagbCr5bkXLs8l...&amp;lt;/dsig:SignatureValue&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	  &amp;lt;dsig:KeyInfo&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	  &amp;lt;wsse:SecurityTokenReference&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	    &amp;lt;wsse:Reference URI=&amp;quot;#aXhOJ5&amp;quot; ValueType=&amp;quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3&amp;quot;/&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	  &amp;lt;/wsse:SecurityTokenReference&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''        &amp;lt;/dsig:KeyInfo&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;/dsig:Signature&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''    &amp;lt;/wsse:Security&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''  &amp;lt;/soap:Header&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''  &amp;lt;soap:Body xmlns:wsu=&amp;quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd&amp;quot; wsu:Id=&amp;quot;s91397860&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''    &amp;lt;xenc:EncryptedData xmlns:xenc=&amp;quot;http://www.w3.org/2001/04/xmlenc#&amp;quot; Id=&amp;quot;aDNa2iD&amp;quot; Type=&amp;quot;http://www.w3.org/2001/04/xmlenc#Content&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;xenc:EncryptionMethod Algorithm=&amp;quot;http://www.w3.org/2001/04/xmlenc#tripledes-cbc&amp;quot;/&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;xenc:CipherData&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	&amp;lt;xenc:CipherValue&amp;gt;XFM4J6C...&amp;lt;/xenc:CipherValue&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;/xenc:CipherData&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''    &amp;lt;/xenc:EncryptedData&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''  &amp;lt;/soap:Body&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;/soap:Envelope&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Types of tokens ===&lt;br /&gt;
&lt;br /&gt;
A WSS Header may have the following types of security tokens in it:&lt;br /&gt;
&lt;br /&gt;
* Username token&lt;br /&gt;
&lt;br /&gt;
Defines mechanisms to pass username and, optionally, a password - the latter is described in the username profile document. Unless whole token is encrypted, a message which includes a clear-text password should always be transmitted via a secured channel. In situations where the target Web Service has access to clear-text passwords for verification (this might not be possible with LDAP or some other user directories, which do not return clear-text passwords), using a hashed version with nonce and a timestamp is generally preferable. The profile document defines an unambiguous algorithm for producing password hash: &lt;br /&gt;
&lt;br /&gt;
''Password_Digest = Base64 ( SHA-1 ( nonce + created + password ) )''&lt;br /&gt;
&lt;br /&gt;
* Binary token&lt;br /&gt;
&lt;br /&gt;
They are used to convey binary data, such as X.509 certificates, in a text-encoded format, Base64 by default. The core specification defines BinarySecurityToken element, while profile documents specify additional attributes and sub-elements to handle attachment of various tokens. Presently, both the X.509 and the Kerberos profiles have been adopted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;wsse:BinarySecurityToken EncodingType=&amp;quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary&amp;quot; ValueType=&amp;quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3&amp;quot; wsu:Id=&amp;quot;aXhOJ5&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''        MIICtzCCAi...''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;/wsse:BinarySecurityToken&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* XML token&lt;br /&gt;
&lt;br /&gt;
These are meant for any kind of XML-based tokens, but primarily – for SAML assertions. The core specification merely mentions the possibility of inserting such tokens, leaving all details to the profile documents. At the moment, SAML 1.1 profile has been accepted by OASIS.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''	&amp;lt;saml:Assertion AssertionID=&amp;quot;1106844369755&amp;quot; IssueInstant=&amp;quot;2005-01-27T16:46:09.755Z&amp;quot; Issuer=&amp;quot;www.my.com&amp;quot; MajorVersion=&amp;quot;1&amp;quot; MinorVersion=&amp;quot;1&amp;quot; xmlns:saml=&amp;quot;urn:oasis:names:tc:SAML:1.0:assertion&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''		...				''&lt;br /&gt;
&lt;br /&gt;
''	&amp;lt;/saml:Assertion&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Although technically it is not a security token, a Timestamp element may be inserted into a security header to ensure message’s freshness. See the further reading section for a design pattern on this.&lt;br /&gt;
&lt;br /&gt;
===Referencing message parts ===&lt;br /&gt;
&lt;br /&gt;
In order to retrieve security tokens, passed in the message, or to identify signed and encrypted message parts, the core specification adopts usage of a special attribute, wsu:Id. The only requirement on this attribute is that the values of such IDs should be unique within the scope of XML document where they are defined. Its application has a significant advantage for the intermediate processors, as it does not require understanding of the message’s XML Schema. Unfortunately, XML Signature and Encryption specifications do not allow for attribute extensibility (i.e. they have closed schema), so, when trying to locate signature or encryption elements, local IDs of the Signature and Encryption elements must be considered first.&lt;br /&gt;
&lt;br /&gt;
WSS core specification also defines a general mechanism for referencing security tokens via SecurityTokenReference element. An example of such element, referring to a SAML assertion in the same header, is provided below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''	&amp;lt;wsse:SecurityTokenReference wsu:Id=&amp;quot;aZG0sGbRpXLySzgM1X6aSjg22&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	  &amp;lt;wsse:KeyIdentifier ValueType=&amp;quot;http://docs.oasis-open.org/wss/2004/XX/oasis-2004XX-wss-saml-token-profile-1.0#SAMLAssertionID&amp;quot; wsu:Id=&amp;quot;a2tv1Uz&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''            1106844369755''&lt;br /&gt;
&lt;br /&gt;
''          &amp;lt;/wsse:KeyIdentifier&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	&amp;lt;/wsse:SecurityTokenReference&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As this element was designed to refer to pretty much any possible token type (including encryption keys, certificates, SAML assertions, etc) both internal and external to the WSS Header, it is enormously complicated. The specification recommends using two of its possible four reference types – Direct References (by URI) and Key Identifiers (some kind of token identifier). Profile documents (SAML, X.509 for instance) provide additional extensions to these mechanisms to take advantage of specific qualities of different token types.&lt;br /&gt;
&lt;br /&gt;
==Communication Protection Mechanisms ==&lt;br /&gt;
&lt;br /&gt;
As was already explained earlier (see 0), channel security, while providing important services, is not a panacea, as it does not solve many of the issues facing Web Service developers. WSS helps addressing some of them at the SOAP message level, using the mechanisms described in the sections below.&lt;br /&gt;
&lt;br /&gt;
===Integrity ===&lt;br /&gt;
&lt;br /&gt;
WSS specification makes use of the XML-dsig standard to ensure message integrity, restricting its functionality in certain cases; for instance, only explicitly referenced elements can be signed (i.e. no Embedding or Embedded signature modes are allowed). Prior to signing an XML document, a transformation is required to create its canonical representation, taking into account the fact that XML documents can be represented in a number of semantically equivalent ways. There are two main transformations defined by the XML Digital Signature WG at W3C, Inclusive and Exclusive Canonicalization Transforms (C14N and EXC-C14N), which differ in the way namespace declarations are processed. The WSS core specification specifically recommends using EXC-C14N, as it allows copying signed XML content into other documents without invalidating the signature.&lt;br /&gt;
&lt;br /&gt;
In order to provide a uniform way of addressing signed tokens, WSS adds a Security Token Reference (STR) Dereference Transform option, which is comparable with dereferencing a pointer to an object of specific data type in programming languages. Similarly, in addition to the XML Signature-defined ways of addressing signing keys, WSS allows for references to signing security tokens through the STR mechanism (explained in 0), extended by token profiles to accommodate specific token types. A typical signature example is shown in an earlier sample in the section 0.&lt;br /&gt;
&lt;br /&gt;
Typically, a XML signature is applied to secure elements such as SOAP Body and the timestamp, as well as any user credentials, passed in the request. There is an interesting twist when a particular element is both signed and encrypted, since these operations may follow (even repeatedly) in any order, and knowledge of their ordering is required for signature verification. To address this issue, the WSS core specification requires that each new element is pre-pended to the security header, thus defining the “natural” order of operations. A particularly nasty problem arises when there are several security headers in a single SOAP message, using overlapping signature and encryption blocks, as there is nothing in this case that would point to the right order of operations.&lt;br /&gt;
&lt;br /&gt;
===Confidentiality ===&lt;br /&gt;
&lt;br /&gt;
For its confidentiality protection, WSS relies on yet another standard, XML Encryption. Similarly to XML-dsig, this standard operates on selected elements of the SOAP message, but it then replaces the encrypted element’s data with a &amp;lt;xenc:EncryptedData&amp;gt; sub-element carrying the encrypted bytes. For encryption efficiency, the specification recommends using a unique key, which is then encrypted by the recipient’s public key and pre-pended to the security header in a &amp;lt;xenc:EncryptedKey&amp;gt; element. A SOAP message with encrypted body is shown in the section 0.&lt;br /&gt;
&lt;br /&gt;
===Freshness ===&lt;br /&gt;
&lt;br /&gt;
SOAP messages’ freshness is addressed via timestamp mechanism – each security header may contain just one such element, which states, in UTC time and using the UTC time format, creation and expiration moments of the security header. It is important to realize that the timestamp is applied to the WSS Header, not to the SOAP message itself, since the latter may contain multiple security headers, each with a different timestamp. There is an unresolved problem with this “single timestampt” approach, since, once the timestamp is created and signed, it is impossible to update it without breaking existing signatures, even in case of a legitimate change in the WSS Header.&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;wsu:Timestamp wsu:Id=&amp;quot;afc6fbe-a7d8-fbf3-9ac4-f884f435a9c1&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	&amp;lt;wsu:Created&amp;gt;2005-01-27T16:46:10Z&amp;lt;/wsu:Created&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''	&amp;lt;wsu:Expires&amp;gt;2005-01-27T18:46:10Z&amp;lt;/wsu:Expires&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''      &amp;lt;/wsu:Timestamp&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
If a timestamp is included in a message, it is typically signed to prevent tampering and replay attacks. There is no mechanism foreseen to address clock synchronization issue (which, as was already point out earlier, is generally not an issue in modern day systems) – this has to be addressed out-of-band as far as the WSS mechanics is concerned. See the further reading section for a design pattern addressing this issue.&lt;br /&gt;
&lt;br /&gt;
==Access Control Mechanisms ==&lt;br /&gt;
&lt;br /&gt;
When it comes to access control decisions, Web Services do not offer specific protection mechanisms by themselves – they just have the means to carry the tokens and data payloads in a secure manner between source and destination SOAP endpoints. &lt;br /&gt;
&lt;br /&gt;
For more complete description of access control tasks, please, refer to other sections of this Guide.&lt;br /&gt;
&lt;br /&gt;
===Identification ===&lt;br /&gt;
&lt;br /&gt;
Identification represents a claim to have certain identity, which is expressed by attaching certain information to the message. This can be a username, a SAML assertion, a Kerberos ticket, or any other piece of information, from which the service can infer who the caller claims to be. &lt;br /&gt;
&lt;br /&gt;
WSS represents a very good way to convey this information, as it defines an extensible mechanism for attaching various token types to a message (see 0). It is the receiver’s job to extract the attached token and figure out which identity it carries, or to reject the message if it can find no acceptable token in it.&lt;br /&gt;
&lt;br /&gt;
===Authentication ===&lt;br /&gt;
&lt;br /&gt;
Authentication can come in two flavors – credentials verification or token validation. The subtle difference between the two is that tokens are issued after some kind of authentication has already happened prior to the current invocation, and they usually contain user’s identity along with the proof of its integrity. &lt;br /&gt;
&lt;br /&gt;
WSS offers support for a number of standard authentication protocols by defining binding mechanism for transmitting protocol-specific tokens and reliably linking them to the sender. However, the mechanics of proof that the caller is who he claims to be is completely at the Web Service’s discretion. Whether it takes the supplied username and password’s hash and checks it against the backend user store, or extracts subject name from the X.509 certificate used for signing the message, verifies the certificate chain and looks up the user in its store – at the moment, there are no requirements or standards which would dictate that it should be done one way or another. &lt;br /&gt;
&lt;br /&gt;
===Authorization ===&lt;br /&gt;
&lt;br /&gt;
XACML may be used for expressing authorization rules, but its usage is not Web Service-specific – it has much broader scope. So, whatever policy or role-based authorization mechanism the host server already has in place will most likely be utilized to protect the deployed Web Services deployed as well. &lt;br /&gt;
&lt;br /&gt;
Depending on the implementation, there may be several layers of authorization involved at the server. For instance, JSRs 224 (JAX-RPC 2.0) and 109 (Implementing Enterprise Web Services), which define Java binding for Web Services, specify implementing Web Services in J2EE containers. This means that when a Web Service is accessed, there will be a URL authorization check executed by the J2EE container, followed by a check at the Web Service layer for the Web Service-specific resource. Granularity of such checks is implementation-specific and is not dictated by any standards. In the Windows universe it happens in a similar fashion, since IIS is going to execute its access checks on the incoming HTTP calls before they reach the ASP.NET runtime, where SOAP message is going to be further decomposed and analyzed.&lt;br /&gt;
&lt;br /&gt;
===Policy Agreement ===&lt;br /&gt;
&lt;br /&gt;
Normally, Web Services’ communication is based on the endpoint’s public interface, defined in its WSDL file. This descriptor has sufficient details to express SOAP binding requirements, but it does not define any security parameters, leaving Web Service developers struggling to find out-of-band mechanisms to determine the endpoint’s security requirements. &lt;br /&gt;
&lt;br /&gt;
To make up for these shortcomings, WS-Policy specification was conceived as a mechanism for expressing complex policy requirements and qualities, sort of WSDL on steroids. Through the published policy SOAP endpoints can advertise their security requirements, and their clients can apply appropriate measures of message protection to construct the requests. The general WS-Policy specification (actually comprised of three separate documents) also has extensions for specific policy types, one of them – for security, WS-SecurityPolicy.&lt;br /&gt;
&lt;br /&gt;
If the requestor does not possess the required tokens, it can try obtaining them via trust mechanism, using WS-Trust-enabled services, which are called to securely exchange various token types for the requested identity. &lt;br /&gt;
&lt;br /&gt;
[[Image: Using Trust Service.gif|Figure 5. Using Trust service]]&lt;br /&gt;
&lt;br /&gt;
Unfortunately, both WS-Policy and WS-Trust specifications have not been submitted for standardization to public bodies, and their development is progressing via private collaboration of several companies, although it was opened up for other participants as well. As a positive factor, there have been several interoperability events conducted for these specifications, so the development process of these critical links in the Web Services’ security infrastructure is not a complete black box.&lt;br /&gt;
&lt;br /&gt;
==Forming Web Service Chains ==&lt;br /&gt;
&lt;br /&gt;
Many existing or planned implementations of SOA or B2B systems rely on dynamic chains of Web Services for accomplishing various business specific tasks, from taking the orders through manufacturing and up to the distribution process. &lt;br /&gt;
&lt;br /&gt;
[[Image:Service Chain.gif|Figure 6: Service chain]]&lt;br /&gt;
&lt;br /&gt;
This is in theory. In practice, there are a lot of obstacles hidden among the way, and one of the major ones among them – security concerns about publicly exposing processing functions to intra- or Internet-based clients. &lt;br /&gt;
&lt;br /&gt;
Here is just a few of the issues that hamper Web Services interaction – incompatible authentication and authorization models for users, amount of trust between services themselves and ways of establishing such trust, maintaining secure connections, and synchronization of user directories or otherwise exchanging users’ attributes. These issues will be briefly tackled in the following paragraphs.&lt;br /&gt;
&lt;br /&gt;
===Incompatible user access control models ===&lt;br /&gt;
&lt;br /&gt;
As explained earlier, in section 0, Web Services themselves do not include separate extensions for access control, relying instead on the existing security framework. What they do provide, however, are mechanisms for discovering and describing security requirements of a SOAP service (via WS-Policy), and for obtaining appropriate security credentials via WS-Trust based services.&lt;br /&gt;
&lt;br /&gt;
===Service trust ===&lt;br /&gt;
&lt;br /&gt;
In order to establish mutual trust between client and service, they have to satisfy each other’s policy requirements. A simple and popular model is mutual certificate authentication via SSL, but it is not scalable for open service models, and supports only one authentication type. Services that require more flexibility have to use pretty much the same access control mechanisms as with users to establish each other’s identities prior to engaging in a conversation.&lt;br /&gt;
&lt;br /&gt;
===Secure connections ===&lt;br /&gt;
&lt;br /&gt;
Once trust is established it would be impractical to require its confirmation on each interaction. Instead, a secure client-server link is formed and maintained all time while client’s session is active. Again, the most popular mechanism today for maintaining such link is SSL, but it is not a Web Service-specific mechanism, and it has a number of shortcomings when applied to SOAP communication, as explained in 0.&lt;br /&gt;
&lt;br /&gt;
===Synchronization of user directories ===&lt;br /&gt;
&lt;br /&gt;
This is a very acute problem when dealing with cross-domain applications, as users’ population tends to change frequently among different domains. So, how does a service in domain B decide whether it is going to trust user’s claim that he has been already authenticated in domain A? There exist different aspects of this problem. First – a common SSO mechanism, which implies that a user is known in both domains (through synchronization, or by some other means), and authentication tokens from one domain are acceptable in another. In Web Services world, this would be accomplished by passing around a SAML or Kerberos token for a user. &lt;br /&gt;
&lt;br /&gt;
===Domain federation ===&lt;br /&gt;
&lt;br /&gt;
Another aspect of the problem is when users are not shared across domains, but merely the fact that a user with certain ID has successfully authenticated in another domain, as would be the case with several large corporations, which would like to form a partnership, but would be reluctant to share customers’ details. The decision to accept this request is then based on the inter-domain procedures, establishing special trust relationships and allowing for exchanging such opaque tokens, which would be an example of Federation relationships. Of those efforts, most notable example is Liberty Alliance project, which is now being used as a basis for SAML 2.0 specifications. The work in this area is still far from being completed, and most of the existing deployments are nothing more than POC or internal pilot projects than to real cross-companies deployments, although LA’s website does list some case studies of large-scale projects.&lt;br /&gt;
&lt;br /&gt;
==Available Implementations ==&lt;br /&gt;
&lt;br /&gt;
It is important to realize from the beginning that no security standard by itself is going to provide security to the message exchanges – it is the installed implementations, which will be assessing conformance of the incoming SOAP messages to the applicable standards, as well as appropriately securing the outgoing messages.&lt;br /&gt;
&lt;br /&gt;
===.NET – Web Service Extensions ===&lt;br /&gt;
&lt;br /&gt;
Since new standards are being developed at a rather quick pace, .NET platform is not trying to catch up immediately, but uses Web Service Extensions (WSE) instead. WSE, currently at the version 2.0, adds development and runtime support for the latest Web Service security standards to the platform and development tools, even while they are still “work in progress”. Once standards mature, their support is incorporated into new releases of the .NET platform, which is what is going to happen when .NET 2.0 finally sees the world. The next release of WSE, 3.0, is going to coincide with VS.2005 release and will take advantages of the latest innovations of .NET 2.0 platform in messaging and Web Application areas.&lt;br /&gt;
&lt;br /&gt;
Considering that Microsoft is one of the most active players in the Web Service security area and recognizing its influence in the industry, its WSE implementation is probably one of the most complete and up to date, and it is strongly advisable to run at least a quick interoperability check with WSE-secured .NET Web Service clients. If you have a Java-based Web Service, and the interoperability is a requirement (which is usually the case), in addition to the questions of security testing one needs to keep in mind the basic interoperability between Java and .NET Web Service data structures. &lt;br /&gt;
&lt;br /&gt;
This is especially important since current versions of .NET Web Service tools frequently do not cleanly handle WS-Security’s and related XML schemas as published by OASIS, so some creativity on the part of a Web Service designer is needed. That said – WSE package itself contains very rich and well-structured functionality, which can be utilized both with ASP.NET-based and standalone Web Service clients to check incoming SOAP messages and secure outgoing ones at the infrastructure level, relieving Web Service programmers from knowing these details. Among other things, WSE 2.0 supports the most recent set of WS-Policy and WS-Security profiles, providing for basic message security and WS-Trust with WS-SecureConversation. Those are needed for establishing secure exchanges and sessions - similar to what SSL does at the transport level, but applied to message-based communication.&lt;br /&gt;
&lt;br /&gt;
===Java toolkits ===&lt;br /&gt;
&lt;br /&gt;
Most of the publicly available Java toolkits work at the level of XML security, i.e. XML-dsig and XML-enc – such as IBM’s XML Security Suite and Apache’s XML Security Java project. Java’s JSR 105 and JSR 106 (still not finalized) define Java bindings for signatures and encryption, which will allow plugging the implementations as JCA providers once work on those JSRs is completed. &lt;br /&gt;
&lt;br /&gt;
Moving one level up, to address Web Services themselves, the picture becomes muddier – at the moment, there are many implementations in various stages of incompleteness. For instance, Apache is currently working on the WSS4J project, which is moving rather slowly, and there is commercial software package from Phaos (now owned by Oracle), which suffers from a lot of implementation problems.&lt;br /&gt;
&lt;br /&gt;
A popular choice among Web Service developers today is Sun’s JWSDP, which includes support for Web Service security. However, its support for Web Service security specifications in the version 1.5 is only limited to implementation of the core WSS standard with username and X.509 certificate profiles. Security features are implemented as part of the JAX-RPC framework and configuration-driven, which allows for clean separation from the Web Service’s implementation.&lt;br /&gt;
&lt;br /&gt;
===Hardware, software systems ===&lt;br /&gt;
&lt;br /&gt;
This category includes complete systems, rather than toolkits or frameworks. On one hand, they usually provide rich functionality right off the shelf, on the other hand – its usage model is rigidly constrained by the solution’s architecture and implementation. This is in contrast to the toolkits, which do not provide any services by themselves, but handing system developers necessary tools to include the desired Web Service security features in their products… or to shoot themselves in the foot by applying them inappropriately.&lt;br /&gt;
&lt;br /&gt;
These systems can be used at the infrastructure layer to verify incoming messages against the effective policy, check signatures, tokens, etc, before passing them on to the target Web Service. When applied to the outgoing SOAP messages, they act as a proxy, now altering the messages to decorate with the required security elements, sign and/or encrypt them.&lt;br /&gt;
&lt;br /&gt;
Software systems are characterized by significant configuration flexibility, but comparatively slow processing. On the bright side, they often provide high level of integration with the existing enterprise infrastructure, relying on the back-end user and policy stores to look at the credentials, extracted from the WSS header, from the broader perspective. An example of such service is TransactionMinder from the former Netegrity – a Policy Enforcement Point for Web Services behind it, layered on top of the Policy Server, which makes policy decisions by checking the extracted credentials against the configured stores and policies.&lt;br /&gt;
&lt;br /&gt;
For hardware systems, performance is the key – they have already broken gigabyte processing threshold, and allow for real-time processing of huge documents, decorated according to the variety of the latest Web Service security standards, not only WSS. The usage simplicity is another attractive point of those systems - in the most trivial cases, the hardware box may be literally dropped in, plugged, and be used right away. These qualities come with a price, however – this performance and simplicity can be achieved as long as the user stays within the pre-configured confines of the hardware box. The moment he tries to integrate with the back-end stores via callbacks (for those solutions that have this capability, since not all of them do), most of the advantages are lost. As an example of such hardware device, DataPower provides a nice XS40 XML Security Gateway, which acts both as the inbound firewall and the outbound proxy to handle XML traffic in real time.&lt;br /&gt;
&lt;br /&gt;
==Problems ==&lt;br /&gt;
&lt;br /&gt;
As is probably clear from the previous sections, Web Services are still experiencing a lot of turbulence, and it will take a while before they can really catch on. Here is a brief look at what problems surround currently existing security standards and their implementations.&lt;br /&gt;
&lt;br /&gt;
===Immaturity of the standards ===&lt;br /&gt;
&lt;br /&gt;
Most of the standards are either very recent (couple years old at most), or still being developed. Although standards development is done in committees, which, presumably, reduces risks by going through an exhaustive reviewing and commenting process, some error scenarios still slip in periodically, as no theory can possibly match the testing resulting from pounding by thousands of developers working in the real field. &lt;br /&gt;
&lt;br /&gt;
Additionally, it does not help that for political reasons some of this standards are withheld from public process, which is the case with many standards from the WSA arena (see 0), or that some of the efforts are duplicated, as was the case with LA and WS-Federation specifications.&lt;br /&gt;
&lt;br /&gt;
===Performance ===&lt;br /&gt;
&lt;br /&gt;
XML parsing is a slow task, which is an accepted reality, and SOAP processing slows it down even more. Now, with expensive cryptographic and textual conversion operations thrown into the mix, these tasks become a performance bottleneck, even with the latest crypto- and XML-processing hardware solutions offered today. All of the products currently on the market are facing this issue, and they are trying to resolve it with varying degrees of success. &lt;br /&gt;
&lt;br /&gt;
Hardware solutions, while substantially (by orders of magnitude) improving the performance, can not always be used as an optimal solution, as they can not be easily integrated with the already existing back-end software infrastructure, at least – not without making performance sacrifices. Another consideration whether hardware-based systems are the right solution – they are usually highly specialized in what they are doing, while modern Application Servers and security frameworks can usually offer a much greater variety of protection mechanisms, protecting not only Web Services, but also other deployed applications in a uniform and consistent way.&lt;br /&gt;
&lt;br /&gt;
===Complexity and interoperability ===&lt;br /&gt;
&lt;br /&gt;
As could be deduced from the previous sections, Web Service security standards are fairly complex, and have very steep learning curve associated with them. Most of the current products, dealing with Web Service security, suffer from very mediocre usability due to the complexity of the underlying infrastructure. Configuring all different policies, identities, keys, and protocols takes a lot of time and good understanding of the involved technologies, as most of the times errors that end users are seeing have very cryptic and misleading descriptions. &lt;br /&gt;
&lt;br /&gt;
In order to help administrators and reduce security risks from service misconfigurations, many companies develop policy templates, which group together best practices for protecting incoming and outgoing SOAP messages. Unfortunately, this work is not currently on the radar of any of the standard’s bodies, so it appears unlikely that such templates will be released for public use any time soon. Closest to this effort may be WS-I’s Basic Security Profile (BSP), which tries to define the rules for better interoperability among Web Services, using a subset of common security features from various security standards like WSS. However, this work is not aimed at supplying the administrators with ready for deployment security templates matching the most popular business use cases, but rather at establishing the least common denominator.&lt;br /&gt;
&lt;br /&gt;
===Key management ===&lt;br /&gt;
&lt;br /&gt;
Key management usually lies at the foundation of any other security activity, as most protection mechanisms rely on cryptographic keys one way or another. While Web Services have XKMS protocol for key distribution, local key management still presents a huge challenge in most cases, since PKI mechanism has a lot of well-documented deployment and usability issues. Those systems that opt to use homegrown mechanisms for key management run significant risks in many cases, since questions of storing, updating, and recovering secret and private keys more often than not are not adequately addressed in such solutions.&lt;br /&gt;
&lt;br /&gt;
==Further Reading ==&lt;br /&gt;
&lt;br /&gt;
* Piliptchouk, D., WS-Security in the Enterprise, O’Reilly ONJava&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.onjava.com/pub/a/onjava/2005/02/09/wssecurity.html&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.onjava.com/pub/a/onjava/2005/03/30/wssecurity2.html&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
* WS-Security OASIS site&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=wss&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
* Microsoft, ''What’s new with WSE 3.0''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://msdn.microsoft.com/webservices/webservices/building/wse/default.aspx?pull=/library/en-us/dnwse/html/newwse3.asp&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
* Eoin Keary, Preventing DOS attacks on web services&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;https://www.threatsandcountermeasures.com/wiki/default.aspx/ThreatsAndCountermeasuresCommunityKB.PreventingDOSAttacksOnWebServices&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
==Reference&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:Web Services]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Guide_Introduction&amp;diff=27739</id>
		<title>Guide Introduction</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Guide_Introduction&amp;diff=27739"/>
				<updated>2008-04-06T08:38:32Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
Welcome to the OWASP Guide 3.0! &lt;br /&gt;
&lt;br /&gt;
Web application security is an essential component of any successful project, whether open source PHP applications, web services such as straight through processing, or proprietary business web sites. Hosters (rightly) shun insecure code, and users shun insecure services that lead to fraud. &lt;br /&gt;
&lt;br /&gt;
The aim of this Guide is to allow businesses, developers, designers and solution architects to produce secure web applications. If done from the earliest stages, secure applications cost about the same to develop as insecure applications, but are far more cost effective in the long run.&lt;br /&gt;
&lt;br /&gt;
==Developing Secure Applications ==&lt;br /&gt;
&lt;br /&gt;
Unlike other forms of security (such as firewalls and secure lockdowns), web applications have the ability to make a skilled attacker rich, or make the life of a victim a complete misery. At this highest level of the OSI software map, traditional firewalls, and other controls simply do not help. The application itself must be self-defending. The Guide can help you get there. &lt;br /&gt;
&lt;br /&gt;
The Guide has been written to cover all forms of web application security issues, from old hoary chestnuts such as SQL Injection, through modern concerns such as AJAX, phishing, credit card handling, session fixation, cross-site request forgeries, compliance, and privacy issues.&lt;br /&gt;
&lt;br /&gt;
==Improvements in this edition ==&lt;br /&gt;
&lt;br /&gt;
This latest edition of the Guide builds upon the successful release of the Guide 2.0 at BlackHat Las Vegas in July 2005. With fearless editing by our publisher, No Starch Press, this edition aims to be concise and accurate. There are three new chapters, and a great deal of new content throughout. &lt;br /&gt;
&lt;br /&gt;
Each chapter is organized into roughly three sections:&lt;br /&gt;
&lt;br /&gt;
* Best practices – Practices or features every application should possess&lt;br /&gt;
* Secure patterns – Optional secure patterns, such as the best way to do password self-help&lt;br /&gt;
* Anti-patterns – if you have these in your code, you are more insecure&lt;br /&gt;
&lt;br /&gt;
==How to use this Guide ==&lt;br /&gt;
&lt;br /&gt;
This Guide is a large work as it aims for completeness. The best way to treat the Guide is as a dictionary of best practices. However, web application security is like a language – without some form of context – it is nearly impossible to speak it well. Therefore, readers are well advised to read the “Security Principles” chapter in its entirety.  &lt;br /&gt;
&lt;br /&gt;
==Updates and errata ==&lt;br /&gt;
&lt;br /&gt;
The Guide will likely have errors and deficiencies. We will publish errata on our web site from time to time if you’d like to keep your copy up to date.&lt;br /&gt;
&lt;br /&gt;
If you have any comments or suggestions on the Guide, please e-mail the Guide mail list (see our web site for details) or contact me directly. &lt;br /&gt;
&lt;br /&gt;
==With thanks ==&lt;br /&gt;
&lt;br /&gt;
I wish to extend my thanks to the many authors, reviewers, and editors for their hard work in producing this guide. We stand on the shoulders of giants, and this Guide is no exception.&lt;br /&gt;
&lt;br /&gt;
Lastly, I wish to thank No Starch Press, particularly our editors and Bill Pollock for believing in us, and bringing our community’s text into a publishable state. &lt;br /&gt;
&lt;br /&gt;
Andrew van der Stock, vanderaj@owasp.org&lt;br /&gt;
Melbourne, Australia&lt;br /&gt;
December, 2005&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Guide_to_Cryptography&amp;diff=27729</id>
		<title>Guide to Cryptography</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Guide_to_Cryptography&amp;diff=27729"/>
				<updated>2008-04-06T05:07:04Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* Cryptography */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]__TOC__&lt;br /&gt;
&lt;br /&gt;
==Objective ==&lt;br /&gt;
&lt;br /&gt;
To ensure that cryptography is safely used to protect the confidentiality and integrity of sensitive user data&lt;br /&gt;
&lt;br /&gt;
==Platforms Affected ==&lt;br /&gt;
&lt;br /&gt;
All.&lt;br /&gt;
&lt;br /&gt;
==Relevant COBIT Topics ==&lt;br /&gt;
&lt;br /&gt;
DS5.18 – Cryptographic key management&lt;br /&gt;
&lt;br /&gt;
==Description ==&lt;br /&gt;
&lt;br /&gt;
Initially confined to the realms of academia and the military, cryptography has become ubiquitous thanks to the Internet. Common every day uses of cryptography include mobile phones, passwords, SSL, smart cards, and DVDs. Cryptography has permeated everyday life, and is heavily used by many web applications.&lt;br /&gt;
&lt;br /&gt;
Cryptography (or crypto) is one of the more advanced topics of information security, and one whose understanding requires the most schooling and experience. It is difficult to get right because there are many approaches to encryption, each with advantages and disadvantages that need to be thoroughly understood by web solution architects and developers.  In addition, serious cryptography research is typically based in advanced mathematics and number theory, providing a serious barrier to entry. &lt;br /&gt;
&lt;br /&gt;
The proper and accurate implementation of cryptography is extremely critical to its efficacy. A small mistake in configuration or coding will result in removing a large degree of the protection it affords and rending the crypto implementation useless against serious attacks.&lt;br /&gt;
&lt;br /&gt;
A good understanding of crypto is required to be able to discern between solid products and snake oil. The inherent complexity of crypto makes it easy to fall for fantastic claims from vendors about their product. Typically, these are “a breakthrough in cryptography” or “unbreakable” or provide &amp;quot;military grade&amp;quot; security. If a vendor says &amp;quot;trust us, we have had experts look at this,” chances are they weren't experts!&lt;br /&gt;
&lt;br /&gt;
==Cryptographic Functions ==&lt;br /&gt;
&lt;br /&gt;
Cryptographic systems can provide one or more of the following four services. It is important to distinguish between these, as some algorithms are more suited to particular tasks, but not to others.&lt;br /&gt;
&lt;br /&gt;
When analyzing your requirements and risks, you need to decide which of these four functions should be used to protect your data.&lt;br /&gt;
&lt;br /&gt;
===Authentication ===&lt;br /&gt;
&lt;br /&gt;
Using a cryptographic system, we can establish the identity of a remote user (or system). A typical example is the SSL certificate of a web server providing proof to the user that he or she is connected to the correct server.&lt;br /&gt;
&lt;br /&gt;
The identity is not of the user, but of the cryptographic key of the user. Having a less secure key lowers the trust we can place on the identity.&lt;br /&gt;
&lt;br /&gt;
===Non-Repudiation ===&lt;br /&gt;
&lt;br /&gt;
The concept of non-repudiation is particularly important for financial or e-commerce applications. Often, cryptographic tools are required to prove that a unique user has made a transaction request. It must not be possible for the user to refute his or her actions.&lt;br /&gt;
&lt;br /&gt;
For example, a customer may request a transfer of money from her account to be paid to another account. Later, she claims never to have made the request and demands the money be refunded to the account. If we have non-repudiation through cryptography, we can prove – usually through digitally signing the transaction request, that the user authorized the transaction.&lt;br /&gt;
&lt;br /&gt;
===Confidentiality ===&lt;br /&gt;
&lt;br /&gt;
More commonly, the biggest concern will be to keep information private. Cryptographic systems were originally developed to function in this capacity. Whether it be passwords sent during a log on process, or storing confidential medical records in a database, encryption can assure that only users who have access to the appropriate key will get access to the data.&lt;br /&gt;
&lt;br /&gt;
===Integrity ===&lt;br /&gt;
&lt;br /&gt;
We can use cryptography to provide a means to ensure data is not viewed or altered during storage or transmission. Cryptographic hashes for example, can safeguard data by providing a secure checksum.&lt;br /&gt;
&lt;br /&gt;
==Cryptographic Algorithms ==&lt;br /&gt;
&lt;br /&gt;
Various types of cryptographic systems exist that have different strengths and weaknesses. Typically, they are divided into two classes; those that are strong, but slow to run and those that are quick, but less secure. Most often a combination of the two approaches is used (e.g.: SSL), whereby we establish the connection with a secure algorithm, and then if successful, encrypt the actual transmission with the weaker, but much faster algorithm.&lt;br /&gt;
&lt;br /&gt;
===Symmetric Cryptography ===&lt;br /&gt;
&lt;br /&gt;
Symmetric Cryptography is the most traditional form of cryptography.  In a symmetric cryptosystem, the involved parties share a common secret (password, pass phrase, or key). Data is encrypted and decrypted using the same key. These algorithms tend to be comparatively fast, but they cannot be used unless the involved parties have already exchanged keys.  Any party possessing a specific key can create encrypted messages using that key as well as decrypt any messages encrypted with the key.  In systems involving a number of users who each need to set up independent, secure communication channels symmetric cryptosystems can have practical limitations due to the requirement to securely distribute and manage large numbers of keys.&lt;br /&gt;
&lt;br /&gt;
Common examples of symmetric algorithms are DES, 3DES and AES. The 56-bit keys used in DES are short enough to be easily brute-forced by modern hardware and DES should no longer be used.  Triple DES (or 3DES) uses the same  algorithm, applied three times with different keys giving it an effective key length of 128 bits.  Due to the problems using the DES alrgorithm, the United States National Institute of Standards and Technology (NIST) hosted a selection process for a new algorithm.  The winning algorithm was Rijndael and the associated cryptosystem is now known as the Advanced Encryption Standard or AES.  For most applications 3DES is acceptably secure at the current time, but for most new applications it is advisable to use AES.&lt;br /&gt;
&lt;br /&gt;
===Asymmetric Cryptography (also called Public/Private Key Cryptography) ===&lt;br /&gt;
&lt;br /&gt;
Asymmetric algorithms use two keys, one to encrypt the data, and either key to decrypt. These inter-dependent keys are generated together. One is labeled the Public key and is distributed freely. The other is labeled the Private Key must be kept hidden.&lt;br /&gt;
&lt;br /&gt;
Often referred to as Public/Private Key Cryptography, these cryptosystems can provide a number of different functions depending on how they are used. &lt;br /&gt;
&lt;br /&gt;
The most common usage of asymmetric cryptography is to send messages with a guarantee of confidentiality.  If User A wanted to send a message to User B, User A would get access to User B’s publicly-available Public Key.  The message is then encrypted with this key and sent to User B.  Because of the cryptosystem’s property that messages encoded with the Public Key of User B can only be decrypted with User B’s Private Key, only User B can read the message.&lt;br /&gt;
&lt;br /&gt;
Another usage scenario is one where User A wants to send User B a message and wants User B to have a guarantee that the message was sent by User A.  In order to accomplish this, User A would encrypt the message with their Private Key.  The message can then only be decrypted using User A’s Public Key.  This guarantees that User A created the message Because they are then only entity who had access to the Private Key required to create a message that can be decrcrypted by User A’s Public Key.  This is essentially a digital signature guaranteeing that the message was created by User A.&lt;br /&gt;
&lt;br /&gt;
A Certificate Authority (CA), whose public certificates are installed with browsers or otherwise commonly available, may also digitally sign public keys or certificates. We can authenticate remote systems or users via a mutual trust of an issuing CA. We trust their ‘root’ certificates, which in turn authenticate the public certificate presented by the server.&lt;br /&gt;
&lt;br /&gt;
PGP and SSL are prime examples of a systems implementing asymmetric cryptography, using RSA or other algorithms.&lt;br /&gt;
&lt;br /&gt;
===Hashes ===&lt;br /&gt;
&lt;br /&gt;
Hash functions take some data of an arbitrary length (and possibly a key or password) and generate a fixed-length hash based on this input. Hash functions used in cryptography have the property that it is easy to calculate the hash, but difficult or impossible to re-generate the original input if only the hash value is known.  In addition, hash functions useful for cryptography  have the property that it is difficult to craft an initial input such that the hash will match a specific desired value.&lt;br /&gt;
&lt;br /&gt;
MD5 and SHA-1 are common hashing algorithms used today. These algorithms are considered weak (see below) and are likely to be replaced after a process similar to the AES selection. New applications should consider using SHA-256 instead of these weaker algorithms.&lt;br /&gt;
&lt;br /&gt;
===Key Exchange Algorithms ===&lt;br /&gt;
&lt;br /&gt;
Lastly, we have key exchange algorithms (such as Diffie-Hellman for SSL). These allow use to safely exchange encryption keys with an unknown party. &lt;br /&gt;
&lt;br /&gt;
==Algorithm Selection ==&lt;br /&gt;
&lt;br /&gt;
As modern cryptography relies on being computationally expensive to break, specific standards can be set for key sizes that will provide assurance that with today’s technology and understanding, it will take too long to decrypt a message by attempting all possible keys.&lt;br /&gt;
&lt;br /&gt;
Therefore, we need to ensure that both the algorithm and the key size are taken into account when selecting an algorithm.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
Proprietary encryption algorithms are not to be trusted as they typically rely on ‘security through obscurity’ and not sound mathematics. These algorithms should be avoided if possible.&lt;br /&gt;
&lt;br /&gt;
Specific algorithms to avoid:&lt;br /&gt;
&lt;br /&gt;
* MD5 has recently been found less secure than previously thought. While still safe for most applications such as hashes for binaries made available publicly, secure applications should now be migrating away from this algorithm.&lt;br /&gt;
&lt;br /&gt;
* SHA-0 has been conclusively broken. It should no longer be used for any sensitive applications.&lt;br /&gt;
&lt;br /&gt;
* SHA-1 has been reduced in strength and we encourage a migration to SHA-256, which implements a larger key size.&lt;br /&gt;
&lt;br /&gt;
* DES was once the standard crypto algorithm for encryption; a normal desktop machine can now break it. AES is the current preferred symmetric algorithm.&lt;br /&gt;
&lt;br /&gt;
Cryptography is a constantly changing field. As new discoveries in cryptanalysis are made, older algorithms will be found unsafe. In addition, as computing power increases the feasibility of brute force attacks will render other cryptosystems or the use of certain key lengths unsafe. Standard bodies such as NIST should be monitored for future recommendations. &lt;br /&gt;
&lt;br /&gt;
Specific applications, such as banking transaction systems may have specific requirements for algorithms and key sizes.&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
Assuming you have chosen an open, standard algorithm, the following recommendations should be considered when reviewing algorithms:&lt;br /&gt;
&lt;br /&gt;
'''Symmetric:'''&lt;br /&gt;
&lt;br /&gt;
* Key sizes of 128 bits (standard for SSL) are sufficient for most applications&lt;br /&gt;
&lt;br /&gt;
* Consider 168 or 256 bits for secure systems such as large financial transactions&lt;br /&gt;
&lt;br /&gt;
'''Asymmetric:'''&lt;br /&gt;
&lt;br /&gt;
The difficulty of cracking a 2048 bit key compared to a 1024 bit key is far, far, far, more than the twice you might expect. Don’t use excessive key sizes unless you know you need them. Bruce Schneier in 2002 (see the references section) recommended the following key lengths for circa 2005 threats:&lt;br /&gt;
&lt;br /&gt;
* Key sizes of 1280 bits are sufficient for most personal applications&lt;br /&gt;
&lt;br /&gt;
* 1536 bits should be acceptable today for most secure applications&lt;br /&gt;
&lt;br /&gt;
* 2048 bits should be considered for highly protected applications.&lt;br /&gt;
&lt;br /&gt;
'''Hashes:'''&lt;br /&gt;
&lt;br /&gt;
* Hash sizes of 128 bits (standard for SSL) are sufficient for most applications&lt;br /&gt;
&lt;br /&gt;
* Consider 168 or 256 bits for secure systems, as many hash functions are currently being revised (see above).&lt;br /&gt;
&lt;br /&gt;
NIST and other standards bodies will provide up to date guidance on suggested key sizes.&lt;br /&gt;
&lt;br /&gt;
'''Design your application to cope with new hashes and algorithms'''&lt;br /&gt;
&lt;br /&gt;
==Key Storage ==&lt;br /&gt;
&lt;br /&gt;
As highlighted above, crypto relies on keys to assure a user’s identity, provide confidentiality and integrity as well as non-repudiation. It is vital that the keys are adequately protected. Should a key be compromised, it can no longer be trusted.&lt;br /&gt;
&lt;br /&gt;
Any system that has been compromised in any way should have all its cryptographic keys replaced. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
Unless you are using hardware cryptographic devices, your keys will most likely be stored as binary files on the system providing the encryption. &lt;br /&gt;
&lt;br /&gt;
Can you export the private key or certificate from the store? &lt;br /&gt;
&lt;br /&gt;
* Are any private keys or certificate import files (usually in PKCS#12 format) on the file system? Can they be imported without a password?&lt;br /&gt;
&lt;br /&gt;
* Keys are often stored in code. This is a bad idea, as it means you will not be able to easily replace keys should they become compromised.&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Cryptographic keys should be protected as much as is possible with file system permissions. They should be read only and only the application or user directly accessing them should have these rights.&lt;br /&gt;
&lt;br /&gt;
* Private keys should be marked as not exportable when generating the certificate signing request. &lt;br /&gt;
&lt;br /&gt;
* Once imported into the key store (CryptoAPI, Certificates snap-in, Java Key Store, etc), the private certificate import file obtained from the certificate provider should be safely destroyed from front-end systems. This file should be safely stored in a safe until required (such as installing or replacing a new front end server)&lt;br /&gt;
&lt;br /&gt;
* Host based intrusion systems should be deployed to monitor access of keys. At the very least, changes in keys should be monitored.&lt;br /&gt;
&lt;br /&gt;
* Applications should log any changes to keys. &lt;br /&gt;
&lt;br /&gt;
* Pass phrases used to protect keys should be stored in physically secure places; in some environments, it may be necessary to split the pass phrase or password into two components such that two people will be required to authorize access to the key. These physical, manual processes should be tightly monitored and controlled.&lt;br /&gt;
&lt;br /&gt;
* Storage of keys within source code or binaries should be avoided. This not only has consequences if developers have access to source code, but key management will be almost impossible.&lt;br /&gt;
&lt;br /&gt;
* In a typical web environment, web servers themselves will need permission to access the key. This has obvious implications that other web processes or malicious code may also have access to the key. In these cases, it is vital to minimize the functionality of the system and application requiring access to the keys.&lt;br /&gt;
&lt;br /&gt;
* For interactive applications, a sufficient safeguard is to use a pass phrase or password to encrypt the key when stored on disk. This requires the user to supply a password on startup, but means the key can safely be stored in cases where other users may have greater file system privileges.&lt;br /&gt;
&lt;br /&gt;
Storage of keys in hardware crypto devices is beyond the scope of this document. If you require this level of security, you should really be consulting with crypto specialists.&lt;br /&gt;
&lt;br /&gt;
==Insecure transmission of secrets ==&lt;br /&gt;
&lt;br /&gt;
In security, we assess the level of trust we have in information. When applied to transmission of sensitive data, we need to ensure that encryption occurs before we transmit the data onto any untrusted network. &lt;br /&gt;
&lt;br /&gt;
In practical terms, this means we should aim to encrypt as close to the source of the data as possible.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
This can be extremely difficult without expert help. We can try to at least eliminate the most common problems:&lt;br /&gt;
&lt;br /&gt;
* The encryption algorithm or protocol needs to be adequate to the task. The above discuss on weak algorithms and weak keys should be a good starting point&lt;br /&gt;
&lt;br /&gt;
* We must ensure that through all paths of the transmission we apply this level of encryption&lt;br /&gt;
&lt;br /&gt;
* Extreme care needs to be taken at the point of encryption and decryption. If your encryption library needs to use temporary files, are these adequately protected? &lt;br /&gt;
&lt;br /&gt;
* Are keys stored securely? Is an unsecured file left behind after it has been encrypted?&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
We have the possibility to encrypt or otherwise protect data at different levels. Choosing the right place for this to occur can involve looking at both security as well as resource requirements. &lt;br /&gt;
&lt;br /&gt;
'''Application''': at this level, the actual application performs the encryption or other crypto function. This is the most desirable, but can place additional strain on resources and create unmanageable complexity. Encryption would be performed typically through an API such as the OpenSSL toolkit (www.openssl.com) or operating system provided crypto functions.&lt;br /&gt;
&lt;br /&gt;
An example would be an S/MIME encrypted email, which is transmitted as encoded text within a standard email. No changes to intermediate email hosts are necessary to transmit the message because we do not require a change to the protocol itself.&lt;br /&gt;
&lt;br /&gt;
'''Protocol''': at this layer, the protocol provides the encryption service. Most commonly, this is seen in HTTPS, using SSL encryption to protect sensitive web traffic. The application no longer needs to implementing secure connectivity. However, this does not mean the application has a free ride. SSL requires careful attention when used for mutual (client-side) authentication, as there are two different session keys, one for each direction. Each should be verified before transmitting sensitive data.&lt;br /&gt;
&lt;br /&gt;
Attackers and penetration testers love SSL to hide malicious requests (such as injection attacks for example). Content scanners are most likely unable to decode the SSL connection, letting it pass to the vulnerable web server.&lt;br /&gt;
&lt;br /&gt;
'''Network''': below the protocol layer, we can use technologies such as Virtual Private Networks (VPN) to protect data. This has many incarnations, the most popular being IPsec (Internet Protocol v6 Security), typically implemented as a protected ‘tunnel’ between two gateway routers. Neither the application nor the protocol needs to be crypto aware – all traffic is encrypted regardless.&lt;br /&gt;
&lt;br /&gt;
Possible issues at this level are computational and bandwidth overheads on network devices.&lt;br /&gt;
&lt;br /&gt;
==Reversible Authentication Tokens ==&lt;br /&gt;
&lt;br /&gt;
Today’s web servers typically deal with large numbers of users. Differentiating between them is often done through cookies or other session identifiers. If these session identifiers use a predictable sequence, an attacker need only generate a value in the sequence in order to present a seemingly valid session token.&lt;br /&gt;
&lt;br /&gt;
This can occur at a number of places; the network level for TCP sequence numbers, or right through to the application layer with cookies used as authenticating tokens.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
Any deterministic sequence generator is likely to be vulnerable.&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
The only way to generate secure authentication tokens is to ensure there is no way to predict their sequence. In other words: true random numbers.&lt;br /&gt;
&lt;br /&gt;
It could be argued that computers can not generate true random numbers, but using new techniques such as reading mouse movements and key strokes to improve entropy has significantly increased the randomness of random number generators. It is critical that you do not try to implement this on your own; use of existing, proven implementations is highly desirable.&lt;br /&gt;
&lt;br /&gt;
Most operating systems include functions to generate random numbers that can be called from almost any programming language.&lt;br /&gt;
&lt;br /&gt;
'''Windows &amp;amp; .NET:''' On Microsoft platforms including .NET, it is recommended to use the inbuilt CryptGenRandom function (&amp;lt;u&amp;gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/seccrypto/security/cryptgenrandom.asp&amp;lt;/u&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Unix:''' For all Unix based platforms, OpenSSL is an excellent option (&amp;lt;u&amp;gt;http://www.openssl.org/&amp;lt;/u&amp;gt;). It features tools and API functions to generate random numbers. On some platforms, /dev/urandom is a suitable source of pseudo-random entropy.&lt;br /&gt;
&lt;br /&gt;
'''PHP:'''  mt_rand() uses a Mersenne Twister, but is nowhere near as good as CryptoAPI’s secure random number generation options, OpenSSL, or /dev/urandom which is available on many Unix variants. mt_rand() has been noted to produce the same number on some platforms – test prior to deployment. '''Do not use rand() as it is very weak.'''&lt;br /&gt;
&lt;br /&gt;
'''Java:''' java.security.SecureRandom within the Java Cryptography Extension (JCE) provides secure random numbers. This should be used in preference to other random number generators.&lt;br /&gt;
&lt;br /&gt;
'''ColdFusion: '''ColdFusion MX 7 leverages the JCE java.security.SecureRandom class of the underlying JVM as its pseudo random number generator (PRNG)'''''.'' '''&lt;br /&gt;
&lt;br /&gt;
==Safe UUID generation ==&lt;br /&gt;
&lt;br /&gt;
UUIDs (such as GUIDs and so on) are only unique if you generate them. This seems relatively straightforward. However, there are many code snippets available that contain existing UUIDS. &lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
# Determine the source of your existing UUIDS &lt;br /&gt;
## Did they come from MSDN?&lt;br /&gt;
## Or from a example found on the Internet? &lt;br /&gt;
# Use your favorite search engine to find out&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* Do not cut and paste UUIDs and GUIDs from anything other than the UUIDGEN program or from the UuidCreate() API&lt;br /&gt;
&lt;br /&gt;
* Generate fresh UUIDs or GUIDs for each new program &lt;br /&gt;
&lt;br /&gt;
==Summary ==&lt;br /&gt;
&lt;br /&gt;
Cryptography is one of pillars of information security. Its usage and propagation has exploded due to the Internet and it is now included in most areas computing. Crypto can be used for:&lt;br /&gt;
&lt;br /&gt;
* Remote access such as IPsec VPN&lt;br /&gt;
&lt;br /&gt;
* Certificate based authentication&lt;br /&gt;
&lt;br /&gt;
* Securing confidential or sensitive information&lt;br /&gt;
&lt;br /&gt;
* Obtaining non-repudiation using digital certificates&lt;br /&gt;
&lt;br /&gt;
* ?Online orders and payments&lt;br /&gt;
&lt;br /&gt;
* Email and messaging security such as S/MIME&lt;br /&gt;
&lt;br /&gt;
A web application can implement cryptography at multiple layers: application, application server or runtime (such as .NET), operating system and hardware. Selecting an optimal approach requires a good understanding of application requirements, the areas of risk, and the level of security strength it might require, flexibility, cost, etc.&lt;br /&gt;
&lt;br /&gt;
Although cryptography is not a panacea, the majority of security breaches do not come from brute force computation but from exploiting mistakes in implementation. The strength of a cryptographic system is measured in key length. Using a large key length and then storing the unprotected keys on the same server, eliminates most of the protection benefit gained. Besides the secure storage of keys, another classic mistake is engineering custom cryptographic algorithms (to generate random session ids for example). Many web applications were successfully attacked because the developers thought they could create their crypto functions. &lt;br /&gt;
&lt;br /&gt;
Our recommendation is to use proven products, tools, or packages rather than rolling your own.&lt;br /&gt;
&lt;br /&gt;
==Further Reading ==&lt;br /&gt;
&lt;br /&gt;
* Wu, H., ''Misuse of stream ciphers in Word and Excel''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://eprint.iacr.org/2005/007.pdf&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
* Bindview, ''Vulnerability in Windows NT's SYSKEY encryption'' &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.bindview.com/Services/razor/Advisories/1999/adv_WinNT_syskey.cfm&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
* Schneier, B. ''Is 1024 bits enough?, ''April 2002 Cryptogram''&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;u&amp;gt;http://www.schneier.com/crypto-gram-0204.html#3&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
* Schneier, B., Cryptogram, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://www.counterpane.com/cryptogram.html&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
* NIST, Replacing SHA-1 with stronger variants: SHA-256 ? 512&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://csrc.nist.gov/CryptoToolkit/tkhash.html&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://csrc.nist.gov/CryptoToolkit/tkencryption.html&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* UUIDs are only unique if you generate them:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://blogs.msdn.com/larryosterman/archive/2005/07/21/441417.aspx&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
* Cryptographically Secure Random Numbers on Win32:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx&amp;lt;/u&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
==Cryptography ==&lt;br /&gt;
&lt;br /&gt;
The following section describes the ColdFusion’s cryptography features. ColdFusion MX leverages the Java Cryptography Extension (JCE) of the underlying J2EE platform for cryptography and random number generation. It provides functions for symmetric (or private-key) encryption. While it does not provide native functionality for public-key (asymmetric) encryption, it does use the Java Secure Socket Extension (JSSE) for SSL communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Pseudo-Random Number Generation'''&lt;br /&gt;
&lt;br /&gt;
ColdFusion provides three functions for random number generation: rand(), randomize(), and randRange(). Function descriptions and syntax:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Rand''' – Use to generate a pseudo-random number&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''	rand([algorithm])'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Randomize''' – Use to seed the pseudo-random number generator (PRNG) with an integer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''	randomize(number [, algorithm])'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''RandRange''' – Use to generate a pseudo-random integer within the range of the specified numbers&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''	randrange(number1, number2 [, algorithm])'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following values are the allowed algorithm parameters''' ''':&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CFMX_COMPAT: (default) – Invokes java.util.rand&lt;br /&gt;
&lt;br /&gt;
SHA1PRNG: (recommended) – Invokes java.security.SecureRandom using the Sun Java SHA-1 PRNG algorithm.&lt;br /&gt;
&lt;br /&gt;
IBMSecureRandom: IBM WebSphere’s JVM does not support the SHA1PRNG algorithm. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Symmetric Encryption'''&lt;br /&gt;
&lt;br /&gt;
ColdFusion MX 7 provides six encryption functions: decrypt(), decryptBinary(), encrypt(), encryptBinary(), generateSecretKey(), and hash(). Function descriptions and syntax:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Decrypt''' – Use to decrypt encrypted strings with specified key, algorithm, encoding, initialization vector or salt, and iterations&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''	decrypt(encrypted_string, key[, algorithm[, encoding[, IVorSalt[, iterations]]]]))'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''DecryptBinary''' – Use to decrypt encrypted binary data with specified key, algorithm, initialization vector or salt, and iterations&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''	decryptBinary(bytes, key[, algorithm[, IVorSalt[, iterations]]])'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Encrypt''' – Use to encrypt string using specific algorithm, encoding, initialization vector or salt, and iterations&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''	encrypt(string, key[, algorithm[, encoding[, IVorSalt[, iterations]]]]))'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''EncryptBinary''' – Use to encrypt binary data with specified key, algorithm, initialization vector or salt, and iterations&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''	encryptBinary(bytes, key[, algorithm[, IVorSalt[, iterations]]])'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''GenerateSecretKey''' – Use to generate a secure key using the specified algorithm for the encrypt and encryptBinary functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''	generateSecretKey(algorithm)'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Hash '''– Use for one-way conversion of a variable-length string to fixed-length string using the specified algorithm and encoding&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''	hash(string[, algorithm[, encoding]] )'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ColdFusion offers the following default algorithms for these functions''' ''':&lt;br /&gt;
&lt;br /&gt;
CFMX_COMPAT: the algorithm used in ColdFusion MX and prior releases. This algorithm is the least secure option (default). &lt;br /&gt;
&lt;br /&gt;
AES: the Advanced Encryption Standard specified by the National Institute of Standards and Technology (NIST) FIPS-197. (recommended)&lt;br /&gt;
&lt;br /&gt;
BLOWFISH: the Blowfish algorithm defined by Bruce Schneier. &lt;br /&gt;
&lt;br /&gt;
DES: the Data Encryption Standard algorithm defined by NIST FIPS-46-3. &lt;br /&gt;
&lt;br /&gt;
DESEDE: the &amp;quot;Triple DES&amp;quot; algorithm defined by NIST FIPS-46-3. &lt;br /&gt;
&lt;br /&gt;
PBEWithMD5AndDES: A password-based version of the DES algorithm which uses a MD5 hash of the specified password as the encryption key &lt;br /&gt;
&lt;br /&gt;
PBEWithMD5AndTripleDES: A password-based version of the DESEDE algorithm which uses a MD5 hash of the specified password as the encryption key&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following algorithms are provided by default for the hash() function. Note, SHA algorithms used in ColdFusion are NIST FIPS-180-2 compliant''' ''':&lt;br /&gt;
&lt;br /&gt;
CFMX_COMPAT: Generates a MD5 hash string identical to that generated by ColdFusion MX and ColdFusion MX 6.1 (default). &lt;br /&gt;
&lt;br /&gt;
MD5: Generates a 128-bit digest.&lt;br /&gt;
&lt;br /&gt;
SHA: Generates a 160-bit digest. (SHA-1)&lt;br /&gt;
&lt;br /&gt;
SHA-256: Generates a 256-bit digest&lt;br /&gt;
&lt;br /&gt;
SHA-384: Generates a 384-bit digest&lt;br /&gt;
&lt;br /&gt;
SHA-512: Generates a 512-bit digest&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Pluggable Encryption'''&lt;br /&gt;
&lt;br /&gt;
ColdFusion MX 7 introduced pluggable encryption for CFML. The JCE allows developers to specify multiple cryptographic service providers. ColdFusion can leverage the algorithms, feedback modes, and padding methods of third-party Java security providers to strengthen its cryptography functions. For example, ColdFusion can leverage the Bouncy Castle ('''&amp;lt;u&amp;gt;http://www.bouncycastle.org/'''&amp;lt;/u&amp;gt;) crypto package and use the SHA-224 algorithm for the hash() function or the Serpent block encryption for the encrypt() function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See Macromedia’s Strong Encryption in ColdFusion MX 7 technote for information on installing additional security providers for ColdFusion at http://www.macromedia.com/go/e546373d. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''SSL'''&lt;br /&gt;
&lt;br /&gt;
ColdFusion does not provide tags and functions for public-key encryption, but it can communicate over SSL. ColdFusion leverages the Sun JSSE to communicate over SSL with web and LDAP (lightweight directory access protocol) servers. ColdFusion uses the Java certificate database (e.g. jre_root/lib/security/cacerts) to store server certificates. It compares presented certificate of remote systems to those stored in the database. It also grabs the host system’s certificate from this database and uses it to present to remote systems to initiate the SSL handshake. Certificate information is then exposed as CGI variables.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''''Best Practices'''''&lt;br /&gt;
&lt;br /&gt;
Enable /dev/urandom for higher entropy for random number generation&lt;br /&gt;
&lt;br /&gt;
Call the randomize function before calling rand() or randRange() to seed the random number generator&lt;br /&gt;
&lt;br /&gt;
DO NOT use the CFMX_COMPAT algorithms. Upgrade your application to use stronger cryptographic ciphers.&lt;br /&gt;
&lt;br /&gt;
Use AES or higher for symmetric encryption &lt;br /&gt;
&lt;br /&gt;
Use SHA-256 or higher for the hash function&lt;br /&gt;
&lt;br /&gt;
Use a salt (or random string) for password generation with the hash function&lt;br /&gt;
&lt;br /&gt;
Always use generateSecretKey() to generate keys of the appropriate length for Block Encryption algorithms unless a customized key is required&lt;br /&gt;
&lt;br /&gt;
Use separate key databases to store remote server certificates separately from the ColdFusion server’s certificate&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:Encryption]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Data_Validation&amp;diff=27728</id>
		<title>Data Validation</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Data_Validation&amp;diff=27728"/>
				<updated>2008-04-06T05:04:09Z</updated>
		
		<summary type="html">&lt;p&gt;Tomo: /* ASP.NET Viewstate */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Guide Table of Contents]]__TOC__&lt;br /&gt;
&lt;br /&gt;
==Objective ==&lt;br /&gt;
&lt;br /&gt;
To ensure that the application is robust against all forms of input data, whether obtained from the user, infrastructure, external entities or database systems&lt;br /&gt;
&lt;br /&gt;
==Platforms Affected ==&lt;br /&gt;
&lt;br /&gt;
All. &lt;br /&gt;
&lt;br /&gt;
==Relevant COBIT Topics ==&lt;br /&gt;
&lt;br /&gt;
DS11 – Manage Data. All sections should be reviewed&lt;br /&gt;
&lt;br /&gt;
==Description ==&lt;br /&gt;
&lt;br /&gt;
The most common web application security weakness is the failure to properly validate input from the client or environment. This weakness leads to almost all of the major vulnerabilities in applications, such as interpreter injection, locale/Unicode attacks, file system attacks and buffer overflows. Data from the client should never be trusted for the client has every possibility to tamper with the data.&lt;br /&gt;
&lt;br /&gt;
In many cases, [[Encoding]] has the potential to defuse attacks that rely on lack of input validation. For example, if you use HTML entity encoding on user input before it is sent to a browser, it will prevent most [[XSS]] attacks. However, simply preventing attacks is not enough - you must perform [[Intrusion Detection]] in your applications. Otherwise, you are allowing attackers to repeatedly attack your application until they find a vulnerability that you haven't protected against. Detecting attempts to find these weaknesses is a critical protection mechanism.&lt;br /&gt;
&lt;br /&gt;
==Definitions ==&lt;br /&gt;
&lt;br /&gt;
These definitions are used within this document:&lt;br /&gt;
&lt;br /&gt;
* '''Integrity checks'''&lt;br /&gt;
&lt;br /&gt;
Ensure that the data has not been tampered with and is the same as before&lt;br /&gt;
&lt;br /&gt;
* '''Validation'''&lt;br /&gt;
&lt;br /&gt;
Ensure that the data is strongly typed, correct syntax, within length boundaries, contains only permitted characters, or that numbers are correctly signed and within range boundaries &lt;br /&gt;
&lt;br /&gt;
* '''Business rules'''&lt;br /&gt;
&lt;br /&gt;
Ensure that data is not only validated, but business rule correct. For example, interest rates fall within permitted boundaries.&lt;br /&gt;
&lt;br /&gt;
Some documentation and references interchangeably use the various meanings, which is very confusing to all concerned. This confusion directly causes continuing financial loss to the organization. &lt;br /&gt;
&lt;br /&gt;
==Where to include integrity checks ==&lt;br /&gt;
&lt;br /&gt;
Integrity checks must be included wherever data passes from a trusted to a less trusted boundary, such as from the application to the user's browser in a hidden field, or to a third party payment gateway, such as a transaction ID used internally upon return. &lt;br /&gt;
&lt;br /&gt;
The type of integrity control (checksum, HMAC, encryption, digital signature) should be directly related to the risk of the data transiting the trust boundary. &lt;br /&gt;
&lt;br /&gt;
==Where to include validation ==&lt;br /&gt;
&lt;br /&gt;
Validation must be performed on every tier. However, validation should be performed as per the function of the server executing the code. For example, the web / presentation tier should validate for web related issues, persistence layers should validate for persistence issues such as SQL / HQL injection, directory lookups should check for LDAP injection, and so on.&lt;br /&gt;
&lt;br /&gt;
==Where to include business rule validation ==&lt;br /&gt;
&lt;br /&gt;
Business rules are known during design, and they influence implementation. However, there are bad, good and &amp;quot;best&amp;quot; approaches. Often the best approach is the simplest in terms of code. &lt;br /&gt;
&lt;br /&gt;
===Example - Scenario ===&lt;br /&gt;
&lt;br /&gt;
* You are to populate a list with accounts provided by the back-end system&lt;br /&gt;
* The user will choose an account, choose a biller, and press next&lt;br /&gt;
&lt;br /&gt;
===Wrong way===&lt;br /&gt;
&lt;br /&gt;
The account select option is read directly and provided in a message back to the backend system without validating the account number if one of the accounts provided by the backend system.&lt;br /&gt;
&lt;br /&gt;
===Why this is bad===&lt;br /&gt;
&lt;br /&gt;
An attacker can change the HTML in any way they choose:&lt;br /&gt;
&lt;br /&gt;
* The lack of validation requires a round-trip to the backend to provide an error message that the front end code could easily have eliminated&lt;br /&gt;
&lt;br /&gt;
* The back end may not be able to cope with the data payload the front-end code could have easily eliminated. For example, buffer overflows, XML injection, or similar. &lt;br /&gt;
&lt;br /&gt;
===Acceptable Method ===&lt;br /&gt;
&lt;br /&gt;
The account select option parameter (&amp;quot;payee_id&amp;quot;) is read by the code, and compared to an already-known list. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (account.hasPayee( session.getParameter(&amp;quot;payee_id&amp;quot;) )) {&lt;br /&gt;
    backend.performTransfer( session.getParameter(&amp;quot;payee_id&amp;quot;) );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This prevents parameter tampering, but requires the list of possible payee_id's to be to be calculated beforehand.&lt;br /&gt;
&lt;br /&gt;
===Best Method ===&lt;br /&gt;
&lt;br /&gt;
The original code emitted indexes &amp;lt;option value=&amp;quot;1&amp;quot; ... &amp;gt; rather than account names.&lt;br /&gt;
&lt;br /&gt;
''int payeeLstId = session.getParameter('payeelstid');''&lt;br /&gt;
&lt;br /&gt;
''accountFrom = account.getAcctNumberByIndex(payeeLstId);''&lt;br /&gt;
&lt;br /&gt;
Not only is this easier to render in HTML, it makes validation and business rule validation trivial. The field cannot be tampered with.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- dkaplan: why is this the best?  I can see how it can make things easier to guess.  Where before I had to guess an account name, now I can just put in 9 if I see a list of id's from 1-8 and this code example doesn't directly check the integrity of that.  I think this needs more explanation. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Conclusion ===&lt;br /&gt;
&lt;br /&gt;
To provide defense in depth and to prevent attack payloads from trust boundaries, such as backend hosts, which are probably incapable of handling arbitrary input data, business rule validation is to be performed (preferably in workflow or command patterns), even if it is known that the back end code performs business rule validation.&lt;br /&gt;
&lt;br /&gt;
This is not to say that the entire set of business rules need be applied - it means that the fundamentals are performed to prevent unnecessary round trips to the backend and to prevent the backend from receiving most tampered data.&lt;br /&gt;
&lt;br /&gt;
==Data Validation Strategies ==&lt;br /&gt;
&lt;br /&gt;
There are four strategies for validating data, and they should be used in this order:&lt;br /&gt;
&lt;br /&gt;
===Accept known good===&lt;br /&gt;
&lt;br /&gt;
This strategy is also known as &amp;quot;whitelist&amp;quot; or &amp;quot;positive&amp;quot; validation. The idea is that you should check that the data is one of a set of tightly constrained known good values. Any data that doesn't match should be rejected.  Data should be:&lt;br /&gt;
&lt;br /&gt;
* Strongly typed at all times&lt;br /&gt;
* Length checked and fields length minimized&lt;br /&gt;
* Range checked if a numeric&lt;br /&gt;
* Unsigned unless required to be signed&lt;br /&gt;
* Syntax or grammar should be checked prior to first use or inspection&lt;br /&gt;
&lt;br /&gt;
If you expect a postcode, validate for a postcode (type, length and syntax):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public String isPostcode(String postcode) {&lt;br /&gt;
    return (postcode != null &amp;amp;&amp;amp; Pattern.matches(&amp;quot;^(((2|8|9)\d{2})|((02|08|09)\d{2})|([1-9]\d{3}))$&amp;quot;, postcode)) ? postcode : &amp;quot;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Coding guidelines should use some form of visible tainting on input from the client or untrusted sources, such as third party connectors to make it obvious that the input is unsafe:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
String taintPostcode = request.getParameter(&amp;quot;postcode&amp;quot;);&lt;br /&gt;
ValidationEngine validator = new ValidationEngine();&lt;br /&gt;
boolean isValidPostcode = validator.isPostcode(taintPostcode);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Reject known bad===&lt;br /&gt;
&lt;br /&gt;
This strategy, also known as &amp;quot;negative&amp;quot; or &amp;quot;blacklist&amp;quot; validation is a weak alternative to positive validation. Essentially, if you don't expect to see characters such as %3f or JavaScript or similar, reject strings containing them. This is a dangerous strategy, because the set of possible bad data is potentially infinite. Adopting this strategy means that you will have to maintain the list of &amp;quot;known bad&amp;quot; characters and patterns forever, and you will by definition have incomplete protection.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''public String removeJavascript(String input) {''&lt;br /&gt;
&lt;br /&gt;
''	Pattern p = Pattern.compile(&amp;quot;javascript&amp;quot;, CASE_INSENSITIVE);''&lt;br /&gt;
&lt;br /&gt;
''	p.matcher(input);''&lt;br /&gt;
&lt;br /&gt;
''	return (!p.matches()) ? input : '';''&lt;br /&gt;
&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
It can take upwards of 90 regular expressions (see the CSS Cheat Sheet in the Guide 2.0) to eliminate known malicious software, and each regex needs to be run over every field. Obviously, this is slow and not secure. Just rejecting &amp;quot;current known bad&amp;quot; (which is at the time of writing hundreds of strings and literally millions of combinations) is insufficient if the input is a string. This strategy is directly akin to anti-virus pattern updates. Unless the business will allow updating &amp;quot;bad&amp;quot; regexes on a daily basis and support someone to research new attacks regularly, this approach will be obviated before long.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Sanitize===&lt;br /&gt;
&lt;br /&gt;
Eliminate or translate characters (such as to HTML entities or to remove quotes) in an effort to make the input &amp;quot;safe&amp;quot;. &lt;br /&gt;
Like blacklists, this approach requires maintenance and is usually incomplete. As most fields have a particular grammar, it is simpler, faster, and more secure to simply validate a single correct positive test than to try to include complex and slow sanitization routines for all current and future attacks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public String quoteApostrophe(String input) {&lt;br /&gt;
    if (input != null)&lt;br /&gt;
        return input.replaceAll(&amp;quot;[\']&amp;quot;, &amp;quot;&amp;amp;amp;rsquo;&amp;quot;);&lt;br /&gt;
    else&lt;br /&gt;
        return null;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===No validation===&lt;br /&gt;
&lt;br /&gt;
This is inherently unsafe and strongly discouraged. The business must sign off each and every example of no validation as the lack of validation usually leads to direct obviation of application, host and network security controls.&lt;br /&gt;
&lt;br /&gt;
''account.setAcctId(getParameter('formAcctNo'));''&lt;br /&gt;
''...''&lt;br /&gt;
&lt;br /&gt;
''public setAcctId(String acctId) {''&lt;br /&gt;
''	cAcctId = acctId;''&lt;br /&gt;
''}''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Prevent parameter tampering ==&lt;br /&gt;
&lt;br /&gt;
There are many input sources:&lt;br /&gt;
&lt;br /&gt;
* HTTP headers, such as REMOTE_ADDR, PROXY_VIA or similar&lt;br /&gt;
&lt;br /&gt;
* Environment variables, such as getenv() or via server properties &lt;br /&gt;
&lt;br /&gt;
* All GET, POST and Cookie data&lt;br /&gt;
&lt;br /&gt;
This includes supposedly tamper resistant fields such as radio buttons, drop downs, etc - any client side HTML can be re-written to suit the attacker&lt;br /&gt;
&lt;br /&gt;
Configuration data (mistakes happen :))&lt;br /&gt;
&lt;br /&gt;
External systems (via any form of input mechanism, such as XML input, RMI, web services, etc)&lt;br /&gt;
&lt;br /&gt;
All of these data sources supply untrusted input. Data received from untrusted data sources must be properly checked before first use.&lt;br /&gt;
&lt;br /&gt;
==Hidden fields ==&lt;br /&gt;
&lt;br /&gt;
Hidden fields are a simple way to avoid storing state on the server. Their use is particularly prevalent in &amp;quot;wizard-style&amp;quot; multi-page forms. However, their use exposes the inner workings of your application, and exposes data to trivial tampering, replay, and validation attacks. In general, only use hidden fields for page sequence.&lt;br /&gt;
&lt;br /&gt;
If you have to use hidden fields, there are some rules:&lt;br /&gt;
&lt;br /&gt;
* Secrets, such as passwords, should never be sent in the clear&lt;br /&gt;
&lt;br /&gt;
* Hidden fields need to have integrity checks and preferably encrypted using non-constant initialization vectors (i.e. different users at different times have different yet cryptographically strong random IVs)&lt;br /&gt;
&lt;br /&gt;
* Encrypted hidden fields must be robust against replay attacks, which means some form of temporal keying&lt;br /&gt;
&lt;br /&gt;
* Data sent to the user must be validated on the server once the last page has been received, even if it has been previously validated on the server - this helps reduce the risk from replay attacks.&lt;br /&gt;
&lt;br /&gt;
The preferred integrity control should be at least a HMAC using SHA-256 or preferably digitally signed or encrypted using PGP. IBMJCE supports SHA-256, but PGP JCE support require the inclusion of the Legion of the Bouncy Castle (http://www.bouncycastle.org/) JCE classes.&lt;br /&gt;
&lt;br /&gt;
It is simpler to store this data temporarily in the session object. Using the session object is the safest option as data is never visible to the user, requires (far) less code, nearly no CPU, disk or I/O utilization, less memory (particularly on large multi-page forms), and less network consumption. &lt;br /&gt;
&lt;br /&gt;
In the case of the session object being backed by a database, large session objects may become too large for the inbuilt handler. In this case, the recommended strategy is to store the validated data in the database, but mark the transaction as &amp;quot;incomplete&amp;quot;. Each page will update the incomplete transaction until it is ready for submission. This minimizes the database load, session size, and activity between the users whilst remaining tamperproof. &lt;br /&gt;
&lt;br /&gt;
Code containing hidden fields should be rejected during code reviews.&lt;br /&gt;
&lt;br /&gt;
==ASP.NET Viewstate ==&lt;br /&gt;
&lt;br /&gt;
ASP.NET sends form data back to the client in a hidden “Viewstate” field. Despite looking forbidding, this “encryption” is simply plain-text equivalent (base64 encoding) and has no data integrity without further action on your behalf in ASP.NET 1.0. In ASP.NET 1.1 and 2.0, tamper proofing, called &amp;quot;enableViewStateMAC&amp;quot; is on by default using a SHA-1 hash.&lt;br /&gt;
&lt;br /&gt;
Any application framework with a similar mechanism might be at fault – you should investigate your application framework’s support for sending data back to the user. Preferably it should not round trip.&lt;br /&gt;
&lt;br /&gt;
===How to determine if you are vulnerable ===&lt;br /&gt;
&lt;br /&gt;
These configurations are set hierarchically in the .NET framework. The machine.config file contains the global configuration; each web directory may contain a web.config file further specifying or overriding configuration; each page may contain @page directives specifying same configuration or overrides; you must check all three locations:&lt;br /&gt;
&lt;br /&gt;
* If the enableViewStateMac is not set to “true”, you are at risk if your viewstate contains authorization state&lt;br /&gt;
&lt;br /&gt;
* If the viewStateEncryptionMode is not set to “always”, you are at risk if your viewstate contains secrets such as credentials&lt;br /&gt;
&lt;br /&gt;
* If you share a host with many other customers, you all share the same machine key by default in ASP.NET 1.1. In ASP.NET 2.0, it is possible to configure unique viewstate keys per application&lt;br /&gt;
&lt;br /&gt;
===How to protect yourself ===&lt;br /&gt;
&lt;br /&gt;
* If your application relies on data returning from the viewstate without being tampered with, you should turn on viewstate integrity checks at the least, and strongly consider:&lt;br /&gt;
&lt;br /&gt;
* Encrypt viewstate if any of the data is application sensitive&lt;br /&gt;
&lt;br /&gt;
* Upgrade to ASP.NET 2.0 as soon as practical if you are on a shared hosting arrangement&lt;br /&gt;
&lt;br /&gt;
* Move truly sensitive viewstate data to the session variable instead&lt;br /&gt;
&lt;br /&gt;
===Selects, radio buttons, and checkboxes ===&lt;br /&gt;
&lt;br /&gt;
It is commonly held belief that the value settings for these items cannot be easily tampered. This is wrong. In the following example, actual account numbers are used, which can lead to compromise:&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;html:radio value=&amp;quot;&amp;lt;%=acct.getCardNumber(1).toString( )%&amp;gt;&amp;quot; property=&amp;quot;acctNo&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;bean:message key=&amp;quot;msg.card.name&amp;quot; arg0=&amp;quot;&amp;lt;%=acct.getCardName(1).toString( )%&amp;gt;&amp;quot; /&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;html:radio value=&amp;quot;&amp;lt;%=acct.getCardNumber(1).toString( )%&amp;gt;&amp;quot; property=&amp;quot;acctNo&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;bean:message key=&amp;quot;msg.card.name&amp;quot; arg0=&amp;quot;&amp;lt;%=acct.getCardName(2).toString( )%&amp;gt;&amp;quot; /&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This produces (for example):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;input type=&amp;quot;radio&amp;quot; name=&amp;quot;acctNo&amp;quot; value=&amp;quot;455712341234&amp;quot;&amp;gt;Gold Card''&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;input type=&amp;quot;radio&amp;quot; name=&amp;quot;acctNo&amp;quot; value=&amp;quot;455712341235&amp;quot;&amp;gt;Platinum Card''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the value is retrieved and then used directly in a SQL query, an interesting form of SQL injection may occur: authorization tampering leading to information disclosure. As the connection pool connects to the database using a single user, it may be possible to see other user's accounts if the SQL looks something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''String acctNo = getParameter('acctNo');''&lt;br /&gt;
&lt;br /&gt;
''String sql = &amp;quot;SELECT acctBal FROM accounts WHERE acctNo = '?'&amp;quot;;''&lt;br /&gt;
&lt;br /&gt;
''PreparedStatement st = conn.prepareStatement(sql);''&lt;br /&gt;
&lt;br /&gt;
''st.setString(1, acctNo);''&lt;br /&gt;
&lt;br /&gt;
''ResultSet rs = st.executeQuery();''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This should be re-written to retrieve the account number via index, and include the client's unique ID to ensure that other valid account numbers are exposed:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''String acctNo = acct.getCardNumber(getParameter('acctIndex'));''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''String sql = &amp;quot;SELECT acctBal FROM accounts WHERE acct_id = '?' AND acctNo = '?'&amp;quot;;''&lt;br /&gt;
&lt;br /&gt;
''PreparedStatement st = conn.prepareStatement(sql);''&lt;br /&gt;
&lt;br /&gt;
''st.setString(1, acct.getID());''&lt;br /&gt;
&lt;br /&gt;
''st.setString(2, acctNo);''&lt;br /&gt;
&lt;br /&gt;
''ResultSet rs = st.executeQuery();''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This approach requires rendering input values from 1 to ... x, and assuming accounts are stored in a Collection which can be iterated using logic:iterate:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;logic:iterate id=&amp;quot;loopVar&amp;quot; name=&amp;quot;MyForm&amp;quot; property=&amp;quot;values&amp;quot;&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''  &amp;lt;html:radio property=&amp;quot;acctIndex&amp;quot; idName=&amp;quot;loopVar&amp;quot; value=&amp;quot;value&amp;quot;/&amp;gt;&amp;amp;nbsp;''&lt;br /&gt;
&lt;br /&gt;
''  &amp;lt;bean:write name=&amp;quot;loopVar&amp;quot; property=&amp;quot;name&amp;quot;/&amp;gt;&amp;lt;br /&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;/logic:iterate&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The code will emit HTML with the values &amp;quot;1&amp;quot; .. &amp;quot;x&amp;quot; as per the collection's content. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;input type=&amp;quot;radio&amp;quot; name=&amp;quot;acctIndex&amp;quot; value=&amp;quot;1&amp;quot; /&amp;gt;Gold Credit Card''&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;input type=&amp;quot;radio&amp;quot; name=&amp;quot;acctIndex&amp;quot; value=&amp;quot;2&amp;quot; /&amp;gt;Platinum Credit Card''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This approach should be used for any input type that allows a value to be set: radio buttons, checkboxes, and particularly select / option lists.&lt;br /&gt;
&lt;br /&gt;
===Per-User Data ===&lt;br /&gt;
&lt;br /&gt;
In fully normalized databases, the aim is to minimize the amount of repeated data. However, some data is inferred. For example, users can see messages that are stored in a messages table. Some messages are private to the user. However, in a fully normalized database, the list of message IDs are kept within another table:&lt;br /&gt;
&amp;lt;!-- dkaplan: IMPORTANT: if users have messages, this is NOT a normalized table, it is denormalized.  If users have messages, it is normalized by putting a userid in the MESSAGES table. This section is claiming the opposite.  --&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
+------------------------+&lt;br /&gt;
|       MESSAGES         |&lt;br /&gt;
+------------------------+&lt;br /&gt;
|  msgid   |   message   |&lt;br /&gt;
+------------------------+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a user marks a message for deletion, the usual way is to recover the message ID from the user, and delete that:&lt;br /&gt;
&lt;br /&gt;
''DELETE FROM message WHERE msgid='frmMsgId'''&lt;br /&gt;
&lt;br /&gt;
However, how do you know if the user is eligible to delete that message ID? Such tables need to be denormalized slightly to include a user ID or make it easy to perform a single query to delete the message safely. For example, by adding back an (optional) uid column, the delete is now made reasonably safe:&lt;br /&gt;
&lt;br /&gt;
''DELETE FROM message WHERE uid='session.myUserID' and msgid='frmMsgId';''&lt;br /&gt;
&lt;br /&gt;
Where the data is potentially both a private resource and a public resource (for example, in the secure message service, broadcast messages are just a special type of private message), additional precautions need to be taken to prevent users from deleting public resources without authorization. This can be done using role based checks, as well as using SQL statements to discriminate by message type:&lt;br /&gt;
&lt;br /&gt;
''DELETE FROM message ''&lt;br /&gt;
&lt;br /&gt;
''WHERE''&lt;br /&gt;
&lt;br /&gt;
''uid='session.myUserID' AND''&lt;br /&gt;
&lt;br /&gt;
''msgid='frmMsgId' AND''&lt;br /&gt;
&lt;br /&gt;
''broadcastFlag = false;''&lt;br /&gt;
&lt;br /&gt;
==URL encoding ==&lt;br /&gt;
&lt;br /&gt;
Data sent via the URL, which is strongly discouraged, should be URL encoded and decoded. This reduces the likelihood of cross-site scripting attacks from working.&lt;br /&gt;
&lt;br /&gt;
In general, do not send data via GET request unless for navigational purposes.&lt;br /&gt;
&lt;br /&gt;
==HTML encoding ==&lt;br /&gt;
&lt;br /&gt;
Data sent to the user needs to be safe for the user to view. This can be done using &amp;lt;bean:write ...&amp;gt; and friends. Do not use &amp;lt;%=var%&amp;gt; unless it is used to supply an argument for &amp;lt;bean:write...&amp;gt; or similar. &lt;br /&gt;
&lt;br /&gt;
HTML encoding translates a range of characters into their HTML entities. For example, &amp;gt; becomes &amp;amp;amp;gt; This will still display as &amp;gt; on the user's browser, but it is a safe alternative.&lt;br /&gt;
&lt;br /&gt;
==Encoded strings ==&lt;br /&gt;
&lt;br /&gt;
Some strings may be received in encoded form. It is essential to send the correct locale to the user so that the web server and application server can provide a single level of canoncalization prior to the first use. &lt;br /&gt;
&lt;br /&gt;
Do not use getReader() or getInputStream() as these input methods do not decode encoded strings. If you need to use these constructs, you must decanoncalize data by hand. &lt;br /&gt;
&lt;br /&gt;
==Data Validation and Interpreter Injection ==&lt;br /&gt;
&lt;br /&gt;
This section focuses on preventing injection in ColdFusion. Interpreter Injection involves manipulating application parameters to execute malicious code on the system. The most prevalent of these is SQL injection but it also includes other injection techniques, including LDAP, ORM, User Agent, XML, etc. – see the Interpreter Injection chapter of this document for greater details. As a developer you should assume that all input is malicious. Before processing any input coming from a user, data source, component, or data service it should be validated for type, length, and/or range. ColdFusion includes support for Regular Expressions and CFML tags that can be used to validate input.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''SQL Injection'''&lt;br /&gt;
&lt;br /&gt;
SQL Injection involves sending extraneous SQL queries as variables. ColdFusion provides the &amp;lt;cfqueryparam&amp;gt; and &amp;lt;cfprocparam&amp;gt; tags for validating database parameters. These tags nests inside &amp;lt;cfquery&amp;gt; and &amp;lt;cfstoredproc&amp;gt;, respectively. For dynamic SQL submitted in &amp;lt;cfquery&amp;gt;, use the CFSQLTYPE attribute of the &amp;lt;cfqueryparam&amp;gt; to validate variables against the expected database datatype. Similarly, use the CFSQLTYPE attribute of &amp;lt;cfprocparam&amp;gt; to validate the datatypes of stored procedure parameters passed through &amp;lt;cfstoredproc&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can also strengthen your systems against SQL Injection by disabling the Allowed SQL operations for individual data sources. See the '''Configuration''' section below for more information.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''LDAP Injection'''&lt;br /&gt;
&lt;br /&gt;
ColdFusion uses the &amp;lt;cfldap&amp;gt; tag to communicate with LDAP servers. This tag has an ACTION attribute which dictates the query performed against the LDAP. The valid values for this attribute are: add, delete, query (default), modify, and modifyDN. &amp;lt;cfldap&amp;gt; calls are turned into JNDI (Java Naming And Directory Interface) lookups. However, because &amp;lt;cfldap&amp;gt; wraps the calls, it will throw syntax errors if native JNDI code is passed to its attributes making LDAP injection more difficult.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''XML Injection'''&lt;br /&gt;
&lt;br /&gt;
Two parsers exist for XML data – SAX and DOM. ColdFusion uses DOM which reads the entire XML document into the server’s memory. This requires the administrator to restrict the size of the JVM containing ColdFusion.  ColdFusion is built on Java therefore by default, entity references are expanded during parsing. To prevent unbounded entity expansion, before a string is converted to an XML DOM, filter out DOCTYPES elements.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After the DOM has been read, to reduce the risk of XML, Injection use the ColdFusion XML decision functions: isXML(), isXmlAttribute(), isXmlElement(), isXmlNode(), and isXmlRoot(). The isXML() function determines if a string is well-formed XML. The other functions determine whether or not the passed parameter is a valid part of an XML document. Use the xmlValidate() function to validate external XML documents against a Document Type Definition (DTD) or XML Schema.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Event Gateway, IM, and SMS Injection'''&lt;br /&gt;
&lt;br /&gt;
ColdFusion MX 7 enables Event Gateways, instant messaging (IM), and SMS (short message service) for interacting with external systems. Event Gateways are ColdFusion components that respond asynchronously to non-HTTP requests – e.g. instant messages, SMS text from wireless devices, etc. ColdFusion provides Lotus Sametime and XMPP (Extensible Messaging and Presence Protocol) gateways for instant messaging. It also provides an event gateway for interacting with SMS text messages.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Injection along these gateways can happen when end users (and/or systems) send malicious code to execute on the server. These gateways all utilize ColdFusion Components (CFCs) for processing. Use standard ColdFusion functions, tags, and validation techniques to protect against malicious code injection. Sanitize all input strings and do not allow un-validated code to access backend systems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Best Practices'''&lt;br /&gt;
&lt;br /&gt;
Use the XML functions to validate XML input.&lt;br /&gt;
&lt;br /&gt;
Before performing XPath searches and transformations in ColdFusion, validate the source before executing.&lt;br /&gt;
&lt;br /&gt;
Use ColdFusion validation techniques to sanitize strings passed to xmlSearch for performing XPath queries. &lt;br /&gt;
&lt;br /&gt;
When performing XML transformations only use a trusted source for the XSL stylesheet.&lt;br /&gt;
&lt;br /&gt;
Ensure that the memory size of the Java Sandbox containing ColdFusion can handle large XML documents without adversely affecting server resources.&lt;br /&gt;
&lt;br /&gt;
Set the memory value to less than the amount of RAM on the server (-Xmx)&lt;br /&gt;
&lt;br /&gt;
Remove DOCTYPE elements from the XML string before converting it to an XML object.&lt;br /&gt;
&lt;br /&gt;
Using scriptProtect can be used to thwart most attempts of cross-site scripting. Set scriptProtect to All in the Application.cfc&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;cfparam&amp;gt; or &amp;lt;cfargument&amp;gt; to instantiate variables in ColdFusion. Use this tag with the name and type attributes. If the value is not of the specified type, ColdFusion returns an error.&lt;br /&gt;
&lt;br /&gt;
To handle untyped variables use IsValid() to validate its value against any legal object type that ColdFusion supports.&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;cfqueryparam&amp;gt; and &amp;lt;cfprocparam&amp;gt; to valid dynamic SQL variables against database datatypes&lt;br /&gt;
&lt;br /&gt;
Use CFLDAP for accessing LDAP servers. Avoid allowing native JNDI calls to connect to LDAP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Best Practice in Action'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The sample code below shows a database authentication function using some of the input validation techniques discussed in this section.&lt;br /&gt;
&lt;br /&gt;
{| border=1&lt;br /&gt;
&lt;br /&gt;
 || &lt;br /&gt;
* &amp;lt;cffunction name=&amp;quot;dblogin&amp;quot; access=&amp;quot;private&amp;quot; output=&amp;quot;false&amp;quot; returntype=&amp;quot;struct&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*   &amp;lt;cfargument name=&amp;quot;strUserName&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*   &amp;lt;cfargument name=&amp;quot;strPassword&amp;quot; required=&amp;quot;true&amp;quot; type=&amp;quot;string&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*   &amp;lt;cfset var retargs = StructNew()&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*   &amp;lt;cfif IsValid(&amp;quot;regex&amp;quot;, uUserName, &amp;quot;[A-Za-z0-9%]*&amp;quot;) AND IsValid(&amp;quot;regex&amp;quot;, uPassword, &amp;quot;[A-Za-z0-9%]*&amp;quot;)&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*     &amp;lt;cfquery name=&amp;quot;loginQuery&amp;quot; dataSource=&amp;quot;#Application.DB#&amp;quot; &amp;gt;&lt;br /&gt;
&lt;br /&gt;
*     SELECT hashed_password, salt&lt;br /&gt;
&lt;br /&gt;
*     FROM UserTable&lt;br /&gt;
&lt;br /&gt;
*     WHERE UserName =&lt;br /&gt;
&lt;br /&gt;
*     &amp;lt;cfqueryparam value=&amp;quot;#strUserName#&amp;quot; cfsqltype=&amp;quot;CF_SQL_VARCHAR&amp;quot; maxlength=&amp;quot;25&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*     &amp;lt;/cfquery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*     &amp;lt;cfif loginQuery.hashed_password EQ Hash(strPassword &amp;amp; loginQuery.salt, &amp;quot;SHA-256&amp;quot; )&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*       &amp;lt;cfset retargs.authenticated=&amp;quot;YES&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*       &amp;lt;cfset Session.UserName = strUserName&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*       &amp;lt;!-- Add code to get roles from database --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*       &amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*       &amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*     &amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*   &amp;lt;cfelse&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*     &amp;lt;cfset retargs.authenticated=&amp;quot;NO&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*   &amp;lt;/cfif&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*   &amp;lt;cfreturn retargs&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;/cffunction&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Delimiter and special characters ==&lt;br /&gt;
&lt;br /&gt;
There are many characters that mean something special to various programs. If you followed the advice only to accept characters that are considered good, it is very likely that only a few delimiters will catch you out. &lt;br /&gt;
&lt;br /&gt;
Here are the usual suspects:&lt;br /&gt;
&lt;br /&gt;
* NULL (zero) %00&lt;br /&gt;
&lt;br /&gt;
* LF - ANSI chr(10) &amp;quot;\r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* CR - ANSI chr(13) &amp;quot;\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* CRLF - &amp;quot;\n\r&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* CR - EBCDIC 0x0f &lt;br /&gt;
&lt;br /&gt;
* Quotes &amp;quot; '&lt;br /&gt;
&lt;br /&gt;
* Commas, slashes spaces and tabs and other white space - used in CSV, tab delimited output, and other specialist formats&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;&amp;gt; - XML and HTML tag markers, redirection characters&lt;br /&gt;
&lt;br /&gt;
* ; &amp;amp; - Unix and NT file system continuance&lt;br /&gt;
&lt;br /&gt;
* @ - used for e-mail addresses&lt;br /&gt;
&lt;br /&gt;
* 0xff&lt;br /&gt;
&lt;br /&gt;
* ... more&lt;br /&gt;
&lt;br /&gt;
Whenever you code to a particular technology, you should determine which characters are &amp;quot;special&amp;quot; and prevent them appearing in input, or properly escaping them.&lt;br /&gt;
&lt;br /&gt;
==Further Reading ==&lt;br /&gt;
&lt;br /&gt;
* ASP.NET 2.0 Viewstate&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;http://channel9.msdn.com/wiki/default.aspx/Channel9.HowToConfigureTheMachineKeyInASPNET2&amp;lt;/u&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Guide Table of Contents]]&lt;br /&gt;
[[Category:OWASP_Guide_Project]]&lt;br /&gt;
[[Category:Validation]]&lt;br /&gt;
[[Category:Encoding]]&lt;/div&gt;</summary>
		<author><name>Tomo</name></author>	</entry>

	</feed>