
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@osohq/express
Advanced tools
The Oso SDK with Express integration provides helper functions to facilitate hooking Oso into the Express web framework.
The Oso SDK with Express integration provides helper functions to facilitate hooking Oso into the Express web framework.
Please Note: The SDK is currently released as a developer preview. Do not use this SDK for production workloads.
npm install --save @osohq/express
yarn add @osohq/express
The Oso SDK should be initialized as early as possible in the main entry module. The Oso SDK can be hooked into Express as a centralized middleware or as a route middleware using the enforce
function.
import { init } from '@osohq/express';
import express from 'express';
const oso = init({
apiKey: 'YOUR_API_KEY',
// ...
})
const enforcement = {
action: 'view',
resourceType: 'Org',
resourceId: '123',
};
// Centralized enforcement
app.use(oso.enforce(enforcement));
// Per-route enforcement
app.get('/', oso.enforce(enforcement), (_req, _res) => {
// ...
});
app.listen(5678);
After the Oso SDK is initialized, you may access it by calling globalOso()
:
import { globalOso } from '@osohq/node';
oso = globalOso();
The Oso SDK may be further configured by setting relevant fields in the ConfigOptions
object passed on init
.
By default,
_
. You may override the Actor ID using the setting defaultActorId
when initializing the Oso SDK.defaultAction
when initializing the Oso SDK.defaultErrorHandler
when initializing the Oso SDK.You may provide a function to determine the Actor Id by setting defaultActorId
when initializing the Oso SDK.
import { init } from '@osohq/express';
import { Request } from 'express';
init({
apiKey: 'YOUR_API_KEY',
// Hardcode the actor Id to `admin`
defaultActorId: (_req: Request) => 'admin',
});
You may provide a function to determine the action by setting defaultAction
when initializing the Oso SDK.
import { init } from '@osohq/express';
import { Request } from 'express';
init({
apiKey: 'YOUR_API_KEY',
// Hardcode the action to `view`
defaultAction: (_req: Request) => 'view',
});
You can provide a function to determine the response on authorization failure.
import { init } from '@osohq/express';
import { Response, NextFunction } from 'express';
init({
apiKey: 'YOUR_API_KEY',
// Return HTTP 418 on authorization failure
defaultErrorHandler: (res: Response, _next: NextFunction) => {
res.send(418).send("I'm a teapot");
return;
},
});
FAQs
The Oso SDK with Express integration provides helper functions to facilitate hooking Oso into the Express web framework.
The npm package @osohq/express receives a total of 8 weekly downloads. As such, @osohq/express popularity was classified as not popular.
We found that @osohq/express demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.