Security/Reviews/CloudServices/Marketplace Payments: Difference between revisions

(→‎Architecture Diagram: edit diagrams)
(→‎Threat Model: add items)
 
(25 intermediate revisions by the same user not shown)
Line 74: Line 74:
* Payments tied to FxA project wiki page  - https://wiki.mozilla.org/CloudServices/Payments/FirefoxAccounts
* Payments tied to FxA project wiki page  - https://wiki.mozilla.org/CloudServices/Payments/FirefoxAccounts
* In App Payments - https://wiki.mozilla.org/Marketplace/InAppPayments
* In App Payments - https://wiki.mozilla.org/Marketplace/InAppPayments
* Web Payments Provider - https://wiki.mozilla.org/WebAPI/WebPaymentProvider


'''Project Links - Mana pages (Mozilla staff/contrib LDAP account needed)'''
'''Project Links - Mana pages (Mozilla staff/contrib LDAP account needed)'''
Line 94: Line 93:
* http://firefox-marketplace-api.readthedocs.org/en/latest/topics/payment.html#preparing-payment
* http://firefox-marketplace-api.readthedocs.org/en/latest/topics/payment.html#preparing-payment
* http://firefox-marketplace-api.readthedocs.org/en/latest/topics/payment.html#payment-status
* http://firefox-marketplace-api.readthedocs.org/en/latest/topics/payment.html#payment-status
* WebPayment API (navigator.Mozpay) - https://wiki.mozilla.org/WebAPI/WebPayment
* Web Payments Provider - https://wiki.mozilla.org/WebAPI/WebPaymentProvider


'''Related'''
'''Related'''
Firefox Accounts Payments Proposal - https://wiki.mozilla.org/CloudServices/Payments/FirefoxAccounts
* Firefox Accounts Payments Proposal - https://wiki.mozilla.org/CloudServices/Payments/FirefoxAccounts
* Jugband engineering metrics and activity for Marketplace - https://jugband.paas.allizom.org/
* Jugband engineering metrics and activity for Marketplace - https://jugband.paas.allizom.org/


Line 105: Line 107:


=== Use Cases ===
=== Use Cases ===
[https://webpay.readthedocs.org/en/latest/api.html Webpay] is an implementation of the [[WebAPI/WebPaymentProvider|WebPaymentProvider spec]]. It hosts the payment flow inside [https://developer.mozilla.org/en-US/docs/Web/API/Navigator/mozPay navigator.mozPay]() when making app purchases or in-app payments on Firefox OS.
* Webpay provides a REST API for clients to interact with the server.
* All API’s use JSON for request and responses.


=== Data Flows ===
=== Data Flows ===


==== Diagram ====
==== Diagrams ====


===== Payment Flow =====
===== Payments Flow Sequence =====
[[Image:Pay_Flow_Sequence.png]]
[[Image:Pay_Flow_Sequence.png]]


==== 1. Section 1 ====
===== Payments Data Flow Diagram =====
{| border="1" class="fullwidth-table"
[[Image:PaymentsDFD.jpg]]
| align="center" style="background:#f0f0f0;"|'''ID'''
| align="center" style="background:#f0f0f0;"|'''Origin'''
| align="center" style="background:#f0f0f0;"|'''Destination'''
| align="center" style="background:#f0f0f0;"|'''Description'''
|-
|1.A||Abcdefg hij klmnop||Abcdefg hij klmnop|| Abcdefg hij klmnop.
|-
|1.B||klmnop||klmnop klmnop||klmnop klmnop klmnop klmnop. klmnop klmnopklmnopklmnop
|}


==== 2. Section 2 ====
===== Pin Flow =====
{| border="1" class="fullwidth-table"
[[Image:Pin-flow.png]]
| align="center" style="background:#f0f0f0;"|'''ID'''
<br />''(Note: Persona was replaced with FxA)''
| align="center" style="background:#f0f0f0;"|'''Origin'''
| align="center" style="background:#f0f0f0;"|'''Destination'''
| align="center" style="background:#f0f0f0;"|'''Description'''
|-
|2.A||Abcdefg hij klmnop||Abcdefg hij klmnop|| Abcdefg hij klmnop.
|-
|2.B||klmnop||klmnop klmnop||klmnop klmnop klmnop klmnop. klmnop klmnopklmnopklmnop
|}
 
==== 3. Section 3 ====
{| border="1" class="fullwidth-table"
| align="center" style="background:#f0f0f0;"|'''ID'''
| align="center" style="background:#f0f0f0;"|'''Origin'''
| align="center" style="background:#f0f0f0;"|'''Destination'''
| align="center" style="background:#f0f0f0;"|'''Description'''
|-
|3.A||Abcdefg hij klmnop||Abcdefg hij klmnop|| Abcdefg hij klmnop.
|-
|3.B||klmnop||klmnop klmnop||klmnop klmnop klmnop klmnop. klmnop klmnopklmnopklmnop
|-
|}


=== Architecture Diagram ===
=== Architecture Diagram ===


====Top-level architecural view====<br />
====Top-level architecural view====
[[File:Mkt_layers.png|830px]]
[[File:Mkt_layers.png|830px]]


Line 158: Line 135:
[[File:Pmt systems.png|600px|Payment Systems diagram -  by Wil Clouser]]
[[File:Pmt systems.png|600px|Payment Systems diagram -  by Wil Clouser]]


<br />Payment Systems diagram by Wil Clouser
<br />Logical diagram of Payments application services architecture. 


===== Description =====
'''Diagram Key'''
Logical diagram of Payments application services architecture. 
 
'''Usage'''


The dotted line from a red service goes to a breakout describing the logical components of its service stack.  
The dotted line from a red service goes to a breakout describing the logical components of its service stack.  
Line 170: Line 144:
Starting from a Red Services box,
Starting from a Red Services box,
* Solid line represents dependency/backend component relationships
* Solid line represents dependency/backend component relationships
* Dotted lines point to breakouts describing the logical components of a service stack.
* Dotted lines point to breakouts describing the logical components of a service stack


===== Mozilla Services =====
===== Mozilla Services =====
Line 232: Line 206:
|-
|-
| 7||Compromise web heads||The attacker could then leverage their access to attack other parts of the application environment or to serve arbitrary/manipulated content to users.||Mitigation possibilities are being discussed.||System access||12||3||4 – Reputation||
| 7||Compromise web heads||The attacker could then leverage their access to attack other parts of the application environment or to serve arbitrary/manipulated content to users.||Mitigation possibilities are being discussed.||System access||12||3||4 – Reputation||
|-
| 8||Appplication Theft||The attacker could begin a payment, cancel the payment, and craft a postback to the app server, fooling it into thinking the cancelled payment was successful. (BID 1145024)||Bug detected, application patched.||System access||12||3||4 – Reputation||
|-
| 9||Appplication Theft||The attacker could modify the JWT for payment to craft $0 payment that executes successfully. (BID 1145024)||Bug detected, application patched.||System access||12||3||4 – Reputation||
|-
|-
|}
|}
[[image:TEMPLATE-Threat-Model.png|thumb|TEMPLATE Implementation Dataflow]]
 


