Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit59ee944

Browse files
committed
Remove read_file/write_file tests. These were originally intended to
*fail*, to test that plpython didn't allow untrusted operations.When we changed plpython to plpythonu because python didn't actually havea secure sandbox mode, someone (probably me :-() misinterpreted the testsas checking whether Python's file I/O works. Which is a stupid thing forus to be testing. Remove it so we don't clutter the filesystem withrandom temporary files.
1 parent9d7c005 commit59ee944

File tree

4 files changed

+0
-33
lines changed

4 files changed

+0
-33
lines changed

‎src/pl/plpython/expected/plpython_error.out

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,3 @@ SELECT valid_type('rick');
1919

2020
(1 row)
2121

22-
-- Security sandbox tests
23-
SELECT write_file('/tmp/plpython','Only trusted users should be able to do this!');
24-
write_file
25-
------------------------------
26-
Wrote to file: /tmp/plpython
27-
(1 row)
28-
29-
SELECT read_file('/tmp/plpython');
30-
read_file
31-
-----------------------------------------------
32-
Only trusted users should be able to do this!
33-
(1 row)
34-

‎src/pl/plpython/expected/plpython_function.out

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,6 @@ for r in rv:
255255
return seq
256256
'
257257
LANGUAGE plpythonu;
258-
CREATE OR REPLACE FUNCTION read_file(text) RETURNS text AS '
259-
return open(args[0]).read()
260-
' LANGUAGE plpythonu;
261-
CREATE OR REPLACE FUNCTION write_file(text,text) RETURNS text AS '
262-
open(args[0],"w").write(args[1])
263-
return "Wrote to file: %s" % args[0]
264-
' LANGUAGE plpythonu;
265258
--
266259
-- Universal Newline Support
267260
--

‎src/pl/plpython/sql/plpython_error.sql

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,3 @@ SELECT invalid_type_uncaught('rick');
77
SELECT invalid_type_caught('rick');
88
SELECT invalid_type_reraised('rick');
99
SELECT valid_type('rick');
10-
11-
-- Security sandbox tests
12-
SELECT write_file('/tmp/plpython','Only trusted users should be able to do this!');
13-
SELECT read_file('/tmp/plpython');

‎src/pl/plpython/sql/plpython_function.sql

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,6 @@ return seq
298298
'
299299
LANGUAGE plpythonu;
300300

301-
CREATE OR REPLACEFUNCTIONread_file(text) RETURNStextAS'
302-
return open(args[0]).read()
303-
' LANGUAGE plpythonu;
304-
305-
CREATE OR REPLACEFUNCTIONwrite_file(text,text) RETURNStextAS'
306-
open(args[0],"w").write(args[1])
307-
return "Wrote to file: %s" % args[0]
308-
' LANGUAGE plpythonu;
309-
310301
--
311302
-- Universal Newline Support
312303
--

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp