create-seamless 0.0.3 → 0.0.4
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/index.js +155 -19
- package/package.json +7 -1
- package/.github/workflows/release.yml +0 -40
- package/SECURITY.md +0 -80
package/index.js
CHANGED
|
@@ -13,6 +13,34 @@ const streamPipeline = promisify(pipeline);
|
|
|
13
13
|
const MIN_NODE_MAJOR = 18;
|
|
14
14
|
const nodeMajor = Number(process.versions.node.split(".")[0]);
|
|
15
15
|
|
|
16
|
+
function printHelp() {
|
|
17
|
+
console.log(`
|
|
18
|
+
create-seamless
|
|
19
|
+
|
|
20
|
+
Scaffold a local Seamless Auth development environment.
|
|
21
|
+
|
|
22
|
+
Usage:
|
|
23
|
+
npx create-seamless [project-name] [options]
|
|
24
|
+
|
|
25
|
+
Options:
|
|
26
|
+
--auth Include the Seamless Auth server
|
|
27
|
+
--api Include the Express API example
|
|
28
|
+
--web Include the React web application
|
|
29
|
+
--no-git Skip git initialization
|
|
30
|
+
|
|
31
|
+
--auth-port <n> Auth server port (default: 5312)
|
|
32
|
+
--api-port <n> API server port (default: 3000)
|
|
33
|
+
--web-port <n> Web server port (default: 5173)
|
|
34
|
+
|
|
35
|
+
-h, --help Show this help message
|
|
36
|
+
|
|
37
|
+
If no component flags are provided, all components are included.
|
|
38
|
+
|
|
39
|
+
Docs:
|
|
40
|
+
https://docs.seamlessauth.com
|
|
41
|
+
`);
|
|
42
|
+
}
|
|
43
|
+
|
|
16
44
|
if (nodeMajor < MIN_NODE_MAJOR) {
|
|
17
45
|
console.error(`
|
|
18
46
|
❌ Seamless requires Node ${MIN_NODE_MAJOR}+.
|
|
@@ -24,6 +52,11 @@ Upgrade at https://nodejs.org
|
|
|
24
52
|
}
|
|
25
53
|
|
|
26
54
|
const args = process.argv.slice(2);
|
|
55
|
+
|
|
56
|
+
if (args.includes("-h") || args.includes("--help")) {
|
|
57
|
+
printHelp();
|
|
58
|
+
process.exit(0);
|
|
59
|
+
}
|
|
27
60
|
const projectName = args.find((a) => !a.startsWith("--")) ?? "seamless-app";
|
|
28
61
|
|
|
29
62
|
const hasFlag = (flag) => args.includes(`--${flag}`);
|
|
@@ -35,7 +68,6 @@ const getFlag = (flag, fallback) => {
|
|
|
35
68
|
const includeAuth = hasFlag("auth");
|
|
36
69
|
const includeWeb = hasFlag("web");
|
|
37
70
|
const includeApi = hasFlag("api");
|
|
38
|
-
const installDeps = hasFlag("install");
|
|
39
71
|
const skipGit = hasFlag("no-git");
|
|
40
72
|
|
|
41
73
|
const authPort = getFlag("auth-port", "5312");
|
|
@@ -71,9 +103,10 @@ It is designed for development environments where you want:
|
|
|
71
103
|
|
|
72
104
|
\`\`\`text
|
|
73
105
|
.
|
|
74
|
-
├─ auth/
|
|
75
|
-
├─ api/
|
|
76
|
-
├─ web/
|
|
106
|
+
├─ auth/ # Seamless Auth open source server
|
|
107
|
+
├─ api/ # Backend API server (optional)
|
|
108
|
+
├─ web/ # Frontend web application (optional)
|
|
109
|
+
├─ Docker-compose.yml # Docker compose for one command spin up of dev environment
|
|
77
110
|
└─ README.md
|
|
78
111
|
\`\`\`
|
|
79
112
|
|
|
@@ -81,6 +114,54 @@ It is designed for development environments where you want:
|
|
|
81
114
|
|
|
82
115
|
## Running the stack
|
|
83
116
|
|
|
117
|
+
### Running with Docker (optional)
|
|
118
|
+
|
|
119
|
+
This project includes a Docker Compose configuration that allows you to run the
|
|
120
|
+
entire Seamless Auth stack locally with a single command.
|
|
121
|
+
|
|
122
|
+
### Requirements
|
|
123
|
+
|
|
124
|
+
* Docker
|
|
125
|
+
* Docker Compose
|
|
126
|
+
|
|
127
|
+
### Start the stack
|
|
128
|
+
|
|
129
|
+
From the project root, run:
|
|
130
|
+
|
|
131
|
+
\`\`\`bash
|
|
132
|
+
docker compose up
|
|
133
|
+
\`\`\`
|
|
134
|
+
|
|
135
|
+
This will start the following services in development mode:
|
|
136
|
+
|
|
137
|
+
* Postgres database
|
|
138
|
+
* Seamless Auth server
|
|
139
|
+
* API server
|
|
140
|
+
* Web UI
|
|
141
|
+
|
|
142
|
+
All services are configured with hot reload. Changes to the source code will be
|
|
143
|
+
picked up automatically.
|
|
144
|
+
|
|
145
|
+
### Access the application
|
|
146
|
+
|
|
147
|
+
Once all services are running, open:
|
|
148
|
+
|
|
149
|
+
\`\`\`
|
|
150
|
+
http://localhost:5001
|
|
151
|
+
\`\`\`
|
|
152
|
+
|
|
153
|
+
This is the main entry point for the web application.
|
|
154
|
+
|
|
155
|
+
### Stopping the stack
|
|
156
|
+
|
|
157
|
+
To stop all services:
|
|
158
|
+
|
|
159
|
+
\`\`\`bash
|
|
160
|
+
docker compose down
|
|
161
|
+
\`\`\`
|
|
162
|
+
|
|
163
|
+
This will shut down all containers while preserving the local database volume.
|
|
164
|
+
|
|
84
165
|
Open separate terminals and run each service independently.
|
|
85
166
|
|
|
86
167
|
### Auth server
|
|
@@ -90,7 +171,7 @@ cd auth
|
|
|
90
171
|
npm run dev
|
|
91
172
|
\`\`\`
|
|
92
173
|
|
|
93
|
-
Default port: \`
|
|
174
|
+
Default port: \`5312\`
|
|
94
175
|
|
|
95
176
|
---
|
|
96
177
|
|
|
@@ -101,7 +182,7 @@ cd api
|
|
|
101
182
|
npm run dev
|
|
102
183
|
\`\`\`
|
|
103
184
|
|
|
104
|
-
Default port: \`
|
|
185
|
+
Default port: \`3000\`
|
|
105
186
|
|
|
106
187
|
---
|
|
107
188
|
|
|
@@ -112,7 +193,7 @@ cd web
|
|
|
112
193
|
npm run dev
|
|
113
194
|
\`\`\`
|
|
114
195
|
|
|
115
|
-
Default port: \`
|
|
196
|
+
Default port: \`5001\`
|
|
116
197
|
|
|
117
198
|
---
|
|
118
199
|
|
|
@@ -145,6 +226,64 @@ includes.
|
|
|
145
226
|
Review each subproject for its specific license before deploying to production.
|
|
146
227
|
`;
|
|
147
228
|
|
|
229
|
+
const GENERATED_DOCKER_COMPOSE = `
|
|
230
|
+
version: "3.9"
|
|
231
|
+
|
|
232
|
+
services:
|
|
233
|
+
db:
|
|
234
|
+
image: postgres:16
|
|
235
|
+
container_name: seamless-db
|
|
236
|
+
ports:
|
|
237
|
+
- "5432:5432"
|
|
238
|
+
environment:
|
|
239
|
+
POSTGRES_USER: seamless
|
|
240
|
+
POSTGRES_PASSWORD: seamless
|
|
241
|
+
POSTGRES_DB: seamless
|
|
242
|
+
volumes:
|
|
243
|
+
- pgdata:/var/lib/postgresql/data
|
|
244
|
+
|
|
245
|
+
auth:
|
|
246
|
+
container_name: seamless-auth
|
|
247
|
+
build: ./auth
|
|
248
|
+
ports:
|
|
249
|
+
- "5312:5312"
|
|
250
|
+
env_file:
|
|
251
|
+
- ./auth/.env
|
|
252
|
+
volumes:
|
|
253
|
+
- ./auth:/app
|
|
254
|
+
depends_on:
|
|
255
|
+
- db
|
|
256
|
+
|
|
257
|
+
api:
|
|
258
|
+
container_name: seamless-api
|
|
259
|
+
build: ./api
|
|
260
|
+
ports:
|
|
261
|
+
- "3000:3000"
|
|
262
|
+
env_file:
|
|
263
|
+
- ./api/.env
|
|
264
|
+
volumes:
|
|
265
|
+
- ./api:/app
|
|
266
|
+
depends_on:
|
|
267
|
+
- auth
|
|
268
|
+
- db
|
|
269
|
+
|
|
270
|
+
web:
|
|
271
|
+
container_name: seamless-web
|
|
272
|
+
build: ./web
|
|
273
|
+
ports:
|
|
274
|
+
- "5001:5001"
|
|
275
|
+
env_file:
|
|
276
|
+
- ./web/.env
|
|
277
|
+
volumes:
|
|
278
|
+
- ./web:/app
|
|
279
|
+
depends_on:
|
|
280
|
+
- auth
|
|
281
|
+
- api
|
|
282
|
+
|
|
283
|
+
volumes:
|
|
284
|
+
pgdata:
|
|
285
|
+
`;
|
|
286
|
+
|
|
148
287
|
function writeEnv(dir, values) {
|
|
149
288
|
const env = Object.entries(values)
|
|
150
289
|
.map(([k, v]) => `${k}=${v}`)
|
|
@@ -202,8 +341,8 @@ async function downloadRepo(repo, dest) {
|
|
|
202
341
|
VERSION: "1.0.0",
|
|
203
342
|
APP_NAME: "Seamless Auth Example",
|
|
204
343
|
APP_ID: "local-dev",
|
|
205
|
-
APP_ORIGIN:
|
|
206
|
-
ISSUER:
|
|
344
|
+
APP_ORIGIN: `http://localhost:${apiPort}`,
|
|
345
|
+
ISSUER: `http://localhost:${authPort}`,
|
|
207
346
|
|
|
208
347
|
AUTH_MODE: "server",
|
|
209
348
|
DEMO: "true",
|
|
@@ -223,7 +362,7 @@ async function downloadRepo(repo, dest) {
|
|
|
223
362
|
JWKS_ACTIVE_KID: "dev-main",
|
|
224
363
|
|
|
225
364
|
RPID: "localhost",
|
|
226
|
-
ORIGINS:
|
|
365
|
+
ORIGINS: `http://localhost:${apiPort}`,
|
|
227
366
|
});
|
|
228
367
|
}
|
|
229
368
|
|
|
@@ -234,7 +373,7 @@ async function downloadRepo(repo, dest) {
|
|
|
234
373
|
await downloadRepo(REPOS.api, dir);
|
|
235
374
|
|
|
236
375
|
writeEnv(dir, {
|
|
237
|
-
AUTH_SERVER_URL: `http://localhost
|
|
376
|
+
AUTH_SERVER_URL: `http://localhost:${authPort}`,
|
|
238
377
|
APP_ORIGIN: `http://localhost:${apiPort}`,
|
|
239
378
|
COOKIE_SIGNING_KEY: randomBytes(32).toString("hex"),
|
|
240
379
|
API_SERVICE_TOKEN: API_SERVICE_TOKEN,
|
|
@@ -263,14 +402,11 @@ async function downloadRepo(repo, dest) {
|
|
|
263
402
|
execSync("git init", { cwd: root });
|
|
264
403
|
}
|
|
265
404
|
|
|
266
|
-
if (
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
execSync("npm install", { cwd: full, stdio: "inherit" });
|
|
272
|
-
}
|
|
273
|
-
}
|
|
405
|
+
if (AUTH && API && WEB) {
|
|
406
|
+
fs.writeFileSync(
|
|
407
|
+
path.join(root, "Docker-compose.yml"),
|
|
408
|
+
GENERATED_DOCKER_COMPOSE,
|
|
409
|
+
);
|
|
274
410
|
}
|
|
275
411
|
|
|
276
412
|
console.log(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-seamless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "The starter script for Seamless Auth",
|
|
5
5
|
"homepage": "https://github.com/fells-code/create-seamless#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
"author": "Fells Code, LLC",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"main": "index.js",
|
|
17
|
+
"files": [
|
|
18
|
+
"index.js",
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE"
|
|
22
|
+
],
|
|
17
23
|
"scripts": {
|
|
18
24
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
19
25
|
},
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
name: Publish to npm
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- "v*.*.*"
|
|
7
|
-
|
|
8
|
-
permissions:
|
|
9
|
-
contents: read
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
publish:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
|
|
15
|
-
steps:
|
|
16
|
-
- name: Checkout
|
|
17
|
-
uses: actions/checkout@v4
|
|
18
|
-
|
|
19
|
-
- name: Use Node.js
|
|
20
|
-
uses: actions/setup-node@v4
|
|
21
|
-
with:
|
|
22
|
-
node-version: 20
|
|
23
|
-
registry-url: https://registry.npmjs.org
|
|
24
|
-
|
|
25
|
-
- name: Install dependencies
|
|
26
|
-
run: npm ci
|
|
27
|
-
|
|
28
|
-
- name: Verify tag matches package version
|
|
29
|
-
run: |
|
|
30
|
-
TAG_VERSION=${GITHUB_REF#refs/tags/v}
|
|
31
|
-
PKG_VERSION=$(node -p "require('./package.json').version")
|
|
32
|
-
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
|
|
33
|
-
echo "Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)"
|
|
34
|
-
exit 1
|
|
35
|
-
fi
|
|
36
|
-
|
|
37
|
-
- name: Publish to npm
|
|
38
|
-
run: npm publish
|
|
39
|
-
env:
|
|
40
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/SECURITY.md
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# Security Policy
|
|
2
|
-
|
|
3
|
-
## Reporting a Vulnerability
|
|
4
|
-
|
|
5
|
-
Seamless Auth takes security seriously.
|
|
6
|
-
We appreciate responsible disclosure and will work quickly with researchers and users to investigate and resolve issues.
|
|
7
|
-
|
|
8
|
-
**Please do not report security vulnerabilities through public GitHub issues.**
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## How to Report
|
|
13
|
-
|
|
14
|
-
If you believe you have found a security vulnerability, please report it privately by emailing:
|
|
15
|
-
|
|
16
|
-
security@seamlessauth.com
|
|
17
|
-
|
|
18
|
-
Include as much detail as possible:
|
|
19
|
-
|
|
20
|
-
- A clear description of the issue
|
|
21
|
-
- Steps to reproduce (proof-of-concept if available)
|
|
22
|
-
- Affected package(s) and version(s)
|
|
23
|
-
- Potential impact (authentication bypass, privilege escalation, data exposure, etc.)
|
|
24
|
-
|
|
25
|
-
Encrypted reports are welcome. If you need a public PGP key, request one in your initial email.
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Scope
|
|
30
|
-
|
|
31
|
-
This policy applies to:
|
|
32
|
-
|
|
33
|
-
- @seamless-auth/core
|
|
34
|
-
- @seamless-auth/express
|
|
35
|
-
- @seamless-auth/react
|
|
36
|
-
- Seamless Auth Api
|
|
37
|
-
- Create seamless
|
|
38
|
-
- Official Docker images published under the Seamless Auth organization
|
|
39
|
-
|
|
40
|
-
Third-party dependencies are not covered, but reports identifying vulnerable dependency usage are appreciated.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## What to Expect
|
|
45
|
-
|
|
46
|
-
- **Acknowledgement** within 72 hours
|
|
47
|
-
- **Initial assessment** within 5 business days
|
|
48
|
-
- **Fix or mitigation** as quickly as possible depending on severity
|
|
49
|
-
|
|
50
|
-
We will coordinate disclosure timing with you if a fix requires public communication.
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## Supported Versions
|
|
55
|
-
|
|
56
|
-
Security fixes are applied to:
|
|
57
|
-
|
|
58
|
-
- The latest published version
|
|
59
|
-
- The current development branch
|
|
60
|
-
|
|
61
|
-
Older versions may not receive patches unless the issue is critical.
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
## Responsible Disclosure
|
|
66
|
-
|
|
67
|
-
We kindly ask that you:
|
|
68
|
-
|
|
69
|
-
- Allow reasonable time to investigate and remediate
|
|
70
|
-
- Avoid exploiting vulnerabilities beyond proof-of-concept
|
|
71
|
-
- Avoid public disclosure until a fix is released or coordinated
|
|
72
|
-
|
|
73
|
-
We believe responsible disclosure helps keep the ecosystem safer for everyone.
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
Thank you for helping keep Seamless Auth secure.
|
|
78
|
-
|
|
79
|
-
— Fells Code, LLC
|
|
80
|
-
https://seamlessauth.com
|