Skip to content

Commit

Permalink
[SOAR-18171] Redis - Snyk Vulnerability and SDK Bump (#2950)
Browse files Browse the repository at this point in the history
* early commit - utf-8

* Snyk and unit tests

* Fixing unit test expected outcome

* black

* rename test

* Renaming all unit tests with test_

* new line
  • Loading branch information
rmurray-r7 committed Nov 21, 2024
1 parent 7ff0694 commit 304c54a
Show file tree
Hide file tree
Showing 81 changed files with 1,175 additions and 464 deletions.
30 changes: 15 additions & 15 deletions plugins/redis/.CHECKSUM
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
{
"spec": "d0b30bfb265d667698015fcfe69b3cae",
"manifest": "bbc79cf009aa939c5b68b8451bc78cff",
"setup": "ff76a01958969fcc28eee17ba2c723c4",
"spec": "d87af4a73af23e65eb280f06b17501b0",
"manifest": "bcbee882883b3bbc53d23c28bd6b860d",
"setup": "c8ba0398d017459776ab5d8547c2cec8",
"schemas": [
{
"identifier": "delete/schema.py",
"hash": "cc53755684e4fafc9ed1fe174c785ffb"
"hash": "386fe4ffdd554d1fb0a496a236ccda92"
},
{
"identifier": "get/schema.py",
"hash": "5f1665805e95c97039a3b5fad822d780"
"hash": "2418731519a2321c938a28e583e704af"
},
{
"identifier": "hash_get/schema.py",
"hash": "b5f4fdbc34ae38777e2845e3dc8fc64f"
"hash": "bdc6637e32a37012a11202971b603724"
},
{
"identifier": "hash_set/schema.py",
"hash": "e1a4b84e6de13a1ac9ddd9ed796a49d7"
"hash": "18f12299445dfd8f3f44112c740cfcfb"
},
{
"identifier": "hincrby/schema.py",
"hash": "5a4bc414be3bc4a85e498e8448ddf4c0"
"hash": "850449363335a16515b2688d9175ae44"
},
{
"identifier": "hmget/schema.py",
"hash": "b04fd826b25f37609b74b0dfdb26eb26"
"hash": "cfd9e10b14abf01aee7ba9b51decc806"
},
{
"identifier": "hmset/schema.py",
"hash": "7b6f4e269aaa39359d5d6e8250068cef"
"hash": "5a6329f4e908f56dda0945dd5d5f5b86"
},
{
"identifier": "keys/schema.py",
"hash": "926ec56a7a223dd425ed8ebdea29277f"
"hash": "8d7d2d83a6ca32146513410db60a2ffe"
},
{
"identifier": "list_get/schema.py",
"hash": "c8e12e4c4a39041a9314ec2983debf55"
"hash": "9f58960109892b890a5a13901f5a37ea"
},
{
"identifier": "list_push/schema.py",
"hash": "18d8d51e7b8587da3378a9d46c5a6340"
"hash": "0bec3c41dc71e64bafdc6b08b8cfa478"
},
{
"identifier": "set/schema.py",
"hash": "0ff0feb90ffa83aeba47a5dfb263b77c"
"hash": "f66301278673270476bc92beb2e90fe3"
},
{
"identifier": "connection/schema.py",
"hash": "979eba6adfe726ecd022022e917e5d6d"
"hash": "9eaaa3df08bbb42bb41cddb928260b07"
}
]
}
25 changes: 10 additions & 15 deletions plugins/redis/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
FROM komand/python-3-plugin:2
# The three supported python parent images are:
# - komand/python-2-plugin
# - komand/python-3-plugin
# - komand/python-pypy3-plugin
#
# Update the tag to a full semver version
FROM --platform=linux/amd64 rapid7/insightconnect-python-3-slim-plugin:6.2.0

# Add any custom package dependencies here
# NOTE: Add pip packages to requirements.txt
LABEL organization=rapid7
LABEL sdk=python

# End package dependencies

# Add source code
WORKDIR /python/src

ADD ./plugin.spec.yaml /plugin.spec.yaml
ADD . /python/src
ADD ./requirements.txt /python/src/requirements.txt

# Install pip dependencies
RUN if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

# Install plugin
ADD . /python/src

RUN python setup.py build && python setup.py install

# User to run plugin code. The two supported users are: root, nobody
USER nobody

ENTRYPOINT ["/usr/local/bin/komand_redis"]
86 changes: 50 additions & 36 deletions plugins/redis/bin/komand_redis
Original file line number Diff line number Diff line change
@@ -1,50 +1,64 @@
#!/usr/bin/env python
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
from komand_redis import connection, actions, triggers
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
import os
import json
from sys import argv

Name = "Redis"
Vendor = "rapid7"
Version = "1.0.2"
Description = "Redis is an in-memory data structure project implementing a distributed, in-memory key-value database with optional durability. Redis supports different kinds of abstract data structures, such as strings, lists, maps, sets, sorted sets, HyperLogLogs, bitmaps, streams, and spatial indexes.\nThis package allows you to interact with the [Redis](https://redis.io/) database API"

Name = 'Redis'
Vendor = 'rapid7'
Version = '1.0.1'
Description = 'The Redis plugin allows you to add, update, and manage data in a Redis database'


class ICONRedis(komand.Plugin):
def __init__(self):
super(self.__class__, self).__init__(
def main():
if 'http' in argv:
if os.environ.get("GUNICORN_CONFIG_FILE"):
with open(os.environ.get("GUNICORN_CONFIG_FILE")) as gf:
gunicorn_cfg = json.load(gf)
if gunicorn_cfg.get("worker_class", "sync") == "gevent":
from gevent import monkey
monkey.patch_all()
elif 'gevent' in argv:
from gevent import monkey
monkey.patch_all()

import insightconnect_plugin_runtime
from komand_redis import connection, actions, triggers, tasks

class ICONRedis(insightconnect_plugin_runtime.Plugin):
def __init__(self):
super(self.__class__, self).__init__(
name=Name,
vendor=Vendor,
version=Version,
description=Description,
connection=connection.Connection()
)
self.add_action(actions.Delete())

self.add_action(actions.Get())

self.add_action(actions.HashGet())

self.add_action(actions.HashSet())

self.add_action(actions.Hincrby())

self.add_action(actions.Hmget())
)
self.add_action(actions.Delete())

self.add_action(actions.Set())

self.add_action(actions.Get())

self.add_action(actions.Keys())

self.add_action(actions.HashSet())

self.add_action(actions.HashGet())

self.add_action(actions.ListPush())

self.add_action(actions.ListGet())

self.add_action(actions.Hmset())

self.add_action(actions.Hmget())

self.add_action(actions.Hincrby())


self.add_action(actions.Hmset())

self.add_action(actions.Keys())

self.add_action(actions.ListGet())

self.add_action(actions.ListPush())

self.add_action(actions.Set())


def main():
"""Run plugin"""
cli = komand.CLI(ICONRedis())
cli = insightconnect_plugin_runtime.CLI(ICONRedis())
cli.run()


Expand Down
Loading

0 comments on commit 304c54a

Please sign in to comment.