open-privacy-protocol-engine 0.1.0a1__tar.gz
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.
- open_privacy_protocol_engine-0.1.0a1/.github/workflows/release.yml +57 -0
- open_privacy_protocol_engine-0.1.0a1/.gitignore +8 -0
- open_privacy_protocol_engine-0.1.0a1/CODE_OF_CONDUCT.md +41 -0
- open_privacy_protocol_engine-0.1.0a1/CONTRIBUTING.md +39 -0
- open_privacy_protocol_engine-0.1.0a1/Dockerfile +14 -0
- open_privacy_protocol_engine-0.1.0a1/LICENSE +201 -0
- open_privacy_protocol_engine-0.1.0a1/NOTICE +4 -0
- open_privacy_protocol_engine-0.1.0a1/PKG-INFO +213 -0
- open_privacy_protocol_engine-0.1.0a1/README.md +148 -0
- open_privacy_protocol_engine-0.1.0a1/SECURITY.md +28 -0
- open_privacy_protocol_engine-0.1.0a1/assets/brand/icon-512.png +0 -0
- open_privacy_protocol_engine-0.1.0a1/assets/brand/logo-transparent-dark.png +0 -0
- open_privacy_protocol_engine-0.1.0a1/assets/brand/logo-transparent-white.png +0 -0
- open_privacy_protocol_engine-0.1.0a1/docs/agents.md +51 -0
- open_privacy_protocol_engine-0.1.0a1/docs/data-sources.md +134 -0
- open_privacy_protocol_engine-0.1.0a1/docs/detectors.md +44 -0
- open_privacy_protocol_engine-0.1.0a1/pyproject.toml +51 -0
- open_privacy_protocol_engine-0.1.0a1/src/opp_engine/__init__.py +2 -0
- open_privacy_protocol_engine-0.1.0a1/src/opp_engine/cli.py +132 -0
- open_privacy_protocol_engine-0.1.0a1/src/opp_engine/connectors.py +207 -0
- open_privacy_protocol_engine-0.1.0a1/src/opp_engine/data/hygiene_lists.json +413 -0
- open_privacy_protocol_engine-0.1.0a1/src/opp_engine/detect.py +145 -0
- open_privacy_protocol_engine-0.1.0a1/src/opp_engine/engine.py +200 -0
- open_privacy_protocol_engine-0.1.0a1/src/opp_engine/generate.py +282 -0
- open_privacy_protocol_engine-0.1.0a1/src/opp_engine/hygiene.py +186 -0
- open_privacy_protocol_engine-0.1.0a1/src/opp_engine/mcp_server.py +35 -0
- open_privacy_protocol_engine-0.1.0a1/src/opp_engine/model_detector.py +149 -0
- open_privacy_protocol_engine-0.1.0a1/src/opp_engine/nosql.py +84 -0
- open_privacy_protocol_engine-0.1.0a1/src/opp_engine/report.py +65 -0
- open_privacy_protocol_engine-0.1.0a1/src/opp_engine/server.py +52 -0
- open_privacy_protocol_engine-0.1.0a1/tests/fixtures/northwind-coaching.opp.yaml +120 -0
- open_privacy_protocol_engine-0.1.0a1/tests/sample_data.py +83 -0
- open_privacy_protocol_engine-0.1.0a1/tests/test_custom.py +35 -0
- open_privacy_protocol_engine-0.1.0a1/tests/test_kit.py +144 -0
- open_privacy_protocol_engine-0.1.0a1/tests/test_model_and_hygiene.py +85 -0
- open_privacy_protocol_engine-0.1.0a1/tests/test_nosql.py +88 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Publishes to PyPI when a tag like v0.1.0a1 is pushed. Uses PyPI trusted publishing (no token):
|
|
4
|
+
# on pypi.org add a pending publisher for project "open-privacy-protocol-engine", owner "kannancet",
|
|
5
|
+
# repository "open-privacy-protocol-engine", workflow "release.yml", environment "pypi".
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
tags: ["v*"]
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.12"
|
|
21
|
+
- name: Tag matches the package version
|
|
22
|
+
run: |
|
|
23
|
+
V=$(python -c "import re;print(re.search(r'__version__ = \"([^\"]+)\"', open('src/opp_engine/__init__.py').read()).group(1))")
|
|
24
|
+
[ "v$V" = "${GITHUB_REF_NAME}" ] || { echo "::error::tag ${GITHUB_REF_NAME} does not match version $V"; exit 1; }
|
|
25
|
+
- run: pip install -e ".[test]" build twine && pytest -q
|
|
26
|
+
- run: python -m build && twine check dist/*
|
|
27
|
+
- uses: actions/upload-artifact@v4
|
|
28
|
+
with:
|
|
29
|
+
name: dist
|
|
30
|
+
path: dist/
|
|
31
|
+
|
|
32
|
+
publish:
|
|
33
|
+
needs: build
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
environment: pypi
|
|
36
|
+
permissions:
|
|
37
|
+
id-token: write
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/download-artifact@v4
|
|
40
|
+
with:
|
|
41
|
+
name: dist
|
|
42
|
+
path: dist/
|
|
43
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
44
|
+
|
|
45
|
+
github-release:
|
|
46
|
+
needs: publish
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
permissions:
|
|
49
|
+
contents: write
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/download-artifact@v4
|
|
52
|
+
with:
|
|
53
|
+
name: dist
|
|
54
|
+
path: dist/
|
|
55
|
+
- run: gh release create "$GITHUB_REF_NAME" dist/* --repo "$GITHUB_REPOSITORY" --title "$GITHUB_REF_NAME" --generate-notes --prerelease
|
|
56
|
+
env:
|
|
57
|
+
GH_TOKEN: ${{ github.token }}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
This project adopts the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
|
|
4
|
+
|
|
5
|
+
## Our pledge
|
|
6
|
+
|
|
7
|
+
We as members, contributors and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
8
|
+
|
|
9
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive and healthy community.
|
|
10
|
+
|
|
11
|
+
## Our standards
|
|
12
|
+
|
|
13
|
+
Examples of behaviour that contributes to a positive environment:
|
|
14
|
+
|
|
15
|
+
- demonstrating empathy and kindness toward other people;
|
|
16
|
+
- being respectful of differing opinions, viewpoints and experiences;
|
|
17
|
+
- giving and gracefully accepting constructive feedback;
|
|
18
|
+
- accepting responsibility for our mistakes and learning from them;
|
|
19
|
+
- focusing on what is best for the overall community.
|
|
20
|
+
|
|
21
|
+
Examples of unacceptable behaviour:
|
|
22
|
+
|
|
23
|
+
- sexualized language or imagery, and sexual attention or advances of any kind;
|
|
24
|
+
- trolling, insulting or derogatory comments, and personal or political attacks;
|
|
25
|
+
- public or private harassment;
|
|
26
|
+
- publishing others' private information without their explicit permission;
|
|
27
|
+
- other conduct which could reasonably be considered inappropriate in a professional setting.
|
|
28
|
+
|
|
29
|
+
## Scope
|
|
30
|
+
|
|
31
|
+
This Code of Conduct applies within all community spaces, and when an individual is officially representing the community in public spaces.
|
|
32
|
+
|
|
33
|
+
## Enforcement
|
|
34
|
+
|
|
35
|
+
Instances of abusive, harassing or otherwise unacceptable behaviour may be reported to the project maintainers privately, using the contact route described in [SECURITY.md](SECURITY.md). All complaints will be reviewed and investigated promptly and fairly, and the privacy and security of the reporter will be respected.
|
|
36
|
+
|
|
37
|
+
Maintainers will follow the Contributor Covenant's [enforcement guidelines](https://www.contributor-covenant.org/version/2/1/code_of_conduct/#enforcement-guidelines): correction, warning, temporary ban, permanent ban.
|
|
38
|
+
|
|
39
|
+
## Attribution
|
|
40
|
+
|
|
41
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Contributing to OPP Engine
|
|
2
|
+
|
|
3
|
+
Thank you for helping build the Open Privacy Protocol. This repository holds connectors, the privacy-model generator, the review report and the query engine (MCP and HTTP).
|
|
4
|
+
Issues, pull requests, reviews and documentation are all welcome.
|
|
5
|
+
|
|
6
|
+
## Ground rules
|
|
7
|
+
|
|
8
|
+
- **Never put real personal data or real secrets** in code, tests, fixtures, issues or pull
|
|
9
|
+
requests. Use obviously fictional values (`jane@example.com`, `CE-123456`).
|
|
10
|
+
- **Security problems go to [SECURITY.md](SECURITY.md)**, not to public issues.
|
|
11
|
+
- Open an issue before starting a large change, so we can agree on the approach first.
|
|
12
|
+
- Be kind. This project follows the [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
13
|
+
|
|
14
|
+
## Development setup
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
python -m venv .venv && . .venv/bin/activate
|
|
18
|
+
pip install -e ../open-privacy-protocol -e ".[test]"
|
|
19
|
+
pytest
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Adding a connector or detector
|
|
23
|
+
|
|
24
|
+
- Connectors live in `src/opp_engine/connectors.py`. A connector yields datasets with field names,
|
|
25
|
+
types and sampled values; values must stay in memory and never be logged.
|
|
26
|
+
- Detectors implement the interface in `src/opp_engine/detect.py` (see [docs/detectors.md](docs/detectors.md)).
|
|
27
|
+
- Add tests with synthetic data only (`tests/sample_data.py` shows how).
|
|
28
|
+
|
|
29
|
+
## Pull requests
|
|
30
|
+
|
|
31
|
+
- Keep each pull request focused on one change, with tests and documentation updated alongside it.
|
|
32
|
+
- Explain *why* in the description; the diff shows *what*.
|
|
33
|
+
- All checks must pass before review.
|
|
34
|
+
- By contributing, you agree that your contribution is licensed under the
|
|
35
|
+
[Apache License, Version 2.0](LICENSE).
|
|
36
|
+
|
|
37
|
+
## Where to start
|
|
38
|
+
|
|
39
|
+
Issues labelled `good first issue` are a good entry point. Questions are welcome as issues too.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Query engine image: serves one privacy model over HTTP (default) or MCP.
|
|
2
|
+
# docker build -t opp-engine .
|
|
3
|
+
# docker run --rm -p 8765:8765 -v $PWD/acme.opp.yaml:/model.opp.yaml -e OPP_TOKEN=... opp-engine
|
|
4
|
+
FROM python:3.12-slim
|
|
5
|
+
WORKDIR /app
|
|
6
|
+
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
|
|
7
|
+
COPY pyproject.toml README.md LICENSE ./
|
|
8
|
+
COPY src ./src
|
|
9
|
+
RUN pip install --no-cache-dir ".[server,mcp,documents]"
|
|
10
|
+
RUN useradd --uid 10001 opp
|
|
11
|
+
USER opp
|
|
12
|
+
EXPOSE 8765
|
|
13
|
+
ENTRYPOINT ["opp-engine", "serve", "/model.opp.yaml"]
|
|
14
|
+
CMD ["--http", "0.0.0.0:8765"]
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: open-privacy-protocol-engine
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: OPP Engine: generate Open Privacy Protocol privacy models from any data source and serve them to agents over HTTP and MCP
|
|
5
|
+
Project-URL: Homepage, https://openprivacyprotocol.com/engine/
|
|
6
|
+
Project-URL: Documentation, https://openprivacyprotocol.com/engine/data-sources/
|
|
7
|
+
Project-URL: Source, https://github.com/kannancet/open-privacy-protocol-engine
|
|
8
|
+
Author: The Open Privacy Protocol Authors
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: NOTICE
|
|
12
|
+
Keywords: ai-agents,confidential-ai,data-classification,gdpr,llm,mcp,open-privacy-protocol,pii,pii-redaction,privacy
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Topic :: Security
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Requires-Dist: open-privacy-protocol>=0.1.0a1
|
|
19
|
+
Requires-Dist: pyyaml>=6.0
|
|
20
|
+
Requires-Dist: sqlalchemy>=2.0
|
|
21
|
+
Provides-Extra: all
|
|
22
|
+
Requires-Dist: fastapi>=0.110; extra == 'all'
|
|
23
|
+
Requires-Dist: mcp<3,>=1.2; extra == 'all'
|
|
24
|
+
Requires-Dist: numpy>=1.26; extra == 'all'
|
|
25
|
+
Requires-Dist: onnxruntime>=1.18; extra == 'all'
|
|
26
|
+
Requires-Dist: pyarrow>=15; extra == 'all'
|
|
27
|
+
Requires-Dist: pymongo>=4.6; extra == 'all'
|
|
28
|
+
Requires-Dist: pypdf>=4; extra == 'all'
|
|
29
|
+
Requires-Dist: python-docx>=1.1; extra == 'all'
|
|
30
|
+
Requires-Dist: tokenizers>=0.19; extra == 'all'
|
|
31
|
+
Requires-Dist: uvicorn>=0.29; extra == 'all'
|
|
32
|
+
Provides-Extra: documents
|
|
33
|
+
Requires-Dist: pypdf>=4; extra == 'documents'
|
|
34
|
+
Requires-Dist: python-docx>=1.1; extra == 'documents'
|
|
35
|
+
Provides-Extra: mcp
|
|
36
|
+
Requires-Dist: mcp<3,>=1.2; extra == 'mcp'
|
|
37
|
+
Provides-Extra: model
|
|
38
|
+
Requires-Dist: numpy>=1.26; extra == 'model'
|
|
39
|
+
Requires-Dist: onnxruntime>=1.18; extra == 'model'
|
|
40
|
+
Requires-Dist: tokenizers>=0.19; extra == 'model'
|
|
41
|
+
Provides-Extra: mongodb
|
|
42
|
+
Requires-Dist: pymongo>=4.6; extra == 'mongodb'
|
|
43
|
+
Provides-Extra: mysql
|
|
44
|
+
Requires-Dist: pymysql>=1.1; extra == 'mysql'
|
|
45
|
+
Provides-Extra: parquet
|
|
46
|
+
Requires-Dist: pyarrow>=15; extra == 'parquet'
|
|
47
|
+
Provides-Extra: postgres
|
|
48
|
+
Requires-Dist: psycopg[binary]>=3.1; extra == 'postgres'
|
|
49
|
+
Provides-Extra: server
|
|
50
|
+
Requires-Dist: fastapi>=0.110; extra == 'server'
|
|
51
|
+
Requires-Dist: uvicorn>=0.29; extra == 'server'
|
|
52
|
+
Provides-Extra: test
|
|
53
|
+
Requires-Dist: fastapi>=0.110; extra == 'test'
|
|
54
|
+
Requires-Dist: httpx>=0.27; extra == 'test'
|
|
55
|
+
Requires-Dist: mcp<3,>=1.2; extra == 'test'
|
|
56
|
+
Requires-Dist: numpy>=1.26; extra == 'test'
|
|
57
|
+
Requires-Dist: onnxruntime>=1.18; extra == 'test'
|
|
58
|
+
Requires-Dist: pymongo>=4.6; extra == 'test'
|
|
59
|
+
Requires-Dist: pypdf>=4; extra == 'test'
|
|
60
|
+
Requires-Dist: pytest>=8; extra == 'test'
|
|
61
|
+
Requires-Dist: python-docx>=1.1; extra == 'test'
|
|
62
|
+
Requires-Dist: tokenizers>=0.19; extra == 'test'
|
|
63
|
+
Requires-Dist: uvicorn>=0.29; extra == 'test'
|
|
64
|
+
Description-Content-Type: text/markdown
|
|
65
|
+
|
|
66
|
+
<p align="center">
|
|
67
|
+
<a href="https://openprivacyprotocol.com/engine/">
|
|
68
|
+
<picture>
|
|
69
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/brand/logo-transparent-white.png">
|
|
70
|
+
<img src="assets/brand/logo-transparent-dark.png" alt="Open Privacy Protocol" width="440">
|
|
71
|
+
</picture>
|
|
72
|
+
</a>
|
|
73
|
+
</p>
|
|
74
|
+
|
|
75
|
+
<h3 align="center">OPP Engine</h3>
|
|
76
|
+
|
|
77
|
+
<p align="center">
|
|
78
|
+
<a href="LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-5689F5?style=flat-square"></a>
|
|
79
|
+
<a href="https://github.com/kannancet/open-privacy-protocol"><img alt="OPP 0.1.0.dev0" src="https://img.shields.io/badge/OPP-0.1.0.dev0-8964F4?style=flat-square"></a>
|
|
80
|
+
<img alt="MCP server" src="https://img.shields.io/badge/MCP-server-4C5FD7?style=flat-square">
|
|
81
|
+
<img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-0B1025?style=flat-square&logo=python&logoColor=white">
|
|
82
|
+
<img alt="Docker" src="https://img.shields.io/badge/docker-ready-0B1025?style=flat-square&logo=docker&logoColor=white">
|
|
83
|
+
</p>
|
|
84
|
+
|
|
85
|
+
<p align="center">
|
|
86
|
+
<a href="https://openprivacyprotocol.com/engine/"><b>Documentation</b></a> ·
|
|
87
|
+
<a href="#quick-start"><b>Quick start</b></a> ·
|
|
88
|
+
<a href="docs/agents.md"><b>Connect agents</b></a> ·
|
|
89
|
+
<a href="docs/detectors.md"><b>Detectors</b></a> ·
|
|
90
|
+
<a href="https://github.com/kannancet/open-privacy-protocol/blob/main/spec/spec.md"><b>Specification</b></a>
|
|
91
|
+
</p>
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
<!-- opp-nav:start -->
|
|
95
|
+
<p align="center">
|
|
96
|
+
<a href="https://openprivacyprotocol.com/">openprivacyprotocol.com</a> | <a href="https://github.com/kannancet/open-privacy-protocol">OPP Spec</a> · <b>OPP Engine</b> · <a href="https://github.com/kannancet/open-privacy-protocol-model">OPP Model</a> · <a href="https://github.com/kannancet/opp-python">OPP for Python</a> · <a href="https://github.com/kannancet/opp-js">OPP for JavaScript</a>
|
|
97
|
+
</p>
|
|
98
|
+
<!-- opp-nav:end -->
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
**OPP Engine** is the reference toolkit of the [Open Privacy Protocol](https://github.com/kannancet/open-privacy-protocol).
|
|
103
|
+
It connects to an organization's databases, files, documents and web pages, writes a draft
|
|
104
|
+
**privacy model** describing what in them is private or confidential, and serves that model to
|
|
105
|
+
agents so they can check content *before* they share it.
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
databases, files, opp-engine generate acme.opp.yaml opp-engine serve agents
|
|
109
|
+
documents, web pages ───────────────────────► (review, certify) ──────────────────────► (MCP / HTTP)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Everything runs on your own infrastructure. **No data value is ever written into the model, the
|
|
113
|
+
review report or the logs.**
|
|
114
|
+
|
|
115
|
+
## Features
|
|
116
|
+
|
|
117
|
+
| | |
|
|
118
|
+
|---|---|
|
|
119
|
+
| **Connect anything** | Any SQLAlchemy database URL (PostgreSQL, MySQL, SQL Server, Oracle, SQLite, Snowflake, BigQuery and more with their drivers); MongoDB and MongoDB Atlas (`mongodb://`, `mongodb+srv://`, with the `[mongodb]` extra), nested fields included; CSV, TSV, JSON, JSON Lines and Parquet files; text, Markdown, HTML, PDF and Word documents; folders and web pages |
|
|
120
|
+
| **Generate** | Every column is classified against the OPP baseline catalog from its name and sampled values; text columns and documents get topic classes (health data, HR matters, internal financials); ID columns get their format (`CE-[0-9]{6}`). Each entry carries its evidence and starts `proposed` |
|
|
121
|
+
| **Better with OPP Model** | With the open-weight [OPP Model](https://github.com/kannancet/open-privacy-protocol-model) (`--opp-model`), names, addresses and confidential topics are found in free text and headerless columns, and the organization's own concepts match by meaning |
|
|
122
|
+
| **Industry presets** | `--industry 622110` (a NAICS code) or `--industry healthcare` lists the classes that industry usually holds and were not found |
|
|
123
|
+
| **Hygiene** | Cues, terms and identifier patterns that would match ordinary text are removed and reported |
|
|
124
|
+
| **Human review** | A Markdown report lists what to check; certified entries survive the next run (`--merge`) |
|
|
125
|
+
| **Serve** | The query engine answers `check` (verdict, findings, safe content), `explain` and `list_classes` over MCP or a REST API |
|
|
126
|
+
|
|
127
|
+
## Quick start
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
pip install "open-privacy-protocol-engine[server,mcp,documents]"
|
|
131
|
+
|
|
132
|
+
python tests/sample_data.py demo # a synthetic CRM database, exports and documents
|
|
133
|
+
opp-engine generate sqlite:///demo/crm.db demo/exports demo/docs \
|
|
134
|
+
--name acme --org "Acme Coaching (fictional)" -o acme.opp.yaml --report review.md
|
|
135
|
+
|
|
136
|
+
opp-engine check acme.opp.yaml --dest external_ai "Email jane@example.com about CE-123456"
|
|
137
|
+
opp-engine serve acme.opp.yaml --mcp # for any MCP client
|
|
138
|
+
opp-engine serve acme.opp.yaml --http 127.0.0.1:8765 # REST API
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Use a read-only database account. Connection strings are never written into the model; only the
|
|
142
|
+
host and database name are kept.
|
|
143
|
+
|
|
144
|
+
### Connect an agent over MCP
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"mcpServers": {
|
|
149
|
+
"opp": {
|
|
150
|
+
"command": "opp-engine",
|
|
151
|
+
"args": ["serve", "/path/to/acme.opp.yaml", "--mcp"]
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Then tell the agent: *"Before sending data outside the system it came from, call `check`. Send
|
|
158
|
+
`safe_content` instead of the original. If the verdict is `block` or `review`, do not send."*
|
|
159
|
+
See [docs/agents.md](docs/agents.md) for the REST API and tool reference.
|
|
160
|
+
|
|
161
|
+
### Docker
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
docker build -t opp-engine .
|
|
165
|
+
docker run --rm -p 8765:8765 -v "$PWD/acme.opp.yaml:/model.opp.yaml" -e OPP_TOKEN=change-me opp-engine
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Documentation
|
|
169
|
+
|
|
170
|
+
- [Connecting data sources](docs/data-sources.md): SQL and NoSQL databases, files, folders and web pages, with install and URL examples
|
|
171
|
+
- [Connecting agents](docs/agents.md): MCP tools, REST endpoints, system-prompt guidance
|
|
172
|
+
- [Detectors and OPP Model](docs/detectors.md): built-in rules, custom detectors, the open-weight model
|
|
173
|
+
- [OPP specification](https://github.com/kannancet/open-privacy-protocol/blob/main/spec/spec.md): the document kinds this engine reads and writes
|
|
174
|
+
- [Website](https://openprivacyprotocol.com/engine/)
|
|
175
|
+
|
|
176
|
+
## Status
|
|
177
|
+
|
|
178
|
+
`0.1.0.dev0`, tracking OPP `0.1.0.dev0`. Interfaces may change before `0.1.0`.
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
<!-- opp-project:start -->
|
|
182
|
+
## One project, five repositories
|
|
183
|
+
|
|
184
|
+
Open Privacy Protocol is developed as a set of repositories that version together. This repository implements the standard: it reads and writes the documents defined in the spec, and uses the model as an optional detector.
|
|
185
|
+
|
|
186
|
+
| Part | Repository | What it is | Docs |
|
|
187
|
+
|---|---|---|---|
|
|
188
|
+
| **OPP Spec** | [`open-privacy-protocol`](https://github.com/kannancet/open-privacy-protocol) | The standard: specification, JSON Schemas, baseline catalog, industry presets, reference validator | [Docs](https://openprivacyprotocol.com/spec/) |
|
|
189
|
+
| **OPP Engine** | [`open-privacy-protocol-engine`](https://github.com/kannancet/open-privacy-protocol-engine) **(this repository)** | Generates a privacy model from your sources and serves it to agents over MCP and HTTP | [Docs](https://openprivacyprotocol.com/engine/) |
|
|
190
|
+
| **OPP Model** | [`open-privacy-protocol-model`](https://github.com/kannancet/open-privacy-protocol-model) | Open-weight model that finds private values and confidential topics in text, on CPU | [Docs](https://openprivacyprotocol.com/model/) |
|
|
191
|
+
| **OPP for Python** | [`opp-python`](https://github.com/kannancet/opp-python) | `pip install open-privacy-protocol`: validate models, resolve rules, call the engine | [Docs](https://openprivacyprotocol.com/get-started/) |
|
|
192
|
+
| **OPP for JavaScript** | [`opp-js`](https://github.com/kannancet/opp-js) | `npm install open-privacy-protocol`: the same API for Node.js, Bun and Deno | [Docs](https://openprivacyprotocol.com/get-started/) |
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
your sources ──► OPP Engine ──► acme.opp.yaml ──► OPP Engine ──► any agent
|
|
196
|
+
generate (OPP Spec) serve MCP / HTTP
|
|
197
|
+
▲ ▲
|
|
198
|
+
└────────── OPP Model ──────────┘
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Website and documentation: **[openprivacyprotocol.com](https://openprivacyprotocol.com/)**
|
|
202
|
+
<!-- opp-project:end -->
|
|
203
|
+
|
|
204
|
+
## Contributing
|
|
205
|
+
|
|
206
|
+
Contributions are welcome: connectors, detectors, tests and documentation. Read
|
|
207
|
+
[CONTRIBUTING.md](CONTRIBUTING.md), report security problems as described in
|
|
208
|
+
[SECURITY.md](SECURITY.md), and follow the [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
209
|
+
|
|
210
|
+
## License
|
|
211
|
+
|
|
212
|
+
Licensed under the [Apache License, Version 2.0](LICENSE). Part of the Open Privacy Protocol
|
|
213
|
+
project.
|