wiqa 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
wiqa/__init__.py ADDED
@@ -0,0 +1,7 @@
1
+ """Wiqa (وِقاء): in-app protection against MongoDB injection for FastAPI / Starlette."""
2
+ from .detect import Finding, regex_risk, scan_json, scan_query
3
+ from .messages import explain
4
+ from .middleware import WiqaMiddleware
5
+
6
+ __all__ = ["Finding", "WiqaMiddleware", "explain", "regex_risk", "scan_json", "scan_query"]
7
+ __version__ = "0.1.0"
wiqa/detect.py ADDED
@@ -0,0 +1,78 @@
1
+ """Detectors for MongoDB injection in request input.
2
+
3
+ Two checks, both chosen to stay silent on normal text (Arabic, names like O'Brien, plain search terms):
4
+ * nosql-operator: a key that starts with "$" (e.g. {"password": {"$ne": ""}} or ?password[$ne]=),
5
+ which turns a value the app expected into a MongoDB query operator.
6
+ * regex-dos: a value with a nested quantifier such as (a+)+ that can stall a $regex search.
7
+ """
8
+ from __future__ import annotations
9
+
10
+ import re
11
+ from dataclasses import dataclass
12
+ from typing import Any, Iterator
13
+
14
+ MAX_DEPTH = 32
15
+ MAX_NODES = 5_000
16
+ MAX_REGEX_SCAN_LEN = 2_000
17
+
18
+ # A group that contains a quantifier and is itself quantified: (a+)+, (\w*)*, (.+){2,}
19
+ _NESTED_QUANTIFIER = re.compile(r"\((?:[^()\\]|\\.)*[+*}](?:[^()\\]|\\.)*\)\s*(?:[+*]|\{\d+,?\d*\})")
20
+ # A quantified group with alternation: (a|aa)+
21
+ _ALTERNATION_QUANTIFIED = re.compile(r"\((?:[^()\\]|\\.)*\|(?:[^()\\]|\\.)*\)\s*[+*]")
22
+ # A quantifier that closes a group which is itself quantified, at any nesting depth: ((ab)*)+
23
+ _QUANTIFIED_CLOSE = re.compile(r"[+*}]\s*\)\s*(?:[+*]|\{\d+,?\d*\})")
24
+ # Bracket syntax some frameworks turn into nested dicts: password[$ne]=x
25
+ _BRACKET_OPERATOR = re.compile(r"\[\s*(\$[A-Za-z]+)\s*\]")
26
+
27
+
28
+ @dataclass(frozen=True)
29
+ class Finding:
30
+ kind: str # "nosql-operator" | "regex-dos"
31
+ location: str # e.g. "body.password", "query.q"
32
+ detail: str # operator name or pattern class; never the raw user value
33
+
34
+
35
+ def regex_risk(value: str) -> bool:
36
+ """True when the string looks like a catastrophic-backtracking regex."""
37
+ if len(value) > MAX_REGEX_SCAN_LEN or "(" not in value:
38
+ return False
39
+ return bool(
40
+ _NESTED_QUANTIFIER.search(value)
41
+ or _ALTERNATION_QUANTIFIED.search(value)
42
+ or _QUANTIFIED_CLOSE.search(value)
43
+ )
44
+
45
+
46
+ def scan_query(pairs: list[tuple[str, str]]) -> list[Finding]:
47
+ findings: list[Finding] = []
48
+ for key, value in pairs:
49
+ match = _BRACKET_OPERATOR.search(key)
50
+ if match:
51
+ base = key.split("[", 1)[0]
52
+ findings.append(Finding("nosql-operator", f"query.{base}", match.group(1)))
53
+ elif key.startswith("$"):
54
+ findings.append(Finding("nosql-operator", f"query.{key}", key))
55
+ if regex_risk(value):
56
+ findings.append(Finding("regex-dos", f"query.{key}", "nested-quantifier"))
57
+ return findings
58
+
59
+
60
+ def scan_json(data: Any) -> list[Finding]:
61
+ return list(_walk(data, "body", 0, [0]))
62
+
63
+
64
+ def _walk(node: Any, path: str, depth: int, count: list[int]) -> Iterator[Finding]:
65
+ count[0] += 1
66
+ if depth > MAX_DEPTH or count[0] > MAX_NODES:
67
+ return
68
+ if isinstance(node, dict):
69
+ for key, value in node.items():
70
+ key_str = str(key)
71
+ if key_str.startswith("$"):
72
+ yield Finding("nosql-operator", path, key_str)
73
+ yield from _walk(value, f"{path}.{key_str}", depth + 1, count)
74
+ elif isinstance(node, list):
75
+ for index, item in enumerate(node):
76
+ yield from _walk(item, f"{path}[{index}]", depth + 1, count)
77
+ elif isinstance(node, str) and regex_risk(node):
78
+ yield Finding("regex-dos", path, "nested-quantifier")
wiqa/messages.py ADDED
@@ -0,0 +1,29 @@
1
+ """Human explanations for each finding, in Arabic and English."""
2
+ from __future__ import annotations
3
+
4
+ from .detect import Finding
5
+
6
+ _TEXT = {
7
+ "nosql-operator": {
8
+ "ar": "حد بعت أمر MongoDB ({detail}) مكان قيمة عادية في {location}. "
9
+ "ده ممكن يخلّيه يدخل من غير باسورد، أو يقرا بيانات مش بتاعته.",
10
+ "en": "A MongoDB operator ({detail}) was sent where a plain value was expected in {location}. "
11
+ "This can bypass a login or read other users' data.",
12
+ "fix_ar": "خلّي نوع الحقل ده str في الـ Pydantic model، أو ارفض أي قيمة نوعها dict قبل ما تبني الـ query.",
13
+ },
14
+ "regex-dos": {
15
+ "ar": "القيمة في {location} فيها نمط regex ممكن يعلّق قاعدة البيانات أو السيرفر (ReDoS).",
16
+ "en": "The value in {location} contains a regex pattern that can stall the database or server (ReDoS).",
17
+ "fix_ar": "استخدم re.escape() على كلام اليوزر قبل ما تحطه في $regex.",
18
+ },
19
+ }
20
+
21
+
22
+ def explain(finding: Finding) -> dict[str, str]:
23
+ text = _TEXT[finding.kind]
24
+ values = {"detail": finding.detail, "location": finding.location}
25
+ return {
26
+ "ar": text["ar"].format(**values),
27
+ "en": text["en"].format(**values),
28
+ "fix_ar": text["fix_ar"],
29
+ }
wiqa/middleware.py ADDED
@@ -0,0 +1,139 @@
1
+ """ASGI middleware that scans each request and either logs (monitor) or rejects (block) injection attempts.
2
+
3
+ Usage (FastAPI / Starlette):
4
+ from wiqa import WiqaMiddleware
5
+ app.add_middleware(WiqaMiddleware, mode="monitor") # or "block"
6
+
7
+ Only JSON bodies are buffered and scanned; uploads and other content types pass through untouched.
8
+ Raw user values are never logged: only the location, operator name and request path.
9
+ """
10
+ from __future__ import annotations
11
+
12
+ import json
13
+ import logging
14
+ from typing import Any, Awaitable, Callable
15
+ from urllib.parse import parse_qsl
16
+
17
+ from .detect import Finding, scan_json, scan_query
18
+ from .messages import explain
19
+
20
+ Scope = dict[str, Any]
21
+ Message = dict[str, Any]
22
+ Receive = Callable[[], Awaitable[Message]]
23
+ Send = Callable[[Message], Awaitable[None]]
24
+ ASGIApp = Callable[[Scope, Receive, Send], Awaitable[None]]
25
+
26
+ MODES = ("monitor", "block")
27
+ DEFAULT_MAX_BODY = 1_000_000
28
+ BLOCK_STATUS = 403
29
+
30
+
31
+ class WiqaMiddleware:
32
+ def __init__(
33
+ self,
34
+ app: ASGIApp,
35
+ mode: str = "monitor",
36
+ max_body: int = DEFAULT_MAX_BODY,
37
+ logger: logging.Logger | None = None,
38
+ on_finding: Callable[[Finding, str], None] | None = None,
39
+ ) -> None:
40
+ if mode not in MODES:
41
+ raise ValueError(f"mode must be one of {MODES}, got {mode!r}")
42
+ self.app = app
43
+ self.mode = mode
44
+ self.max_body = max_body
45
+ self.logger = logger or logging.getLogger("wiqa")
46
+ self.on_finding = on_finding
47
+
48
+ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
49
+ if scope["type"] != "http":
50
+ await self.app(scope, receive, send)
51
+ return
52
+
53
+ findings = scan_query(_query_pairs(scope))
54
+ receive, body = await _buffer_json_body(scope, receive, self.max_body)
55
+ if body is not None:
56
+ findings.extend(scan_json(body))
57
+
58
+ if not findings:
59
+ await self.app(scope, receive, send)
60
+ return
61
+
62
+ path = scope.get("path", "")
63
+ for finding in findings:
64
+ self._report(finding, path)
65
+
66
+ if self.mode == "block":
67
+ await _send_blocked(send, findings[0])
68
+ return
69
+ await self.app(scope, receive, send)
70
+
71
+ def _report(self, finding: Finding, path: str) -> None:
72
+ text = explain(finding)
73
+ self.logger.warning(
74
+ "wiqa %s %s %s %s op=%s | %s | الحل: %s",
75
+ self.mode, finding.kind, path, finding.location, finding.detail, text["ar"], text["fix_ar"],
76
+ )
77
+ if self.on_finding is not None:
78
+ self.on_finding(finding, path)
79
+
80
+
81
+ def _query_pairs(scope: Scope) -> list[tuple[str, str]]:
82
+ raw = scope.get("query_string", b"").decode("utf-8", errors="replace")
83
+ return parse_qsl(raw, keep_blank_values=True)
84
+
85
+
86
+ def _is_json(scope: Scope) -> bool:
87
+ for name, value in scope.get("headers", []):
88
+ if name.lower() == b"content-type":
89
+ return b"json" in value.lower()
90
+ return False
91
+
92
+
93
+ async def _buffer_json_body(scope: Scope, receive: Receive, max_body: int) -> tuple[Receive, Any]:
94
+ """Read a JSON body once, then hand the app a receive() that replays it."""
95
+ if not _is_json(scope):
96
+ return receive, None
97
+
98
+ messages: list[Message] = []
99
+ size = 0
100
+ more = True
101
+ while more:
102
+ message = await receive()
103
+ messages.append(message)
104
+ if message["type"] != "http.request":
105
+ break
106
+ size += len(message.get("body", b""))
107
+ more = message.get("more_body", False)
108
+
109
+ parsed: Any = None
110
+ if size <= max_body:
111
+ raw = b"".join(m.get("body", b"") for m in messages if m["type"] == "http.request")
112
+ try:
113
+ parsed = json.loads(raw) if raw else None
114
+ except (ValueError, UnicodeDecodeError):
115
+ parsed = None # invalid JSON is the app's problem to reject, not ours
116
+
117
+ pending = list(messages)
118
+
119
+ async def replay() -> Message:
120
+ if pending:
121
+ return pending.pop(0)
122
+ return await receive()
123
+
124
+ return replay, parsed
125
+
126
+
127
+ async def _send_blocked(send: Send, finding: Finding) -> None:
128
+ text = explain(finding)
129
+ payload = json.dumps(
130
+ {"error": "blocked_by_wiqa", "kind": finding.kind, "message_ar": text["ar"], "message_en": text["en"]},
131
+ ensure_ascii=False,
132
+ ).encode("utf-8")
133
+ await send({
134
+ "type": "http.response.start",
135
+ "status": BLOCK_STATUS,
136
+ "headers": [(b"content-type", b"application/json; charset=utf-8"),
137
+ (b"content-length", str(len(payload)).encode())],
138
+ })
139
+ await send({"type": "http.response.body", "body": payload})
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.4
2
+ Name: wiqa
3
+ Version: 0.1.0
4
+ Summary: In-app security layer for FastAPI + MongoDB: stops NoSQL injection and ReDoS, explains attacks in Arabic and English
5
+ Author-email: Wiqa <wiqa@shift-agency.net>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://wiqa.shift-agency.net
8
+ Project-URL: Source, https://github.com/wiqa-dev/wiqa-python
9
+ Project-URL: Issues, https://github.com/wiqa-dev/wiqa-python/issues
10
+ Project-URL: Security, https://github.com/wiqa-dev/wiqa-python/security/policy
11
+ Keywords: security,fastapi,starlette,mongodb,nosql-injection,redos,middleware,arabic
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Framework :: FastAPI
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Natural Language :: Arabic
16
+ Classifier: Natural Language :: English
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Topic :: Security
19
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Provides-Extra: dev
24
+ Requires-Dist: fastapi>=0.110; extra == "dev"
25
+ Requires-Dist: httpx>=0.27; extra == "dev"
26
+ Requires-Dist: mongomock-motor>=0.0.36; extra == "dev"
27
+ Requires-Dist: pytest>=8; extra == "dev"
28
+ Requires-Dist: pytest-asyncio>=1.0; extra == "dev"
29
+ Dynamic: license-file
30
+
31
+ # Wiqa (وِقاء)
32
+
33
+ [![tests](https://github.com/wiqa-dev/wiqa-python/actions/workflows/tests.yml/badge.svg)](https://github.com/wiqa-dev/wiqa-python/actions/workflows/tests.yml)
34
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
35
+
36
+ **Know who tried, from where, and how to close it.**
37
+
38
+ Wiqa is an open-source security layer that runs *inside* your app, not in front of it. It sees every request from the inside, stops the attack before it reaches your code or your database, and explains it in Arabic and English. Nothing leaves your server.
39
+
40
+ This repository is the Python library for **FastAPI / Starlette + MongoDB**. Website: [wiqa.shift-agency.net](https://wiqa.shift-agency.net) · [العربي ↓](#بالعربي)
41
+
42
+ > Early release (v0.1). It catches two attack classes today. Read [What it does not do](#what-it-does-not-do-yet) before relying on it.
43
+
44
+ ## What it catches
45
+
46
+ | Attack | Example | What happens without protection |
47
+ |---|---|---|
48
+ | NoSQL operator injection | `{"username": "admin", "password": {"$ne": ""}}` | Login as admin without the password |
49
+ | Regex DoS (ReDoS) | `GET /search?q=^(a+)+$` | One request keeps the database/server busy |
50
+
51
+ Normal input passes: Arabic text, names like `O'Brien`, prices like `$15`, phone numbers.
52
+
53
+ ## Install and use
54
+
55
+ ```bash
56
+ pip install wiqa
57
+ ```
58
+
59
+ ```python
60
+ from fastapi import FastAPI
61
+ from wiqa import WiqaMiddleware
62
+
63
+ app = FastAPI()
64
+ app.add_middleware(WiqaMiddleware, mode="monitor") # log only. Switch to "block" when you trust it.
65
+ ```
66
+
67
+ In `monitor` mode nothing changes for your users; each finding is logged on the `wiqa` logger. In `block` mode the request gets `403` with a JSON explanation. Raw values (passwords, search text) are never logged.
68
+
69
+ No dependencies, no network calls, no telemetry.
70
+
71
+ ## Try it yourself (the demo)
72
+
73
+ `demo/vulnerable_app.py` is a small FastAPI + MongoDB app with both bugs on purpose (in-memory database, fake users).
74
+
75
+ ```bash
76
+ python -m venv .venv
77
+ .venv/bin/pip install -e ".[dev]" # Windows: .venv\Scripts\pip
78
+ .venv/bin/python -m demo.attack # same attacks, without and with wiqa
79
+ .venv/bin/python -m pytest -q # 31 tests
80
+ ```
81
+
82
+ ## What it does not do (yet)
83
+
84
+ - It checks the **request**, not the final query sent to MongoDB, so an operator built inside your own code is not seen.
85
+ - It does not cover SQL databases, XSS, SSRF, or auth logic bugs.
86
+ - The ReDoS check looks for nested quantifiers; it is a heuristic, not a full regex analyser.
87
+ - It is not a replacement for fixing the code: type your Pydantic fields as `str` and use `re.escape()` on user text.
88
+
89
+ ## Roadmap
90
+
91
+ - **Working on:** query-level checks inside pymongo/motor (so a real Arabic name is never blocked), SQL injection and XSS, first real apps in monitor mode.
92
+ - **Next:** one fast engine for every language (Node.js, Django and more), WhatsApp alerts, an Arabic/English security report.
93
+
94
+ ## Security
95
+
96
+ Found a way past Wiqa? Please report it privately. See [SECURITY.md](SECURITY.md).
97
+
98
+ ---
99
+
100
+ <div dir="rtl">
101
+
102
+ ## بالعربي
103
+
104
+ **اعرف مين حاول، ومنين، وإزاي تقفلها.**
105
+
106
+ وِقاء طبقة حماية مفتوحة المصدر بتتركّب جوه تطبيقك، مش قدامه. بتشوف كل طلب من جوه، وبتوقف الهجمة قبل ما توصل للكود أو الداتابيز، وبتشرحها بالعربي. وبيانات عملائك عمرها ما بتخرج من سيرفرك.
107
+
108
+ الريبو ده هو مكتبة بايثون لـ **FastAPI + MongoDB**.
109
+
110
+ ### بتمسك إيه دلوقتي
111
+
112
+ - **حقن أوامر MongoDB**، زي `{"$ne": ""}` في خانة الباسورد، اللي بيدخّل المهاجم كأدمن من غير باسورد.
113
+ - **ReDoS**، يعني نص بحث متصمم عشان يوقّف السيرفر.
114
+
115
+ النصوص العادية بتعدّي: العربي، والأسماء زي `O'Brien`، والأسعار زي `$15`.
116
+
117
+ ### الاستخدام
118
+
119
+ ابدأ بوضع `monitor`: بيسجّل بس، ومش بيغيّر حاجة لمستخدمينك. ولما تطمّن، حوّل لـ `block`. القيم الحساسة زي الباسوردات عمرها ما بتتكتب في اللوج.
120
+
121
+ ### اللي لسه مش بتعمله
122
+
123
+ بتفحص الطلب نفسه، مش الـquery النهائية. ومش بتغطي SQL ولا XSS لسه، وده اللي شغالين عليه دلوقتي. وهي مش بديل إنك تصلّح الكود.
124
+
125
+ لو لقيت ثغرة في وِقاء نفسها، شوف [SECURITY.md](SECURITY.md).
126
+
127
+ </div>
128
+
129
+ ---
130
+
131
+ License: [Apache-2.0](LICENSE)
@@ -0,0 +1,9 @@
1
+ wiqa/__init__.py,sha256=t1hPOq60bQ1M-8Kp1n4aFHxO_wOIgXdgROmQN6Q-yFE,341
2
+ wiqa/detect.py,sha256=LXUISfbINSEVX2X1ZxAZnK60vXArKofABZPdnFc_Y2g,3171
3
+ wiqa/messages.py,sha256=PgvXKGdCKoyvnOo0ApUYDn8NqRC8IFPhXRVpsbTB1MI,1422
4
+ wiqa/middleware.py,sha256=XyOSIPu4Yr1Ba6a98c9v7M_dz6KJlmARAypNZ7TcjGw,4634
5
+ wiqa-0.1.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
6
+ wiqa-0.1.0.dist-info/METADATA,sha256=sSmIVmQ06bXG1JOYmw4BIMyxO9h9As0P7BYTb-tV2VI,5885
7
+ wiqa-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
8
+ wiqa-0.1.0.dist-info/top_level.txt,sha256=y1ik5WgcwxeRxGdHPoSvEtJ8gOOHWk3dto9UepSjEOQ,5
9
+ wiqa-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1 @@
1
+ wiqa