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

Coverity-report-output-v7-json Demo #14

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
35 changes: 13 additions & 22 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Simple Detect Workflow
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
name: Simple Coverity Workflow
on: [pull_request]

jobs:
build:
runs-on: macos
runs-on: rich
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
- name: Coverity Capture
run: '${{ secrets.RO_COVERITY_PATH }}/cov-capture --dir idir --source-dir .'
- name: Coverity Analyze
run: '${{ secrets.RO_COVERITY_PATH }}/cov-analyze --dir idir'
- name: Coverity Format Errors
run: '${{ secrets.RO_COVERITY_PATH }}/cov-format-errors --dir idir --json-output-v7 output.json'
- name: Coverity Report
uses: synopsys-sig/coverity-report-output-v7-json@main
with:
java-version: '11'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Synopsys Detect
uses: synopsys-sig/detect-action@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
detect-version: 7.7.0
blackduck-url: ${{ secrets.BLACKDUCK_URL }}
blackduck-api-token: ${{ secrets.BLACKDUCK_API_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
json-file-path: output.json
24 changes: 24 additions & 0 deletions bad_cert_demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var tls = require('tls');
var https = require('https');

var socket1 = tls.connect({
port: 1337,
host: 'https://example1.com',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
host: 'https://example1.com',
host: 'https://example2.com',

rejectUnauthorized: true,
checkServerIdentity: function(servername, peer) {
const good = '77:53:28:AD:42:B1:04:F7:49:2B:C7:C7:7B:2A:84:64:EA:0B:1F:CE';
const bad = 'mismatch';
console.log('Woohoo, www.google.com is using our pinned fingerprint');
return undefined;
}}, () => {
console.log('client connected');
});

socket1.on('error', (data)=> {
console.log(data);
});

var req = https.request({port: 1336, host: 'https://example2.com', rejectUnauthorized: false}, function(){
console.log('client connected');
});

38 changes: 38 additions & 0 deletions deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Resources:
ElasticsearchDomain:
Type: AWS::Elasticsearch::Domain
Properties:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity Issue - Insecure TLS version

The Amazon Elasticsearch Service (Amazon ES) domain supports TLS 1.0.

Low Impact, CWE-327
SIGMA.insecure_tls_version_cloudformation_elastic_search

How to fix

Configure the ElasticSearch service domain to require TLS 1.2 or newer by explicitly setting the Properties.DomainEndpointOptions.TLSSecurityPolicy value to Policy-Min-TLS-1-2-2019-07.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity Issue - Missing TLS

The Amazon Elasticsearch Service (Amazon ES) domain does not enforce HTTPS connections, exposing data in transit.

High Impact, CWE-319
SIGMA.missing_tls_cloudformation_elastic_search

How to fix

Explicitly set the Properties.DomainEndpointOptions.EnforceHTTPS value to true to require HTTPS for all connections.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity Issue - Missing TLS

The Amazon Elasticsearch Service (Amazon ES) domain does not use TLS for node-to-node encryption within the VPC.

Low Impact, CWE-319
SIGMA.missing_tls_cloudformation_elastic_search_node_to_node

How to fix

Enable node-to-node encryption by explicitly setting the Properties.NodeToNodeEncryptionOptions.Enabled value to true.

DomainName: "test"
ElasticsearchClusterConfig:
DedicatedMasterEnabled: true
InstanceCount: 2
ZoneAwarenessEnabled: true
InstanceType: "m3.medium.elasticsearch"
DedicatedMasterType: "m3.medium.elasticsearch"
DedicatedMasterCount: 3
EncryptionAtRestOptions:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity Issue - Disk-level encryption is disabled

The Amazon ElasticSearch Domain does not have encryption enabled for data at rest.

Medium Impact, CWE-313
SIGMA.disk_encryption_disabled_cloudformation_elastic_search

How to fix

Enable encryption for data at rest by explicitly setting the Properties.EncryptionAtRestOptions.Enabled value to true.

Enabled: false
EBSOptions:
EBSEnabled: true
Iops: 0
VolumeSize: 20
VolumeType: "gp2"
SnapshotOptions:
AutomatedSnapshotStartHour: 0
AccessPolicies:
Version: '2012-10-17'
Statement:
- Effect: Deny
Principal:
AWS: '*'
Action: 'es:*'
Resource: '*'
LogPublishingOptions:
SEARCH_SLOW_LOGS:
CloudWatchLogsLogGroupArn: >-
arn:aws:logs:us-east-1:123456789012:log-group:/aws/aes/domains/es-slow-logs
Enabled: true
INDEX_SLOW_LOGS:
CloudWatchLogsLogGroupArn: >-
arn:aws:logs:us-east-1:123456789012:log-group:/aws/aes/domains/es-slow-logs
Enabled: true