![Malicious npm Package Typosquats react-login-page to Deploy Keylogger](https://cdn.sanity.io/images/cgdhsj6q/production/007b21d9cf9e03ae0bb3f577d1bd59b9d715645a-1024x1024.webp?w=400&fit=max&auto=format)
Research
Security News
Malicious npm Package Typosquats react-login-page to Deploy Keylogger
Socket researchers unpack a typosquatting package with malicious code that logs keystrokes and exfiltrates sensitive data to a remote server.
google-admin-sdk
Advanced tools
Readme
node.js library that wraps Google's Admin SDK. A subset of CRUD actions in the Directory API are supported.
The library includes 4 submodules:
OrgUnitProvisioning
for CRUD operations on OrgUnitsUserProvisioning
for CRUD operations on Google Apps usersGroupProvisioning
for CRUD operations on GroupsBatch
for batching requestsTo use the library, you must have your Google credentials in the form
opts = {
client: {
id: '12345.apps.googleusercontent.com',
secret: 'abcdefgh'
},
token: {
refresh: 'your_refresh_token'
}
};
The library is designed such that you can initialize and use any submodule independently of the other three. Any or all submodules can be initialized using the credentials above:
admin_sdk = require('google-admin-sdk');
user_provisioning = new admin_sdk.UserProvisioning(opts);
new_user = {
name: {
givenName: 'Grace',
familyName: 'Hopper',
},
password: 'password1234',
primaryEmail: 'grace.hopper@example.com'
fields: "kind,nextPageToken,users(id,kind,name,orgUnitPath,primaryEmail)"
};
user_provisioning.insert(new_user, function(err, body) {
console.log("Received response: " + body);
});
Note: it is recommended to use Google's fields editor to construct queries with fields
arguments.
new_user = {
name: {
givenName: 'Grace',
familyName: 'Hopper',
},
password: 'password1234',
primaryEmail: 'grace.hopper@example.com'
};
query = user_provisioning.insert(new_usery);
query.exec(function(err, body){
// Handle error and body
});
## OrgUnitProvisioning
The following provide functionality for querying the orgunits endpoint of the Directory API. For information on constructing queries and parsing responses, see the [official documentation](https://developers.google.com/admin-sdk/directory/v1/reference/orgunits).
### OrgUnitProvisioning.findOrCreate(customer_id, org_unit[, cache, callback])
Creates an OrgUnit and any of its parents that need to be created. Accepts arguments:
* `customer_id`: your Google customer id.
* `org_unit`: an array of the form that specifies the path of the OrgUnit to create. For example, to create the OrgUnit "/Users/Admins/SuperAdmins", pass in `['Users', 'Admins', 'SuperAdmins'].
* `cache` (optional): a map of strings representing OrgUnits that are known to exist. For example, `{'/': 1, 'Users':1, 'Admins':1}
* `callback` (optional): function of the form `callback(error, body)` to call when the response is received.
Note that findOrCreate
uses async.memoize
. This can cause problems with tests that expect a fresh state at the beginning of each test. You can use async.unmemoize
to reset state.
Creates an OrgUnit. Accepts arguments:
customer_id
: your Google customer id.properties
: an object that specifies the name of the OrgUnit to create. Uses the form { name: 'X', parent: 'Y' }
. Note that the parent must already exist; to deep create an OrgUnit, use OrgUnitProvisioning.findOrCreate
.fields
(optional): fields to return in the response.callback
(optional): function of the form callback(error, body)
to call when the response is received.Lists OrgUnits owned by a customer. Accepts arguments:
customer_id
: your Google customer id.params
(optional): object containing querystring arguments.callback
(optional): function of the form callback(error, body)
to call when the response is received.Gets a single OrgUnit owned by a customer. Accepts arguments:
customer_id
: your Google customer id.org_unit_path
: String representation of the OrgUnit to find.callback
(optional): function of the form callback(error, body)
to call when the response is received.Updates an OrgUnit using patch semantics. Accepts arguments:
customer_id
: your Google customer id.org_unit_path
: the full OrgUnit path to update.body
(optional): object containing the fields to update on the OrgUnit and their new values.fields
(optional): fields to return in the response.callback
(optional): function of the form callback(error, body)
to call when the response is received.Deletes an OrgUnit. Accepts arguments:
customer_id
: your Google customer id.org_unit_path
: String representation of the OrgUnit to delete.callback
(optional): function of the form callback(error, body)
to call when the response is received.Gets information for a single user. Accepts arguments:
userkey
: the unique userkey of the user to find.callback
(optional): function of the form callback(error, body)
to call when the response is received.Lists Google Apps users. Accepts arguments:
params
: user fields to query bycallback
(optional): function of the form callback(error, body)
to call when the response is received.// Get at most 200 users in the domain `example.com`
params = {
domain: 'example.com',
max_results: 200
};
user_provisioning.list(params, function(err, body) {
// Handle error and do something with users
});
Updates a user using patch semantics. Accepts arguments:
userkey
: the unique userkey of the user to update.body
: object containing fields to update on the user and their new values.fields
(optional): fields to return in the response.callback
(optional): function of the form callback(error, body)
to call when the response is received.Same as patch
, but updates a user without using patch semantics.
Deletes a user. Accepts arguments:
userkey
: the unique userkey of the user to delete.callback
(optional): function of the form callback(error, body)
to call when the response is received. queries = [];
user1_properties = {
name: { familyName: 'Parr', givenName: 'Bob' },
password: 'password12345',
primaryEmail: 'bob@example.com'
};
user2_properties = {
name: { familyName: 'Huph', givenName: 'Gilbert' },
password: 'password12345',
primaryEmail: 'gilbert@example.com'
};
queries.push(UserProvisioning.insert(user1_properties));
queries.push(UserProvisioning.insert(user2_properties));
Batch.go(queries, function(error, results){
// Handle error and parse results
});
FAQs
Unknown package
We found that google-admin-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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 researchers unpack a typosquatting package with malicious code that logs keystrokes and exfiltrates sensitive data to a remote server.
Security News
The JavaScript community has launched the e18e initiative to improve ecosystem performance by cleaning up dependency trees, speeding up critical parts of the ecosystem, and documenting lighter alternatives to established tools.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.