@underpostnet/cyberia 3.3.77 → 3.4.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.
Files changed (105) hide show
  1. package/.env.example +1 -0
  2. package/.github/workflows/coverall.cyberia.ci.yml +12 -3
  3. package/.github/workflows/cyberia-client.cd.yml +2 -1
  4. package/.github/workflows/cyberia-server.cd.yml +2 -1
  5. package/.github/workflows/docker-image.cyberia-client.ci.yml +1 -1
  6. package/.github/workflows/docker-image.cyberia-client.dev.ci.yml +1 -1
  7. package/.github/workflows/docker-image.cyberia-server.ci.yml +1 -1
  8. package/.github/workflows/docker-image.cyberia-server.dev.ci.yml +1 -1
  9. package/.github/workflows/docker-image.engine-cyberia.ci.yml +1 -1
  10. package/.github/workflows/docker-image.engine-cyberia.dev.ci.yml +1 -1
  11. package/.github/workflows/engine-cyberia.ci.yml +6 -0
  12. package/.github/workflows/ghpkg.ci.yml +19 -2
  13. package/.github/workflows/gitlab.ci.yml +8 -6
  14. package/.github/workflows/hardhat.ci.yml +4 -1
  15. package/.github/workflows/npmpkg.ci.yml +9 -5
  16. package/.github/workflows/publish.ci.yml +21 -12
  17. package/.github/workflows/publish.cyberia.ci.yml +25 -14
  18. package/.github/workflows/pwa-microservices-template-page.cd.yml +4 -2
  19. package/CHANGELOG.md +75 -140
  20. package/CLI-HELP.md +28 -1
  21. package/Dockerfile +1 -1
  22. package/Dockerfile.dev +1 -1
  23. package/Dockerfile.test +1 -1
  24. package/README.md +1 -1
  25. package/bin/build.js +2 -4
  26. package/bin/cyberia.js +4 -4
  27. package/bin/index.js +4 -4
  28. package/compose.env +1 -0
  29. package/conf.js +1 -1042
  30. package/deploy/cyberia-client/deploy.sh +13 -11
  31. package/deploy/cyberia-server/deploy.sh +13 -11
  32. package/deploy/dd-cyberia/sync-deploy.sh +7 -28
  33. package/deploy/lib/config.sh +1 -1
  34. package/deploy/lib/github-actions-logging.sh +3 -2
  35. package/deploy/pwa-microservices-template/deploy.sh +7 -1
  36. package/deployment.yaml +1 -1
  37. package/docker-compose.yml +7 -7
  38. package/docs/coverage/cyberia/api/cyberia-instance/cyberia-fallback-capture.js.html +1 -1
  39. package/docs/coverage/cyberia/api/cyberia-instance/index.html +1 -1
  40. package/docs/coverage/cyberia/api/cyberia-server-defaults/cyberia-server-defaults.js.html +1 -1
  41. package/docs/coverage/cyberia/api/cyberia-server-defaults/index.html +1 -1
  42. package/docs/coverage/cyberia/api/object-layer/index.html +1 -1
  43. package/docs/coverage/cyberia/api/object-layer/object-layer.model.js.html +1 -1
  44. package/docs/coverage/cyberia/index.html +1 -1
  45. package/docs/coverage/cyberia/projects/cyberia/atlas-sprite-sheet-generator.js.html +1 -1
  46. package/docs/coverage/cyberia/projects/cyberia/index.html +1 -1
  47. package/docs/coverage/cyberia/projects/cyberia/instance-backup.js.html +1 -1
  48. package/docs/coverage/cyberia/projects/cyberia/instance-data.js.html +1 -1
  49. package/docs/coverage/cyberia/projects/cyberia/shape-generator.js.html +1 -1
  50. package/docs/coverage/cyberia/projects/cyberia/stat-balance.js.html +1 -1
  51. package/hardhat/package-lock.json +6 -6
  52. package/hardhat/package.json +2 -2
  53. package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +1 -1
  54. package/manifests/cronjobs/dd-cron/dd-cron-vultr.yaml +1 -1
  55. package/manifests/deployment/dd-cyberia-development/deployment.yaml +1 -1
  56. package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
  57. package/package.json +19 -17
  58. package/scripts/test-monitor.sh +1 -1
  59. package/src/api/file/file.router.js +7 -1
  60. package/src/cli/baremetal.js +1 -1
  61. package/src/cli/docker-compose.js +1 -1
  62. package/src/cli/index.js +36 -0
  63. package/src/cli/kubectl.js +4 -3
  64. package/src/cli/release.js +2 -0
  65. package/src/cli/repository.js +7 -2
  66. package/src/cli/run.js +1 -1
  67. package/src/cli/secrets.js +393 -200
  68. package/src/cli/socketsecurity.js +260 -0
  69. package/src/client/components/core/CssCore.js +3 -0
  70. package/src/client/components/core/Modal.js +160 -36
  71. package/src/client/components/core/SearchBox.js +0 -1
  72. package/src/client/components/underpost/AppShellUnderpost.js +13 -1
  73. package/src/client/components/underpost/CssUnderpost.js +15 -2
  74. package/src/client/public/cyberia-docs/CYBERIA-CLIENT.md +8 -0
  75. package/src/client/public/cyberia-docs/CYBERIA.md +1 -1
  76. package/src/client/public/cyberia-docs/OFF-CHAIN-ECONOMY.md +54 -56
  77. package/src/client/public/cyberia-docs/ROADMAP.md +1 -1
  78. package/src/client/public/cyberia-docs/UNDERPOST-PLATFORM.md +30 -29
  79. package/src/client/public/cyberia-docs/WHITE-PAPER.md +1 -1
  80. package/src/client/ssr/body/UnderpostDefaultSplashScreen.js +54 -25
  81. package/src/client/ssr/head/Css.js +12 -10
  82. package/src/client/ssr/views/Cyberia404.js +6 -10
  83. package/src/client/ssr/views/NotFound.js +75 -0
  84. package/src/client-builder/client-bundle.js +2 -2
  85. package/src/index.js +13 -1
  86. package/src/runtime/engine-cyberia/Dockerfile +1 -1
  87. package/src/runtime/engine-cyberia/Dockerfile.dev +1 -1
  88. package/src/runtime/engine-cyberia/Dockerfile.test +1 -1
  89. package/src/runtime/engine-cyberia/compose.env +1 -0
  90. package/src/runtime/engine-cyberia/docker-compose.yml +7 -7
  91. package/src/server/build/catalog.js +1 -0
  92. package/src/server/build/execution.js +19 -5
  93. package/src/server/build/package.js +166 -3
  94. package/src/server/build/testing.js +2 -1
  95. package/src/server/runtime/conf.js +21 -0
  96. package/src/server/runtime/config-scope.js +2 -0
  97. package/src/server/runtime/process.js +4 -3
  98. package/src/server/security/socketsecurity.js +1735 -0
  99. package/test/integration/infra/1-security/config-scope.test.js +3 -0
  100. package/test/integration/infra/1-security/socketsecurity.test.js +1041 -0
  101. package/test/integration/infra/1-security/sops-secret-store.test.js +201 -71
  102. package/test/unit/build-template.test.js +24 -0
  103. package/test/unit/deploy-log-table.test.js +38 -0
  104. package/test/unit/execution-profiles.test.js +1 -0
  105. package/test/unit/package.test.js +118 -0
