You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
that Nazgul supports a config.py. Could you provide an sample/example one?
This repo should probably have https://pyup.io/ set-up to ensure dependencies do not get out of date.
data.sql appears to only contain a schema. It may be better called schema.sql? You could also consider using alembic to manage it, but it's probably overkill here.
A 500 status code would be more appropriate in any place where you have an "Unknown error". Returning a 400 is a client error, and is usually reserved for when you know the client has made a mistake (for example, if they pass the wrong type for an argument).
Using autocommit is probably a bad idea, because it will commit after each statement. Doing this means that any API call that updates/inserts/deletes multiple rows could possibly commit only part of the request, which may cause an invalid or unknown state in the database. You should use transactions to ensure that each request is all or nothing. https://docs.sqlalchemy.org/en/13/orm/session_transaction.html
Is there any way to run this locally? docker run complains about MySQL not being available.
I see the API is using xml responses. Is this required for backwards compatibility, or was it chosen for some other reason? If the latter, JSON would probably be a better choice.
Similarly, it would be more convenient/modern to use JSON for POST data. Uusing request.form means that clients must use x-www-form-urlencoded.
(@jbuck asked me to have a look at this, it seems like an issue is the easiest way to comment on the overall repo)
There's a couple of things that I definitely think need fixing:
hashincan help you easily add them to the file.SECRET_KEYis always set todev(https://github.com/mozilla-services/bouncer-admin/blob/master/nazgul/__init__.py#L9). I imagine this is intended to be overridden in production, but it would be safer to set that default in theelsebranch a bit further down.x-www-form-urlencodedwould fix this, as you could safely pass JSON objects and decode them into strings/lists/dicts.And there's some other questions/comments. Whether or not you address them is up to you and @jbuck as far as I'm concerned:
bouncer-admin/nazgul/__init__.py
Line 13 in 566d102
data.sqlappears to only contain a schema. It may be better calledschema.sql? You could also consider usingalembicto manage it, but it's probably overkill here.autocommitis probably a bad idea, because it will commit after each statement. Doing this means that any API call that updates/inserts/deletes multiple rows could possibly commit only part of the request, which may cause an invalid or unknown state in the database. You should use transactions to ensure that each request is all or nothing. https://docs.sqlalchemy.org/en/13/orm/session_transaction.htmldocker runcomplains about MySQL not being available.request.formmeans that clients must usex-www-form-urlencoded.