create-seamless 0.0.3 → 0.0.5
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 +181 -23
- 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,12 +68,11 @@ 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");
|
|
42
74
|
const apiPort = getFlag("api-port", "3000");
|
|
43
|
-
const webPort = getFlag("web-port", "
|
|
75
|
+
const webPort = getFlag("web-port", "5001");
|
|
44
76
|
|
|
45
77
|
const wantsSomething = includeAuth || includeWeb || includeApi;
|
|
46
78
|
const AUTH = wantsSomething ? includeAuth : true;
|
|
@@ -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,72 @@ 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
|
+
- "${authPort}:${authPort}"
|
|
250
|
+
env_file:
|
|
251
|
+
- ./auth/.env
|
|
252
|
+
environment:
|
|
253
|
+
- DB_HOST: db
|
|
254
|
+
- ISSUER=http://auth:${authPort}
|
|
255
|
+
volumes:
|
|
256
|
+
- ./auth:/app
|
|
257
|
+
- /app/node_modules
|
|
258
|
+
depends_on:
|
|
259
|
+
- db
|
|
260
|
+
|
|
261
|
+
api:
|
|
262
|
+
container_name: seamless-api
|
|
263
|
+
build: ./api
|
|
264
|
+
ports:
|
|
265
|
+
- "${apiPort}:${apiPort}"
|
|
266
|
+
env_file:
|
|
267
|
+
- ./api/.env
|
|
268
|
+
environment:
|
|
269
|
+
- AUTH_SERVER_URL=http://auth:${authPort}
|
|
270
|
+
volumes:
|
|
271
|
+
- ./api:/app
|
|
272
|
+
- /app/node_modules
|
|
273
|
+
depends_on:
|
|
274
|
+
- auth
|
|
275
|
+
- db
|
|
276
|
+
|
|
277
|
+
web:
|
|
278
|
+
container_name: seamless-web
|
|
279
|
+
build: ./web
|
|
280
|
+
ports:
|
|
281
|
+
- "${webPort}:${webPort}"
|
|
282
|
+
env_file:
|
|
283
|
+
- ./web/.env
|
|
284
|
+
volumes:
|
|
285
|
+
- ./web:/app
|
|
286
|
+
- /app/node_modules
|
|
287
|
+
depends_on:
|
|
288
|
+
- auth
|
|
289
|
+
- api
|
|
290
|
+
|
|
291
|
+
volumes:
|
|
292
|
+
pgdata:
|
|
293
|
+
`;
|
|
294
|
+
|
|
148
295
|
function writeEnv(dir, values) {
|
|
149
296
|
const env = Object.entries(values)
|
|
150
297
|
.map(([k, v]) => `${k}=${v}`)
|
|
@@ -202,8 +349,8 @@ async function downloadRepo(repo, dest) {
|
|
|
202
349
|
VERSION: "1.0.0",
|
|
203
350
|
APP_NAME: "Seamless Auth Example",
|
|
204
351
|
APP_ID: "local-dev",
|
|
205
|
-
APP_ORIGIN:
|
|
206
|
-
ISSUER:
|
|
352
|
+
APP_ORIGIN: `http://localhost:${apiPort}`,
|
|
353
|
+
ISSUER: `http://localhost:${authPort}`,
|
|
207
354
|
|
|
208
355
|
AUTH_MODE: "server",
|
|
209
356
|
DEMO: "true",
|
|
@@ -211,7 +358,11 @@ async function downloadRepo(repo, dest) {
|
|
|
211
358
|
DEFAULT_ROLES: "user,betaUser",
|
|
212
359
|
AVAILABLE_ROLES: "user,admin,betaUser,team",
|
|
213
360
|
|
|
214
|
-
|
|
361
|
+
DB_HOST: "localhost",
|
|
362
|
+
DB_PORT: "5432",
|
|
363
|
+
DB_NAME: "seamless-auth",
|
|
364
|
+
DB_USER: "myuser",
|
|
365
|
+
DB_PASSWORD: "mypassword",
|
|
215
366
|
|
|
216
367
|
ACCESS_TOKEN_TTL: "30m",
|
|
217
368
|
REFRESH_TOKEN_TTL: "1h",
|
|
@@ -223,7 +374,7 @@ async function downloadRepo(repo, dest) {
|
|
|
223
374
|
JWKS_ACTIVE_KID: "dev-main",
|
|
224
375
|
|
|
225
376
|
RPID: "localhost",
|
|
226
|
-
ORIGINS:
|
|
377
|
+
ORIGINS: `http://localhost:${apiPort}`,
|
|
227
378
|
});
|
|
228
379
|
}
|
|
229
380
|
|
|
@@ -234,11 +385,17 @@ async function downloadRepo(repo, dest) {
|
|
|
234
385
|
await downloadRepo(REPOS.api, dir);
|
|
235
386
|
|
|
236
387
|
writeEnv(dir, {
|
|
237
|
-
AUTH_SERVER_URL: `http://localhost
|
|
238
|
-
APP_ORIGIN: `http://localhost:${
|
|
388
|
+
AUTH_SERVER_URL: `http://localhost:${authPort}`,
|
|
389
|
+
APP_ORIGIN: `http://localhost:${webPort}`,
|
|
239
390
|
COOKIE_SIGNING_KEY: randomBytes(32).toString("hex"),
|
|
240
391
|
API_SERVICE_TOKEN: API_SERVICE_TOKEN,
|
|
241
|
-
|
|
392
|
+
|
|
393
|
+
DB_HOST: "localhost",
|
|
394
|
+
DB_PORT: "5432",
|
|
395
|
+
DB_NAME: "seamless-auth",
|
|
396
|
+
DB_USER: "myuser",
|
|
397
|
+
DB_PASSWORD: "mypassword",
|
|
398
|
+
|
|
242
399
|
DB_NAME: "seamless",
|
|
243
400
|
SQL_LOGGING: "false",
|
|
244
401
|
});
|
|
@@ -263,14 +420,11 @@ async function downloadRepo(repo, dest) {
|
|
|
263
420
|
execSync("git init", { cwd: root });
|
|
264
421
|
}
|
|
265
422
|
|
|
266
|
-
if (
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
execSync("npm install", { cwd: full, stdio: "inherit" });
|
|
272
|
-
}
|
|
273
|
-
}
|
|
423
|
+
if (AUTH && API && WEB) {
|
|
424
|
+
fs.writeFileSync(
|
|
425
|
+
path.join(root, "Docker-compose.yml"),
|
|
426
|
+
GENERATED_DOCKER_COMPOSE,
|
|
427
|
+
);
|
|
274
428
|
}
|
|
275
429
|
|
|
276
430
|
console.log(`
|
|
@@ -293,6 +447,10 @@ Start development:
|
|
|
293
447
|
# terminal 3
|
|
294
448
|
cd web && npm i && npm run dev
|
|
295
449
|
|
|
450
|
+
or if using Docker
|
|
451
|
+
|
|
452
|
+
docker compose up
|
|
453
|
+
|
|
296
454
|
Docs: https://docs.seamlessauth.com/docs
|
|
297
455
|
Happy hacking. 🚀
|
|
298
456
|
`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-seamless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
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
|