Skip to content

Fix sign check by verifying timestamp #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ async def access_log_middleware(request: fastapi.Request, call_next):

def get_cluster_from_sign(hash: str, s: str, e: str) -> Optional[str]:
for cluster in clusters.clusters:
if check_sign_without_time(hash, cluster._token._secret, s, e):
if check_sign(hash, cluster._token._secret, s, e):
Copy link
Preview

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The timestamp validation logic in check_sign uses time.time() - 300 < int(e, 36) which could allow future timestamps to be valid. Consider using abs(time.time() - int(e, 36)) < 300 to reject both old and future timestamps, or add an explicit check that int(e, 36) <= time.time() to prevent acceptance of future-dated signatures.

Copilot uses AI. Check for mistakes.

return cluster.id
return None

Expand Down