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.
keycloak-mock
Advanced tools
A minimal mock for a Keycloak server to be used in unit tests.
This does not launch an actual HTTP server. It uses nock
to patch Node.js HTTP client to intercept requests.
/auth/[realm]/protocol/openid-connect/certs
/auth/[realm]/protocol/openid-connect/userinfo
import * as KeycloakMock from "keycloak-node-mock";
const keycloak = await KeycloakMock.createMockInstance({
authServerURL: "https://myserver.com/auth",
realm: "myrealm",
clientID: "client-1",
});
// all requests to `https://myserver.com/auth` will now be
// intercepted and replied to
const mock = KeycloakMock.activateMock(keycloak);
// create a user and a token for it
const user = keycloak.database.createUser({ name: "test", email: "hello@hello.com" });
const token = keycloak.createBearerToken(user.sub);
// get active mock without a reference
const sameMock = KeycloakMock.getMock("https://myserver.com/auth");
// clear user database
mock.instance.database.clear();
// find user profile
const sameUser = mock.instance.database.findUserByID(user.sub);
// de-activate the mock
KeycloakMock.deactivateMock(sameMock);
import * as KeycloakMock from "keycloak-node-mock";
const keycloak = await KeycloakMock.createMockInstance({
authServerURL: "https://myserver.com/auth",
realm: "myrealm",
clientID: "client-1",
});
keycloak.activateMock(keycloak, {
listCertificatesView: (instance, request) => {
return Promise.resolve([500, ""]);
},
getUserInfoView: (instance, request) => {
return Promise.resolve([500, ""]);
},
})
FAQs
Keycloak server mock for Node.js
The npm package keycloak-mock receives a total of 350 weekly downloads. As such, keycloak-mock popularity was classified as not popular.
We found that keycloak-mock demonstrated a not healthy version release cadence and project activity because the last version was released 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.
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.