<commit_before>{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "DevSecOps Bootcamp CloudFormation Template: Creates a vulnerable application running on a single instance.",
  "Parameters": {
    "KeyName": {
      "Description": "Name of an existing EC2 KeyPair to enable SSH access to the instance",
      "Type": "AWS::EC2::KeyPair::KeyName",
      "ConstraintDescription": "must be the name of an existing EC2 KeyPair."
    },
    "SubnetId": {
      "Type": "String",
      "Description": "A subnet ID where the app will run",
      "Default": "subnet-bd16e7cb",
      "MinLength": "1"
    },
    "VpcId": {
      "Type": "String",
      "Description": "A VPC ID where the app will run",
      "Default": "vpc-c9d501ad",
      "MinLength": "1"
    },
    "InstanceType": {
      "Description": "WebServer EC2 instance type",
      "Type": "String",
      "Default": "m3.medium",
      "AllowedValues": [
        "m1.small",
        "m1.medium",
        "m1.large",
        "m1.xlarge",
        "m2.xlarge",
        "m2.2xlarge",
        "m2.4xlarge",
        "m3.medium",
        "m3.large",
        "m3.xlarge",
        "m3.2xlarge",
        "m4.large"
      ],
      "ConstraintDescription": "must be a valid EC2 instance type."
    },
    "SSHLocation": {
      "Description": " The IP address range that can be used to SSH to the EC2 instances",
      "Type": "String",
      "MinLength": "9",
      "MaxLength": "18",
      "Default": "0.0.0.0/0",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x."
    }
  },
  "Mappings": {
    "AWSInstanceType2Arch": {
      "m1.small": {
        "Arch": "PV64"
      },
      "m1.medium": {
        "Arch": "PV64"
      },
      "m1.large": {
        "Arch": "PV64"
      },
      "m1.xlarge": {
        "Arch": "PV64"
      },
      "m2.xlarge": {
        "Arch": "PV64"
      },
      "m2.2xlarge": {
        "Arch": "PV64"
      },
      "m2.4xlarge": {
        "Arch": "PV64"
      },
      "m3.medium": {
        "Arch": "HVM64"
      },
      "m3.large": {
        "Arch": "HVM64"
      },
      "m3.xlarge": {
        "Arch": "HVM64"
      },
      "m3.2xlarge": {
        "Arch": "HVM64"
      },
      "m4.large": {
        "Arch": "HVM64"
      }
    },
    "AWSInstanceType2NATArch": {
      "m1.small": {
        "Arch": "NATPV64"
      },
      "m1.medium": {
        "Arch": "NATPV64"
      },
      "m1.large": {
        "Arch": "NATPV64"
      },
      "m1.xlarge": {
        "Arch": "NATPV64"
      },
      "m2.xlarge": {
        "Arch": "NATPV64"
      },
      "m2.2xlarge": {
        "Arch": "NATPV64"
      },
      "m2.4xlarge": {
        "Arch": "NATPV64"
      },
      "m3.medium": {
        "Arch": "NATHVM64"
      },
      "m3.large": {
        "Arch": "NATHVM64"
      },
      "m3.xlarge": {
        "Arch": "NATHVM64"
      },
      "m3.2xlarge": {
        "Arch": "NATHVM64"
      },
      "m4.large": {
        "Arch": "NATHVM64"
      }
    },
    "AWSRegionArch2AMI": {
      "us-east-1": {
        "PV64": "ami-22111148",
        "HVM64": "ami-08111162",
        "HVMG2": "ami-ebcec381"
      },
      "us-west-2": {
        "PV64": "ami-792bc219",
        "HVM64": "ami-c229c0a2",
        "HVMG2": "ami-0f28c06f"
      },
      "us-west-1": {
        "PV64": "ami-0e087a6e",
        "HVM64": "ami-1b0f7d7b",
        "HVMG2": "ami-ab9defcb"
      }
    }
  },
  "Resources": {
    "WebServerInstance": {
      "Type": "AWS::EC2::Instance",
      "Properties": {
        "NetworkInterfaces": [
          {
            "AssociatePublicIpAddress": "true",
            "DeviceIndex": "0",
            "GroupSet": [
              {
                "Ref": "WebServerSecurityGroup"
              }
            ],
            "SubnetId": {
              "Ref": "SubnetId"
            }
          }
        ],
        "ImageId": {
          "Fn::FindInMap": [
            "AWSRegionArch2AMI",
            {
              "Ref": "AWS::Region"
            },
            {
              "Fn::FindInMap": [
                "AWSInstanceType2Arch",
                {
                  "Ref": "InstanceType"
                },
                "Arch"
              ]
            }
          ]
        },
        "InstanceType": {
          "Ref": "InstanceType"
        },
        "KeyName": {
          "Ref": "KeyName"
        },
        "UserData": {
          "Fn::Base64": {
            "Fn::Join": [
              "",
              [
                "#!/bin/bash -xe\n",
                "curl -sSL https://rvm.io/mpapis.asc | sudo gpg2 --import -\n",
                "curl -L https://get.rvm.io | bash -s stable --autolibs=3 --ruby=1.9.3\n",
                "source /usr/local/rvm/scripts/rvm\n",
                "cd /opt\n",
                "yum -y install git mysql mysql-server mysql-libs mysql-devel\n",
                "service mysqld start\n",
                "git clone https://github.com/OWASP/railsgoat.git\n",
                "cd railsgoat\n",
                "gem install bundler && bundle install\n",
                "RAILS_ENV=mysql rake db:setup\n",
                "RAILS_ENV=mysql rails server -b 0.0.0.0 -p 80 &\n",
                "\n"
              ]
            ]
          }
        }<commit_msg>Change ruby version back to 2.3.0<commit_after>{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "DevSecOps Bootcamp CloudFormation Template: Creates a vulnerable application running on a single instance.",
  "Parameters": {
    "KeyName": {
      "Description": "Name of an existing EC2 KeyPair to enable SSH access to the instance",
      "Type": "AWS::EC2::KeyPair::KeyName",
      "ConstraintDescription": "must be the name of an existing EC2 KeyPair."
    },
    "SubnetId": {
      "Type": "String",
      "Description": "A subnet ID where the app will run",
      "Default": "subnet-bd16e7cb",
      "MinLength": "1"
    },
    "VpcId": {
      "Type": "String",
      "Description": "A VPC ID where the app will run",
      "Default": "vpc-c9d501ad",
      "MinLength": "1"
    },
    "InstanceType": {
      "Description": "WebServer EC2 instance type",
      "Type": "String",
      "Default": "m3.medium",
      "AllowedValues": [
        "m1.small",
        "m1.medium",
        "m1.large",
        "m1.xlarge",
        "m2.xlarge",
        "m2.2xlarge",
        "m2.4xlarge",
        "m3.medium",
        "m3.large",
        "m3.xlarge",
        "m3.2xlarge",
        "m4.large"
      ],
      "ConstraintDescription": "must be a valid EC2 instance type."
    },
    "SSHLocation": {
      "Description": " The IP address range that can be used to SSH to the EC2 instances",
      "Type": "String",
      "MinLength": "9",
      "MaxLength": "18",
      "Default": "0.0.0.0/0",
      "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
      "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x."
    }
  },
  "Mappings": {
    "AWSInstanceType2Arch": {
      "m1.small": {
        "Arch": "PV64"
      },
      "m1.medium": {
        "Arch": "PV64"
      },
      "m1.large": {
        "Arch": "PV64"
      },
      "m1.xlarge": {
        "Arch": "PV64"
      },
      "m2.xlarge": {
        "Arch": "PV64"
      },
      "m2.2xlarge": {
        "Arch": "PV64"
      },
      "m2.4xlarge": {
        "Arch": "PV64"
      },
      "m3.medium": {
        "Arch": "HVM64"
      },
      "m3.large": {
        "Arch": "HVM64"
      },
      "m3.xlarge": {
        "Arch": "HVM64"
      },
      "m3.2xlarge": {
        "Arch": "HVM64"
      },
      "m4.large": {
        "Arch": "HVM64"
      }
    },
    "AWSInstanceType2NATArch": {
      "m1.small": {
        "Arch": "NATPV64"
      },
      "m1.medium": {
        "Arch": "NATPV64"
      },
      "m1.large": {
        "Arch": "NATPV64"
      },
      "m1.xlarge": {
        "Arch": "NATPV64"
      },
      "m2.xlarge": {
        "Arch": "NATPV64"
      },
      "m2.2xlarge": {
        "Arch": "NATPV64"
      },
      "m2.4xlarge": {
        "Arch": "NATPV64"
      },
      "m3.medium": {
        "Arch": "NATHVM64"
      },
      "m3.large": {
        "Arch": "NATHVM64"
      },
      "m3.xlarge": {
        "Arch": "NATHVM64"
      },
      "m3.2xlarge": {
        "Arch": "NATHVM64"
      },
      "m4.large": {
        "Arch": "NATHVM64"
      }
    },
    "AWSRegionArch2AMI": {
      "us-east-1": {
        "PV64": "ami-22111148",
        "HVM64": "ami-08111162",
        "HVMG2": "ami-ebcec381"
      },
      "us-west-2": {
        "PV64": "ami-792bc219",
        "HVM64": "ami-c229c0a2",
        "HVMG2": "ami-0f28c06f"
      },
      "us-west-1": {
        "PV64": "ami-0e087a6e",
        "HVM64": "ami-1b0f7d7b",
        "HVMG2": "ami-ab9defcb"
      }
    }
  },
  "Resources": {
    "WebServerInstance": {
      "Type": "AWS::EC2::Instance",
      "Properties": {
        "NetworkInterfaces": [
          {
            "AssociatePublicIpAddress": "true",
            "DeviceIndex": "0",
            "GroupSet": [
              {
                "Ref": "WebServerSecurityGroup"
              }
            ],
            "SubnetId": {
              "Ref": "SubnetId"
            }
          }
        ],
        "ImageId": {
          "Fn::FindInMap": [
            "AWSRegionArch2AMI",
            {
              "Ref": "AWS::Region"
            },
            {
              "Fn::FindInMap": [
                "AWSInstanceType2Arch",
                {
                  "Ref": "InstanceType"
                },
                "Arch"
              ]
            }
          ]
        },
        "InstanceType": {
          "Ref": "InstanceType"
        },
        "KeyName": {
          "Ref": "KeyName"
        },
        "UserData": {
          "Fn::Base64": {
            "Fn::Join": [
              "",
              [
                "#!/bin/bash -xe\n",
                "curl -sSL https://rvm.io/mpapis.asc | sudo gpg2 --import -\n",
                "curl -L https://get.rvm.io | bash -s stable --autolibs=3 --ruby=2.3.0\n",
                "source /usr/local/rvm/scripts/rvm\n",
                "cd /opt\n",
                "yum -y install git mysql mysql-server mysql-libs mysql-devel\n",
                "service mysqld start\n",
                "git clone https://github.com/OWASP/railsgoat.git\n",
                "cd railsgoat\n",
                "gem install bundler && bundle install\n",
                "RAILS_ENV=mysql rake db:setup\n",
                "RAILS_ENV=mysql rails server -b 0.0.0.0 -p 80 &\n",
                "\n"
              ]
            ]
          }
        }
{'fraction_non_alphanumeric': 0.18037085596553662, 'fraction_numerical': 0.04111256789660985, 'mean_word_length': 1.3532393124724549, 'pattern_counts': {'":': 236, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6627931', 'n_tokens_mistral': 4042, 'n_tokens_neox': 3790, 'n_words': 669}