|
1 | 1 | ## Authentication Examples |
2 | 2 |
|
3 | | -### Recent Login Attempts |
4 | | - |
5 | | -Track recent login attempts to monitor account access patterns. |
6 | | - |
7 | | -```sql |
8 | | -select |
9 | | - timestamp, |
10 | | - action, |
11 | | - actor, |
12 | | - tp_source_ip, |
13 | | - user_agent |
14 | | -from |
15 | | - github_security_log |
16 | | -where |
17 | | - action like '%login%' |
18 | | -order by |
19 | | - timestamp desc |
20 | | -limit 20; |
21 | | -``` |
22 | | - |
23 | | -```yaml |
24 | | -folder: Authentication |
25 | | -``` |
26 | | -
|
27 | 3 | ### Failed Login Attempts |
28 | 4 |
|
29 | 5 | Identify failed login attempts that might indicate security threats. |
@@ -547,31 +523,6 @@ order by |
547 | 523 | folder: Security Analysis |
548 | 524 | ``` |
549 | 525 |
|
550 | | -### Geographic Anomalies |
551 | | -
|
552 | | -Detect rapid geographic changes in access patterns (when location data is available). |
553 | | -
|
554 | | -```sql |
555 | | -select |
556 | | - timestamp, |
557 | | - actor, |
558 | | - tp_source_ip, |
559 | | - action, |
560 | | - lag(tp_source_ip) over (partition by actor order by timestamp) as previous_ip, |
561 | | - lag(timestamp) over (partition by actor order by timestamp) as previous_timestamp |
562 | | -from |
563 | | - github_security_log |
564 | | -where |
565 | | - actor is not null |
566 | | - and timestamp >= current_timestamp - interval '24 hours' |
567 | | -order by |
568 | | - actor, timestamp; |
569 | | -``` |
570 | | - |
571 | | -```yaml |
572 | | -folder: Security Analysis |
573 | | -``` |
574 | | -
|
575 | 526 | ## Operational Monitoring |
576 | 527 |
|
577 | 528 | ### Daily Security Event Trends |
@@ -813,31 +764,6 @@ folder: Environment Security |
813 | 764 |
|
814 | 765 | ## Repository Access Analysis |
815 | 766 |
|
816 | | -### Multi-Repository Token Analysis |
817 | | -
|
818 | | -Analyze tokens with access to multiple repositories. |
819 | | -
|
820 | | -```sql |
821 | | -select |
822 | | - timestamp, |
823 | | - action, |
824 | | - actor, |
825 | | - cardinality(repositories) as repo_count, |
826 | | - repositories, |
827 | | - repository_selection |
828 | | -from |
829 | | - github_security_log |
830 | | -where |
831 | | - repositories is not null |
832 | | - and cardinality(repositories) > 1 |
833 | | -order by |
834 | | - repo_count desc, timestamp desc; |
835 | | -``` |
836 | | - |
837 | | -```yaml |
838 | | -folder: Repository Security |
839 | | -``` |
840 | | -
|
841 | 767 | ### Repository Access Patterns |
842 | 768 |
|
843 | 769 | Track which repositories are most frequently accessed via security events. |
@@ -871,53 +797,3 @@ limit 20; |
871 | 797 | ```yaml |
872 | 798 | folder: Repository Security |
873 | 799 | ``` |
874 | | -
|
875 | | -### Specific Repository Security Events |
876 | | -
|
877 | | -Monitor security events for a specific repository. |
878 | | -
|
879 | | -```sql |
880 | | -select |
881 | | - timestamp, |
882 | | - action, |
883 | | - actor, |
884 | | - permissions, |
885 | | - repository_selection |
886 | | -from |
887 | | - github_security_log |
888 | | -where |
889 | | - repositories @> '[313325091]' -- Replace with your repository ID |
890 | | -order by |
891 | | - timestamp desc; |
892 | | -``` |
893 | | - |
894 | | -```yaml |
895 | | -folder: Repository Security |
896 | | -``` |
897 | | -
|
898 | | -### Repository Permission Changes |
899 | | -
|
900 | | -Track changes in repository permissions using old_value and new_value fields. |
901 | | -
|
902 | | -```sql |
903 | | -select |
904 | | - timestamp, |
905 | | - action, |
906 | | - actor, |
907 | | - repositories, |
908 | | - old_value, |
909 | | - new_value, |
910 | | - permissions_added, |
911 | | - permissions_upgraded |
912 | | -from |
913 | | - github_security_log |
914 | | -where |
915 | | - (old_value is not null or new_value is not null) |
916 | | - and repositories is not null |
917 | | -order by |
918 | | - timestamp desc; |
919 | | -``` |
920 | | - |
921 | | -```yaml |
922 | | -folder: Repository Security |
923 | | -``` |
0 commit comments