You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

n8n-nodes-netbox

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

n8n-nodes-netbox - npm Package Compare versions

Comparing version

to
1.2.0

15

dist/credentials/NetBoxApi.credentials.js

@@ -34,18 +34,3 @@ "use strict";

];
authenticate = {
type: 'generic',
properties: {
headers: {
Authorization: '=Token {{$credentials.token}}',
},
},
};
test = {
request: {
baseURL: '={{$credentials.url}}/api',
url: '/status/',
skipSslCertificateValidation: '={{!$credentials.sslVerify}}',
},
};
}
exports.NetBoxApi = NetBoxApi;

103

dist/nodes/NetBox/helpers/apiRequest.js
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -6,2 +42,4 @@ exports.apiRequest = apiRequest;

const errorHandler_1 = require("./errorHandler");
const https = __importStar(require("https"));
const axios_1 = __importDefault(require("axios"));
/**

@@ -12,4 +50,2 @@ * Make an API request to NetBox

const credentials = await this.getCredentials('netBoxApi');
// Convert method string to IHttpRequestMethods
const methodType = method.toUpperCase();
// The URL should NOT have /api/ in it as we add it here

@@ -21,33 +57,40 @@ const baseUrl = credentials.url;

const apiEndpoint = endpoint.startsWith('/api/') ? endpoint : `/api${endpoint}`;
const options = {
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
},
method: methodType,
qs: query,
url: uri || `${cleanBaseUrl}${apiEndpoint}`,
json: true,
};
// Add SSL certificate bypass if disabled
if (credentials.sslVerify === false) {
options.skipSslCertificateValidation = true;
}
// Only add body for methods that support it
if (['POST', 'PUT', 'PATCH'].includes(methodType) && Object.keys(body).length > 0) {
options.body = body;
}
if (Object.keys(query).length === 0) {
delete options.qs;
}
const url = uri || `${cleanBaseUrl}${apiEndpoint}`;
try {
console.log(`Making API request to: ${options.url}`);
console.log(`Method: ${options.method}`);
console.log(`Making API request to: ${url}`);
console.log(`Method: ${method.toUpperCase()}`);
console.log(`SSL Verification: ${credentials.sslVerify}`);
console.log(`Skip SSL Certificate Validation: ${options.skipSslCertificateValidation}`);
// Log body for debugging (but not sensitive data)
if (options.body) {
console.log('Request body:', JSON.stringify(options.body, null, 2));
// Create axios configuration with proper SSL handling
const axiosConfig = {
method: method.toLowerCase(),
url: url,
headers: {
'Content-Type': 'application/json',
'Authorization': `Token ${credentials.token}`,
'Accept': 'application/json',
},
params: Object.keys(query).length > 0 ? query : undefined,
};
// Add body for methods that support it
if (['POST', 'PUT', 'PATCH'].includes(method.toUpperCase()) && Object.keys(body).length > 0) {
axiosConfig.data = body;
console.log('Request body:', JSON.stringify(body, null, 2));
}
return await this.helpers.httpRequestWithAuthentication.call(this, 'netBoxApi', options);
// Handle SSL certificate bypass using httpsAgent
if (credentials.sslVerify === false) {
console.log('Creating HTTPS agent with SSL verification disabled');
const httpsAgent = new https.Agent({
rejectUnauthorized: false,
requestCert: false,
});
axiosConfig.httpsAgent = httpsAgent;
}
console.log('Axios config:', {
method: axiosConfig.method,
url: axiosConfig.url,
hasHTTPSAgent: !!axiosConfig.httpsAgent,
sslVerifyDisabled: credentials.sslVerify === false
});
const response = await (0, axios_1.default)(axiosConfig);
return response.data;
}

@@ -54,0 +97,0 @@ catch (error) {

{
"name": "n8n-nodes-netbox",
"version": "1.1.5",
"version": "1.2.0",
"description": "n8n community node for NetBox API integration with comprehensive DCIM, IPAM, and data center management operations",

@@ -59,2 +59,5 @@ "keywords": [

},
"dependencies": {
"axios": "^1.6.0"
},
"peerDependencies": {

@@ -61,0 +64,0 @@ "n8n-workflow": "*"