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
5a7fb3a5
Commit
5a7fb3a5
authored
Mar 01, 2022
by
Dennis Appelt
Committed by
Rémy Coutable
Mar 01, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload package hunter report to S3
parent
c1c597bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
.gitlab/ci/reports.gitlab-ci.yml
.gitlab/ci/reports.gitlab-ci.yml
+5
-0
scripts/ingest-reports-to-siem
scripts/ingest-reports-to-siem
+38
-0
No files found.
.gitlab/ci/reports.gitlab-ci.yml
View file @
5a7fb3a5
...
...
@@ -121,6 +121,11 @@ yarn-audit-dependency_scanning:
-
cd .. && tar -I "gzip --best" -cf gitlab.tgz gitlab/
script
:
-
DEBUG=* node /usr/src/app/cli.js analyze --format gitlab --manager ${PACKAGE_MANAGER} gitlab.tgz | tee ${CI_PROJECT_DIR}/gl-dependency-scanning-report.json
after_script
:
-
mkdir ~/.aws
-
'
[[
-z
"${AWS_SIEM_REPORT_INGESTION_CREDENTIALS_FILE}"
]]
||
mv
"${AWS_SIEM_REPORT_INGESTION_CREDENTIALS_FILE}"
~/.aws/credentials'
-
npm install --no-save --ignore-scripts @aws-sdk/client-s3@3.49.0
-
scripts/ingest-reports-to-siem
artifacts
:
paths
:
-
gl-dependency-scanning-report.json
...
...
scripts/ingest-reports-to-siem
0 → 100755
View file @
5a7fb3a5
#!/usr/bin/env node
const
{
S3Client
,
PutObjectCommand
}
=
require
(
'
@aws-sdk/client-s3
'
)
const
{
fromIni
}
=
require
(
'
@aws-sdk/credential-provider-ini
'
)
const
path
=
require
(
'
path
'
)
const
fs
=
require
(
'
fs
'
)
const
crypto
=
require
(
'
crypto
'
)
function
getMD5HashFromFile
(
data
)
{
const
hash
=
crypto
.
createHash
(
'
md5
'
).
update
(
data
).
digest
(
'
base64
'
)
return
hash
}
(
async
function
()
{
const
s3Client
=
new
S3Client
({
region
:
'
us-east-2
'
,
credentials
:
fromIni
({
profile
:
'
gl-logs-for-panther
'
}),
})
try
{
const
file
=
'
gl-dependency-scanning-report.json
'
const
data
=
fs
.
readFileSync
(
file
)
const
responseData
=
await
s3Client
.
send
(
new
PutObjectCommand
({
Bucket
:
'
gl-logs-for-panther-test
'
,
Key
:
path
.
join
(
'
package_hunter_test
'
,
path
.
basename
(
file
)),
Body
:
data
,
ContentMD5
:
getMD5HashFromFile
(
data
),
}),
)
console
.
log
(
'
Successfully uploaded %s
'
,
file
)
}
catch
(
err
)
{
if
(
err
.
name
===
'
CredentialsProviderError
'
||
err
.
name
===
'
AuthorizationHeaderMalformed
'
)
console
.
log
(
'
Could not upload the report. Are AWS credentials configured in ~/.aws/credentials?
'
)
else
console
.
log
(
'
Unexpected error during upload.
'
)
process
.
exit
(
1
)
}
})()
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