@@ -24,7 +24,7 @@ MODE=runtime # runtime | instance
24
24
  ENV=development # development | production
25
25
  DEPLOY_ID=dd-test # deploy id (instance mode: parent of conf.instances.json)
26
26
  INSTANCE_IDS= # instance mode: csv of ids (default: all in conf.instances.json)
27
- IMAGE=underpost/wp:v3.3.77 # runtime mode image (instance mode reads image from conf)
27
+ IMAGE=underpost/wp:v3.4.0 # runtime mode image (instance mode reads image from conf)
28
28
  VERSIONS=green # csv of blue/green versions
29
29
  REPLICAS=1 # replicas per deployment
30
30
  NAMESPACE=default # k8s namespace
@@ -4,7 +4,7 @@ import { FileController } from './file.controller.js';
4
4
 
5
5
  class FileRouter {
6
6
  /**
7
- * authenticated writes, admin-only deletes.
7
+ * authenticated writes, admin-only deletes and full listing.
8
8
  * @param {import('../types.js').RouterOptions} options
9
9
  * @returns {import('express').Router}
10
10
  */
@@ -13,6 +13,12 @@ class FileRouter {
13
13
  router.post(`/:id`, options.authMiddleware, async (req, res) => await FileController.post(req, res, options));
14
14
  router.post(`/`, options.authMiddleware, async (req, res) => await FileController.post(req, res, options));
15
15
  router.get(`/blob/:id`, async (req, res) => await FileController.get(req, res, options));
16
+ router.get(
17
+ `/all`,
18
+ options.authMiddleware,
19
+ adminGuard,
20
+ async (req, res) => await FileController.get(req, res, options),
21
+ );
16
22
  router.get(`/:id`, async (req, res) => await FileController.get(req, res, options));
17
23
  router.get(`/`, async (req, res) => await FileController.get(req, res, options));
18
24
  router.delete(
@@ -3389,7 +3389,7 @@ fi
3389
3389
  throw new Error('Invalid token format');
3390
3390
  }
3391
3391
 
3392
- logger.info('Maas api token generated', { consumer_key, consumer_secret, token_key, token_secret });
3392
+ logger.info('Maas api token generated', { consumer_key, token_key });
3393
3393
  return { consumer_key, consumer_secret, token_key, token_secret };
3394
3394
  },
3395
3395
 
@@ -192,7 +192,7 @@ services:
192
192
  MONGO_IMAGE=mongo:latest
193
193
  VALKEY_IMAGE=valkey/valkey:latest
194
194
  APP_IMAGE=underpost/underpost-engine
195
- APP_TAG=v3.3.77
195
+ APP_TAG=v3.4.0
196
196
  PROXY_IMAGE=nginx:stable-alpine
197
197
  PROMETHEUS_IMAGE=prom/prometheus:latest
198
198
  GRAFANA_IMAGE=grafana/grafana:latest
package/src/cli/index.js CHANGED
@@ -7,6 +7,7 @@ import { commitData } from '../client/components/core/CommonJs.js';
7
7
  import { registerDomainCommand } from './domains.js';
8
8
  import { TEST_TIERS, testSuiteNames } from '../server/build/testing.js';
9
9
  import { EXECUTION_PROFILES, profileFromOptionsFactory, setExecutionProfile } from '../server/build/execution.js';
10
+ import { SEVERITIES } from '../server/security/socketsecurity.js';
10
11
 
11
12
  import Underpost from '../index.js';
12
13
 
@@ -1403,6 +1404,41 @@ program
1403
1404
  )
