mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Merge branch 'main' into feature/add-rush-monorepo-support
This commit is contained in:
commit
178b8a4423
5 changed files with 52 additions and 1029 deletions
1
.github/workflows/build-and-release.yml
vendored
1
.github/workflows/build-and-release.yml
vendored
|
|
@ -101,6 +101,7 @@ jobs:
|
||||||
|
|
||||||
publish-npm:
|
publish-npm:
|
||||||
name: Publish to npm
|
name: Publish to npm
|
||||||
|
if: github.event_name == 'release'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
|
||||||
25
docs/Release.md
Normal file
25
docs/Release.md
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
# Release Guide
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
|
||||||
|
### 1. Create and push a version tag
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git tag 1.0.0
|
||||||
|
git push origin 1.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
This triggers the build pipeline, which compiles binaries for all platforms and creates a draft GitHub release.
|
||||||
|
|
||||||
|
### 2. Wait for artifacts to build
|
||||||
|
|
||||||
|
Monitor the [Actions tab](https://github.com/AikidoSec/safe-chain/actions) until the `Create Release` workflow completes.
|
||||||
|
|
||||||
|
### 3. Publish the GitHub release
|
||||||
|
|
||||||
|
1. Go to the [Releases page](https://github.com/AikidoSec/safe-chain/releases)
|
||||||
|
2. Open the draft release created for your tag
|
||||||
|
3. Add release notes
|
||||||
|
4. Click **Publish release**
|
||||||
|
|
||||||
|
Publishing the release automatically triggers an npm publish. Pre-release versions (e.g. `1.0.0-beta`) are published to npm under a tag matching the pre-release identifier (e.g. `beta`). Stable versions are published to the `latest` tag.
|
||||||
942
npm-shrinkwrap.json
generated
942
npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -39,7 +39,6 @@
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"description": "The Aikido Safe Chain wraps around the [npm cli](https://github.com/npm/cli), [npx](https://github.com/npm/cli/blob/latest/docs/content/commands/npx.md), [yarn](https://yarnpkg.com/), [pnpm](https://pnpm.io/), [pnpx](https://pnpm.io/cli/dlx), [rush](https://rushjs.io/), [bun](https://bun.sh/), [bunx](https://bun.sh/docs/cli/bunx), [uv](https://docs.astral.sh/uv/) (Python), and [pip](https://pip.pypa.io/) to provide extra checks before installing new packages. This tool will detect when a package contains malware and prompt you to exit, preventing npm, npx, yarn, pnpm, pnpx, rush, bun, bunx, uv, or pip/pip3 from downloading or running the malware.",
|
"description": "The Aikido Safe Chain wraps around the [npm cli](https://github.com/npm/cli), [npx](https://github.com/npm/cli/blob/latest/docs/content/commands/npx.md), [yarn](https://yarnpkg.com/), [pnpm](https://pnpm.io/), [pnpx](https://pnpm.io/cli/dlx), [rush](https://rushjs.io/), [bun](https://bun.sh/), [bunx](https://bun.sh/docs/cli/bunx), [uv](https://docs.astral.sh/uv/) (Python), and [pip](https://pip.pypa.io/) to provide extra checks before installing new packages. This tool will detect when a package contains malware and prompt you to exit, preventing npm, npx, yarn, pnpm, pnpx, rush, bun, bunx, uv, or pip/pip3 from downloading or running the malware.",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"archiver": "^7.0.1",
|
|
||||||
"certifi": "14.5.15",
|
"certifi": "14.5.15",
|
||||||
"chalk": "5.4.1",
|
"chalk": "5.4.1",
|
||||||
"https-proxy-agent": "7.0.6",
|
"https-proxy-agent": "7.0.6",
|
||||||
|
|
@ -50,7 +49,6 @@
|
||||||
"semver": "7.7.2"
|
"semver": "7.7.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/archiver": "^7.0.0",
|
|
||||||
"@types/ini": "^4.1.1",
|
"@types/ini": "^4.1.1",
|
||||||
"@types/make-fetch-happen": "^10.0.4",
|
"@types/make-fetch-happen": "^10.0.4",
|
||||||
"@types/node": "^18.19.130",
|
"@types/node": "^18.19.130",
|
||||||
|
|
|
||||||
|
|
@ -1,111 +0,0 @@
|
||||||
import { platform } from 'os';
|
|
||||||
import { ui } from "../environment/userInteraction.js";
|
|
||||||
import { readFileSync, existsSync } from "node:fs";
|
|
||||||
import {randomUUID} from "node:crypto";
|
|
||||||
import {createWriteStream} from "fs";
|
|
||||||
import archiver from 'archiver';
|
|
||||||
import path from "node:path";
|
|
||||||
|
|
||||||
export async function printUltimateLogs() {
|
|
||||||
const { proxyLogPath, ultimateLogPath, proxyErrLogPath, ultimateErrLogPath } = getPathsPerPlatform();
|
|
||||||
|
|
||||||
await printLogs(
|
|
||||||
"SafeChain Proxy",
|
|
||||||
proxyLogPath,
|
|
||||||
proxyErrLogPath
|
|
||||||
);
|
|
||||||
|
|
||||||
await printLogs(
|
|
||||||
"SafeChain Ultimate",
|
|
||||||
ultimateLogPath,
|
|
||||||
ultimateErrLogPath
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function troubleshootingExport() {
|
|
||||||
const { logDir } = getPathsPerPlatform();
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
if (!existsSync(logDir)) {
|
|
||||||
ui.writeError(`Log directory not found: ${logDir}`);
|
|
||||||
reject(new Error(`Log directory not found: ${logDir}`));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const date = new Date().toISOString().split('T')[0];
|
|
||||||
const uuid = randomUUID();
|
|
||||||
const zipFileName = `safechain-ultimate-${date}-${uuid}.zip`;
|
|
||||||
const output = createWriteStream(zipFileName);
|
|
||||||
const archive = archiver('zip', { zlib: { level: 9 } });
|
|
||||||
|
|
||||||
output.on('close', () => {
|
|
||||||
ui.writeInformation(`Logs collected and zipped as: ${path.resolve(zipFileName)}`);
|
|
||||||
resolve(zipFileName);
|
|
||||||
});
|
|
||||||
|
|
||||||
archive.on('error', (/** @type {Error} */ err) => {
|
|
||||||
ui.writeError(`Failed to zip logs: ${err.message}`);
|
|
||||||
reject(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
archive.pipe(output);
|
|
||||||
archive.directory(logDir, false);
|
|
||||||
archive.finalize();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function getPathsPerPlatform() {
|
|
||||||
const os = platform();
|
|
||||||
if (os === 'win32') {
|
|
||||||
const logDir = `C:\\ProgramData\\AikidoSecurity\\SafeChainUltimate\\logs`;
|
|
||||||
return {
|
|
||||||
logDir,
|
|
||||||
proxyLogPath: `${logDir}\\SafeChainProxy.log`,
|
|
||||||
ultimateLogPath: `${logDir}\\SafeChainUltimate.log`,
|
|
||||||
proxyErrLogPath: `${logDir}\\SafeChainProxy.err`,
|
|
||||||
ultimateErrLogPath: `${logDir}\\SafeChainUltimate.err`,
|
|
||||||
};
|
|
||||||
} else if (os === 'darwin') {
|
|
||||||
const logDir = `/Library/Logs/AikidoSecurity/SafeChainUltimate`;
|
|
||||||
return {
|
|
||||||
logDir,
|
|
||||||
proxyLogPath: `${logDir}/safechain-proxy.log`,
|
|
||||||
ultimateLogPath: `${logDir}/safechain-ultimate.log`,
|
|
||||||
proxyErrLogPath: `${logDir}/safechain-proxy.error.log`,
|
|
||||||
ultimateErrLogPath: `${logDir}/safechain-ultimate.error.log`,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
throw new Error('Unsupported platform for log printing.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} appName
|
|
||||||
* @param {string} logPath
|
|
||||||
* @param {string} errLogPath
|
|
||||||
*/
|
|
||||||
async function printLogs(appName, logPath, errLogPath) {
|
|
||||||
ui.writeInformation(`=== ${appName} Logs ===`);
|
|
||||||
try {
|
|
||||||
if (existsSync(logPath)) {
|
|
||||||
const logs = readFileSync(logPath, "utf-8");
|
|
||||||
ui.writeInformation(logs);
|
|
||||||
} else {
|
|
||||||
ui.writeWarning(`${appName} log file not found: ${logPath}`);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
ui.writeError(`Failed to read ${appName} logs: ${error}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.writeInformation(`=== ${appName} Error Logs ===`);
|
|
||||||
try {
|
|
||||||
if (existsSync(errLogPath)) {
|
|
||||||
const errLogs = readFileSync(errLogPath, "utf-8");
|
|
||||||
ui.writeInformation(errLogs);
|
|
||||||
} else {
|
|
||||||
ui.writeInformation(`No error log file found for ${appName}.`);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
ui.writeError(`Failed to read ${appName} error logs: ${error}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue