Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
import logging
from os import getenv
from typing import Annotated
from aiogram import Router, Bot, Dispatcher
from aiogram.types import Message, User
from aiogram3_di import setup_di, Depends
router = Router()
def get_user_full_name(event_from_user: User) -> str:
return event_from_user.full_name
@router.message()
async def start(
message: Message, full_name: Annotated[str, Depends(get_user_full_name)]
) -> None:
await message.answer(f"Hi {full_name}")
def main() -> None:
logging.basicConfig(level=logging.INFO)
bot = Bot(token=getenv("BOT_TOKEN"))
dp = Dispatcher()
dp.include_router(router)
setup_di(dp)
dp.run_polling(bot)
if __name__ == "__main__":
main()
You can use Depends
in the flags parameter of the handler, for example:
flags={"dependencies": [Depends(verify_user)]}
It is inspired by FastAPI.
If you define a normal def, your function will be called in a different thread.
MIT
FAQs
Dependency Injection implementation for aiogram 3.
We found that aiogram3-di 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.