-
-
Notifications
You must be signed in to change notification settings - Fork 313
Security Dashboard (Phase 1 Implementation) #5113
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
Merged
Merged
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
a923c30
added cyber security dashboard (phase 1)
Nachiket-Roy d645275
added cyber security dashboard (phase 1)
Nachiket-Roy b680ad3
chore : ordering wth rank
Nachiket-Roy 9163939
chore : harden csv export
Nachiket-Roy 13a2193
chore : csv harden refined
Nachiket-Roy d79e840
conflicting migration resolved
Nachiket-Roy 6ed2d0f
reviewer leaderboard logic fixed
Nachiket-Roy 27ec274
Added indexes and automatic timestamp management
Nachiket-Roy d7b6a01
prevent csv injection, added logger and rate-limit
Nachiket-Roy d604818
rate limit fixed
Nachiket-Roy 5fa95d0
NameError fixed
Nachiket-Roy b1c8522
removed sort logic
Nachiket-Roy 822a9b1
contributor counted and bot excluded
Nachiket-Roy f30681e
Hardcoded label resolved
Nachiket-Roy ca007f1
updated permission class
Nachiket-Roy e1baecc
security label enforced
Nachiket-Roy b80a9b6
response improved
Nachiket-Roy bca77cf
migration conflict resolved
Nachiket-Roy bd9bf73
migration conflict resolved
Nachiket-Roy 2fcbf6c
merge conflict resolved
Nachiket-Roy afd9c3e
chore : security issues fixed
Nachiket-Roy 65c6e48
NameError fixed
Nachiket-Roy e27c722
pre-commit fixed
Nachiket-Roy de1ceb2
fresh migration created
Nachiket-Roy f9fee98
race condition and authorization fixed
Nachiket-Roy 9114d31
dead code removed
Nachiket-Roy b59c403
af75d72
csv sanitization
Nachiket-Roy b194086
csv export filter resolved
Nachiket-Roy c7691d3
removed hardcoded label
Nachiket-Roy 587f138
fixed form validation
Nachiket-Roy cf0d561
nitpick solved
Nachiket-Roy 2f1bdba
chore: nitpick resolved
Nachiket-Roy 3f4ce1e
migration updated
Nachiket-Roy 4978fd4
signal register
Nachiket-Roy 7fb59d9
from Middleware → Thread-local → Signal → History creation to View → …
Nachiket-Roy c34ad20
Merge branch 'main' into feature/dashboard
Nachiket-Roy 4b00b99
import fixed
Nachiket-Roy 9cbd4b3
migration corrected
Nachiket-Roy 2daf854
duplicate securityincidentview resolved
Nachiket-Roy 6df63ed
added missing description field
Nachiket-Roy a0e7523
nitpick
Nachiket-Roy 824f22f
nitpick
Nachiket-Roy ad2b487
nitpick
Nachiket-Roy 9d9251f
corrected incident_form
Nachiket-Roy 67be17c
dead code removed
Nachiket-Roy 3199439
template error fixed
Nachiket-Roy 72bcf59
added missing import
Nachiket-Roy 4bb6590
wire up history
Nachiket-Roy 5e4ccd7
nitpick
Nachiket-Roy 65df06f
fix : Export fails: missing
Nachiket-Roy 6fdf411
handle error gracefully
Nachiket-Roy fd26bdd
fixed js broken syntax
Nachiket-Roy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
104 changes: 104 additions & 0 deletions
104
website/migrations/0262_securityincident_securityincidenthistory_and_more.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| # Generated by Django 5.2.9 on 2025-12-13 12:33 | ||
|
|
||
| import django.db.models.deletion | ||
| from django.conf import settings | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("website", "0261_add_connected_action_type"), | ||
| migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name="SecurityIncident", | ||
| fields=[ | ||
| ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
| ("title", models.CharField(max_length=255)), | ||
| ( | ||
| "severity", | ||
| models.CharField( | ||
| choices=[("low", "Low"), ("medium", "Medium"), ("high", "High"), ("critical", "Critical")], | ||
| default="medium", | ||
| max_length=20, | ||
| ), | ||
| ), | ||
| ( | ||
| "status", | ||
| models.CharField( | ||
| choices=[("open", "Open"), ("investigating", "Investigating"), ("resolved", "Resolved")], | ||
| default="open", | ||
| max_length=20, | ||
| ), | ||
| ), | ||
| ("affected_systems", models.TextField(blank=True)), | ||
| ("description", models.TextField(blank=True, help_text="Detailed description of the incident")), | ||
| ("created_at", models.DateTimeField(auto_now_add=True)), | ||
| ("resolved_at", models.DateTimeField(blank=True, null=True)), | ||
| ], | ||
| options={ | ||
| "ordering": ["-created_at"], | ||
| }, | ||
| ), | ||
| migrations.CreateModel( | ||
| name="SecurityIncidentHistory", | ||
| fields=[ | ||
| ("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
| ("field_name", models.CharField(max_length=100)), | ||
| ("old_value", models.TextField(blank=True, null=True)), | ||
| ("new_value", models.TextField(blank=True, null=True)), | ||
| ("changed_at", models.DateTimeField(auto_now_add=True)), | ||
| ], | ||
| options={ | ||
| "ordering": ["-changed_at"], | ||
| }, | ||
| ), | ||
| migrations.RenameIndex( | ||
| model_name="socialaccountreward", | ||
| new_name="website_soc_user_id_fb0840_idx", | ||
| old_name="website_soc_user_id_provid_idx", | ||
| ), | ||
| migrations.AddField( | ||
| model_name="securityincident", | ||
| name="reporter", | ||
| field=models.ForeignKey( | ||
| blank=True, | ||
| null=True, | ||
| on_delete=django.db.models.deletion.SET_NULL, | ||
| related_name="reported_incidents", | ||
| to=settings.AUTH_USER_MODEL, | ||
| ), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="securityincidenthistory", | ||
| name="changed_by", | ||
| field=models.ForeignKey( | ||
| blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL | ||
| ), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="securityincidenthistory", | ||
| name="incident", | ||
| field=models.ForeignKey( | ||
| on_delete=django.db.models.deletion.CASCADE, related_name="history", to="website.securityincident" | ||
| ), | ||
| ), | ||
| migrations.AddIndex( | ||
| model_name="securityincident", | ||
| index=models.Index(fields=["severity"], name="incident_severity_idx"), | ||
| ), | ||
| migrations.AddIndex( | ||
| model_name="securityincident", | ||
| index=models.Index(fields=["status"], name="incident_status_idx"), | ||
| ), | ||
| migrations.AddIndex( | ||
| model_name="securityincident", | ||
| index=models.Index(fields=["-created_at"], name="incident_created_idx"), | ||
| ), | ||
| migrations.AddIndex( | ||
| model_name="securityincidenthistory", | ||
| index=models.Index(fields=["incident", "-changed_at"], name="history_incident_changedat_idx"), | ||
| ), | ||
| ] |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| from django import forms | ||
|
|
||
| from website.models import SecurityIncident | ||
|
|
||
|
|
||
| class SecurityIncidentForm(forms.ModelForm): | ||
| class Meta: | ||
| model = SecurityIncident | ||
| fields = [ | ||
| "title", | ||
| "severity", | ||
| "status", | ||
| "affected_systems", | ||
| "description", | ||
| ] | ||
|
|
||
| widgets = { | ||
| "title": forms.TextInput( | ||
| attrs={ | ||
| "class": "form-control", | ||
| "placeholder": "Enter incident title", | ||
| } | ||
| ), | ||
| "severity": forms.Select(attrs={"class": "form-select"}), | ||
| "status": forms.Select(attrs={"class": "form-select"}), | ||
| "affected_systems": forms.Textarea( | ||
| attrs={ | ||
| "class": "form-control", | ||
| "placeholder": "List affected systems (comma-separated)", | ||
| "rows": 4, | ||
| } | ||
| ), | ||
| "description": forms.Textarea( | ||
| attrs={ | ||
| "class": "form-control", | ||
| "placeholder": "Detailed description of the incident", | ||
| "rows": 6, | ||
| } | ||
| ), | ||
| } | ||
|
|
||
| def clean_affected_systems(self): | ||
| """Normalize comma-separated affected_systems (strip items, drop empties).""" | ||
| raw = self.cleaned_data.get("affected_systems", "") or "" | ||
| parts = [p.strip() for p in raw.split(",")] | ||
| normalized = ", ".join(p for p in parts if p) | ||
| return normalized |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.