Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@upx-us/shield

Package Overview
Dependencies
Maintainers
3
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@upx-us/shield - npm Package Compare versions

Comparing version
0.9.4
to
0.9.5
+86
postinstall.js
#!/usr/bin/env node
/**
* postinstall.js — runs after `npm install`.
*
* Checks whether the openclaw CLI is available. If it is not, this plugin
* has been installed outside of an OpenClaw gateway environment, and we
* print a clear warning to stderr so the user knows what to do.
*
* Must be plain CommonJS — no TypeScript, no npm dependencies.
* Runs before any build step, so dist/ may not exist yet.
*
* Safety contract: this script MUST NEVER exit non-zero. A broken postinstall
* would fail `npm install` for real users, which is unacceptable.
* The outer try/catch guarantees exit(0) in all circumstances.
*/
'use strict';
const { execSync } = require('child_process');
const { existsSync } = require('fs');
const { join } = require('path');
const WARNING_BOX = [
'',
' ┌─────────────────────────────────────────────────────────┐',
' │ ⚠️ OpenClaw Shield requires the OpenClaw gateway │',
' │ This plugin is not meant to be installed directly. │',
' │ Get started at: https://openclaw.ai │',
' └─────────────────────────────────────────────────────────┘',
'',
].join('\n') + '\n';
function isOpenClawAvailable() {
const rawPath = String(process.env.PATH || '');
const rawParts = rawPath.split(/[:;]/).filter(Boolean);
const pathDirs = [];
for (let i = 0; i < rawParts.length; i++) {
const part = rawParts[i];
if (
process.platform === 'win32' &&
/^[A-Za-z]$/.test(part) &&
rawParts[i + 1] &&
/^[\\/]/.test(rawParts[i + 1])
) {
pathDirs.push(part + ':' + rawParts[i + 1]);
i++;
continue;
}
pathDirs.push(part);
}
const candidates = process.platform === 'win32'
? ['openclaw.exe', 'openclaw.cmd', 'openclaw.bat', 'openclaw']
: ['openclaw'];
for (const dir of pathDirs) {
for (const candidate of candidates) {
try {
if (existsSync(join(dir, candidate))) return true;
} catch (_) {
// ignore path access errors and continue
}
}
}
// Try `which openclaw` first (POSIX), then a version flag as a fallback.
// The fallback is important on Windows where `which` is not available.
const checks = ['which openclaw', 'openclaw --version'];
for (const cmd of checks) {
try {
execSync(cmd, { stdio: 'ignore' });
return true;
} catch (_) {
// continue to next check
}
}
return false;
}
try {
if (!isOpenClawAvailable()) {
process.stderr.write(WARNING_BOX);
}
process.exit(0);
} catch (_) {
// Never break a real install — exit cleanly no matter what
process.exit(0);
}
+10
-0

@@ -7,2 +7,12 @@ # Changelog

## [0.9.5] — 2026-04-08
### Fixed
- **install**: fix postinstall hook path — moved postinstall.js to repo root so it is included in the published tarball (closes #227)
- **docs**: add missing `plugins.allow` config step to README Option 1 (closes #227)
- **cli**: fix `activate` command using stale in-memory state instead of on-disk credentials (closes #227)
---
## [0.9.4] — 2026-04-06

@@ -9,0 +19,0 @@

+1
-1

@@ -5,3 +5,3 @@ {

"description": "Real-time security monitoring \u2014 streams enriched, redacted security events to the Shield detection platform.",
"version": "0.9.4",
"version": "0.9.5",
"skills": [

@@ -8,0 +8,0 @@ "./skills"

{
"name": "@upx-us/shield",
"version": "0.9.4",
"version": "0.9.5",
"description": "Security monitoring and SIEM integration for OpenClaw agents — behavioral detection, case generation, and forensic audit trail via Google SecOps (Chronicle).",

@@ -16,2 +16,3 @@ "main": "dist/index.js",

"openclaw.plugin.json",
"postinstall.js",
"skills/",

@@ -23,3 +24,3 @@ "README.md",

"scripts": {
"postinstall": "node scripts/postinstall.js",
"postinstall": "node postinstall.js",
"prebuild": "npm run clean",

@@ -26,0 +27,0 @@ "build": "tsc",

@@ -108,3 +108,15 @@ # OpenClaw Shield

openclaw plugins install @upx-us/shield
```
Then add `"shield"` to the `plugins.allow` array in your `openclaw.json`:
```json
{
"plugins": {
"allow": ["shield"]
}
}
```
```bash
# Step 2: Activate (exchanges your key for credentials)

@@ -111,0 +123,0 @@ openclaw shield activate <YOUR_KEY>

Sorry, the diff of this file is too big to display