-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #226 from MaibornWolff/dev
chore: merge to main for release 2024_11_2
- Loading branch information
Showing
17 changed files
with
134 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: 'SecObserve Check Security Gate' | ||
description: 'Checks SecObserve security gate of a product' | ||
author: 'MaibornWolff' | ||
|
||
inputs: | ||
so_api_base_url: | ||
description: 'Base URL of the SecObserve backend' | ||
required: true | ||
so_api_token: | ||
description: 'API token of the user to be used for the check.' | ||
required: true | ||
so_product_name: | ||
description: 'Name of the product for which the security gate check is being performed.' | ||
required: true | ||
|
||
runs: | ||
using: 'docker' | ||
image: 'docker://maibornwolff/secobserve-scanners:latest' | ||
entrypoint: 'check_security_gate.sh' | ||
env: | ||
SO_API_BASE_URL: ${{ inputs.so_api_base_url }} | ||
SO_API_TOKEN: ${{ inputs.so_api_token }} | ||
SO_PRODUCT_NAME: ${{ inputs.so_product_name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: 'SecObserve Check Security Gate' | ||
description: 'Checks SecObserve security gate for a product' | ||
author: 'MaibornWolff' | ||
|
||
inputs: | ||
so_api_base_url: | ||
description: 'Base URL of the SecObserve backend' | ||
required: true | ||
so_api_token: | ||
description: 'API token of the user to be used for the check.' | ||
required: true | ||
so_product_name: | ||
description: 'Name of the product for which the security gate check is being performed.' | ||
required: true | ||
|
||
runs: | ||
using: 'docker' | ||
image: 'docker://maibornwolff/secobserve-scanners:dev' | ||
entrypoint: 'check_security_gate.sh' | ||
env: | ||
SO_API_BASE_URL: ${{ inputs.so_api_base_url }} | ||
SO_API_TOKEN: ${{ inputs.so_api_token }} | ||
SO_PRODUCT_NAME: ${{ inputs.so_product_name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.check_security_gate: | ||
image: | ||
name: maibornwolff/secobserve-scanners:dev | ||
stage: post_test | ||
variables: | ||
GIT_STRATEGY: none | ||
script: | ||
- check_security_gate.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
set -e | ||
source check_security_gate.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
export PYTHONPATH="${PYTHONPATH}:/usr/local/importer" | ||
python -m importer.check_security_gate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from importer.secobserve_api import Api | ||
from importer.environment import Environment | ||
from requests.exceptions import HTTPError | ||
|
||
|
||
def check_security_gate(): | ||
try: | ||
environment = Environment() | ||
environment.check_environment_common() | ||
api = Api() | ||
product = api.get_product() | ||
if product.get("security_gate_passed") == None: | ||
print(f"Product {product.get('name')}: Security gate DISABLED") | ||
exit(0) | ||
|
||
if product.get("security_gate_passed") == True: | ||
print(f"Product {product.get('name')}: Security gate PASSED") | ||
exit(0) | ||
|
||
print(f"Product {product.get('name')}: Security gate FAILED") | ||
exit(1) | ||
|
||
except Exception as e: | ||
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") | ||
print(f"{e.__class__.__name__}: {str(e)}") | ||
if isinstance(e, HTTPError): | ||
print(f"Response: {e.response.content.decode('utf-8')}") | ||
print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<") | ||
exit(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
check_security_gate() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.check_security_gate: | ||
image: | ||
name: maibornwolff/secobserve-scanners:latest | ||
stage: post_test | ||
variables: | ||
GIT_STRATEGY: none | ||
script: | ||
- check_security_gate.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters