Skip to content
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

Modular sdk 7 #49

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
be4bac8
Move to modular-sdk 7.0.0
dmytro-afanasiev Jan 6, 2025
23672a3
Set application name to rule-engine
dmytro-afanasiev Jan 7, 2025
0714d97
Add compliance report
dmytro-afanasiev Jan 7, 2025
bc3f8ec
Fix bug with ruleset name containing digits
dmytro-afanasiev Jan 8, 2025
8e3792f
Update coverages maestro reports
dmytro-afanasiev Jan 8, 2025
53206da
Add attacks report
dmytro-afanasiev Jan 8, 2025
1f6dc14
Merge remote-tracking branch 'origin/develop' into modular-sdk-7
dmytro-afanasiev Jan 9, 2025
f8921db
Add maestro packer to s3
dmytro-afanasiev Jan 10, 2025
8594d88
EPMCEOOS-6323 WIP add k8s reports and fix tests
dmytro-afanasiev Jan 13, 2025
2c43b98
Add k8s metrics
dmytro-afanasiev Jan 14, 2025
62c0e51
Add k8s report
dmytro-afanasiev Jan 14, 2025
029667f
Minor fixes
dmytro-afanasiev Jan 15, 2025
b970d7f
K8s
dmytro-afanasiev Jan 16, 2025
cf215e1
Add missing stub file
dmytro-afanasiev Jan 17, 2025
453894f
Minor dojo updates
dmytro-afanasiev Jan 22, 2025
6486738
Update stubs
dmytro-afanasiev Jan 22, 2025
9110074
Fix some numbers
dmytro-afanasiev Jan 22, 2025
a40502e
Fix issue with google resources
dmytro-afanasiev Jan 23, 2025
953465b
Add project overview
dmytro-afanasiev Jan 23, 2025
8da7455
Merge remote-tracking branch 'origin/develop' into modular-sdk-7
dmytro-afanasiev Jan 24, 2025
6249373
Add project report
dmytro-afanasiev Jan 24, 2025
ae480d4
Fix outdated for project
dmytro-afanasiev Jan 27, 2025
1649ba0
EPMCEOOS-6510 add deprecations report
dmytro-afanasiev Jan 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.7.0] - 2025-01-06
- moved to modular-sdk 7.0.0
- fixed a bug when ruleset name containing a number was considered to be rulesset version

