Exemple #1
0
def test_JSerializableExploit():
    """Test that we cannot execute arbitrary code with JENcode"""

    exploit = '{"__dCls": "exit", "__dMod": "sys"}'

    with raises(TypeError):
        jsonDecode(exploit)
Exemple #2
0
def test_nonDeclaredAttr():
    """ Tests that an argument not in the list of arguments to serialized
      is not serialized
  """

    objData = Serializable()
    objData.notToBeSerialized = 1

    encodedData = jsonEncode(objData)
    decodedData, _lenData = jsonDecode(encodedData)

    assert not hasattr(decodedData, 'notToBeSerialized')
Exemple #3
0
def test_nonDeclaredAttr():
  """ Tests that an argument not in the list of arguments to serialized
      is not serialized
  """

  objData = Serializable()
  objData.notToBeSerialized = 1

  encodedData = jsonEncode(objData)
  decodedData, _lenData = jsonDecode(encodedData)

  assert not hasattr(decodedData, 'notToBeSerialized')