1404
1405
  .action(Underpost.package.callback);
1405
1406
 
1407
+ program
1408
+ .command('socketsecurity')
1409
+ .option(
1410
+ '--audit',
1411
+ "Audits the checkout (default). Dependency security: segregation, npm audit, the Socket patch scan and, with SOCKET_CLI_API_TOKEN set, the Socket full scan of the dependency manifests. Source code risk: with SOCKET_CLI_API_TOKEN set, the alerts Socket's registry analysis raises on this project's own published package, as refactoring tasks. Writes the JSON and Markdown reports.",
1412
+ )
1413
+ .option(
1414
+ '--reach',
1415
+ 'Runs the full application reachability analysis over the local working tree with the Socket scan (tier 1 evidence); no pushed commit is needed.',
1416
+ )
1417
+ .option(
1418
+ '--ci',
1419
+ 'Audits, then exits non-zero when the Socket scan violates the organization policy or a finding remains at --fail-on.',
1420
+ )
1421
+ .option('--fail-on <severity>', `Severity --ci fails at. One of: ${SEVERITIES.join(', ')}. Defaults to high.`)
1422
+ .option(
1423
+ '--fix',
1424
+ 'Runs the remediation pass before the audit: npm audit fix, every available Socket patch, socket fix without major upgrades, socket patch apply.',
1425
+ )
1426
+ .option('--major', 'With --fix: lets socket fix apply major upgrades.')
1427
+ .option('--patch-scan', 'Lists the Socket patches available for the installed packages.')
1428
+ .option(
1429
+ '--patch-get <identifier>',
1430
+ 'Downloads one patch (UUID, CVE, GHSA or PURL) into .socket/manifest.json and applies it.',
1431
+ )
1432
+ .option('--patch-apply', 'Applies the patch manifest; the prepare hook. A host without the Socket CLI skips it.')
1433
+ .option('--patch-setup', 'Installs the prepare hook in package.json.')
1434
+ .option('--out <dir>', 'Report directory (default: security-reports).')
1435
+ .option('--dry-run', 'Previews --patch-setup; verifies --patch-apply without writing.')
1436
+ .description(
1437
+ 'Security audit through Socket.dev: dependency security (advisories, supply chain alerts, reachability, ' +
1438
+ "security patches in .socket/manifest.json) and source code risk (alerts on this project's own code).",
1439
+ )
1440
+ .action(Underpost.socketSecurity.callback);
1441
+
1406
1442
  program
1407
1443
  .command('release')
