You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: count only commits visible to the link viewer - #1416
Link statistics could count commits that are not visible in the feed, making the totals disagree with the content shown to the viewer.
Change
Applies the same visibility rules to the statistics query as the visible commit list, including approval and blocked-author filtering.
Tests
Focused link controller tests passed (7 tests, 98 assertions). Type checks and lint passed.
Summary by CodeRabbit
Bug Fixes
Link-page commit totals now reflect commits visible to the current viewer, including the viewer’s own pending commits and commits from organizations they belong to. Commits from blocked users and unrelated pending commits remain excluded.
The contributor count reflects the distinct people who authored visible commits, keeping both displayed totals consistent with the commits available to that viewer.
No actionable comments were generated in the recent review.
Walkthrough
Link statistics now use the current user’s commit visibility. The controller passes that user to the stats query. The feature test covers visible commits, including organization commits, and confirms that blocked-user commits and unrelated pending commits remain excluded.
Changes: Link statistics
Layer / File(s)
Summary
Calculate and verify visible commit statistics app/Queries/LinkCommitsQuery.php, app/Http/Controllers/LinkController.php, tests/Feature/Controllers/LinkControllerTest.php
The stats query accepts a user and counts commits visible to that user. The controller passes the current user. The test expects four visible commits by three people and checks excluded commits.
dev-null-sh/dev-null.sh#1134: Introduced LinkController::index and LinkCommitsQuery::stats, whose stats contract this change updates.
dev-null-sh/dev-null.sh#1348: Changed the commit author relation used by the link query and exercised by the organization-commit test.
dev-null-sh/dev-null.sh#1359: Added organization-authored commit visibility that this change uses for link statistics.
Suggested reviewers:mnapoli
Merge Risk: Minimal · up to e0488
The change consistently scopes link statistics to commits visible to the current viewer.
Security architecture risk: Low · up to e0488
The change correctly aligns commit counts with the viewer’s access. However, counting distinct posting accounts can expose information that the displayed organization author intentionally hides. Extending that count to pending or rejected organization posts creates a limited identity-inference risk for other organization members.
Retained concerns
Medium · security · inferred: The viewer-scoped people aggregate extends a hidden-poster identity oracle to pending and rejected organization posts. A non-moderator organization member viewing a link containing one such post and one approved personal post from a known account can distinguish whether their posting accounts match: people is one if they match and two otherwise. The cards conceal the organization poster, but the aggregate uses that protected identity. Approved-post inference predates this PR; inclusion of non-approved organization posts is the newly expanded exposure.
Security review details
Security Blast Radius
inferred — The newly expanded attribution exposure is bounded to authenticated viewers who can see non-approved organization commits through membership. Exploitation requires a suitable link-level set and known posting identities for comparison. It reveals identity equality or attribution through cardinality, not raw account identifiers or unrestricted access to unrelated pending content.
Security Findings and Attack Paths
inferred — For a link with a known person’s approved personal post and one pending organization post, a member can infer whether that person also posted for the organization from whether people equals one or two. Base statistics ignored the pending post; head statistics include it. The same class of aggregate inference for approved organization posts already existed and is not attributed to this PR.
Trust Boundaries and Controls
observed — The route remains authenticated and the viewer comes from CurrentUser. Both list and aggregate enforce the same link and visibility filters. Normal card serialization preserves the model’s hidden posting-account fields; therefore the concern is aggregate inference across an attribute-level privacy boundary, not viewer impersonation or a direct content-authorization bypass.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title states the main change: link statistics now count only commits visible to the link viewer. The raw summary confirms LinkCommitsQuery::stats now takes a User and counts commits visible to tha…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title states the main change: link statistics now count only commits visible to the link viewer. The raw summary confirms LinkCommitsQuery::stats now takes a User and counts commits visible to that user instead of approved commits, and LinkController passes the current user. The PR objectives describe the same goal, aligning statistics with the visible commit list. The title follows the conventional commit style and is specific enough for a teammate scanning history.
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 3 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: fe2547d1-6560-42c3-abb3-bf99beb0e035
Commits
Reviewing files that changed from the base of the PR and between 7166270 and e0488a7.
Files selected for processing: 1
app/Http/Controllers/LinkController.php
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Link statistics could count commits that are not visible in the feed, making the totals disagree with the content shown to the viewer.
Change
Applies the same visibility rules to the statistics query as the visible commit list, including approval and blocked-author filtering.
Tests
Focused link controller tests passed (7 tests, 98 assertions). Type checks and lint passed.
Summary by CodeRabbit