Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server error on update api related to updating tags #1

Open
seanmcfeely opened this issue Dec 10, 2019 · 1 comment
Open

Server error on update api related to updating tags #1

seanmcfeely opened this issue Dec 10, 2019 · 1 comment

Comments

@seanmcfeely
Copy link

seanmcfeely commented Dec 10, 2019

Trying to update an existing indicators tags caused the server to have an error.

removing tag from indicator: whitelist:e2w
2019-12-10 16:11:38,977 - root - [WARNING] Empty list is not handled by SIP API. Will cause schema: [] is too short. Putting in 'sipit-exception-tag:remove me'
updating status of 212946 to Informational
{'tags': ['sipit-exception-tag:remove-me'], 'status': 'Informational'}
Traceback (most recent call last):
  File "./sipit.py", line 261, in <module>
    results = sip_client.put('/api/indicators/{}'.format(args.id),data)
  File "/usr/local/lib/python3.6/dist-packages/pysip/pysip.py", line 142, in put
    raise RequestError(request.text)
pysip.pysip.RequestError: {"error":"Internal Server Error","msg":"Internal server error"}

Exception from SIP Server logs:

[2019-12-10 21:12:25,865] ERROR in app: Exception on /api/indicators/212946 [PUT]
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2311, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1834, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1737, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 36, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1832, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1818, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/src/app/project/api/decorators.py", line 74, in decorated_function
    return function(*args, **kwargs)
  File "/usr/src/app/project/api/decorators.py", line 136, in decorated_function
    return function(*args, **kwargs)
  File "/usr/src/app/project/api/decorators.py", line 154, in decorated_function
    return function(*args, **kwargs)
  File "/usr/src/app/project/api/routes/indicator.py", line 1405, in update_indicator
    db.session.commit()
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/scoping.py", line 162, in do
    return getattr(self.registry(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 1026, in commit
    self.transaction.commit()
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 493, in commit
    self._prepare_impl()
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 472, in _prepare_impl
    self.session.flush()
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2458, in flush
    self._flush(objects)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2596, in _flush
    transaction.rollback(_capture_exception=True)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 129, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2556, in _flush
    flush_context.execute()
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute
    rec.execute(self)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 540, in execute
    self.dependency_processor.process_saves(uow, states)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/dependency.py", line 1124, in process_saves
    state, child, associationrow, False, uowcommit, "add"
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/dependency.py", line 1239, in _synchronize
    self._verify_canload(child)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/dependency.py", line 253, in _verify_canload
    "collection %s" % (self.prop,)
sqlalchemy.orm.exc.FlushError: Can't flush None value found in collection Indicator.tags
@seanmcfeely
Copy link
Author

Another tag related error I'm appending to this.. most likely two different errors.

$ sipit create -v 'this is a test DONE DIP' -t String\ -\ HTML --source OSINT -r 'smcfeely testing' --tags cats,cats
{'type': 'String - HTML', 'status': 'New', 'confidence': 'unknown', 'impact': 'unknown', 'value': 'this is a test DONE DIP', 'references': [{'source': 'OSINT', 'reference': 'smcfeely testing'}], 'username': 'smcfeely', 'case_sensitive': False, 'tags': ['cats', 'cats']}
Traceback (most recent call last):
  File "/usr/local/bin/sipit", line 456, in <module>
    print(sip_client.post('/api/indicators',data))
  File "/usr/local/lib/python3.6/dist-packages/pysip/pysip.py", line 81, in post
    raise RequestError(request.text)
pysip.pysip.RequestError: {"error":"Internal Server Error","msg":"Internal server error"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant