Skip to main content

Git Detected Dubious Ownership in Repository Error

· 6 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

The Git error message "detected dubious ownership in repository" is a modern security feature introduced in Git version 2.35.2 (and backported to several older versions) [1].

This error occurs when you attempt to run Git commands (like git status, git pull, or git commit) inside a repository whose files are owned by a different user ID (UID) than the one currently executing the Git command.

The primary purpose is to prevent privilege escalation or arbitrary code execution when working on shared systems or filesystems that allow one user to create a malicious .git/hooks file that another user (especially one with higher privileges) might unknowingly execute [2].

All Possible Ways to Remove Timezone Information from a Python `datetime` Object

· 7 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

A Python datetime object is considered timezone-aware if its tzinfo attribute is set, and timezone-naive if tzinfo is None. Removing timezone information, or "making it naive," is the process of setting this attribute to None.

The key consideration when stripping the timezone is which time value you want to keep: the time as it was originally represented, or the time converted to a standard reference (like UTC or local time) before stripping the timezone.

Poetry Fails to Install Multidict: Pyenv, Compilers, and Wheels

· 6 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

If your poetry install command is failing specifically when trying to install multidict (or packages that depend on it, like aiohttp or discord.py), the root cause is almost always a failure to compile the optional C extensions for the package.

Since multidict offers pre-compiled binaries (wheels) for standard Python versions on common operating systems, a compilation error indicates one of two things: the wheel is unavailable for your specific setup, or the local build tools are missing. Your use of pyenv often exacerbates the issue by complicating the environment setup.

Authorization in the App Layer: Using Casbin Flask Middleware

· 5 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

If your deployment environment doesn't support a service mesh like Envoy or an external authorization server (common in simpler, monolithic, or traditional hosting setups), you can certainly move the Casbin authorization check into your Flask application using middleware or decorators.

This approach centralizes authorization logic within the Python code, relying on dedicated extensions like flask-authz or Flask-Casbin.

SQLite Adapter for Casbin: Local Policy Storage Guide

· 5 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

Using SQLite as the database adapter for Casbin policy storage is the ideal solution for local development, unit testing, and small-scale applications due to its lightweight, file-based nature.

In the Python Casbin ecosystem, this is achieved using the casbin-sqlalchemy-adapter, as SQLAlchemy natively supports SQLite without needing separate driver installations [2].

Implement Casbin sidecar pattern

· 5 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

1. The Casbin Sidecar Pattern

A sidecar is a helper container that runs alongside your main application container (the Flask app) inside the same Kubernetes Pod [4]. The sidecar, in this case, is the Envoy Proxy, which intercepts all incoming and outgoing traffic for your Flask application.

Centralized Authorization on GCP: Casbin, Envoy, and API Gateway

· 8 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

Centralized Authorization on GCP: Casbin, Envoy, and API Gateway

Implementing authorization within a web application, especially in a microservices environment, can quickly lead to duplicated or inconsistent security logic. By leveraging the External Authorization Pattern using Envoy Proxy and Casbin, you can decouple security checks from your Flask application, making your architecture cleaner, more secure, and scalable.

This strategy is particularly effective on Google Cloud Platform (GCP) when using services like API Gateway or Cloud Endpoints as the entry point, and Firestore as the persistent policy backend.

Casbin Hierarchical RBAC Maintenance: Static Structure vs. Dynamic Roles

· 6 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

A common misconception about using Casbin Hierarchical RBAC is that the entire policy storage must be updated every time a user performs an action or changes state. This is incorrect. The system is designed to separate the static, structural hierarchy (which rarely changes) from the dynamic user assignments (which change frequently).

The efficiency of Hierarchical RBAC lies in this separation, minimizing the required policy updates and reducing redundancy.

Casbin RBAC vs. Casbin RBAC with Hierarchical Roles

· 7 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

The choice between standard Casbin RBAC (Role-Based Access Control) and Casbin RBAC with Hierarchical Roles largely depends on the complexity of your application's user structure and the need for role inheritance.

Both models use a similar policy structure in Casbin's configuration files (models and policies), but the hierarchical model provides a powerful shortcut for managing permissions in complex organizations.

Looking for more content?
Hrekov Blog contains 240 articles. Browse the blog archive or Explore the full timeline.