
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
inference-activity-axios
Advanced tools
Axios interceptors for tracking inference activities on Heroku AI. This package helps you monitor and log API calls to inference endpoints while automatically redacting sensitive information from requests and responses.
npm install inference-activity-axios
const axios = require('axios');
const { applyInterceptors } = require('inference-activity-axios');
// Create your axios instance
const api = axios.create({
baseURL: process.env.INFERENCE_URL,
headers: {
'Authorization': `Bearer ${process.env.INFERENCE_KEY}`,
'Content-Type': 'application/json'
}
});
// Apply the interceptors to start tracking
applyInterceptors(api);
The package requires the following environment variables:
For Heroku Inference API:
INFERENCE_URL: Base URL for the inference APIINFERENCE_KEY: API key for authenticationINFERENCE_MODEL_ID: Model ID to use for inferenceFor Activity Logging:
INFERENCE_ACTIVITY_URL: URL where activity logs will be sentINFERENCE_ACTIVITY_KEY: API key for authentication with the activity logging serviceYou can set them up using:
# For inference API
export INFERENCE_URL=$(heroku config:get -a $APP_NAME INFERENCE_URL)
export INFERENCE_KEY=$(heroku config:get -a $APP_NAME INFERENCE_KEY)
export INFERENCE_MODEL_ID=$(heroku config:get -a $APP_NAME INFERENCE_MODEL_ID)
# For activity logging
export INFERENCE_ACTIVITY_URL=$(heroku config:get -a $APP_NAME INFERENCE_ACTIVITY_URL)
export INFERENCE_ACTIVITY_KEY=$(heroku config:get -a $APP_NAME INFERENCE_ACTIVITY_KEY)
When activity logging is enabled (by setting INFERENCE_ACTIVITY_URL and INFERENCE_ACTIVITY_KEY), the following information is logged for each API call:
{
timestamp: Date.now(),
response_time: duration, // Request duration in milliseconds
status_code: response.status, // HTTP status code
status_message: statusText, // HTTP status message
request: {
method: 'POST',
url: '/v1/chat/completions',
params: {},
body: { // Sensitive data is redacted
model: 'gpt-3.5-turbo',
messages: '[REDACTED]',
temperature: 0.5
}
},
response: { // Sensitive data is redacted
headers: {...},
data: {
choices: [{
message: {
content: '[REDACTED]'
}
}]
}
}
}
const axios = require('axios');
const { applyInterceptors } = require('inference-activity-axios');
const api = axios.create({
baseURL: process.env.INFERENCE_URL,
headers: {
'Authorization': `Bearer ${process.env.INFERENCE_KEY}`,
'Content-Type': 'application/json'
}
});
// Apply the interceptors to start tracking
applyInterceptors(api);
const payload = {
model: process.env.INFERENCE_MODEL_ID,
messages: [
{ role: "user", content: "Hello!" },
{ role: "assistant", content: "Hi there! How can I assist you today?" },
{ role: "user", content: "Why is Heroku so cool?" }
],
temperature: 0.5,
max_tokens: 100,
stream: false
};
async function generateChatCompletion(payload) {
try {
const response = await api.post('/v1/chat/completions', payload);
console.log("Chat Completion:", response.data.choices[0].message.content);
} catch (error) {
console.error("Error generating chat completion:", error.message);
}
}
generateChatCompletion(payload);
const axios = require('axios');
const { applyInterceptors } = require('inference-activity-axios');
const api = axios.create({
baseURL: process.env.INFERENCE_URL,
headers: {
'Authorization': `Bearer ${process.env.INFERENCE_KEY}`,
'Content-Type': 'application/json'
}
});
// Apply the interceptors to start tracking
applyInterceptors(api);
const payload = {
model: process.env.INFERENCE_MODEL_ID,
messages: [
{ role: "user", content: "Hello!" },
{ role: "assistant", content: "Hi there! How can I assist you today?" },
{ role: "user", content: "Why is Heroku so cool?" }
],
temperature: 0.5,
max_tokens: 100,
stream: true
};
async function generateChatCompletion(payload) {
try {
const response = await api.post('/v1/chat/completions', payload, { responseType: 'stream' });
response.data.on('data', chunk => {
process.stdout.write(chunk);
});
} catch (error) {
console.error("Error generating chat completion:", error.message);
}
}
generateChatCompletion(payload);
The package automatically redacts sensitive information:
Chat Completions (/v1/chat/completions):
Embeddings (/v1/embeddings):
Image Generation (/v1/images/generations):
MIT
FAQs
Axios interceptors for tracking inference activities on Heroku AI
The npm package inference-activity-axios receives a total of 0 weekly downloads. As such, inference-activity-axios popularity was classified as not popular.
We found that inference-activity-axios demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.