
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
pht-train-container-library
Advanced tools
Python library for validating and interacting with pht-train images/containers.
pip install pht-train-container-library
Make sure you have poetry and pre-commit installed.
Install the dependencies and pre-commit hooks:
poetry install --with dev
poetry run pre-commit install
poetry run pytest
These commands are also run as pre-commit hooks.
Linting with ruff:
poetry run ruff . --fix
Formatting with black:
poetry run black .
The pht security protocol adapted from docs/Secure_PHT_latest__official.pdf
performs two main tasks:
pre-run
.post-run
.To ensure the protocol is working correctly train docker images are required to keep the following structure:
/opt/train_config.json
: Stores the configuration file of the train./opt/pht_train/
: Stores all the files containing code or other things required for the train algorithm to run. The
contents of this directory can never change and is validated by the pre-run
step./opt/pht_results/
: Stores the results of the train. Which will be decrypted in the pre-run
step and encrypted in
the post-run
step.No files in the image outside the /opt/pht_results/
directory should change during the execution of the algorithm.
To use the protocol in your own python application, after installing the library
with pip install pht-train-container-library
an instance of the protocol can be to validate docker images as follows:
from train_lib.security.protocol import SecurityProtocol
from train_lib.docker_util.docker_ops import extract_train_config
image_name = '<image-repo>:<image-tag>'
station_id = '<station-id>'
# Get the train configuration from the image
config = extract_train_config(image_name)
# Initialize the protocol with the extracted config and station_id
protocol = SecurityProtocol(station_id=station_id, config=config)
# execute one of the protocol steps
protocol.pre_run_protocol(image_name, private_key_path='<path-to-private-key>')
# protocol.post_run_protocol(image_name, private_key_path='<path-to-private-key>')
A containerized version of the protocol is also available it can be used with the following command:
docker run -e STATION_ID=<station_id> -e PRIVATE_KEY_PATH=/opt/private_key.pem -v /var/run/docker.sock:/var/run/docker.sock -v <path_to_your_key>:/opt/private_key.pem ghcr.io/pht-medic/protocol <pre-run/post-run> <image-repo>:<image-tag>
STATION_ID
and PRIVATE_KEY_PATH
are required to be set in the environment variables. As well as passing the docker
socket /var/run/docker.sock
to the container as a volume to enable docker-in-docker functionality.
The pre-run protocol consists of the following steps
/opt/pht_results
are decrypted using the symmetric key obtained in the previous stepOnce these steps have been completed the image is ready to be executed.
PRIVATE_KEY_PATH
With the completion of these steps the train is ready to be pushed into the registry for further processing
Run the tests to validate the security protocol is working as intended. From this projects root directory run
pytest train_lib
FAQs
Python library for handling containerized PHT trains
We found that pht-train-container-library demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.