Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@aserto/aserto-spa-js
Advanced tools
Loosely modeled after the Auth0 SPA SDK.
Using npm:
npm install @aserto/aserto-spa-js
Using yarn:
yarn add @aserto/aserto-spa-js
Create an AsertoClient
instance before rendering or initializing your application. You should only have one instance of the client.
You need a valid access token before you can instantiate the client. For
the next few examples, the accessToken
variable is assumed to contain a
valid access token.
To obtain one via Auth0 (for example), use code like this:
// get a valid access token, e.g. from Auth0 getTokenSilently()
import createAuth0Client from '@auth0/auth0-spa-js';
const auth0 = await createAuth0Cient(
domain: '<AUTH0_DOMAIN>',
client_id: '<AUTH0_CLIENT_ID>',
redirect_uri: '<MY_CALLBACK_URL>'
);
const accessToken = await auth0.getTokenSilently();
Create an AsertoClient
in the following way:
import createAsertoClient from '@aserto/aserto-spa-js';
const aserto = await createAsertoClient({
accessToken: accessToken, // valid access token
serviceUrl: 'https://service-url', // defaults to window.location.origin
endpoint: '/__accessmap' // access map endpoint, defaults to /__accessmap
});
// or you can just instantiate the client on its own
import { AsertoClient } from '@aserto/aserto-spa-js';
const aserto = new AsertoClient({
accessToken: accessToken,
serviceUrl: 'https://service-url', // defaults to window.location.origin
endpoint: '/__accessmap' // access map endpoint, defaults to /__accessmap
});
// explicitly load
await aserto.reload();
Retrieves a javascript object that holds the access map
console.log(aserto.accessMap());
Retrieves a map associated with a specific resource.
The path
argument is in the form /path/to/resource
. It may contain a {id}
component to indicate an parameter.
The returned map will be in the following format:
{
get: {
visible: true,
enabled: false,
allowed: false
},
post: {
visible: true,
enabled: false,
allowed: false
},
put: {
//...
},
delete: {
//...
}
}
Check whether a verb / path combination is visible and enabled:
const path = '/api/path';
const resource = aserto.resourceMap(path));
const isVisible = resource.get.visible;
const isEnabled = resource.get.enabled;
Display the values for all access levels on each verb for the path:
const path = '/api/path';
const resource = aserto.resourceMap(path));
for (const verb of ['get', 'post', 'put', 'delete']) {
for (const access of ['visible', 'enabled', 'allowed']) {
console.log(`${verb} ${path} ${access} is ${resource[verb][access]}`);
}
}
FAQs
Aserto single-page application JavaScript SDK
We found that @aserto/aserto-spa-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.