1408
1444
  .argument('[version]', 'The new version string to set (e.g., "3.1.4"). Defaults to current version.')
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { loggerFactory, redactSensitiveText } from '../server/ops/logger.js';
10
- import { shellExec, sleepSync } from '../server/runtime/process.js';
10
+ import { shellArgumentFactory, shellExec, sleepSync } from '../server/runtime/process.js';
11
11
  import { timer } from '../client/components/core/CommonJs.js';
12
12
  import Underpost from '../index.js';
13
13
 
@@ -275,7 +275,8 @@ class UnderpostKubectl {
275
275
  },
276
276
 
277
277
  /**
278
- * Runs a shell command inside a pod container via `kubectl exec`.
278
+ * Runs a shell command inside a pod container via `kubectl exec`. The command is quoted as one
279
+ * argument, so the pod's shell parses it and the host shell never expands it.
279
280
  * @param {object} params
280
281
  * @param {string} params.podName - Target pod name.
281
282
  * @param {string} params.namespace - Pod namespace.
@@ -287,7 +288,7 @@ class UnderpostKubectl {
287
288
  * @memberof UnderpostKubectl
288
289
  */
289
290
  exec({ podName, namespace, command, retries = DEFAULT_POD_RETRIES, timeoutSeconds = 0 }) {
290
- const kubectlCmd = `sudo kubectl exec -n ${namespace} -i ${podName} -- sh -c "${command}"`;
291
+ const kubectlCmd = `sudo kubectl exec -n ${shellArgumentFactory(namespace)} -i ${shellArgumentFactory(podName)} -- sh -c ${shellArgumentFactory(command)}`;
291
292
  return Underpost.kubectl.run(kubectlCmd, {
292
293
  context: `exec in pod ${podName}`,
293
294
  retries,
@@ -503,6 +503,8 @@ class UnderpostRelease {
503
503
  shellExec(`sudo rm -rf ./engine-private/conf/dd-default`);
504
504
  shellExec(`node bin cron --kubeadm --setup-start --git`); // --apply
505
505
  shellExec(`node bin cmt --changelog-build`);
506
+ shellExec(`npm run security`);
507
+ shellExec(`sudo rm -rf ./conf.dd*.js`);
506
508
  return { from: version, to: newVersion, files: report.map((r) => r.file), dryRun: false };
507
509
  },
508
510
 
@@ -950,7 +950,12 @@ Prevent build private config repo.`,
950
950
  confRawPaths[1] = `${JSON.stringify(DefaultConf)};`;
951
951
  const targetConfPath = `./conf${defaultConf ? '' : `.${deployId}`}.js`;
952
952
  fs.writeFileSync(targetConfPath, confRawPaths.join(sepRender), 'utf8');
953
- shellExec(`prettier --write ${targetConfPath}`);
953
+ // A host tool, not a dependency: without it the manifest stays valid, only unformatted.
954
+ if (
955
+ `${shellExec('command -v prettier', { silent: true, silentOnError: true, stdout: true, disableLog: true }) ?? ''}`.trim()
956
+ )
957
+ shellExec(`prettier --write ${shellArgumentFactory(targetConfPath)}`);
958
+ else logger.warn('prettier is not on PATH; conf manifest left unformatted', { targetConfPath });
954
959
  },
955
960
 
956
961
  /**
@@ -1985,7 +1990,7 @@ Prevent build private config repo.`,
1985
1990
  `export GITHUB_TOKEN='${githubToken.replace(/'/g, "'\\''")}'`,
1986
1991
  `export GITHUB_USERNAME='${githubUsername.replace(/'/g, "'\\''")}'`,
1987
1992
  `git config --global --add safe.directory '${siteRoot}' 2>/dev/null || true`,
1988
- `cd '${siteRoot}' && git add -A && git commit -m 'backup $(date -u +%Y-%m-%dT%H:%M:%SZ)' || true`,
1993
+ `cd '${siteRoot}' && git add -A && git commit -m "backup $(date -u +%Y-%m-%dT%H:%M:%SZ)" || true`,
1989
1994
  `cd '${siteRoot}' && underpost push . ${githubUsername}/${repoName}`,
1990
1995
  `cd /home/dd/engine && node bin host clean --force`,
1991
1996
  ].join(' && ');
package/src/cli/run.js CHANGED
@@ -3079,7 +3079,7 @@ EOF`);
3079
3079
  const hostListenResult = etcHostFactory(hosts);
3080
3080
  logger.info(hostListenResult.renderHosts);
3081
3081
  }
3082
- const version = 'v3.3.77';
3082
+ const version = 'v3.4.0';
3083
3083
  const instanceOptionsFactory = (deployId, instanceId) => ({
3084
3084
  ...options,
3085
3085
  ...clusterContextFactory(clusterType),