File tree Expand file tree Collapse file tree 8 files changed +61
-7
lines changed
kubernetes-api/src/client Expand file tree Collapse file tree 8 files changed +61
-7
lines changed Original file line number Diff line number Diff line change
1
+ # Title for the gitleaks configuration file.
2
+ title = " Gitleaks Configuration"
3
+
4
+ # Extend the base (this) configuration. When you extend a configuration
5
+ # the base rules take precedence over the extended rules. I.e., if there are
6
+ # duplicate rules in both the base configuration and the extended configuration
7
+ # the base rules will override the extended rules.
8
+ # Another thing to know with extending configurations is you can chain together
9
+ # multiple configuration files to a depth of 2. Allowlist arrays are appended
10
+ # and can contain duplicates.
11
+ # useDefault and path can NOT be used at the same time. Choose one.
12
+ [extend ]
13
+ # useDefault will extend the base configuration with the default gitleaks config:
14
+ # https://github.com/zricethezav/gitleaks/blob/master/config/gitleaks.toml
15
+ useDefault = true
16
+
17
+ # This is a global allowlist which has a higher order of precedence than rule-specific allowlists.
18
+ # If a commit listed in the `commits` field below is encountered then that commit will be skipped and no
19
+ # secrets will be detected for said commit. The same logic applies for regexes and paths.
20
+ [allowlist ]
21
+ description = " Ignore False-Positives"
22
+ paths = [
23
+ ''' .yarn/.*''' ,
24
+ ''' packages/oauth/src/form/jwt-decode.test.ts'''
25
+ ]
Original file line number Diff line number Diff line change
1
+ exclude:
2
+ global:
3
+ # Exclude all development webpack build config files
4
+ - "webpack.config.dev.js"
5
+ - "webpack.config.js"
Original file line number Diff line number Diff line change 32
32
}
33
33
34
34
kube_binary () {
35
- local k=$( command -v ${1} 2> /dev/null)
35
+ local k
36
+ k=$( command -v ${1} 2> /dev/null)
36
37
if [ $? != 0 ]; then
37
38
return
38
39
fi
Original file line number Diff line number Diff line change 18
18
}
19
19
20
20
kube_binary () {
21
- local k=$( command -v ${1} 2> /dev/null)
21
+ local k
22
+ k=$( command -v ${1} 2> /dev/null)
22
23
if [ $? != 0 ]; then
23
24
return
24
25
fi
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
3
- # Fail on a single failed command in a pipeline (if supported)
4
- (set -o | grep -q pipefail) && set -o pipefail
5
-
6
3
# Fail on error and undefined vars
7
4
set -eu
8
5
@@ -45,7 +42,7 @@ generate_nginx_gateway_conf() {
45
42
' < $TEMPLATE > /etc/nginx/conf.d/nginx.conf
46
43
}
47
44
48
- if [ -v HAWTIO_ONLINE_RBAC_ACL ]; then
45
+ if [ -n " ${ HAWTIO_ONLINE_RBAC_ACL+x} " ]; then
49
46
echo Using RBAC NGINX configuration
50
47
generate_nginx_gateway_conf
51
48
elif [ " ${HAWTIO_ONLINE_GATEWAY:- } " = " true" ]; then
Original file line number Diff line number Diff line change @@ -65,7 +65,25 @@ export class WSHandlerImpl<T extends KubeObject> implements WSHandler<T> {
65
65
ws . addEventListener ( 'open' , ( event : Event ) => self . onOpen ( event ) )
66
66
67
67
log . debug ( "Adding WebSocket event handler for 'message'" )
68
- ws . addEventListener ( 'message' , ( event : MessageEvent ) => self . onMessage ( event ) )
68
+ ws . addEventListener ( 'message' , ( event : MessageEvent ) => {
69
+ if ( ! event . origin || event . origin . length === 0 ) {
70
+ log . warn ( 'Ignoring WebSocket message as origin is not defined' )
71
+ return
72
+ }
73
+
74
+ try {
75
+ const originUrl = new URL ( event . origin )
76
+ if ( ! window . location || window . location . hostname !== originUrl . hostname ) {
77
+ log . warn ( 'The origin of the WebSocket message is not recognized' )
78
+ return
79
+ }
80
+ } catch ( error ) {
81
+ log . warn ( 'The origin of the WebSocket message is invalid' , error )
82
+ return
83
+ }
84
+
85
+ self . onMessage ( event )
86
+ } )
69
87
70
88
log . debug ( "Adding WebSocket event handler for 'close'" )
71
89
ws . addEventListener ( 'close' , ( event : CloseEvent ) => self . onClose ( event ) )
Original file line number Diff line number Diff line change @@ -291,6 +291,9 @@ module.exports = () => {
291
291
292
292
// Adds the Clear-Site-Data header
293
293
res . header ( 'Clear-Site-Data' , '"*"' )
294
+
295
+ // False-positive for coverity SAST scan
296
+ // Ignored since this is just the dev server
294
297
res . redirect ( r )
295
298
}
296
299
} )
Original file line number Diff line number Diff line change @@ -2,12 +2,16 @@ import { jwtDecode } from './jwt-decode'
2
2
3
3
describe ( 'decode' , ( ) => {
4
4
test ( 'not JWT token' , ( ) => {
5
+ // False-positive for coverity SAST scan
6
+ // Ignored in .gitleaks.toml as this is just a unit-test
5
7
const token = 'c3ViamVjdDpvYmplY3Q6dGVzdA=='
6
8
expect ( ( ) => jwtDecode ( token ) ) . toThrowError ( )
7
9
} )
8
10
9
11
test ( 'JWT token' , ( ) => {
10
12
const expected = { iat : 1516239022 , name : 'John Doe' , sub : '1234567890' }
13
+ // False-positive for coverity SAST scan
14
+ // Ignored in .gitleaks.toml as this is just a unit-test
11
15
const token =
12
16
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
13
17
const decoded = jwtDecode ( token )
You can’t perform that action at this time.
0 commit comments