bot-shield 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,50 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ permissions:
9
+ id-token: write
10
+ contents: write
11
+
12
+ jobs:
13
+ publish:
14
+ runs-on: ubuntu-latest
15
+ if: "!contains(github.event.head_commit.message, '[skip ci]')"
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ with:
19
+ token: ${{ secrets.GITHUB_TOKEN }}
20
+
21
+ - uses: actions/setup-node@v4
22
+ with:
23
+ node-version: '22'
24
+
25
+ - name: Upgrade npm to latest
26
+ run: |
27
+ npm install -g npm@latest
28
+ npm --version
29
+
30
+ - name: Install dependencies
31
+ run: npm ci --ignore-scripts
32
+
33
+ - name: Configure git
34
+ run: |
35
+ git config user.name "github-actions[bot]"
36
+ git config user.email "github-actions[bot]@users.noreply.github.com"
37
+
38
+ - name: Bump version
39
+ run: |
40
+ npm version patch --no-git-tag-version
41
+ VERSION=$(node -p "require('./package.json').version")
42
+ git add package.json package-lock.json
43
+ git commit -m "chore(release): bump to v${VERSION} [skip ci]"
44
+ git tag "v${VERSION}"
45
+
46
+ - name: Publish to npm
47
+ run: npm publish --provenance --access public
48
+
49
+ - name: Push version bump
50
+ run: git push --follow-tags
@@ -0,0 +1,102 @@
1
+ AWSTemplateFormatVersion: '2010-09-09'
2
+ Description: 'BotShield DevOps Architecture: EC2, IAM, CloudWatch Telemetry, and SNS Notifications'
3
+
4
+ Resources:
5
+ # 1. THE VIRTUAL PRIVATE SERVER
6
+ BotShieldEC2Instance:
7
+ Type: "AWS::EC2::Instance"
8
+ Properties:
9
+ InstanceType: "t3.micro"
10
+ ImageId: "ami-05d2d839d4f73aafb" # Ubuntu 22.04 LTS
11
+ PrivateIpAddress: "172.31.44.59"
12
+ SecurityGroupIds:
13
+ - !Ref BotShieldSecurityGroup
14
+ Tags:
15
+ - Key: "Name"
16
+ Value: "mainpro_eval"
17
+ IamInstanceProfile: !Ref IAMInstanceProfileEC2cloudwatchrole
18
+
19
+ # 2. THE FIREWALL (SECURITY GROUP)
20
+ BotShieldSecurityGroup:
21
+ Type: "AWS::EC2::SecurityGroup"
22
+ Properties:
23
+ GroupDescription: "BotShield Inbound Port Rules"
24
+ VpcId: "vpc-0c6b04356adb85304"
25
+ SecurityGroupIngress:
26
+ - CidrIp: "0.0.0.0/0"
27
+ IpProtocol: "tcp"
28
+ FromPort: 22
29
+ ToPort: 22
30
+ Description: "Admin Console (SSH)"
31
+ - CidrIp: "0.0.0.0/0"
32
+ IpProtocol: "tcp"
33
+ FromPort: 3000
34
+ ToPort: 3000
35
+ Description: "Shielded Environment"
36
+ - CidrIp: "0.0.0.0/0"
37
+ IpProtocol: "tcp"
38
+ FromPort: 3001
39
+ ToPort: 3001
40
+ Description: "Vulnerable Baseline Environment"
41
+
42
+ # 3. CLOUDWATCH METRIC FILTER (THE THREAT SCANNER)
43
+ LogsMetricFilterThreatScan:
44
+ Type: "AWS::Logs::MetricFilter"
45
+ Properties:
46
+ LogGroupName: "BotShield/Protected-Server"
47
+ FilterPattern: "\"THREAT\""
48
+ FilterName: "BlockedBots"
49
+ MetricTransformations:
50
+ - MetricNamespace: "BotShield"
51
+ MetricName: "BlockedBots"
52
+ MetricValue: "1"
53
+
54
+ # 4. CLOUDWATCH ALARM (THE TRIGGER)
55
+ CloudWatchAlarmBotIntrusion:
56
+ Type: "AWS::CloudWatch::Alarm"
57
+ Properties:
58
+ AlarmName: "BOT INTRUSION DETECTED"
59
+ Namespace: "BotShield"
60
+ MetricName: "BlockedBots"
61
+ Statistic: "Sum"
62
+ ComparisonOperator: "GreaterThanOrEqualToThreshold"
63
+ Threshold: 1
64
+ Period: 60
65
+ EvaluationPeriods: 1
66
+ TreatMissingData: "missing"
67
+ AlarmActions:
68
+ - !Ref SNSTopicAdminAlerts
69
+
70
+ # 5. AMAZON SNS TOPIC (THE MOBILE NOTIFICATION PIPELINE)
71
+ SNSTopicAdminAlerts:
72
+ Type: "AWS::SNS::Topic"
73
+ Properties:
74
+ TopicName: "Default_CloudWatch_Alarms_Topic"
75
+ Subscription:
76
+ - Endpoint: "jacobtsajan@gmail.com"
77
+ Protocol: "email"
78
+ - Endpoint: "jacobtsajan1@gmail.com"
79
+ Protocol: "email"
80
+
81
+ # 6. IAM ROLE PERMISSIONS
82
+ IAMRoleEC2cloudwatchrole:
83
+ Type: "AWS::IAM::Role"
84
+ Properties:
85
+ RoleName: "EC2-cloudwatchrole"
86
+ Description: "Allows EC2 instances to stream daemon logs to AWS CloudWatch."
87
+ ManagedPolicyArns:
88
+ - "arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy"
89
+ AssumeRolePolicyDocument:
90
+ Version: "2012-10-17"
91
+ Statement:
92
+ - Effect: "Allow"
93
+ Action: "sts:AssumeRole"
94
+ Principal:
95
+ Service: "ec2.amazonaws.com"
96
+
97
+ IAMInstanceProfileEC2cloudwatchrole:
98
+ Type: "AWS::IAM::InstanceProfile"
99
+ Properties:
100
+ InstanceProfileName: "EC2-cloudwatchrole"
101
+ Roles:
102
+ - "EC2-cloudwatchrole"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bot-shield",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "An Economic Deterrence Bot Mitigation Middleware for Express",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "repository": {
24
24
  "type": "git",
25
- "url": "https://github.com/jacobtsajan/bot-shield"
25
+ "url": "git+https://github.com/jacobtsajan/bot-shield.git"
26
26
  },
27
27
  "homepage": "https://github.com/jacobtsajan/bot-shield#readme",
28
28
  "license": "ISC"