## [5.6.0] - 2024-11-05
- refactor metrics collector
- refactor such inner reports
Expand Down
2 changes: 1 addition & 1 deletion cli/srecli/group/ruleset.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def describe(ctx: ContextObj, name, version, cloud, get_rules,
help='Project id of git repo to build a ruleset')
@click.option('--git_ref', '-gr', required=False, type=str,
help='Branch of git repo to build a ruleset')
@click.option('--platform', required=False, type=click.Choice(('kubernetes', 'openshift')),
@click.option('--platform', required=False, type=click.Choice(('kubernetes', 'openshift', 'kubernetes and openshift')),
multiple=True, help='Platform for k8s')
@click.option('--category', required=False, type=str, multiple=True,
help='Rules category to use')
Expand Down
4 changes: 2 additions & 2 deletions deployment/helm/rule-engine/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apiVersion: v2
appVersion: "5.6.0"
appVersion: "5.7.0"
description: A Helm chart for the rule-engine
name: rule-engine
type: application
version: "5.6.0"
version: "5.7.0"
dependencies:
- name: vault
repository: "s3://charts-repository/syndicate/"
Expand Down
6 changes: 6 additions & 0 deletions deployment/helm/rule-engine/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ spec:
name: http
protocol: TCP
env:
- name: application_name
value: 'syndicate-rule-engine'
- name: modular_mongo_user
valueFrom:
secretKeyRef:
Expand Down Expand Up @@ -137,4 +139,8 @@ spec:
- name: CAAS_ALLOW_SIMULTANEOUS_JOBS_FOR_ONE_TENANT
value: 'true'
{{- end }}
{{- if .Values.recommendationsBucket }}
- name: CAAS_RECOMMENDATIONS_BUCKET_NAME
value: {{ .Values.recommendationsBucket }}
{{- end}}
restartPolicy: Always
5 changes: 3 additions & 2 deletions deployment/helm/rule-engine/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ service:

image:
repository: public.ecr.aws/x4s4z8e1/syndicate/rule-engine
tag: 5.6.0
tag: 5.7.0
pullPolicy: Always

replicas: 1
Expand Down Expand Up @@ -65,4 +65,5 @@ noProxy: 'localhost,127.0.0.1,169.254.169.254,mongo,vault,minio,defectdojo'

logLevel: INFO
executorLogLevel: INFO
allowSimultaneousJobsForOneTenant: false
allowSimultaneousJobsForOneTenant: false
recommendationsBucket:
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ readme = "README.md"
requires-python = ">=3.10"
license = {file = "LICENSE"}
dependencies = []
version = "5.6.0"
version = "5.7.0"

[dependency-groups]
test = [
Expand Down
3 changes: 1 addition & 2 deletions src/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ VAULT_TOKEN=token
VAULT_URL=127.0.0.1
VAULT_SERVICE_SERVICE_PORT=8200

component_name=custodian_service
application_name=caas
application_name=syndicate-rule-engine
4 changes: 2 additions & 2 deletions src/executor/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
boto3~=1.34.144
botocore~=1.34.144
pynamodb>=5.5.1,<6
pymongo~=4.5.0
pymongo~=4.10.1
hvac~=1.2.1
requests~=2.32.3
python-dateutil>=2.8.2,<3.0
# jinja2~=3.1.2 # currently not used
modular-sdk>=6.3.0,<7.0
modular-sdk~=7.0.0
aws-xray-sdk~=2.14.0
msgspec~=0.18.6
cryptography~=42.0.8
Expand Down
22 changes: 6 additions & 16 deletions src/executor/services/report_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ class ReportFieldsLoader:
json representation of its instances. We cannot know what field inside
that json is considered to be a logical ID, name (or arn in case AWS) of
that resource. Fortunately, this information is present inside Cloud
Custodian and we get get it.
For k8s name is always inside "metadata.name", id - "metadata.uid",
Custodian, and we can get it.
For K8S name is always inside "metadata.name", id - "metadata.uid",
namespace - "metadata.namespace".
For azure they are also always the same due to consistent api.
For AZURE they are also always the same due to consistent api.
For AWS, GOOGLE we must retrieve these values for each resource type
"""
class Fields(TypedDict, total=False):
Expand Down Expand Up @@ -225,7 +225,7 @@ def _extend_resources(self, resources: list[dict], rt: str):
val = json_path_get(res, path)
if not val:
continue
res[field] = val
res.setdefault(field, val)

def iter_raw(self, with_resources: bool = False
) -> Generator[RegionRuleOutput, None, None]:
Expand All @@ -244,21 +244,11 @@ def resolve_azure_locations(it: Iterable[RegionRuleOutput]
) -> Generator[RegionRuleOutput, None, None]:
"""
The thing is: Custodian Custom Core cannot scan Azure
region-dependently. A rule covers the whole subscription
(or whatever, I don't know) and then each found resource has
'location' field with its real location.
region-dependently. A rule covers the whole subscription and then
each found resource has 'location' field with its real location.
In order to adhere to AWS logic, when a user wants to receive
reports only for regions he activated, we need to filter out only
appropriate resources.
Also note that Custom Core has such a thing as `AzureCloud`. From
my point of view it's like a mock for every region (because,
I believe, in the beginning Core was designed for AWS and therefore
there are regions). With the current scanner implementation
(3.3.1) incoming `detailed_report` will always have one key:
`AzureCloud` with a list of all the scanned rules. We must remap it.
All the resources that does not contain
'location' will be congested to 'multiregion' region.
:return:
"""
for _, rule, metadata, resources in it:
if resources is None or not resources:
Expand Down
Loading
Loading