
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
PyGating is a small but simple python library that enables you to quickly introduce a/b testing, control code flow, and introduce control switches to your codebase that can be controlled via both code and json-based configs.
PyGating supports entity-based checks, allowing you to define in the gating configuration exactly the properties, functions, and/or keys the gate will check based on a entity you will pass in at check time.
Check out the respository here for more information and documentation
DateGate
, PercentageGate
, RandomGate
, InclusionGate
, and more.This example will only permit 10% of entities/code invocations to continue.
We can use either a RandomGate for pure 10% random chance or a PercentageGate for a consistant result based on the passed entity
from pygating import PyGating
from pygating.gating_configurations import GatingConfigurationAll
from pygating.gates import PercentageGate
PyGating.init() # only needs to be done once in the application
Code-based config
gate_config = GatingConfigurationAll(
fail_closed=True, #if an exception is thrown, the gate check returns False
gates=[
PercentageGate(percentage=10, allow=True, entity_property="id") # 10% of entities passed into the gate check will pass based on their id field
]
)
Json-based config
gate_config = {
"type": "GatingConfigurationAll",
"fail_closed": true,
"gates": [
{
"type": "PercentageGate",
"percentage": 10.0,
"allow": true,
"entity_property": "id"
}
]
}
class Entity:
def __init__(self, id: str):
self.id = id
example_entity = Entity(id="dfa2oi1nrffvnoivwe")
if PyGating.check_gating(gate_config, entity=entity):
print("Gate passed!") # Will pass for 10% of entity ids, and will be consistent for the same ids
else:
print("Gate Failed")
pip install pygating
FAQs
A small package for creating and using configurations to control code flow
We found that pygating demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.