Skip to content

Commit 15bb151

Browse files
authored
Feature/blint action (#39)
* Blint-Action (#38) * Update Dockerfile * Update publish.yml * GHA integration * Parse multiline arg from GHA * Modified error message. * Pre-release version * Dependency update * Fix parsing of GHA sources Signed-off-by: Caroline Russell <[email protected]> * Update cli.py Signed-off-by: Caroline Russell <[email protected]> * bump version Signed-off-by: Caroline Russell <[email protected]> * bump version Signed-off-by: Caroline Russell <[email protected]> * Fix parsing of sources Signed-off-by: Caroline Russell <[email protected]> * bump version Signed-off-by: Caroline Russell <[email protected]> * bump version Signed-off-by: Caroline Russell <[email protected]> * Remove WORKDIR Signed-off-by: Caroline Russell <[email protected]> * bump version Signed-off-by: Caroline Russell <[email protected]> * Fix variable name Signed-off-by: Caroline Russell <[email protected]> * Update Dockerfile Signed-off-by: Caroline Russell <[email protected]> * Update pyproject.toml Signed-off-by: Caroline Russell <[email protected]> * Update parse sources Signed-off-by: Caroline Russell <[email protected]> * Update Dockerfile Signed-off-by: Caroline Russell <[email protected]> * Troubleshooting env Signed-off-by: Caroline Russell <[email protected]> * Fix syntax error Signed-off-by: Caroline Russell <[email protected]> * Update Dockerfile Signed-off-by: Caroline Russell <[email protected]> * Parse src_dir regardless Signed-off-by: Caroline Russell <[email protected]> * Pass env variable in entrypoint Signed-off-by: Caroline Russell <[email protected]> * Update Dockerfile Signed-off-by: Caroline Russell <[email protected]> * Change deployment service permissions Signed-off-by: Caroline Russell <[email protected]> * Cleanup Signed-off-by: Caroline Russell <[email protected]> * Add option for github actions Signed-off-by: Caroline Russell <[email protected]> * Update cli.py Signed-off-by: Caroline Russell <[email protected]> * Update parsing Signed-off-by: Caroline Russell <[email protected]> * Troubleshooting Signed-off-by: Caroline Russell <[email protected]> * Update cli.py Signed-off-by: Caroline Russell <[email protected]> * Troubleshooting Signed-off-by: Caroline Russell <[email protected]> * Remove extra empty list entry Signed-off-by: Caroline Russell <[email protected]> * Version Signed-off-by: Caroline Russell <[email protected]> * Version Signed-off-by: Caroline Russell <[email protected]> * Variable refactoring Signed-off-by: Caroline Russell <[email protected]> --------- Signed-off-by: Caroline Russell <[email protected]>
1 parent 701c48b commit 15bb151

File tree

4 files changed

+112
-82
lines changed

4 files changed

+112
-82
lines changed

Dockerfile

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ LABEL maintainer="appthreat" \
44
org.opencontainers.image.authors="Team AppThreat <[email protected]>" \
55
org.opencontainers.image.source="https://github.com/AppThreat/blint" \
66
org.opencontainers.image.url="https://github.com/AppThreat/blint" \
7-
org.opencontainers.image.version="1.0.32" \
7+
org.opencontainers.image.version="1.0.33" \
88
org.opencontainers.image.vendor="AppThreat" \
99
org.opencontainers.image.licenses="Apache-2.0" \
1010
org.opencontainers.image.title="blint" \
@@ -31,25 +31,23 @@ ENV GOPATH=/opt/app-root/go \
3131
SBT_HOME="/opt/sbt/${SBT_VERSION}" \
3232
COMPOSER_ALLOW_SUPERUSER=1 \
3333
PYTHONUNBUFFERED=1 \
34-
PYTHONIOENCODING="utf-8"
34+
PYTHONIOENCODING="utf-8"
3535
ENV PATH=${PATH}:${JAVA_HOME}/bin:${MAVEN_HOME}/bin:${GRADLE_HOME}/bin:${SBT_HOME}/bin:${GOPATH}/bin:/usr/local/go/bin:/usr/local/bin/:/root/.local/bin:
3636

3737
COPY . /opt/blint
3838

39-
RUN microdnf install -y python3.11 python3.11-devel python3.11-pip gcc gcc-c++ libstdc++-devel glibc-common cmake openssl-libs compat-openssl11 \
39+
RUN microdnf install -y python3.11 python3.11-devel python3.11-pip \
4040
&& alternatives --install /usr/bin/python3 python /usr/bin/python3.11 1 \
4141
&& python3 --version \
4242
&& python3 -m pip install --upgrade pip \
4343
&& python3 -m pip install setuptools --upgrade \
44-
&& python3 -m pip install scikit-build \
45-
&& python3 -m pip install cmake==3.16.3 ninja==1.10.0.post2
44+
&& python3 -m pip install poetry
4645

4746
RUN cd /opt/blint \
48-
&& python3 -m pip install -e . \
47+
&& poetry config virtualenvs.create false \
48+
&& poetry install --no-cache --without dev \
4949
&& chmod a-w -R /opt \
5050
&& microdnf clean all
5151

5252

53-
WORKDIR /app
54-
5553
ENTRYPOINT [ "blint" ]

blint/cli.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import argparse
55
import os
6+
import sys
67

78
from blint.analysis import report, start
89

@@ -69,11 +70,21 @@ def build_args():
6970
return parser.parse_args()
7071

7172

73+
def parse_input(src):
74+
path = src[0]
75+
result = path.split("\n")
76+
result.pop()
77+
return result
78+
79+
7280
def main():
7381
args = build_args()
7482
if not args.no_banner:
7583
print(blint_logo)
76-
src_dir = args.src_dir_image
84+
if not os.getenv("CI"):
85+
src_dir = args.src_dir_image
86+
else:
87+
src_dir = parse_input(args.src_dir_image)
7788
if args.reports_dir:
7889
reports_dir = args.reports_dir
7990
elif not src_dir:
@@ -86,14 +97,18 @@ def main():
8697
exit()
8798
for dir in src_dir:
8899
if not os.path.exists(dir):
89-
print(f"{src_dir} is an invalid file or directory!")
100+
print(f"{dir} is an invalid file or directory!")
90101
return
91102
# Create reports directory
92103
if reports_dir and not os.path.exists(reports_dir):
93104
os.makedirs(reports_dir)
94105
findings, reviews, files, fuzzables = start(args, src_dir, reports_dir)
95106
report(args, src_dir, reports_dir, findings, reviews, files, fuzzables)
96107

108+
if os.getenv("CI"):
109+
if len(findings) > 0:
110+
sys.exit(1)
111+
97112

98113
if __name__ == "__main__":
99114
main()

0 commit comments

Comments
 (0)