modelos-secure 0.3.9__py3-none-win_amd64.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.
- modelos_secure/__init__.py +0 -0
- modelos_secure/_cli/README.md +63 -0
- modelos_secure/_cli/assets/login-D0M0qeoI.js +1 -0
- modelos_secure/_cli/assets/login-UmFsH3I5.js +936 -0
- modelos_secure/_cli/cli.js +23653 -0
- modelos_secure/_cli/hook/clients.mjs +278 -0
- modelos_secure/_cli/hook/edge.mjs +411 -0
- modelos_secure/_cli/hook/hook.mjs +338 -0
- modelos_secure/_cli/hook/hosts.d.mts +2 -0
- modelos_secure/_cli/hook/hosts.mjs +26 -0
- modelos_secure/_cli/hook/loader.mjs +12 -0
- modelos_secure/_cli/hook/rewrite.mjs +95 -0
- modelos_secure/_cli/node.exe +4 -0
- modelos_secure/_cli/python/modelos_secure/__init__.py +0 -0
- modelos_secure/_cli/python/modelos_secure/clients.py +457 -0
- modelos_secure/_cli/python/modelos_secure/edge.py +365 -0
- modelos_secure/_cli/python/modelos_secure/hook.py +574 -0
- modelos_secure/_cli/python/requirements.txt +0 -0
- modelos_secure/_cli/python/sitecustomize.py +13 -0
- modelos_secure/_cli/wasm/tree-sitter-javascript.wasm +0 -0
- modelos_secure/_cli/wasm/tree-sitter-python.wasm +0 -0
- modelos_secure/_cli/wasm/tree-sitter-tsx.wasm +0 -0
- modelos_secure/_cli/wasm/tree-sitter-typescript.wasm +0 -0
- modelos_secure/_cli/wasm/web-tree-sitter.wasm +0 -0
- modelos_secure/_launcher.py +11 -0
- modelos_secure/clients.py +457 -0
- modelos_secure/edge.py +365 -0
- modelos_secure/hook.py +574 -0
- modelos_secure-0.3.9.dist-info/METADATA +71 -0
- modelos_secure-0.3.9.dist-info/RECORD +32 -0
- modelos_secure-0.3.9.dist-info/WHEEL +4 -0
- modelos_secure-0.3.9.dist-info/entry_points.txt +2 -0
|
File without changes
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# modelos-secure
|
|
2
|
+
|
|
3
|
+
Tests an AI system for Security, Safety and Quality. One command in the system's repository connects it, with no code changes:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx modelos-secure scan .
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
It reads the code the way an engineer would, starting where the app starts, draws the system's map and asks only what it cannot work out. Everything it decides goes into `modelos-secure.yaml`.
|
|
10
|
+
|
|
11
|
+
Before it sends anything it asks once whether a model may read the code it needs, or only an outline of it, or nothing. Every answer it sends passes a filter that takes secrets out, and settings files, keys and credentials are never sent. What leaves: the outline, the reader's answers, the map it registers, your answer key if you add one, and the last lines of the app's own output when a start fails. `.modelos-secure/sent.jsonl` lists every answer the reader sent, `--explain` shows the outline and what may and may not be read without sending anything, and `--offline` keeps everything on your machine.
|
|
12
|
+
|
|
13
|
+
At a terminal, `modelos-secure` on its own starts a session about the app in the folder: ask about it in your own words, and each answer cites the files and lines it rests on, checked against the code.
|
|
14
|
+
|
|
15
|
+
| Command | Does |
|
|
16
|
+
| --------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `modelos-secure` | At a terminal, a session about the app in this folder. |
|
|
18
|
+
| `modelos-secure login` | Saves a workspace token, and signs in with Google if needed. |
|
|
19
|
+
| `modelos-secure scan .` | Connects this repository. `--offline`, `--explain`, `--yes`, `--ci`, `--no-review`. |
|
|
20
|
+
| `modelos-secure review` | Starts a review of this system. `--quick`, `--ci`, `--yes`, `--budget`, `--instances`. |
|
|
21
|
+
| `modelos-secure replay F-031` | Replays one finding of an app the scan connected. |
|
|
22
|
+
| `modelos-secure doctor` | Checks the setup and fixes what it can. |
|
|
23
|
+
| `modelos-secure runner` | Serves a review's attempts from this machine, in the app's folder. `--system`, `--instances`. |
|
|
24
|
+
| `modelos-secure export R-1179 --format sarif` | Prints a review's findings as SARIF or JSON; `--out` writes a file. |
|
|
25
|
+
| `modelos-secure --version` | Prints this CLI's version. |
|
|
26
|
+
|
|
27
|
+
Before it starts your app, a review says what the app relies on and whether each need is met on this machine: a cloud sign-in, a key, a database, a service from a compose file. A need that is not met stops the start with the command that meets it, such as `gcloud auth application-default login`; you can have the CLI run it for you, on a yes, or start anyway. Nothing on your machine is changed without that yes.
|
|
28
|
+
|
|
29
|
+
A review of an app connected by the scan reaches it through a runner on the machine that runs it. `modelos-secure review` starts one itself, and keeps it while the review is paused; a review started from the app needs `modelos-secure runner` running in the app's folder, and says so if none is. A start command is checked before it runs and saved only once the app has started with it.
|
|
30
|
+
|
|
31
|
+
During a review, the tools marked as held in `modelos-secure.yaml` are caught and never run; the scan marks every tool that can act, and a tool set to `run` runs for real. Outside a review the hooks do nothing. Requires Node 22 or newer. Python apps need Python 3.10 or newer.
|
|
32
|
+
|
|
33
|
+
Every command says what it takes with `--help`, such as `modelos-secure scan --help`, and refuses a flag it does not take.
|
|
34
|
+
|
|
35
|
+
| Exit code | Means |
|
|
36
|
+
| --------- | ------------------------------------------------------------------------------- |
|
|
37
|
+
| 0 | Done. |
|
|
38
|
+
| 1 | Something failed, or a fix check found a break. |
|
|
39
|
+
| 2 | The command was used wrongly. |
|
|
40
|
+
| 3 | There are questions only a person can answer, as `--ci` lists. |
|
|
41
|
+
| 130 | Stopped with Ctrl-C. What was done is kept. |
|
|
42
|
+
| 143, 129 | Stopped by a signal, or the terminal closed. The app it started is stopped too. |
|
|
43
|
+
|
|
44
|
+
## Signing in
|
|
45
|
+
|
|
46
|
+
Copy the login command from the workspace tokens page in the app. It has the app's address and, when the app is behind Google sign-in, the Google client to sign in with:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx modelos-secure login --url <address> --client-id <client ID> --client-secret <client secret>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Paste the workspace token when it asks. The token is never typed on the command line. Your browser then opens for you to sign in with Google. The address, the token and the Google sign-in are kept in `~/.modelos-secure/credentials.json`, readable only by you, and the sign-in is renewed as it runs out. Without `--client-id`, as on a local stack, there is no Google sign-in.
|
|
53
|
+
|
|
54
|
+
When the app is reached at an IP address and its certificate is issued for a name, the login command also has `--tls-name` and that name. The CLI then connects to the address and checks the certificate against the name: its chain, its dates and the name are all still checked. `MODELOS_SECURE_TLS_NAME` does the same for one run. When something cannot be reached, the CLI says why in plain words.
|
|
55
|
+
|
|
56
|
+
`MODELOS_SECURE_URL` and `MODELOS_SECURE_TOKEN` take the place of the saved address and token. `modelos-secure doctor` says who is signed in to Google, and why a request was turned away.
|
|
57
|
+
|
|
58
|
+
## In CI
|
|
59
|
+
|
|
60
|
+
CI has no browser, so it signs in to Google as a service account. The service account needs IAP-secured Web App User on the app, and the client ID must be the one on the tokens page. Set `MODELOS_SECURE_URL` and `MODELOS_SECURE_TOKEN`, then one of these:
|
|
61
|
+
|
|
62
|
+
- `MODELOS_SECURE_CLIENT_ID`, the client ID from the tokens page, with gcloud signed in as the service account. The CLI runs `gcloud auth print-identity-token --audiences=<client ID>` and runs it again as the token runs out, so it suits reviews of any length. It does not work with a person's own gcloud sign-in.
|
|
63
|
+
- `MODELOS_SECURE_IAP_TOKEN`, an ID token for the service account with the client ID as its audience. It is sent as it is and never renewed, and it lasts about an hour. In GitHub Actions, `google-github-actions/auth` makes one with `token_format: id_token`, `id_token_audience` set to the client ID and `id_token_include_email: true`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as loginCommand } from "./login-UmFsH3I5.js";
|