Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Inspired from the GitLab Triage Bot, this bot only use the GitLab API (BTA for Bot Triage Api). So there is some functionnality more difficult to do but other more simple.
Inspired from the GitLab Triage Bot, this bot only use the GitLab API. So there is some functionnality more difficult to do but other more simple.
If it is in the API you can use it.
To intall it, just run
npm install -g gitlab-bta
# gitlab-bta --help
gitlab-bta [command]
Commands:
gitlab-bta ./cli.js Make some automatic triage on issues and MR
Options:
--version Show version number [boolean]
--dry-run, -n Don't actually update anything, just print
[boolean] [default: false]
--host-url, -H A valid host url[string] [default: "https://gitlab.com/"]
--token, -t A valid API token [string] [required]
--source-id, -s GitLab project ID [string] [required]
--timeout, -T API call timeout (ms) [number] [default: 10000]
--policies-file, -f A valid policies JS file
[string] [default: "../policies.js"]
--help, -h Show help [boolean]
In your gitlab-ci.yml file you can add jobs like this:
stages:
- triage
.triage:
image: node:8
stage: triage
before_script:
- npm install -g gitlab-bta
- gitlab-bta --version
- gitlab-bta --help
dry-run:
extends: .triage
script:
- gitlab-bta --dry-run --host-url="http://gitlab.subdomain.fr" --token $API_TOKEN --source-id="1" --policies-file ./triage-policies.js
when: manual
run:
extends: .triage
script:
- gitlab-bta --host-url="http://gitlab.subdomain.fr" --token $API_TOKEN --source-id="1" --policies-file ./triage-policies.js
only:
- schedules
Each rule is defined in a policies.js file. Written in JS, it allows you to make some computed properties.
module.exports = {
resource_rules: {
merge_requests: {
rules: [{
name: "No Bug label",
conditions: {
state: "opened",
},
filters: [{
name: "No Bug label",
filter: function (resource) {
return !resource.labels.includes("Bug");
},
}],
actions: [{
name: "label",
value: "Status: to complete",
},{
name: "comment",
value: "Hey @{{author.username}}, there is a problem here!",
}],
}],
},
},
};
You can define a name for each rule making more obvious what the rule do.
Conditions are the parameters used to search in the GitLab API :
conditions: {
state: "opened", // will get only resources opened
labels: "none", // without any label
},
If you need to use information that are only return with the resource detail endpoint (/api/v4/projects/1/issues/1
for example), add additionnal_infos: true
to the rule.
When this parameter is present, the GitLab BTA will get all the resources by calling the detail endpoint for each resource found with the passed conditions.
Then you will be able to use some additional information like diverged_commits_count
in the filter and actions parts.
Be aware that the rule treatment will take more longer as it call the API for each founded resources.
name: "Too diverged",
additionnal_infos: true,
conditions: {
state: "opened",
wip: "no",
include_diverged_commits_count: true, // this parameter will only be used for the detail API call
},
filters: [{
name: "Too diverged",
filter: function (resource) {
return resource.diverged_commits_count < 50;
},
}],
actions: [{
name: "thread",
value: `{{source_branch}} is too far from {{target_branch}} ({{diverged_commits_count}} commits).`,
}
You can add somme additional filters, impossible to do with the API. Those are function taking a resource as input and returning true to keep it or false to filter it.
filters: [{
name: "Already pointed",
filter: function (resource) {
return !resource.labels.includes("Status: Stale");
},
}],
In actions part, you can define some actions to do.
Add a label to the resource.
actions: [{
name: "label",
value: "Status: Stale",
}],
Remove a label from a resource.
actions: [{
name: "unlabel",
value: "Status: Stale",
}],
Add a comment to a resource. You can use the quick actions (like /cc
). You can use the resource data in the comment with mustache.
actions: [{
name: "comment",
value: `Hey @{{author.username}}, there is a problem here!`,
}],
Add a thread (or discussion) to a resource. Adding a thread to an MR can block it if you configured your project like this. You can use the resource data in the thread with mustache.
actions: [{
name: "thread",
value: `Hey @{{author.username}}, there is a problem here!`,
}],
Update a resource. You can update all the data available in the PUT endpoint for that resource (doc for issues and doc for MRs).
actions: [{
name: "update",
value: {
title: "New title",
},
}],
Close a resource
actions: [{
name: "close",
}],
FAQs
Inspired from the GitLab Triage Bot, this bot only use the GitLab API (BTA for Bot Triage Api). So there is some functionnality more difficult to do but other more simple.
We found that gitlab-bta 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.