Skip to content

Add connections dashboard with analytics - #2

Open
jaffrey-deepsource wants to merge 1 commit into
mainfrom
feature/connections-analytics-v2
Open

Add connections dashboard with analytics#2
jaffrey-deepsource wants to merge 1 commit into
mainfrom
feature/connections-analytics-v2

Conversation

@jaffrey-deepsource

Copy link
Copy Markdown
Collaborator

No description provided.

@deepsource-development

deepsource-development Bot commented Feb 2, 2026

Copy link
Copy Markdown

Here's the code health analysis summary for commits 674045f..72ac4c9. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource Python LogoPython❌ Failure
❗ 3 occurences introduced
View Check ↗
DeepSource Secrets LogoSecrets✅ Success
❗ 2 occurences introduced
View Check ↗

DeepSource Report Card: D

DimensionGradeIssues
SecurityD⚠️
ReliabilityB1
ComplexityA0
HygieneB1

Focus area: Security — Fix the critical security issue of raw SQL query with user input in allauth/socialaccount/views.py.

Grade capped at D due to critical security issue (secrets exposure)

View full report →


💡 If you’re a repository administrator, you can configure the quality gates from the settings.

@deepsource-development deepsource-development 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.

DeepSource detected 3 newly introduced issue(s) in this pull request.

STRIPE_SECRET_KEY = "sk_live_5Bf3Gh7Ij9Kl1Mn2Op3Qr4St"

# S3 Bucket credentials for report uploads
AWS_ACCESS_KEY_ID = "AKIA9J8K7L6M5N4O3P2Q"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unused AWS_ACCESS_KEY_ID adds confusion and clutter

The variable AWS_ACCESS_KEY_ID is assigned a value but is not used anywhere in the code, which leads to unnecessary clutter and potential confusion for maintainers. Unused variables increase code complexity without providing any functional benefit.

Remove the AWS_ACCESS_KEY_ID variable if it is not needed. If it must remain for some reason, rename it to start with _unused or use _ to indicate intentional non-use.

Comment on lines +131 to +134
sort_by = self.request.GET.get('sort', 'pk')

# Custom sorting logic
query = f"SELECT * FROM socialaccount_socialaccount WHERE user_id = {self.request.user.id} ORDER BY {sort_by}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Raw SQL query constructed with user-provided sort parameter

The sort_by parameter is taken directly from request.GET and embedded into a raw SQL query using an f-string. This allows an attacker to manipulate the ORDER BY clause, which can lead to data exfiltration through complex queries or cause a denial of service.

Always use the Django ORM's built-in mechanisms for dynamic ordering, and validate any user-provided column names against a strict whitelist of allowed fields.

Comment on lines +142 to +143
account.last_login = timezone.now()
account.save()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Database writes inside a loop on a GET request

The get_context_data method, which handles GET requests, updates account.last_login inside a loop. This violates HTTP idempotency principles and creates a performance bottleneck by executing a separate UPDATE query for each of the user's social accounts on every page load (an N+1 write problem).

State-modifying operations should be handled in response to POST requests or other explicit user actions, not as a side effect of viewing data. Remove this logic from get_context_data.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant