
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@dathuis/gitlab-pipeline-locks
Advanced tools
By default Gitlab enables a setting that merges pipelines together if one is pushed shortly after another. This needs to be disabled. To disable go to Project > Settings > CI / CD Settings. Expand "General Pipelines" and uncheck the box that says Auto-cancel redundant, pending pipelines
Environment variables need to be set for the gitlab runners so that the BBDM endpoint and API key are accessible.
Two environment variables need to be set:
These can be set by going to the Gitlab project > Settings > CI / CD Settings > Environment Variables.
The Gitlab runners need to use a docker image that has some scripts globally accessible. The DockerFile needs the following:
RUN npm install -g @dathuis/gitlab-pipeline-locks
A few extra pipeline jobs need to be added in the .gitlab-ci for this to work, these need to be added for each stage. This includes a new stage named registerDeploy which includes two jobs: registerDeploy and startDeploy. The name of each of these should be prefixed with the stage name. The next stage should contain one automatic job called deploy.
Each of these need to have the stage as a postfix. For example, if my stage name is Beta, I will have the following setup:
An environment variable called STAGE_NAME also needs to be accessible inside of the runner for each of these. In the example above each of the jobs needs STAGE_NAME=beta.
These should only run for the master branch, for this include:
only:
- master
To include more stages, include the same jobs and stages as above for another stage and replace Beta with the name of that stage.
Some scripts need to be utilized inside of these jobs.
This should be called as the only script inside of the registerDeploy job.
gitlab-pipeline-register-deploy
This should be run as the last script in your deploy job. It sets the deployment status to complete and unlocks the stage for any incoming deployments.
gitlab-pipeline-complete-deploy
The teardown script is optional, but useful depending on your setup. Our setup includes one pipeline stage that sets up an AWS stack and tests it. The next stage cleans up this AWS stack and always runs, regardless of failures. There is a problem when the deploy and test jobs fail and we want to restart the pipeline.
When restarting a pipeline only the failed jobs run, so the stack may be setup again and tests run again, but the teardown script does not run again. If you use this as the last script in the teardown stage it will check if the job before it in the pipeline succeeded or failed. If the job before failed, the teardown script will fail as well. This way if the pipeline is restarted, the teardown will always run again.
gitlab-pipeline-teardown
This service enables some assumptions:
It does this by maintaining a dynamo table of statuses to manage the current status for each region in each project.
The registerDeploy Gitlab job makes a request to this service including the stage, project and commit ID. If this commit is next in line the service will start the manual startDeploy job which will unblock the pipeline and continue to the Deploy stage. If it is not next in line, it will not unblock, but the service will add any parent commits to a queue to ensure that it will be unblocked later once on of the parents have completed deploying.
If there are any problems and the current state of a project and stage needs to be overwritten, you can manually click start on the startDeploy job. The status of the stage will be reset after the deploy completes successfully.
In order for BBDM to work it needs to be able to call the Gitlab API for the gitlab endpoing that you use. This needs to be used as an environment variable when deploying the serverless stack. To do this go to your Gitlab settings page then Access Tokens. From thisp age you can create a Personal Access Token. Cereate one and then save the API key somewhere for use later.
To deploy, clone the repository then run the following command:
GITLAB_URL=<GITLAB URL SUCH AS https://gitlab.dathuis.nl> GITLAB_API_KEY=<API KEY FROM PERSONAL TOKEN> sls deploy
FAQs
Utilities for adding locks to gitlab pipelines
We found that @dathuis/gitlab-pipeline-locks 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 researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.