Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
93492538
Commit
93492538
authored
Feb 28, 2018
by
Philippe Lafoucrière
Committed by
Dmitriy Zaporozhets
Feb 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "SAST documentation snippet is invalid"
parent
cf3bf235
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
37 deletions
+9
-37
doc/ci/examples/sast.md
doc/ci/examples/sast.md
+9
-37
No files found.
doc/ci/examples/sast.md
View file @
93492538
...
...
@@ -12,9 +12,6 @@ First, you need GitLab Runner with [docker-in-docker executor](https://docs.gitl
You can then add a new job to
`.gitlab-ci.yml`
, called
`sast`
:
```
yaml
before_script
:
-
*functions
sast
:
image
:
docker:latest
variables
:
...
...
@@ -23,43 +20,18 @@ sast:
services
:
-
docker:dind
script
:
-
setup_docker
-
sast
-
export SAST_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
-
docker run
--env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}"
--env SAST_DISABLE_REMOTE_CHECKS="${SAST_DISABLE_REMOTE_CHECKS:-false}"
--volume "$PWD:/code"
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/sast:$SAST_VERSION" /app/bin/run /code
artifacts
:
paths
:
[
gl-sast-report.json
]
.functions
:
&functions
|
# Variables and functions
function setup_docker() {
if ! docker info &>/dev/null; then
if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
export DOCKER_HOST='tcp://localhost:2375'
fi
fi
}
function sast() {
case "$CI_SERVER_VERSION" in
*-ee)
# Extract "MAJOR.MINOR" from CI_SERVER_VERSION and generate "MAJOR-MINOR-stable"
SAST_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
docker run --env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}" \
--env SAST_DISABLE_REMOTE_CHECKS="${SAST_DISABLE_REMOTE_CHECKS:-false}" \
--volume "$PWD:/code" \
--volume /var/run/docker.sock:/var/run/docker.sock \
"registry.gitlab.com/gitlab-org/security-products/sast:$SAST_VERSION" /app/bin/run /code
;;
*)
echo "GitLab Enterprise Edition is required"
;;
esac
}
```
The above example will create a
`sast`
job in your CI pipeline and will allow
you to download and analyze the report artifact in JSON format. Check the
The above example will create a
`sast`
job in the
`test`
stage and will create the required report artifact. Check the
[
Auto-DevOps template
](
https://gitlab.com/gitlab-org/gitlab-ci-yml/blob/master/Auto-DevOps.gitlab-ci.yml
)
for a full reference.
...
...
@@ -82,7 +54,7 @@ TIP: **Tip:**
Starting with
[
GitLab Ultimate
][
ee
]
10.3, this information will
be automatically extracted and shown right in the merge request widget. To do
so, the CI job must be named
`sast`
and the artifact path must be
`gl-sast-report.json`
.
`gl-sast-report.json`
.
Make sure your pipeline has a stage nammed
`test`
, or specify another existing stage inside the
`sast`
job.
[
Learn more on application security testing results shown in merge requests
](
../../user/project/merge_requests/sast.md
)
.
## Supported languages and frameworks
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment