@shieldfive/cli 0.1.0
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.
- package/LICENSE +201 -0
- package/README.md +144 -0
- package/SECURITY.md +84 -0
- package/package.json +52 -0
- package/src/auth.mjs +35 -0
- package/src/cli.mjs +211 -0
- package/src/sfCrypto.mjs +77 -0
- package/src/sync.mjs +205 -0
- package/src/unlock.mjs +107 -0
- package/src/upload.mjs +342 -0
- package/src/uploadCrypto.mjs +207 -0
- package/src/vault.mjs +45 -0
package/LICENSE
ADDED
|
@@ -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 describing the origin of the Work and
|
|
141
|
+
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 2026 Cho Garcia
|
|
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
|
|
200
|
+
implied. See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# @shieldfive/cli
|
|
2
|
+
|
|
3
|
+
> Command-line client for [ShieldFive](https://shieldfive.com). Encrypt a folder
|
|
4
|
+
> on your machine, then push or continuously sync it to your EU-hosted,
|
|
5
|
+
> post-quantum vault. Everything is encrypted locally before it leaves your
|
|
6
|
+
> machine. Read the code and verify that for yourself.
|
|
7
|
+
|
|
8
|
+
[](https://github.com/shieldfive/cli/actions/workflows/ci.yml)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
[](#honest-scope)
|
|
11
|
+
|
|
12
|
+
The point of this tool being open source is that you do not have to trust a
|
|
13
|
+
marketing claim. The plaintext of your files is never sent to a ShieldFive
|
|
14
|
+
server. The only bytes that leave your machine are AES-GCM ciphertext and a
|
|
15
|
+
short cryptographic proof. Two files carry the whole story:
|
|
16
|
+
|
|
17
|
+
- [`src/uploadCrypto.mjs`](src/uploadCrypto.mjs) — the encryption applied to
|
|
18
|
+
every chunk and to the filename.
|
|
19
|
+
- [`src/upload.mjs`](src/upload.mjs) — the only place bytes are sent over the
|
|
20
|
+
network. Every request body is ciphertext.
|
|
21
|
+
|
|
22
|
+
If you want to see encryption happen without an account at all, run
|
|
23
|
+
`sf encrypt <folder>` — it encrypts each file locally and prints the ciphertext
|
|
24
|
+
size, uploading nothing.
|
|
25
|
+
|
|
26
|
+
## Honest scope
|
|
27
|
+
|
|
28
|
+
- The underlying cryptography ([`@shieldfive/crypto`](https://github.com/shieldfive/crypto))
|
|
29
|
+
has **not** undergone an external audit yet. Treat this as early software.
|
|
30
|
+
- The direct upload path (files up to one 5 MiB chunk) has been run end to end
|
|
31
|
+
against the production backend: files uploaded by this CLI appear in the web
|
|
32
|
+
app with their real names and decrypt correctly.
|
|
33
|
+
- The **multipart** path (files larger than 5 MiB) is covered by a byte-for-byte
|
|
34
|
+
review against the server contract and a mock end-to-end test that decrypts
|
|
35
|
+
every part, but has not yet been exercised against production with a real
|
|
36
|
+
large file.
|
|
37
|
+
- `sf sync` is **append-only**: it uploads new and changed files; it does not
|
|
38
|
+
yet mirror local deletions or renames into the vault.
|
|
39
|
+
|
|
40
|
+
## Requirements
|
|
41
|
+
|
|
42
|
+
- Node.js >= 20
|
|
43
|
+
- A ShieldFive account with a vault (create one in the web app first)
|
|
44
|
+
|
|
45
|
+
Not yet published to npm. For now, clone and run:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
git clone https://github.com/shieldfive/cli.git
|
|
49
|
+
cd cli
|
|
50
|
+
npm install # @shieldfive/crypto (+ libsodium), @supabase/supabase-js, @noble/*
|
|
51
|
+
npm test # 27/27
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Commands
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
sf encrypt <folder> encrypt each file locally, upload nothing (no account needed)
|
|
58
|
+
sf push <folder> sign in, unlock, encrypt, upload every file once
|
|
59
|
+
sf sync <folder> [--watch] [--interval=N] upload new/changed files; --watch keeps a poll loop (N seconds, default 5)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`sf push` and `sf sync` pick the direct or multipart upload path automatically
|
|
63
|
+
from the file size. `sf sync` writes a `.shieldfive-sync.json` manifest in the
|
|
64
|
+
target folder that records what has already been uploaded (by size and mtime),
|
|
65
|
+
so unchanged files are skipped and an interrupted run does not re-upload
|
|
66
|
+
everything.
|
|
67
|
+
|
|
68
|
+
## Running the live commands
|
|
69
|
+
|
|
70
|
+
`sf push` and `sf sync` need only your ShieldFive account. Your password is
|
|
71
|
+
typed, never passed on the command line:
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
export SF_EMAIL=you@example.com
|
|
75
|
+
read -rs SF_PASSWORD; echo; export SF_PASSWORD
|
|
76
|
+
export SF_VAULT_PASSWORD="$SF_PASSWORD" # only if your vault password differs
|
|
77
|
+
|
|
78
|
+
sf push ./my-folder
|
|
79
|
+
sf sync ./my-folder --watch
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The backend endpoints default to ShieldFive, so there is nothing else to
|
|
83
|
+
configure. `SF_API_BASE_URL`, `SF_SUPABASE_URL`, and `SF_SUPABASE_ANON_KEY` are
|
|
84
|
+
baked in with ShieldFive's public values — the Supabase anon key is a `role=anon`
|
|
85
|
+
JWT gated by row-level security, the same value any browser receives — and only
|
|
86
|
+
need overriding if you point the CLI at a development backend. If two-factor
|
|
87
|
+
authentication is enabled on your account, the MFA step-up is not yet handled by
|
|
88
|
+
the CLI.
|
|
89
|
+
|
|
90
|
+
## How the upload works (for auditors)
|
|
91
|
+
|
|
92
|
+
The upload uses **chunked AES-GCM** for file content and issues a
|
|
93
|
+
server-verified HMAC proof. (The `sf encrypt` demo uses the post-quantum hybrid
|
|
94
|
+
suite; the sync/push path uses AES-GCM, which is what the vault's upload
|
|
95
|
+
protocol and server-side proof expect.)
|
|
96
|
+
|
|
97
|
+
- **Filename** — encrypted with AES-GCM under a key derived from your vault root
|
|
98
|
+
key via Argon2id (`encryptMetadataV4`). The server stores ciphertext; it never
|
|
99
|
+
sees the name. A keyed HMAC of the lowercased name (`hashMetadataV4`) lets the
|
|
100
|
+
server deduplicate without learning the name.
|
|
101
|
+
- **File content** — each chunk is AES-GCM encrypted under a per-file content
|
|
102
|
+
key (itself wrapped by your root key). The nonce is a 4-byte random prefix
|
|
103
|
+
followed by an 8-byte big-endian chunk counter, so every chunk has a distinct
|
|
104
|
+
nonce.
|
|
105
|
+
- **Upload proof** — `HMAC-SHA256(proofKey, prefix || ciphertext)` over the first
|
|
106
|
+
chunk, where `prefix = [version=1][cipherVersion=1][chunkSize u32 BE][noncePrefix 4]`.
|
|
107
|
+
The server issues `proofKey` when it creates the session and verifies the proof
|
|
108
|
+
when finalizing. It ties the stored ciphertext to the session without the
|
|
109
|
+
server ever seeing plaintext.
|
|
110
|
+
- **Multipart** (> 5 MiB) — the file is streamed one 5 MiB chunk at a time (never
|
|
111
|
+
loaded whole into memory), each chunk uploaded as a Backblaze part. The
|
|
112
|
+
ciphertext hash the server checks is SHA-1 over the concatenated raw part
|
|
113
|
+
digests; the server finishes the large file with the ordered part list.
|
|
114
|
+
|
|
115
|
+
The mock end-to-end test in [`test/upload.flow.test.mjs`](test/upload.flow.test.mjs)
|
|
116
|
+
captures every byte this client would send, decrypts each part with the key
|
|
117
|
+
recovered from the session envelope, and asserts the result equals the original
|
|
118
|
+
file — a machine-checked demonstration that only ciphertext is uploaded.
|
|
119
|
+
|
|
120
|
+
## Layout
|
|
121
|
+
|
|
122
|
+
- `src/cli.mjs` — the `sf` entry point (argument parsing, command dispatch)
|
|
123
|
+
- `src/auth.mjs` — Supabase sign-in to a Bearer token
|
|
124
|
+
- `src/vault.mjs` / `src/unlock.mjs` — fetch the wrapped vault key, unwrap the
|
|
125
|
+
root key from your password (Argon2id / PBKDF2)
|
|
126
|
+
- `src/uploadCrypto.mjs` — filename and chunk encryption, upload proof, multipart
|
|
127
|
+
ciphertext hash
|
|
128
|
+
- `src/upload.mjs` — create session, encrypt, upload (direct + multipart),
|
|
129
|
+
finalize; the streaming chunk reader
|
|
130
|
+
- `src/sync.mjs` — `sf sync`: manifest, change detection, reconcile pass, watch
|
|
131
|
+
loop (reuses `upload.mjs`)
|
|
132
|
+
- `src/sfCrypto.mjs` — the post-quantum hybrid encrypt/decrypt used by the
|
|
133
|
+
`sf encrypt` demo
|
|
134
|
+
- `test/*.test.mjs` — round-trip guarantees plus the mock end-to-end upload and
|
|
135
|
+
sync tests
|
|
136
|
+
|
|
137
|
+
## Security
|
|
138
|
+
|
|
139
|
+
Please report vulnerabilities privately — see [SECURITY.md](SECURITY.md). Do not
|
|
140
|
+
open a public issue for security reports.
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
[Apache-2.0](LICENSE)
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
ShieldFive takes the security of `@shieldfive/cli` seriously. This document
|
|
4
|
+
describes how to report a vulnerability, what we commit to, and the safe-harbor
|
|
5
|
+
terms for security researchers.
|
|
6
|
+
|
|
7
|
+
## Reporting a vulnerability
|
|
8
|
+
|
|
9
|
+
**Do not open a public GitHub issue for security reports.** Instead, email us
|
|
10
|
+
directly:
|
|
11
|
+
|
|
12
|
+
- **Email:** `security@shieldfive.com`
|
|
13
|
+
- **PGP key:** Not yet published. Encrypt with a temporary key on request, or
|
|
14
|
+
send in plaintext — we would rather know about the issue than have it sit in
|
|
15
|
+
your inbox.
|
|
16
|
+
|
|
17
|
+
If you cannot encrypt the report, send it in plaintext anyway. We will follow up
|
|
18
|
+
over an encrypted channel.
|
|
19
|
+
|
|
20
|
+
### What to include
|
|
21
|
+
|
|
22
|
+
1. A description of the vulnerability and its impact.
|
|
23
|
+
2. Steps to reproduce, including a minimal proof-of-concept if possible.
|
|
24
|
+
3. The CLI version and runtime environment (Node version, operating system).
|
|
25
|
+
4. Whether the issue is already public or has been disclosed elsewhere.
|
|
26
|
+
5. Your name and a way to contact you (or "anonymous" if you prefer).
|
|
27
|
+
|
|
28
|
+
## Our commitments
|
|
29
|
+
|
|
30
|
+
| Severity | Acknowledgement | Initial response | Patch target |
|
|
31
|
+
| ---------------------------- | :-------------: | :--------------: | :----------: |
|
|
32
|
+
| Critical (key/plaintext leak)| 24 hours | 48 hours | 7 days |
|
|
33
|
+
| High (integrity bypass) | 48 hours | 5 days | 14 days |
|
|
34
|
+
| Medium (DoS, info leakage) | 72 hours | 7 days | 30 days |
|
|
35
|
+
| Low (defense-in-depth) | 7 days | 14 days | 90 days |
|
|
36
|
+
|
|
37
|
+
We will:
|
|
38
|
+
|
|
39
|
+
- Acknowledge your report within the windows above.
|
|
40
|
+
- Keep you informed of our investigation.
|
|
41
|
+
- Credit you in the release notes (with your permission, or anonymously).
|
|
42
|
+
- Coordinate public disclosure with you, defaulting to a 90-day window.
|
|
43
|
+
- Publish a CVE when appropriate.
|
|
44
|
+
|
|
45
|
+
We will *not*:
|
|
46
|
+
|
|
47
|
+
- Take legal action against researchers acting in good faith (see Safe Harbor).
|
|
48
|
+
- Demand silence as a condition of bounty or credit.
|
|
49
|
+
|
|
50
|
+
## Safe Harbor
|
|
51
|
+
|
|
52
|
+
Security research conducted in accordance with this policy is authorized. We will
|
|
53
|
+
not pursue civil claims or refer law enforcement against researchers who:
|
|
54
|
+
|
|
55
|
+
1. Make a good-faith effort to avoid privacy violations, data destruction, and
|
|
56
|
+
service interruption.
|
|
57
|
+
2. Do not access, modify, or exfiltrate data belonging to anyone other than
|
|
58
|
+
themselves or research accounts.
|
|
59
|
+
3. Report the vulnerability promptly through this policy's channels.
|
|
60
|
+
4. Do not exploit the vulnerability beyond what is necessary to confirm it.
|
|
61
|
+
5. Do not publicly disclose before we have had a reasonable opportunity to
|
|
62
|
+
remediate (the timelines above).
|
|
63
|
+
|
|
64
|
+
## Bug bounty
|
|
65
|
+
|
|
66
|
+
ShieldFive operates a paid bug bounty program. For current scope, reward tiers,
|
|
67
|
+
rules of engagement, and submission instructions, see
|
|
68
|
+
https://shieldfive.com/security/bug-bounty.
|
|
69
|
+
|
|
70
|
+
## Scope
|
|
71
|
+
|
|
72
|
+
In scope: this CLI — the way it derives keys, encrypts files and filenames,
|
|
73
|
+
constructs the upload proof, and transmits data. A demonstration that plaintext
|
|
74
|
+
or key material can leak from this client is the highest-value report.
|
|
75
|
+
|
|
76
|
+
Out of scope for *this* repository (report elsewhere or not at all):
|
|
77
|
+
|
|
78
|
+
- Vulnerabilities in the cryptographic core — report those against
|
|
79
|
+
[`@shieldfive/crypto`](https://github.com/shieldfive/crypto).
|
|
80
|
+
- Vulnerabilities in dependencies (`@noble/*`, `@supabase/supabase-js`) — report
|
|
81
|
+
those upstream.
|
|
82
|
+
- Server-side issues in the ShieldFive backend — report via the bug bounty
|
|
83
|
+
program above.
|
|
84
|
+
- Attacks that require an attacker to already control the user's device.
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shieldfive/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Open-source command-line client for ShieldFive: encrypt a folder on your machine and sync it to your EU-hosted, post-quantum vault. Read the code; it encrypts before upload.",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"author": "Cho Garcia <security@shieldfive.com>",
|
|
8
|
+
"homepage": "https://github.com/shieldfive/cli",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/shieldfive/cli.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/shieldfive/cli/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"shieldfive",
|
|
18
|
+
"encryption",
|
|
19
|
+
"post-quantum",
|
|
20
|
+
"end-to-end-encryption",
|
|
21
|
+
"client-side-encryption",
|
|
22
|
+
"zero-knowledge",
|
|
23
|
+
"backup",
|
|
24
|
+
"sync",
|
|
25
|
+
"cli"
|
|
26
|
+
],
|
|
27
|
+
"bin": {
|
|
28
|
+
"sf": "src/cli.mjs"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"src",
|
|
35
|
+
"README.md",
|
|
36
|
+
"SECURITY.md",
|
|
37
|
+
"LICENSE"
|
|
38
|
+
],
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=20"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"test": "node --test test/*.test.mjs"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@noble/ciphers": "^2.1.1",
|
|
47
|
+
"@noble/hashes": "^2.0.1",
|
|
48
|
+
"@shieldfive/crypto": "^1.0.0-beta.1",
|
|
49
|
+
"@supabase/supabase-js": "^2",
|
|
50
|
+
"libsodium-wrappers-sumo": "^0.8.2"
|
|
51
|
+
}
|
|
52
|
+
}
|
package/src/auth.mjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// ShieldFive CLI — authentication.
|
|
2
|
+
//
|
|
3
|
+
// Signs in via Supabase to obtain a Bearer access token. The web upload routes
|
|
4
|
+
// now accept this token (Track A: cookie -> Bearer), so it is what `sf push`
|
|
5
|
+
// will use. Same token shape the mobile app uses.
|
|
6
|
+
//
|
|
7
|
+
// NEEDS LIVE TEST: requires your real Supabase URL + anon key + account. If you
|
|
8
|
+
// have 2FA enabled, an AAL2 step-up is required and is NOT handled here yet
|
|
9
|
+
// (mirror the mobile MFA flow when you wire it).
|
|
10
|
+
|
|
11
|
+
import { createClient } from '@supabase/supabase-js'
|
|
12
|
+
|
|
13
|
+
export async function signIn({ supabaseUrl, anonKey, email, password }) {
|
|
14
|
+
const supabase = createClient(supabaseUrl, anonKey, {
|
|
15
|
+
auth: {
|
|
16
|
+
persistSession: false,
|
|
17
|
+
autoRefreshToken: false,
|
|
18
|
+
detectSessionInUrl: false,
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
const { data, error } = await supabase.auth.signInWithPassword({
|
|
22
|
+
email,
|
|
23
|
+
password,
|
|
24
|
+
})
|
|
25
|
+
if (error) throw new Error(`Sign-in failed: ${error.message}`)
|
|
26
|
+
|
|
27
|
+
const accessToken = data.session?.access_token
|
|
28
|
+
if (!accessToken) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
'No access token returned. If 2FA is enabled, the MFA step-up is not yet ' +
|
|
31
|
+
'implemented in the CLI.',
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
return { accessToken }
|
|
35
|
+
}
|