Skip to content

Anonymous: Add configurable device limit - #10

Closed
akshayutture-augment wants to merge 1 commit into
enhance-anonymous-accessfrom
implement-device-limits
Closed

Anonymous: Add configurable device limit#10
akshayutture-augment wants to merge 1 commit into
enhance-anonymous-accessfrom
implement-device-limits

Conversation

@akshayutture-augment

@akshayutture-augment akshayutture-augment commented Nov 17, 2025

Copy link
Copy Markdown

No description provided.

* Anonymous: Add device limiter

* break auth if limit reached

* fix typo

* refactored const to make it clearer with expiration

* anon device limit for config

---------

Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. 1 suggestion posted.

Comment augment review to trigger a new review at any time.


// if device limit is reached, only update devices
if s.deviceLimit > 0 {
count, err := s.CountDevices(ctx, time.Now().UTC().Add(-anonymousDeviceExpiration), time.Now().UTC().Add(time.Minute))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This pre-insert check CountDevices introduces a race: concurrent calls could both see count < deviceLimit and insert new devices, exceeding the limit (also applies across instances). Consider making the limit enforcement atomic with the write path to avoid TOCTOU issues.

🤖 Was this useful? React with 👍 or 👎

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 2 weeks if no further activity occurs. Please feel free to give a status update or ping for review. Thank you for your contributions!

@github-actions github-actions Bot added the stale label Dec 18, 2025
@github-actions

github-actions Bot commented Jan 1, 2026

Copy link
Copy Markdown

This pull request has been automatically closed because it has not had any further activity in the last 2 weeks. Thank you for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants