Skip to content

Commit 8e54411

Browse files
authored
Update the Python Client Flight Example to use a config file instead of command line arguments (dremio-hub#54)
* Add precommit hooks * Run pre-commit hook. Skip running bandit plugins on test. * Update to read config file instead of command line arguments. * Update tests to accomodate changes to DremioFlightEndpointConnection. * Update Readme. * Update QUICKSTART.md to reflect changes. * Update config_template.yaml to give session properties example. * Update parse.py based on comments. * Modify convert_session_properties to use more functional programming approach. * Remove unnecessary variable declaration. * Update ReadMe with assumption users are not cloning repo. * Rewrite parse.py to be more functional when possible. validate_required_options remains imperative because we want to iterate through the required options dictionary comparing to the config dictionary which is not a singleton. * Rename function based on feedback. Renamed _check_option_type_is_expected to _is_option_type_valid_or_throw for better readability. * Update QUICKSTART to match README
1 parent 9221f93 commit 8e54411

18 files changed

Lines changed: 810 additions & 223 deletions

File tree

.bandit.yml

Lines changed: 397 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,397 @@
1+
### Bandit config file generated from:
2+
3+
### This config may optionally select a subset of tests to run or skip by
4+
### filling out the 'tests' and 'skips' lists given below. If no tests are
5+
### specified for inclusion then it is assumed all tests are desired. The skips
6+
### set will remove specific tests from the include set. This can be controlled
7+
### using the -t/-s CLI options. Note that the same test ID should not appear
8+
### in both 'tests' and 'skips', this would be nonsensical and is detected by
9+
### Bandit at runtime.
10+
11+
# Available tests:
12+
# B101 : assert_used
13+
# B102 : exec_used
14+
# B103 : set_bad_file_permissions
15+
# B104 : hardcoded_bind_all_interfaces
16+
# B105 : hardcoded_password_string
17+
# B106 : hardcoded_password_funcarg
18+
# B107 : hardcoded_password_default
19+
# B108 : hardcoded_tmp_directory
20+
# B110 : try_except_pass
21+
# B112 : try_except_continue
22+
# B201 : flask_debug_true
23+
# B301 : pickle
24+
# B302 : marshal
25+
# B303 : md5
26+
# B304 : ciphers
27+
# B305 : cipher_modes
28+
# B306 : mktemp_q
29+
# B307 : eval
30+
# B308 : mark_safe
31+
# B309 : httpsconnection
32+
# B310 : urllib_urlopen
33+
# B311 : random
34+
# B312 : telnetlib
35+
# B313 : xml_bad_cElementTree
36+
# B314 : xml_bad_ElementTree
37+
# B315 : xml_bad_expatreader
38+
# B316 : xml_bad_expatbuilder
39+
# B317 : xml_bad_sax
40+
# B318 : xml_bad_minidom
41+
# B319 : xml_bad_pulldom
42+
# B320 : xml_bad_etree
43+
# B321 : ftplib
44+
# B323 : unverified_context
45+
# B324 : hashlib_insecure_functions
46+
# B325 : tempnam
47+
# B401 : import_telnetlib
48+
# B402 : import_ftplib
49+
# B403 : import_pickle
50+
# B404 : import_subprocess
51+
# B405 : import_xml_etree
52+
# B406 : import_xml_sax
53+
# B407 : import_xml_expat
54+
# B408 : import_xml_minidom
55+
# B409 : import_xml_pulldom
56+
# B410 : import_lxml
57+
# B411 : import_xmlrpclib
58+
# B412 : import_httpoxy
59+
# B413 : import_pycrypto
60+
# B415 : import_pyghmi
61+
# B501 : request_with_no_cert_validation
62+
# B502 : ssl_with_bad_version
63+
# B503 : ssl_with_bad_defaults
64+
# B504 : ssl_with_no_version
65+
# B505 : weak_cryptographic_key
66+
# B506 : yaml_load
67+
# B507 : ssh_no_host_key_verification
68+
# B508 : snmp_insecure_version
69+
# B509 : snmp_weak_cryptography
70+
# B601 : paramiko_calls
71+
# B602 : subprocess_popen_with_shell_equals_true
72+
# B603 : subprocess_without_shell_equals_true
73+
# B604 : any_other_function_with_shell_equals_true
74+
# B605 : start_process_with_a_shell
75+
# B606 : start_process_with_no_shell
76+
# B607 : start_process_with_partial_path
77+
# B608 : hardcoded_sql_expressions
78+
# B609 : linux_commands_wildcard_injection
79+
# B610 : django_extra_used
80+
# B611 : django_rawsql_used
81+
# B701 : jinja2_autoescape_false
82+
# B702 : use_of_mako_templates
83+
# B703 : django_mark_safe
84+
85+
# (optional) list included test IDs here, eg '[B101, B406]':
86+
tests:
87+
88+
# (optional) list skipped test IDs here, eg '[B101, B406]':
89+
skips:
90+
91+
### (optional) plugin settings - some test plugins require configuration data
92+
### that may be given here, per-plugin. All bandit test plugins have a built in
93+
### set of sensible defaults and these will be used if no configuration is
94+
### provided. It is not necessary to provide settings for every (or any) plugin
95+
### if the defaults are acceptable.
96+
97+
exclude_dirs: ["tests"]
98+
any_other_function_with_shell_equals_true:
99+
no_shell:
100+
- os.execl
101+
- os.execle
102+
- os.execlp
103+
- os.execlpe
104+
- os.execv
105+
- os.execve
106+
- os.execvp
107+
- os.execvpe
108+
- os.spawnl
109+
- os.spawnle
110+
- os.spawnlp
111+
- os.spawnlpe
112+
- os.spawnv
113+
- os.spawnve
114+
- os.spawnvp
115+
- os.spawnvpe
116+
- os.startfile
117+
shell:
118+
- os.system
119+
- os.popen
120+
- os.popen2
121+
- os.popen3
122+
- os.popen4
123+
- popen2.popen2
124+
- popen2.popen3
125+
- popen2.popen4
126+
- popen2.Popen3
127+
- popen2.Popen4
128+
- commands.getoutput
129+
- commands.getstatusoutput
130+
subprocess:
131+
- subprocess.Popen
132+
- subprocess.call
133+
- subprocess.check_call
134+
- subprocess.check_output
135+
- subprocess.run
136+
hardcoded_tmp_directory:
137+
tmp_dirs:
138+
- /tmp
139+
- /var/tmp
140+
- /dev/shm
141+
linux_commands_wildcard_injection:
142+
no_shell:
143+
- os.execl
144+
- os.execle
145+
- os.execlp
146+
- os.execlpe
147+
- os.execv
148+
- os.execve
149+
- os.execvp
150+
- os.execvpe
151+
- os.spawnl
152+
- os.spawnle
153+
- os.spawnlp
154+
- os.spawnlpe
155+
- os.spawnv
156+
- os.spawnve
157+
- os.spawnvp
158+
- os.spawnvpe
159+
- os.startfile
160+
shell:
161+
- os.system
162+
- os.popen
163+
- os.popen2
164+
- os.popen3
165+
- os.popen4
166+
- popen2.popen2
167+
- popen2.popen3
168+
- popen2.popen4
169+
- popen2.Popen3
170+
- popen2.Popen4
171+
- commands.getoutput
172+
- commands.getstatusoutput
173+
subprocess:
174+
- subprocess.Popen
175+
- subprocess.call
176+
- subprocess.check_call
177+
- subprocess.check_output
178+
- subprocess.run
179+
ssl_with_bad_defaults:
180+
bad_protocol_versions:
181+
- PROTOCOL_SSLv2
182+
- SSLv2_METHOD
183+
- SSLv23_METHOD
184+
- PROTOCOL_SSLv3
185+
- PROTOCOL_TLSv1
186+
- SSLv3_METHOD
187+
- TLSv1_METHOD
188+
ssl_with_bad_version:
189+
bad_protocol_versions:
190+
- PROTOCOL_SSLv2
191+
- SSLv2_METHOD
192+
- SSLv23_METHOD
193+
- PROTOCOL_SSLv3
194+
- PROTOCOL_TLSv1
195+
- SSLv3_METHOD
196+
- TLSv1_METHOD
197+
start_process_with_a_shell:
198+
no_shell:
199+
- os.execl
200+
- os.execle
201+
- os.execlp
202+
- os.execlpe
203+
- os.execv
204+
- os.execve
205+
- os.execvp
206+
- os.execvpe
207+
- os.spawnl
208+
- os.spawnle
209+
- os.spawnlp
210+
- os.spawnlpe
211+
- os.spawnv
212+
- os.spawnve
213+
- os.spawnvp
214+
- os.spawnvpe
215+
- os.startfile
216+
shell:
217+
- os.system
218+
- os.popen
219+
- os.popen2
220+
- os.popen3
221+
- os.popen4
222+
- popen2.popen2
223+
- popen2.popen3
224+
- popen2.popen4
225+
- popen2.Popen3
226+
- popen2.Popen4
227+
- commands.getoutput
228+
- commands.getstatusoutput
229+
subprocess:
230+
- subprocess.Popen
231+
- subprocess.call
232+
- subprocess.check_call
233+
- subprocess.check_output
234+
- subprocess.run
235+
start_process_with_no_shell:
236+
no_shell:
237+
- os.execl
238+
- os.execle
239+
- os.execlp
240+
- os.execlpe
241+
- os.execv
242+
- os.execve
243+
- os.execvp
244+
- os.execvpe
245+
- os.spawnl
246+
- os.spawnle
247+
- os.spawnlp
248+
- os.spawnlpe
249+
- os.spawnv
250+
- os.spawnve
251+
- os.spawnvp
252+
- os.spawnvpe
253+
- os.startfile
254+
shell:
255+
- os.system
256+
- os.popen
257+
- os.popen2
258+
- os.popen3
259+
- os.popen4
260+
- popen2.popen2
261+
- popen2.popen3
262+
- popen2.popen4
263+
- popen2.Popen3
264+
- popen2.Popen4
265+
- commands.getoutput
266+
- commands.getstatusoutput
267+
subprocess:
268+
- subprocess.Popen
269+
- subprocess.call
270+
- subprocess.check_call
271+
- subprocess.check_output
272+
- subprocess.run
273+
start_process_with_partial_path:
274+
no_shell:
275+
- os.execl
276+
- os.execle
277+
- os.execlp
278+
- os.execlpe
279+
- os.execv
280+
- os.execve
281+
- os.execvp
282+
- os.execvpe
283+
- os.spawnl
284+
- os.spawnle
285+
- os.spawnlp
286+
- os.spawnlpe
287+
- os.spawnv
288+
- os.spawnve
289+
- os.spawnvp
290+
- os.spawnvpe
291+
- os.startfile
292+
shell:
293+
- os.system
294+
- os.popen
295+
- os.popen2
296+
- os.popen3
297+
- os.popen4
298+
- popen2.popen2
299+
- popen2.popen3
300+
- popen2.popen4
301+
- popen2.Popen3
302+
- popen2.Popen4
303+
- commands.getoutput
304+
- commands.getstatusoutput
305+
subprocess:
306+
- subprocess.Popen
307+
- subprocess.call
308+
- subprocess.check_call
309+
- subprocess.check_output
310+
- subprocess.run
311+
subprocess_popen_with_shell_equals_true:
312+
no_shell:
313+
- os.execl
314+
- os.execle
315+
- os.execlp
316+
- os.execlpe
317+
- os.execv
318+
- os.execve
319+
- os.execvp
320+
- os.execvpe
321+
- os.spawnl
322+
- os.spawnle
323+
- os.spawnlp
324+
- os.spawnlpe
325+
- os.spawnv
326+
- os.spawnve
327+
- os.spawnvp
328+
- os.spawnvpe
329+
- os.startfile
330+
shell:
331+
- os.system
332+
- os.popen
333+
- os.popen2
334+
- os.popen3
335+
- os.popen4
336+
- popen2.popen2
337+
- popen2.popen3
338+
- popen2.popen4
339+
- popen2.Popen3
340+
- popen2.Popen4
341+
- commands.getoutput
342+
- commands.getstatusoutput
343+
subprocess:
344+
- subprocess.Popen
345+
- subprocess.call
346+
- subprocess.check_call
347+
- subprocess.check_output
348+
- subprocess.run
349+
subprocess_without_shell_equals_true:
350+
no_shell:
351+
- os.execl
352+
- os.execle
353+
- os.execlp
354+
- os.execlpe
355+
- os.execv
356+
- os.execve
357+
- os.execvp
358+
- os.execvpe
359+
- os.spawnl
360+
- os.spawnle
361+
- os.spawnlp
362+
- os.spawnlpe
363+
- os.spawnv
364+
- os.spawnve
365+
- os.spawnvp
366+
- os.spawnvpe
367+
- os.startfile
368+
shell:
369+
- os.system
370+
- os.popen
371+
- os.popen2
372+
- os.popen3
373+
- os.popen4
374+
- popen2.popen2
375+
- popen2.popen3
376+
- popen2.popen4
377+
- popen2.Popen3
378+
- popen2.Popen4
379+
- commands.getoutput
380+
- commands.getstatusoutput
381+
subprocess:
382+
- subprocess.Popen
383+
- subprocess.call
384+
- subprocess.check_call
385+
- subprocess.check_output
386+
- subprocess.run
387+
try_except_continue:
388+
check_typed_exception: false
389+
try_except_pass:
390+
check_typed_exception: false
391+
weak_cryptographic_key:
392+
weak_key_size_dsa_high: 1024
393+
weak_key_size_dsa_medium: 2048
394+
weak_key_size_ec_high: 160
395+
weak_key_size_ec_medium: 224
396+
weak_key_size_rsa_high: 1024
397+
weak_key_size_rsa_medium: 2048

0 commit comments

Comments
 (0)