summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9577d0b)
The yaml.load() function can run arbitrary code, the safe_load() variant only
understands a safe subset of YAML which is enough for dak.
from os.path import isfile, join, splitext
from re import findall, DOTALL, MULTILINE
from sys import stderr
from os.path import isfile, join, splitext
from re import findall, DOTALL, MULTILINE
from sys import stderr
-from yaml import load, safe_dump
+from yaml import safe_load, safe_dump
from daklib import utils
from daklib.dbconn import DBConn, get_suite_architectures, Suite, Architecture
from daklib import utils
from daklib.dbconn import DBConn, get_suite_architectures, Suite, Architecture
global stats
try:
with open(yaml, 'r') as fd:
global stats
try:
with open(yaml, 'r') as fd:
except IOError:
pass
if not stats:
except IOError:
pass
if not stats:
sourcecontent = sourcefile.read()
failure = False
try:
sourcecontent = sourcefile.read()
failure = False
try:
- trans = yaml.load(sourcecontent)
+ trans = yaml.safe_load(sourcecontent)
except yaml.YAMLError as exc:
# Someone fucked it up
print "ERROR: %s" % (exc)
except yaml.YAMLError as exc:
# Someone fucked it up
print "ERROR: %s" % (exc)
temp_lock = lock_file(trans_temp)
destfile = file(trans_temp, 'w')
temp_lock = lock_file(trans_temp)
destfile = file(trans_temp, 'w')
- yaml.dump(from_trans, destfile, default_flow_style=False)
+ yaml.safe_dump(from_trans, destfile, default_flow_style=False)
destfile.close()
os.rename(trans_temp, trans_file)
destfile.close()
os.rename(trans_temp, trans_file)
(fd, path) = tempfile.mkstemp("", "transitions", Cnf["Dir::TempPath"])
os.chmod(path, 0o644)
f = open(path, "w")
(fd, path) = tempfile.mkstemp("", "transitions", Cnf["Dir::TempPath"])
os.chmod(path, 0o644)
f = open(path, "w")
- yaml.dump(transitions, f, default_flow_style=False)
+ yaml.safe_dump(transitions, f, default_flow_style=False)
return path
################################################################################
return path
################################################################################
contents = file(path, 'r').read()
try:
contents = file(path, 'r').read()
try:
- transitions = yaml.load(contents)
+ transitions = yaml.safe_load(contents)
return transitions
except yaml.YAMLError as msg:
utils.warn('Not checking transitions, the transitions file is broken: {0}'.format(msg))
return transitions
except yaml.YAMLError as msg:
utils.warn('Not checking transitions, the transitions file is broken: {0}'.format(msg))
with open(tagfile, 'r') as sourcefile:
sourcecontent = sourcefile.read()
try:
with open(tagfile, 'r') as sourcefile:
sourcecontent = sourcefile.read()
try:
- lintiantags = yaml.load(sourcecontent)['lintian']
+ lintiantags = yaml.safe_load(sourcecontent)['lintian']
except yaml.YAMLError as msg:
raise Exception('Could not read lintian tags file {0}, YAML error: {1}'.format(tagfile, msg))
except yaml.YAMLError as msg:
raise Exception('Could not read lintian tags file {0}, YAML error: {1}'.format(tagfile, msg))
from sqlalchemy.sql.expression import desc
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.sql.expression import desc
from sqlalchemy.orm.exc import NoResultFound
from dak_exceptions import *
from changes import *
from regexes import *
from dak_exceptions import *
from changes import *
from regexes import *