Merge fix/security-audit: RBAC/API-key-hash/cookie hardening
This commit is contained in:
@@ -7,7 +7,10 @@ class APIKey(Base):
|
||||
__tablename__ = "api_keys"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
key = Column(String(64), unique=True, nullable=False, index=True)
|
||||
# The raw key is never stored — only its SHA-256 hash. `key_prefix` holds
|
||||
# the first few chars for human-readable display/masking in listings.
|
||||
key_hash = Column(String(64), unique=True, nullable=False, index=True)
|
||||
key_prefix = Column(String(16), nullable=True)
|
||||
name = Column(String(100), nullable=False) # e.g. "agent-zhi", "agent-lyn"
|
||||
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
||||
is_active = Column(Boolean, default=True)
|
||||
|
||||
Reference in New Issue
Block a user