==== User Interactions ====
==== User Interactions ====
Line 305: Line 283:
| 4 || Open and communicate with MozPay || JavaScript library: fxpay
| 4 || Open and communicate with MozPay || JavaScript library: fxpay
|}
|}
==== Client Interactions ====
{| border="1" class="fullwidth-table"
| align="center" style="background:#f0f0f0;"|'''ID'''
| align="center" style="background:#f0f0f0;"|'''Summary'''
| align="center" style="background:#f0f0f0;"|'''Description'''
|-
| 2.A|| Summary||Description.
|}
==== Server Interactions ====
{| border="1" class="fullwidth-table"
| align="center" style="background:#f0f0f0;"|'''ID'''
| align="center" style="background:#f0f0f0;"|'''Summary'''
| align="center" style="background:#f0f0f0;"|'''Description'''
| align="center" style="background:#f0f0f0;"|'''Path'''
| align="center" style="background:#f0f0f0;"|'''Input'''
| align="center" style="background:#f0f0f0;"|'''Output'''
| align="center" style="background:#f0f0f0;"|'''CEF'''
| align="center" style="background:#f0f0f0;"|'''CSRF'''
|-
| 3.A|| Summary||Description||Path||Input||Output||CEF||CSRF
|-
| 3.b|| Summary||Description||Path||Input||Output||CEF||CSRF
|}
CEF and CSRF columns indicate wether or not CEF logging or CSRF prevention is required for the interactions


==== Security Recommendations / Open Issues ====
==== Security Recommendations / Open Issues ====
Line 366: Line 318:
* Large number of  file uploads
* Large number of  file uploads
* Attempt to upload something other than expected file
* Attempt to upload something other than expected file
=== Business Test Cases ===
Document application specific test cases here


=== Privacy Risk Analysis ===
=== Privacy Risk Analysis ===
Line 406: Line 355:
=== Operation Security Requirements ===
=== Operation Security Requirements ===
Document network/platform security requirements here (e.g. IDS concerns, firewall changes, system hardening reqs, etc)
Document network/platform security requirements here (e.g. IDS concerns, firewall changes, system hardening reqs, etc)
====Mana Website Creation Form ====
* https://mana.mozilla.org/wiki/display/websites/Home
=== Critical Security Requirements ===
=== Critical Security Requirements ===
Itemize individual security blockers here.  Reference components in section AppSec or OpSec subsections.
Itemize individual security blockers here.  Reference components in section AppSec or OpSec subsections.
Line 416: Line 362:
=== Repeatable Security Test Cases ===
=== Repeatable Security Test Cases ===
Document individual repeatable security test cases here.  Include a reference to the source repo, and documentation that governs how to execute test cases.
Document individual repeatable security test cases here.  Include a reference to the source repo, and documentation that governs how to execute test cases.
=== Secure Coding Guidelines ===
=== Secure Coding Guidelines ===
Document specific secure coding guidelines to be followed and relate them to specific issues/requirements that are specified; capture bug ids related to those issues.
Document specific secure coding guidelines to be followed and relate them to specific issues/requirements that are specified; capture bug ids related to those issues.
Line 427: Line 374:
==== Code Review ====
==== Code Review ====
==== Automated Security Testing ====
==== Automated Security Testing ====
* [https://wiki.mozilla.org/WebAppSec/garmr Garmr]
* Minion scanner


==== Manual Security Testing ====
==== Manual Security Testing ====
297

edits