)]}'
{"barbican/api/controllers/secrets.py":[{"author":{"_account_id":9234,"name":"Steve Heyman","email":"steve@heyman.com","username":"hockeynut"},"change_message_id":"cacd9e143256b0e305392c30574ba42403d570d2","unresolved":false,"context_lines":[{"line_number":135,"context_line":""},{"line_number":136,"context_line":"        plugin.store_secret(payload, content_type,"},{"line_number":137,"context_line":"                            content_encoding,"},{"line_number":138,"context_line":"                            secret_model.to_dict_fields(),"},{"line_number":139,"context_line":"                            secret_model, tenant_model, self.repos)"},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"    @index.when(method\u003d\u0027DELETE\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_1df08c91","line":138,"updated":"2014-07-30 16:31:18.000000000","message":"just curious why this was reflowed?","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"93560ad99759aef0b46acbd159ace4fb0225b6ce","unresolved":false,"context_lines":[{"line_number":135,"context_line":""},{"line_number":136,"context_line":"        plugin.store_secret(payload, content_type,"},{"line_number":137,"context_line":"                            content_encoding,"},{"line_number":138,"context_line":"                            secret_model.to_dict_fields(),"},{"line_number":139,"context_line":"                            secret_model, tenant_model, self.repos)"},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"    @index.when(method\u003d\u0027DELETE\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_e8c14631","line":138,"in_reply_to":"baada198_1df08c91","updated":"2014-07-31 02:07:05.000000000","message":"In an earlier patch, this call was changed.  By this iteration, the code was changed back, but the indentation had changed.  I\u0027ll restore the original indentation so as not to confuse things.","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":6783,"name":"Nathan Reller","email":"nathan.s.reller@gmail.com","username":"rellerreller"},"change_message_id":"328b0ba94d4bf6637c048ed447a3821486b55464","unresolved":false,"context_lines":[{"line_number":260,"context_line":"        if transport_key_model is not None:"},{"line_number":261,"context_line":"            tkey_url \u003d hrefs.convert_transport_key_to_href("},{"line_number":262,"context_line":"                keystone_id, transport_key_model.id)"},{"line_number":263,"context_line":"            return {\u0027secret_ref\u0027: url, \u0027transport_key_ref\u0027: tkey_url}"},{"line_number":264,"context_line":"        else:"},{"line_number":265,"context_line":"            return {\u0027secret_ref\u0027: url}"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_c4b594ee","line":263,"updated":"2014-07-31 11:25:57.000000000","message":"Why does the transport key need to be returned? Could this not be queried later?","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"6c21201fe727ecc58d977b48d55680fc7c81bb4d","unresolved":false,"context_lines":[{"line_number":260,"context_line":"        if transport_key_model is not None:"},{"line_number":261,"context_line":"            tkey_url \u003d hrefs.convert_transport_key_to_href("},{"line_number":262,"context_line":"                keystone_id, transport_key_model.id)"},{"line_number":263,"context_line":"            return {\u0027secret_ref\u0027: url, \u0027transport_key_ref\u0027: tkey_url}"},{"line_number":264,"context_line":"        else:"},{"line_number":265,"context_line":"            return {\u0027secret_ref\u0027: url}"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_62d53c46","line":263,"in_reply_to":"baada198_c4b594ee","updated":"2014-07-31 15:16:43.000000000","message":"This is the case where the client is doing a two step secret storage - first creating the metadata and then storing thw secret.  Also, the client has requested the transport key.\n\nA URL has been returned to the transport key.  The client can fetch this transport key and use it to wrap the secret so that only the secret is wrapped all the way to the DRM/Dogtag while being stored.","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":7262,"name":"John Vrbanac","email":"john.vrbanac@linux.com","username":"john.vrbanac"},"change_message_id":"d5cfbc0b7d3fc88b88fe2cb055df72c270f2f96c","unresolved":false,"context_lines":[{"line_number":260,"context_line":"            tkey_url \u003d hrefs.convert_transport_key_to_href("},{"line_number":261,"context_line":"                keystone_id, transport_key_model.id)"},{"line_number":262,"context_line":"            return {\u0027secret_ref\u0027: url, \u0027transport_key_ref\u0027: tkey_url}"},{"line_number":263,"context_line":"        else:"},{"line_number":264,"context_line":"            return {\u0027secret_ref\u0027: url}"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_4ec21755","line":263,"updated":"2014-07-31 21:13:25.000000000","message":"For future reference, the else isn\u0027t required as you return out of the if as well.","commit_id":"e2779d481ee7f92d28f90c9e1a2bdc56bbf37246"}],"barbican/common/validators.py":[{"author":{"_account_id":9234,"name":"Steve Heyman","email":"steve@heyman.com","username":"hockeynut"},"change_message_id":"cacd9e143256b0e305392c30574ba42403d570d2","unresolved":false,"context_lines":[{"line_number":127,"context_line":"                },"},{"line_number":128,"context_line":"                \"transport_key_needed\": {"},{"line_number":129,"context_line":"                    \"type\": \"string\","},{"line_number":130,"context_line":"                    \"enum\": [\"true\", \"false\"]"},{"line_number":131,"context_line":"                },"},{"line_number":132,"context_line":"            },"},{"line_number":133,"context_line":"        }"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_fd083830","line":130,"updated":"2014-07-30 16:31:18.000000000","message":"does this imply \"TrUe\" will fail scheme validation, even though we lower() it in the POST handler?","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"93560ad99759aef0b46acbd159ace4fb0225b6ce","unresolved":false,"context_lines":[{"line_number":127,"context_line":"                },"},{"line_number":128,"context_line":"                \"transport_key_needed\": {"},{"line_number":129,"context_line":"                    \"type\": \"string\","},{"line_number":130,"context_line":"                    \"enum\": [\"true\", \"false\"]"},{"line_number":131,"context_line":"                },"},{"line_number":132,"context_line":"            },"},{"line_number":133,"context_line":"        }"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_a8e74ee2","line":130,"in_reply_to":"baada198_fd083830","updated":"2014-07-31 02:07:05.000000000","message":"Probably.  I think thats ok though.","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"}],"barbican/model/repositories.py":[{"author":{"_account_id":9234,"name":"Steve Heyman","email":"steve@heyman.com","username":"hockeynut"},"change_message_id":"cacd9e143256b0e305392c30574ba42403d570d2","unresolved":false,"context_lines":[{"line_number":910,"context_line":""},{"line_number":911,"context_line":"        return entities, offset, limit, total"},{"line_number":912,"context_line":""},{"line_number":913,"context_line":"    def get_latest_key(self, plugin_name, suppress_exception\u003dFalse,"},{"line_number":914,"context_line":"                       session\u003dNone):"},{"line_number":915,"context_line":"        \"\"\"Returns the latest transport key for a given plugin"},{"line_number":916,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_802353a9","line":913,"updated":"2014-07-30 16:31:18.000000000","message":"can we rename this to get_latest_transport_key or get_current_transport_key?","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":7262,"name":"John Vrbanac","email":"john.vrbanac@linux.com","username":"john.vrbanac"},"change_message_id":"d6a989908e2e70d24c5b225dc4d540d1132c5e5d","unresolved":false,"context_lines":[{"line_number":910,"context_line":""},{"line_number":911,"context_line":"        return entities, offset, limit, total"},{"line_number":912,"context_line":""},{"line_number":913,"context_line":"    def get_latest_key(self, plugin_name, suppress_exception\u003dFalse,"},{"line_number":914,"context_line":"                       session\u003dNone):"},{"line_number":915,"context_line":"        \"\"\"Returns the latest transport key for a given plugin"},{"line_number":916,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_5c7f5869","line":913,"in_reply_to":"baada198_802353a9","updated":"2014-07-30 22:35:43.000000000","message":"Technically, this method is within the TransportKeyRepo class, so given the context this makes sense to me.","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"93560ad99759aef0b46acbd159ace4fb0225b6ce","unresolved":false,"context_lines":[{"line_number":910,"context_line":""},{"line_number":911,"context_line":"        return entities, offset, limit, total"},{"line_number":912,"context_line":""},{"line_number":913,"context_line":"    def get_latest_key(self, plugin_name, suppress_exception\u003dFalse,"},{"line_number":914,"context_line":"                       session\u003dNone):"},{"line_number":915,"context_line":"        \"\"\"Returns the latest transport key for a given plugin"},{"line_number":916,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_6804567d","line":913,"in_reply_to":"baada198_802353a9","updated":"2014-07-31 02:07:05.000000000","message":"Will rename to get_latest_transport_key()","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":6783,"name":"Nathan Reller","email":"nathan.s.reller@gmail.com","username":"rellerreller"},"change_message_id":"328b0ba94d4bf6637c048ed447a3821486b55464","unresolved":false,"context_lines":[{"line_number":918,"context_line":"            plugin_name, offset_arg\u003d0, limit_arg\u003d1,"},{"line_number":919,"context_line":"            suppress_exception\u003dsuppress_exception, session\u003dsession)"},{"line_number":920,"context_line":"        return entity"},{"line_number":921,"context_line":""},{"line_number":922,"context_line":"    def _do_build_get_query(self, entity_id, keystone_id, session):"},{"line_number":923,"context_line":"        \"\"\"Sub-class hook: build a retrieve query.\"\"\""},{"line_number":924,"context_line":"        return session.query(models.TransportKey).filter_by(id\u003dentity_id)"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_bfb189e2","line":921,"updated":"2014-07-31 11:25:57.000000000","message":"Why do we need a new TransportKeyRepo? A transport key is the same as any other secret. Why not just add an entry to the secret table for transport keys?","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"6c21201fe727ecc58d977b48d55680fc7c81bb4d","unresolved":false,"context_lines":[{"line_number":918,"context_line":"            plugin_name, offset_arg\u003d0, limit_arg\u003d1,"},{"line_number":919,"context_line":"            suppress_exception\u003dsuppress_exception, session\u003dsession)"},{"line_number":920,"context_line":"        return entity"},{"line_number":921,"context_line":""},{"line_number":922,"context_line":"    def _do_build_get_query(self, entity_id, keystone_id, session):"},{"line_number":923,"context_line":"        \"\"\"Sub-class hook: build a retrieve query.\"\"\""},{"line_number":924,"context_line":"        return session.query(models.TransportKey).filter_by(id\u003dentity_id)"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_a2f4b455","line":921,"in_reply_to":"baada198_bfb189e2","updated":"2014-07-31 15:16:43.000000000","message":"The transport key - as we had envisioned key wrapping - is supposed to be the public key for an asymmetric key pair.  In fact, I was envisioning it to be a certificate from which the public key and all its info could be extracted.\n\nThe transport key is something that is specific to the plugin.  In the dogtag case, its the public key for a public/private key pair that resides on the DRM.\n\nThe transport key needs to be downloaded by the client so that it can be used in two ways:\n\n1.  To wrap secrets prior to being sent for storage.  This would mean that the key would be wrapped all the way to the DRM.\n\n2. To wrap a session key to be sent to the server on secret retrieval.  The DRM will unwrap the session key and use it to wrap the returned secret.  This ensures that the secret is wrapped all the way to the client.\n\nThis particular patch adds the ability to a URL reference to the transport key if the client requests it when creating the secret metadata.\n\nNow we can avoid storing transport keys altogether in a TransportKeyRepo by just asking the plugin for a transport key and passing that back rather than a URL, but we decided at the summit to provide a resource that the client could fetch.","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"}],"barbican/plugin/interface/secret_store.py":[{"author":{"_account_id":6783,"name":"Nathan Reller","email":"nathan.s.reller@gmail.com","username":"rellerreller"},"change_message_id":"c1167965cf35239ee84b4d4aaaac8b959c112ab0","unresolved":false,"context_lines":[{"line_number":342,"context_line":"        raise NotImplementedError  # pragma: no cover"},{"line_number":343,"context_line":""},{"line_number":344,"context_line":"    def get_transport_key(self):"},{"line_number":345,"context_line":"        \"\"\"Gets a transport key ID."},{"line_number":346,"context_line":""},{"line_number":347,"context_line":"        Returns the ID for the transport key associated with this plugin."},{"line_number":348,"context_line":"        By default, returns None.  Plugins that support transport key"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_d42b2631","line":345,"updated":"2014-07-17 21:52:30.000000000","message":"+1 I like that this only returns an ID.","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"d15a74548c40453886e4e5aa978ee30b0e32d413","unresolved":false,"context_lines":[{"line_number":342,"context_line":"        raise NotImplementedError  # pragma: no cover"},{"line_number":343,"context_line":""},{"line_number":344,"context_line":"    def get_transport_key(self):"},{"line_number":345,"context_line":"        \"\"\"Gets a transport key ID."},{"line_number":346,"context_line":""},{"line_number":347,"context_line":"        Returns the ID for the transport key associated with this plugin."},{"line_number":348,"context_line":"        By default, returns None.  Plugins that support transport key"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_91ad4aed","line":345,"in_reply_to":"baada198_d42b2631","updated":"2014-07-23 23:34:45.000000000","message":"I\u0027m warming up to this now too, partly because I found out that uniqueness constraints in mysql are limited in size out of the box. So overall getting a transport key ID from the plugin (so having plugin CRUD the key), storing that id along with the plugin name in barbican core, and then having a means to retrieve the key and giving back to client for their transport/wrapping. Make sense.","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":10873,"name":"Juan Antonio Osorio Robles","email":"jaosorior@redhat.com","username":"ejuaoso"},"change_message_id":"f3825f25c982b34b872eedc113bf9e7b19e1b5a6","unresolved":false,"context_lines":[{"line_number":348,"context_line":"        By default, returns None.  Plugins that support transport key"},{"line_number":349,"context_line":"        wrapping should override this method."},{"line_number":350,"context_line":"        \"\"\""},{"line_number":351,"context_line":"        return None"},{"line_number":352,"context_line":""},{"line_number":353,"context_line":"    def is_transport_key_current(self, transport_key):"},{"line_number":354,"context_line":"        \"\"\"Determines if the provided transport key is the current valid key"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_f725285b","line":351,"updated":"2014-07-28 06:58:05.000000000","message":"Is there a reason why these two functions (get_transport_key and is_transport_key_current) are implemented the way they are? I don\u0027t particularly advocate for having functions with documentation that doesn\u0027t match their current implementation.\n\nThey actually cause the code to have some untested lines.","commit_id":"0dd15d5e5fb923d845532bed5aa47aa82319cd35"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"0f36ce8a132862b26aa6d375e728af3f2f883f38","unresolved":false,"context_lines":[{"line_number":348,"context_line":"        By default, returns None.  Plugins that support transport key"},{"line_number":349,"context_line":"        wrapping should override this method."},{"line_number":350,"context_line":"        \"\"\""},{"line_number":351,"context_line":"        return None"},{"line_number":352,"context_line":""},{"line_number":353,"context_line":"    def is_transport_key_current(self, transport_key):"},{"line_number":354,"context_line":"        \"\"\"Determines if the provided transport key is the current valid key"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_216d9099","line":351,"in_reply_to":"baada198_f725285b","updated":"2014-07-28 14:39:03.000000000","message":"In what way are these functions implemented in a way that does not match the documentation?\n\nBy default currently, most plugins will not implement get_transport_key() or is_transport_key_cureent() as they will not support key wrapping - and they will return None and False as appropriate.\n\nWe decided at the mid cycle meetup to implement these functions with a default implementation, so that only plugins which wanted to implement transport key wrapping would need to re-implement these methods.\n\nThe Dogtag plugin will re-implement these methods - as it will support key wrapping.  This will be added in a subsequent patch.\n\nYou have a good point about it being untested though.  I agree I need to add a new TestPlugin in the unit tests in test_secret_store.py to add some tests in which these methods have been overridden. \n\nWill do so and resbumit.","commit_id":"0dd15d5e5fb923d845532bed5aa47aa82319cd35"},{"author":{"_account_id":10873,"name":"Juan Antonio Osorio Robles","email":"jaosorior@redhat.com","username":"ejuaoso"},"change_message_id":"f3825f25c982b34b872eedc113bf9e7b19e1b5a6","unresolved":false,"context_lines":[{"line_number":388,"context_line":"            return self.extensions[0].obj"},{"line_number":389,"context_line":"        else:"},{"line_number":390,"context_line":"            for ext in self.extensions:"},{"line_number":391,"context_line":"                if ext.obj.get_transport_key() is not None:"},{"line_number":392,"context_line":"                    return ext.obj"},{"line_number":393,"context_line":"            else:"},{"line_number":394,"context_line":"                raise SecretStoreSupportedPluginNotFound()"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_371b201d","line":391,"updated":"2014-07-28 06:58:05.000000000","message":"this, for example, is untested","commit_id":"0dd15d5e5fb923d845532bed5aa47aa82319cd35"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"0f36ce8a132862b26aa6d375e728af3f2f883f38","unresolved":false,"context_lines":[{"line_number":388,"context_line":"            return self.extensions[0].obj"},{"line_number":389,"context_line":"        else:"},{"line_number":390,"context_line":"            for ext in self.extensions:"},{"line_number":391,"context_line":"                if ext.obj.get_transport_key() is not None:"},{"line_number":392,"context_line":"                    return ext.obj"},{"line_number":393,"context_line":"            else:"},{"line_number":394,"context_line":"                raise SecretStoreSupportedPluginNotFound()"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_a1f1a06b","line":391,"in_reply_to":"baada198_371b201d","updated":"2014-07-28 14:39:03.000000000","message":"right - I will add a unit test as noted above.","commit_id":"0dd15d5e5fb923d845532bed5aa47aa82319cd35"},{"author":{"_account_id":6783,"name":"Nathan Reller","email":"nathan.s.reller@gmail.com","username":"rellerreller"},"change_message_id":"328b0ba94d4bf6637c048ed447a3821486b55464","unresolved":false,"context_lines":[{"line_number":344,"context_line":"    def get_transport_key(self):"},{"line_number":345,"context_line":"        \"\"\"Gets a transport key."},{"line_number":346,"context_line":""},{"line_number":347,"context_line":"        Returns the current valid transport key associated with this plugin."},{"line_number":348,"context_line":"        By default, returns None.  Plugins that support transport key"},{"line_number":349,"context_line":"        wrapping should override this method."},{"line_number":350,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_048f8c77","line":347,"updated":"2014-07-31 11:25:57.000000000","message":"What type of object is expected to be returned? Could you please add that to the comment.","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"6c21201fe727ecc58d977b48d55680fc7c81bb4d","unresolved":false,"context_lines":[{"line_number":344,"context_line":"    def get_transport_key(self):"},{"line_number":345,"context_line":"        \"\"\"Gets a transport key."},{"line_number":346,"context_line":""},{"line_number":347,"context_line":"        Returns the current valid transport key associated with this plugin."},{"line_number":348,"context_line":"        By default, returns None.  Plugins that support transport key"},{"line_number":349,"context_line":"        wrapping should override this method."},{"line_number":350,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_7d315dec","line":347,"in_reply_to":"baada198_048f8c77","updated":"2014-07-31 15:16:43.000000000","message":"Yes - I will - I expect it to be a base 64 encoded public key.  In fact, I actually think it should be a base 64 encoded certificate.","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":6783,"name":"Nathan Reller","email":"nathan.s.reller@gmail.com","username":"rellerreller"},"change_message_id":"328b0ba94d4bf6637c048ed447a3821486b55464","unresolved":false,"context_lines":[{"line_number":361,"context_line":"        should override this method."},{"line_number":362,"context_line":"        \"\"\""},{"line_number":363,"context_line":"        return False"},{"line_number":364,"context_line":""},{"line_number":365,"context_line":""},{"line_number":366,"context_line":"class SecretStorePluginManager(named.NamedExtensionManager):"},{"line_number":367,"context_line":"    def __init__(self, conf\u003dCONF, invoke_on_load\u003dTrue,"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_a4efc01c","line":364,"updated":"2014-07-31 11:25:57.000000000","message":"Why is this method necessary?","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"6c21201fe727ecc58d977b48d55680fc7c81bb4d","unresolved":false,"context_lines":[{"line_number":361,"context_line":"        should override this method."},{"line_number":362,"context_line":"        \"\"\""},{"line_number":363,"context_line":"        return False"},{"line_number":364,"context_line":""},{"line_number":365,"context_line":""},{"line_number":366,"context_line":"class SecretStorePluginManager(named.NamedExtensionManager):"},{"line_number":367,"context_line":"    def __init__(self, conf\u003dCONF, invoke_on_load\u003dTrue,"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_3d6a851b","line":364,"in_reply_to":"baada198_a4efc01c","updated":"2014-07-31 15:16:43.000000000","message":"This came out of discussions with John Wood.  The problem is that he was concerned about was requiring the plugin know about how the transport key was stored in barbican-core.  Rather than passing transport keys back and forth, the idea is as follows:\n\nBarbican core gets the latest transport key for a plugin from its repo.  It then checks with the plugin to see if the key is still valid by calling this method.  This method would return True/False.\n\nIn the dogtag implementation, I will get the latest transport cert from the server and check if the key/cert being passed in is the same.  If so, then I will return true - if not then I will return false and keep the new key as a class variable in memory.\n\nBarbican-core will then ask for a new key -- get_transport_key() and I will return the new key which barbican-core will store as the latest.","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":7262,"name":"John Vrbanac","email":"john.vrbanac@linux.com","username":"john.vrbanac"},"change_message_id":"d6a989908e2e70d24c5b225dc4d540d1132c5e5d","unresolved":false,"context_lines":[{"line_number":386,"context_line":""},{"line_number":387,"context_line":"        if not transport_key_needed:"},{"line_number":388,"context_line":"            return self.extensions[0].obj"},{"line_number":389,"context_line":"        else:"},{"line_number":390,"context_line":"            for ext in self.extensions:"},{"line_number":391,"context_line":"                if ext.obj.get_transport_key() is not None:"},{"line_number":392,"context_line":"                    return ext.obj"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_9cc73098","line":389,"updated":"2014-07-30 22:35:43.000000000","message":"Not a show stopper, but the else isn\u0027t required here as you are returning early on 388.","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"93560ad99759aef0b46acbd159ace4fb0225b6ce","unresolved":false,"context_lines":[{"line_number":386,"context_line":""},{"line_number":387,"context_line":"        if not transport_key_needed:"},{"line_number":388,"context_line":"            return self.extensions[0].obj"},{"line_number":389,"context_line":"        else:"},{"line_number":390,"context_line":"            for ext in self.extensions:"},{"line_number":391,"context_line":"                if ext.obj.get_transport_key() is not None:"},{"line_number":392,"context_line":"                    return ext.obj"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_836b4bb8","line":389,"in_reply_to":"baada198_9cc73098","updated":"2014-07-31 02:07:05.000000000","message":"Agreed. I\u0027ll remove it.  The else on line 393 is not needed either.","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":6783,"name":"Nathan Reller","email":"nathan.s.reller@gmail.com","username":"rellerreller"},"change_message_id":"4646b1fb57245fcda37aa1c67700564ecfb079ab","unresolved":false,"context_lines":[{"line_number":342,"context_line":"        raise NotImplementedError  # pragma: no cover"},{"line_number":343,"context_line":""},{"line_number":344,"context_line":"    def get_transport_key(self):"},{"line_number":345,"context_line":"        \"\"\"Gets a transport key."},{"line_number":346,"context_line":""},{"line_number":347,"context_line":"        Returns the current valid transport key associated with this plugin."},{"line_number":348,"context_line":"        By default, returns None.  Plugins that support transport key"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_0bad71ea","line":345,"updated":"2014-07-31 20:36:21.000000000","message":"Should we add a comment that if this key is returned that admins are responsible for deleting from DB? I know they are not created that often and not likely to crash the system, but I would like to know how they are deleted from the DB.","commit_id":"cd9865f4faa621227e0a3efb8f2ceaab6d76cf07"},{"author":{"_account_id":6783,"name":"Nathan Reller","email":"nathan.s.reller@gmail.com","username":"rellerreller"},"change_message_id":"4646b1fb57245fcda37aa1c67700564ecfb079ab","unresolved":false,"context_lines":[{"line_number":347,"context_line":"        Returns the current valid transport key associated with this plugin."},{"line_number":348,"context_line":"        By default, returns None.  Plugins that support transport key"},{"line_number":349,"context_line":"        wrapping should override this method."},{"line_number":350,"context_line":"        \"\"\""},{"line_number":351,"context_line":"        return None"},{"line_number":352,"context_line":""},{"line_number":353,"context_line":"    def is_transport_key_current(self, transport_key):"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_e86cc309","line":350,"updated":"2014-07-31 20:36:21.000000000","message":"What is the expected object to be returned?","commit_id":"cd9865f4faa621227e0a3efb8f2ceaab6d76cf07"}],"barbican/plugin/resources.py":[{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"3edcf24a47541b80de4aa4c05f977eaacd595ec8","unresolved":false,"context_lines":[{"line_number":36,"context_line":"    #   entity created here *and* the secret data to store into it."},{"line_number":37,"context_line":"    if not unencrypted_raw:"},{"line_number":38,"context_line":"        tkey_needed \u003d \\"},{"line_number":39,"context_line":"            spec.get(\u0027transport_key_needed\u0027, \u0027false\u0027).lower() \u003d\u003d \"true\""},{"line_number":40,"context_line":"        tkey_id \u003d None"},{"line_number":41,"context_line":"        if tkey_needed:"},{"line_number":42,"context_line":"            # get_plugin_store() will throw an exception if no suitable"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_f1ea43ab","line":39,"updated":"2014-07-16 13:38:48.000000000","message":"It might be more clear to split this out as an argument to this function. Not a big deal to leave as is though.","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":6783,"name":"Nathan Reller","email":"nathan.s.reller@gmail.com","username":"rellerreller"},"change_message_id":"c1167965cf35239ee84b4d4aaaac8b959c112ab0","unresolved":false,"context_lines":[{"line_number":36,"context_line":"    #   entity created here *and* the secret data to store into it."},{"line_number":37,"context_line":"    if not unencrypted_raw:"},{"line_number":38,"context_line":"        tkey_needed \u003d \\"},{"line_number":39,"context_line":"            spec.get(\u0027transport_key_needed\u0027, \u0027false\u0027).lower() \u003d\u003d \"true\""},{"line_number":40,"context_line":"        tkey_id \u003d None"},{"line_number":41,"context_line":"        if tkey_needed:"},{"line_number":42,"context_line":"            # get_plugin_store() will throw an exception if no suitable"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_f4a3caae","line":39,"in_reply_to":"baada198_ab9d8159","updated":"2014-07-17 21:52:30.000000000","message":"What is spec?","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"d5d897fb1ccaa4f2c7df0b16ccdd0ddbbb7a5acf","unresolved":false,"context_lines":[{"line_number":36,"context_line":"    #   entity created here *and* the secret data to store into it."},{"line_number":37,"context_line":"    if not unencrypted_raw:"},{"line_number":38,"context_line":"        tkey_needed \u003d \\"},{"line_number":39,"context_line":"            spec.get(\u0027transport_key_needed\u0027, \u0027false\u0027).lower() \u003d\u003d \"true\""},{"line_number":40,"context_line":"        tkey_id \u003d None"},{"line_number":41,"context_line":"        if tkey_needed:"},{"line_number":42,"context_line":"            # get_plugin_store() will throw an exception if no suitable"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_ab9d8159","line":39,"in_reply_to":"baada198_f1ea43ab","updated":"2014-07-17 16:27:15.000000000","message":"I can split it out as an argument to make it clearer.  Probably better that way.","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"a0ce0f6daf1cc46e119fed7f448e5c51a4fdc10a","unresolved":false,"context_lines":[{"line_number":36,"context_line":"    #   entity created here *and* the secret data to store into it."},{"line_number":37,"context_line":"    if not unencrypted_raw:"},{"line_number":38,"context_line":"        tkey_needed \u003d \\"},{"line_number":39,"context_line":"            spec.get(\u0027transport_key_needed\u0027, \u0027false\u0027).lower() \u003d\u003d \"true\""},{"line_number":40,"context_line":"        tkey_id \u003d None"},{"line_number":41,"context_line":"        if tkey_needed:"},{"line_number":42,"context_line":"            # get_plugin_store() will throw an exception if no suitable"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_0e7106a8","line":39,"in_reply_to":"baada198_f4a3caae","updated":"2014-07-18 05:04:58.000000000","message":"spec is the JSON name/value info provided with the secret...so the secret\u0027s specification info","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"3edcf24a47541b80de4aa4c05f977eaacd595ec8","unresolved":false,"context_lines":[{"line_number":43,"context_line":"            # plugin with transport key is found"},{"line_number":44,"context_line":"            store_plugin \u003d secret_store.SecretStorePluginManager().\\"},{"line_number":45,"context_line":"                get_plugin_store(True)"},{"line_number":46,"context_line":"            tkey_id \u003d store_plugin.get_transport_key()"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"        _save_secret(secret_model, tenant_model, repos)"},{"line_number":49,"context_line":"        return secret_model, tkey_id"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_f40cf13d","line":46,"updated":"2014-07-16 13:38:48.000000000","message":"This call should return the actual transport key, not the ID to it. Then this code should save this into a transport key repo (so outside of the plugin)...that repo could return the transport key model for that key (which includes its UUID). If that key already exists for a given plugin, then the key repo would just reused the existing record (i.e. the key model would have the same UUID).","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"18c230bcadbbd44b34e628b8e6bbcf491631d125","unresolved":false,"context_lines":[{"line_number":43,"context_line":"            # plugin with transport key is found"},{"line_number":44,"context_line":"            store_plugin \u003d secret_store.SecretStorePluginManager().\\"},{"line_number":45,"context_line":"                get_plugin_store(True)"},{"line_number":46,"context_line":"            tkey_id \u003d store_plugin.get_transport_key()"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"        _save_secret(secret_model, tenant_model, repos)"},{"line_number":49,"context_line":"        return secret_model, tkey_id"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_ce4440ba","line":46,"in_reply_to":"baada198_0ecd86b7","updated":"2014-07-19 17:04:39.000000000","message":"My original design had the plugin manage everything about the transport key itself and keep it within memory.  Based on our conversations at the summit, we decided that the transport key should be a resource stored by Barbican core - and we added the Transport Key as a resource.\n\nIf you dont want to rely on server restarts, we can implement as I suggested above, with the plugin doing a check against the server to see if the key has changed each time we get the transport key.  This would end up being a conditional GET so the overhead may not be too bad.\n\nPersonally, though, I think that the transport key will change so infrequently that the extra queries are unnecessary.\n\nWe could make the check during get_transport_key() optional (ie. configurable) or we could provide an admin call on the transport key resource to force a plugin to reread its transport key.  That would allow max uptime.","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"a0ce0f6daf1cc46e119fed7f448e5c51a4fdc10a","unresolved":false,"context_lines":[{"line_number":43,"context_line":"            # plugin with transport key is found"},{"line_number":44,"context_line":"            store_plugin \u003d secret_store.SecretStorePluginManager().\\"},{"line_number":45,"context_line":"                get_plugin_store(True)"},{"line_number":46,"context_line":"            tkey_id \u003d store_plugin.get_transport_key()"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"        _save_secret(secret_model, tenant_model, repos)"},{"line_number":49,"context_line":"        return secret_model, tkey_id"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_0ecd86b7","line":46,"in_reply_to":"baada198_543e362a","updated":"2014-07-18 05:04:58.000000000","message":"I don\u0027t think we should rely on server restarts to ensure we have the latest transport key available...we should strive for max up-time. Also, I\u0027m leery of plugin instances managing state \u0027in memory due to potential threading issues down the line. It seems that we could have memoization/caching wrt to the transport key repository process if that is a concern, but I think Barbican really should store the actual key used in its data store, if nothing else to be consistent with all the other repositories/entities in the data model. If caching is in place, I really don\u0027t see much of a performance issue for Barbican to manage transport keys directly on behalf of plugins, vs the inconsistencies and possible threading concerns of letting plugins manage that state.","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":6783,"name":"Nathan Reller","email":"nathan.s.reller@gmail.com","username":"rellerreller"},"change_message_id":"c1167965cf35239ee84b4d4aaaac8b959c112ab0","unresolved":false,"context_lines":[{"line_number":43,"context_line":"            # plugin with transport key is found"},{"line_number":44,"context_line":"            store_plugin \u003d secret_store.SecretStorePluginManager().\\"},{"line_number":45,"context_line":"                get_plugin_store(True)"},{"line_number":46,"context_line":"            tkey_id \u003d store_plugin.get_transport_key()"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"        _save_secret(secret_model, tenant_model, repos)"},{"line_number":49,"context_line":"        return secret_model, tkey_id"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_543e362a","line":46,"in_reply_to":"baada198_d6c33836","updated":"2014-07-17 21:52:30.000000000","message":"Why do you need to store the key in a DB? You could just use a dictionary mapping. On start of plugin create a UUID for tkey and store it in memory. Then if key changes then just update that structure in memory. On calls to store then check if UUID matches.","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"d5d897fb1ccaa4f2c7df0b16ccdd0ddbbb7a5acf","unresolved":false,"context_lines":[{"line_number":43,"context_line":"            # plugin with transport key is found"},{"line_number":44,"context_line":"            store_plugin \u003d secret_store.SecretStorePluginManager().\\"},{"line_number":45,"context_line":"                get_plugin_store(True)"},{"line_number":46,"context_line":"            tkey_id \u003d store_plugin.get_transport_key()"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"        _save_secret(secret_model, tenant_model, repos)"},{"line_number":49,"context_line":"        return secret_model, tkey_id"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_d6c33836","line":46,"in_reply_to":"baada198_f40cf13d","updated":"2014-07-17 16:27:15.000000000","message":"I\u0027m not so sure I agree with this.  The fact is that transport keys will change very infrequently.  If you return a transport key rather than an id, then you have to lookup and byte comparison of transport keys every time a secret is created.\n\nI planned to address getting the transport key to begin with in a later patch, but let me explain the approach I was planning to take.  I agree that it would be cleaner to have barbican-core store the transport key.  Here is how I was going to do that for dogtag.\n\n1.  In the init() code for the dogtag plugin - which would then run whenever the server is restarted - a check would be made against the DRM for the transport key.  A method within barbican core (in plugin/resources.py) would be called to store the transport key.\n\nThis method store_transport_key() would do a byte comparison against transport keys and would store a new transport key (ie. create a new transport key model) if needed.  It would return either a transport key model or just a transport_key_id to the plugin.  The plugin would then keep this transport_key_id in memory and would return it whenever get_transport_key() is called.\n\nThe way this would be implemented means that for the dogtag plugin at least, you would need to restart the server if the transport key changes.  But I think this is perfectly reasonable given that the transport key will likely change very infrequently.\n\nNote that if a plugin wanted to to change transport keys frequently, the plugin could always invoke store_plugin() within get_transport_key().  In fact, that may not be a bad idea in any case.  So get_transport_key() could look like:\n\ninit()\n- key \u003d get transport key\n- key_id \u003d store_transport_key(key)\n\nget_transport_key()\n- check with server to see if transport key has changed\n- if changed:\n      key_id \u003d  store_transport_key()\n  return key_id","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"3edcf24a47541b80de4aa4c05f977eaacd595ec8","unresolved":false,"context_lines":[{"line_number":45,"context_line":"                get_plugin_store(True)"},{"line_number":46,"context_line":"            tkey_id \u003d store_plugin.get_transport_key()"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"        _save_secret(secret_model, tenant_model, repos)"},{"line_number":49,"context_line":"        return secret_model, tkey_id"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"    # Locate a suitable plugin to store the secret."}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_b485195b","line":48,"updated":"2014-07-16 13:38:48.000000000","message":"I agree that we shouldn\u0027t actually store the transport key ref onto the secret_model itself...the client could choose to still PUT the secret data without a transport key later, and that should be OK.","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":6783,"name":"Nathan Reller","email":"nathan.s.reller@gmail.com","username":"rellerreller"},"change_message_id":"c1167965cf35239ee84b4d4aaaac8b959c112ab0","unresolved":false,"context_lines":[{"line_number":45,"context_line":"                get_plugin_store(True)"},{"line_number":46,"context_line":"            tkey_id \u003d store_plugin.get_transport_key()"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"        _save_secret(secret_model, tenant_model, repos)"},{"line_number":49,"context_line":"        return secret_model, tkey_id"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"    # Locate a suitable plugin to store the secret."}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_9448cecd","line":48,"in_reply_to":"baada198_8b7b5d28","updated":"2014-07-17 21:52:30.000000000","message":"+1","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"d5d897fb1ccaa4f2c7df0b16ccdd0ddbbb7a5acf","unresolved":false,"context_lines":[{"line_number":45,"context_line":"                get_plugin_store(True)"},{"line_number":46,"context_line":"            tkey_id \u003d store_plugin.get_transport_key()"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"        _save_secret(secret_model, tenant_model, repos)"},{"line_number":49,"context_line":"        return secret_model, tkey_id"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"    # Locate a suitable plugin to store the secret."}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_8b7b5d28","line":48,"in_reply_to":"baada198_b485195b","updated":"2014-07-17 16:27:15.000000000","message":"yup","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":6783,"name":"Nathan Reller","email":"nathan.s.reller@gmail.com","username":"rellerreller"},"change_message_id":"c1167965cf35239ee84b4d4aaaac8b959c112ab0","unresolved":false,"context_lines":[{"line_number":46,"context_line":"            tkey_id \u003d store_plugin.get_transport_key()"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"        _save_secret(secret_model, tenant_model, repos)"},{"line_number":49,"context_line":"        return secret_model, tkey_id"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"    # Locate a suitable plugin to store the secret."},{"line_number":52,"context_line":"    store_plugin \u003d secret_store.SecretStorePluginManager().get_plugin_store()"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_54255608","line":49,"updated":"2014-07-17 21:52:30.000000000","message":"Why is tkey_id returned?","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"a0ce0f6daf1cc46e119fed7f448e5c51a4fdc10a","unresolved":false,"context_lines":[{"line_number":46,"context_line":"            tkey_id \u003d store_plugin.get_transport_key()"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"        _save_secret(secret_model, tenant_model, repos)"},{"line_number":49,"context_line":"        return secret_model, tkey_id"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"    # Locate a suitable plugin to store the secret."},{"line_number":52,"context_line":"    store_plugin \u003d secret_store.SecretStorePluginManager().get_plugin_store()"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_ee405209","line":49,"in_reply_to":"baada198_54255608","updated":"2014-07-18 05:04:58.000000000","message":"The transport key would need to be returned here to support returning the transport key information back to the client who made POST secrets call.","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"18c230bcadbbd44b34e628b8e6bbcf491631d125","unresolved":false,"context_lines":[{"line_number":46,"context_line":"            tkey_id \u003d store_plugin.get_transport_key()"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"        _save_secret(secret_model, tenant_model, repos)"},{"line_number":49,"context_line":"        return secret_model, tkey_id"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"    # Locate a suitable plugin to store the secret."},{"line_number":52,"context_line":"    store_plugin \u003d secret_store.SecretStorePluginManager().get_plugin_store()"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_aed70cbe","line":49,"in_reply_to":"baada198_ee405209","updated":"2014-07-19 17:04:39.000000000","message":"correct.  In this case, the client has done a POST /secrets to create the secret model object, and has explicitly requested a transport key.  The transport_key_id is returned to the calling function to be converted into a URL for a transport key that the client can fetch (if it isn\u0027t already cached on the client)","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"3edcf24a47541b80de4aa4c05f977eaacd595ec8","unresolved":false,"context_lines":[{"line_number":81,"context_line":""},{"line_number":82,"context_line":"def get_secret(requesting_content_type, secret_model, tenant_model):"},{"line_number":83,"context_line":"    tr.analyze_before_decryption(requesting_content_type)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    # Construct metadata dict from data model."},{"line_number":86,"context_line":"    #   Note: Must use the dict/tuple format for py2.6 usage."},{"line_number":87,"context_line":"    secret_metadata \u003d dict((k, v.value) for (k, v) in"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_94ce55b6","line":84,"updated":"2014-07-16 13:38:48.000000000","message":"get_secret should then handle having an optional transport_key_ref passed in as a query parameter. This function should then retrieve the transport key **and** the plugin associated with it, and then just grab that plugin instance. The actual retrieved transport key would then be added to the SecretDTO passed into the plugin.","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"18c230bcadbbd44b34e628b8e6bbcf491631d125","unresolved":false,"context_lines":[{"line_number":81,"context_line":""},{"line_number":82,"context_line":"def get_secret(requesting_content_type, secret_model, tenant_model):"},{"line_number":83,"context_line":"    tr.analyze_before_decryption(requesting_content_type)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    # Construct metadata dict from data model."},{"line_number":86,"context_line":"    #   Note: Must use the dict/tuple format for py2.6 usage."},{"line_number":87,"context_line":"    secret_metadata \u003d dict((k, v.value) for (k, v) in"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_ee8bc4bd","line":84,"in_reply_to":"baada198_2ef88ac3","updated":"2014-07-19 17:04:39.000000000","message":"I\u0027m a little confused by this mechanism actually.  Perhaps you can add this comment to the patch in which I handle get_secret and we can discuss it there.","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"d5d897fb1ccaa4f2c7df0b16ccdd0ddbbb7a5acf","unresolved":false,"context_lines":[{"line_number":81,"context_line":""},{"line_number":82,"context_line":"def get_secret(requesting_content_type, secret_model, tenant_model):"},{"line_number":83,"context_line":"    tr.analyze_before_decryption(requesting_content_type)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    # Construct metadata dict from data model."},{"line_number":86,"context_line":"    #   Note: Must use the dict/tuple format for py2.6 usage."},{"line_number":87,"context_line":"    secret_metadata \u003d dict((k, v.value) for (k, v) in"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_cbdab516","line":84,"in_reply_to":"baada198_94ce55b6","updated":"2014-07-17 16:27:15.000000000","message":"get functionality is implemented in a separate follow on patch so I\u0027ll address this in that patch - if need be.","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":7789,"name":"John Wood","email":"john.wood@rackspace.com","username":"woodster"},"change_message_id":"a0ce0f6daf1cc46e119fed7f448e5c51a4fdc10a","unresolved":false,"context_lines":[{"line_number":81,"context_line":""},{"line_number":82,"context_line":"def get_secret(requesting_content_type, secret_model, tenant_model):"},{"line_number":83,"context_line":"    tr.analyze_before_decryption(requesting_content_type)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    # Construct metadata dict from data model."},{"line_number":86,"context_line":"    #   Note: Must use the dict/tuple format for py2.6 usage."},{"line_number":87,"context_line":"    secret_metadata \u003d dict((k, v.value) for (k, v) in"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_2ef88ac3","line":84,"in_reply_to":"baada198_cbdab516","updated":"2014-07-18 05:04:58.000000000","message":"That sounds fine, but regarding the \u0027if need be\u0027 part there, I think the mechanics above would definitely need to be supported.","commit_id":"e5c518d240cd65f4bde2e1b62f57272e093d402f"},{"author":{"_account_id":994,"name":"Arvind Tiwari","email":"arvindt7@gmail.com","username":"arvind-tiwari"},"change_message_id":"9c05e506fc6e0789888334f8b009e258c5fa2406","unresolved":false,"context_lines":[{"line_number":19,"context_line":""},{"line_number":20,"context_line":"def store_secret(unencrypted_raw, content_type_raw, content_encoding,"},{"line_number":21,"context_line":"                 transport_key_needed, spec, secret_model, tenant_model,"},{"line_number":22,"context_line":"                 repos):"},{"line_number":23,"context_line":"    \"\"\"Store a provided secret into secure backend.\"\"\""},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"    # Create a secret model is one isn\u0027t provided."}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_095192d8","line":22,"updated":"2014-07-28 15:33:47.000000000","message":"can we default transport_key_needed\u003dFalse and remove line# 136 and 137 from https://review.openstack.org/#/c/107110/2/barbican/api/controllers/secrets.py?","commit_id":"0dd15d5e5fb923d845532bed5aa47aa82319cd35"},{"author":{"_account_id":10873,"name":"Juan Antonio Osorio Robles","email":"jaosorior@redhat.com","username":"ejuaoso"},"change_message_id":"f3825f25c982b34b872eedc113bf9e7b19e1b5a6","unresolved":false,"context_lines":[{"line_number":50,"context_line":"                        key_model.transport_key):"},{"line_number":51,"context_line":"                    key_model \u003d None"},{"line_number":52,"context_line":"            if not key_model:"},{"line_number":53,"context_line":"                transport_key \u003d store_plugin.get_transport_key()"},{"line_number":54,"context_line":"                new_key_model \u003d models.TransportKey(plugin_name, transport_key)"},{"line_number":55,"context_line":"                key_model \u003d key_repo.create_from(new_key_model)"},{"line_number":56,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_d7d90457","line":53,"updated":"2014-07-28 06:58:05.000000000","message":"This is also misleading since that function always returns None... But then again, most of this file is untested...","commit_id":"0dd15d5e5fb923d845532bed5aa47aa82319cd35"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"0f36ce8a132862b26aa6d375e728af3f2f883f38","unresolved":false,"context_lines":[{"line_number":50,"context_line":"                        key_model.transport_key):"},{"line_number":51,"context_line":"                    key_model \u003d None"},{"line_number":52,"context_line":"            if not key_model:"},{"line_number":53,"context_line":"                transport_key \u003d store_plugin.get_transport_key()"},{"line_number":54,"context_line":"                new_key_model \u003d models.TransportKey(plugin_name, transport_key)"},{"line_number":55,"context_line":"                key_model \u003d key_repo.create_from(new_key_model)"},{"line_number":56,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_6145c899","line":53,"in_reply_to":"baada198_d7d90457","updated":"2014-07-28 14:39:03.000000000","message":"This function returns None unless it has been overridden by a plugin (which it will be in the case of the Dogtag plugin - in a later patch).  Also, it will be overridden in the case of the default plugins if we choose to implement key wrapping there.\n\nI agree though that most of this file is untested in the sense that the unit tests in test_resources.py test above this level by mocking out the returns from this file.\n\nI propose that this needs to be fixed for this file as a whole in a separate CR.","commit_id":"0dd15d5e5fb923d845532bed5aa47aa82319cd35"},{"author":{"_account_id":9234,"name":"Steve Heyman","email":"steve@heyman.com","username":"hockeynut"},"change_message_id":"cacd9e143256b0e305392c30574ba42403d570d2","unresolved":false,"context_lines":[{"line_number":19,"context_line":""},{"line_number":20,"context_line":"def store_secret(unencrypted_raw, content_type_raw, content_encoding,"},{"line_number":21,"context_line":"                 spec, secret_model, tenant_model, repos,"},{"line_number":22,"context_line":"                 transport_key_needed\u003dNone):"},{"line_number":23,"context_line":"    \"\"\"Store a provided secret into secure backend.\"\"\""},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"    # Create a secret model is one isn\u0027t provided."}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_a09bf7c6","line":22,"updated":"2014-07-30 16:31:18.000000000","message":"should this be False instead of None?","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"93560ad99759aef0b46acbd159ace4fb0225b6ce","unresolved":false,"context_lines":[{"line_number":19,"context_line":""},{"line_number":20,"context_line":"def store_secret(unencrypted_raw, content_type_raw, content_encoding,"},{"line_number":21,"context_line":"                 spec, secret_model, tenant_model, repos,"},{"line_number":22,"context_line":"                 transport_key_needed\u003dNone):"},{"line_number":23,"context_line":"    \"\"\"Store a provided secret into secure backend.\"\"\""},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"    # Create a secret model is one isn\u0027t provided."}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_235a7f1e","line":22,"in_reply_to":"baada198_3cb62426","updated":"2014-07-31 02:07:05.000000000","message":"Yes - will fix.","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":7262,"name":"John Vrbanac","email":"john.vrbanac@linux.com","username":"john.vrbanac"},"change_message_id":"d6a989908e2e70d24c5b225dc4d540d1132c5e5d","unresolved":false,"context_lines":[{"line_number":19,"context_line":""},{"line_number":20,"context_line":"def store_secret(unencrypted_raw, content_type_raw, content_encoding,"},{"line_number":21,"context_line":"                 spec, secret_model, tenant_model, repos,"},{"line_number":22,"context_line":"                 transport_key_needed\u003dNone):"},{"line_number":23,"context_line":"    \"\"\"Store a provided secret into secure backend.\"\"\""},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"    # Create a secret model is one isn\u0027t provided."}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_3cb62426","line":22,"in_reply_to":"baada198_a09bf7c6","updated":"2014-07-30 22:35:43.000000000","message":"+1","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":7262,"name":"John Vrbanac","email":"john.vrbanac@linux.com","username":"john.vrbanac"},"change_message_id":"d6a989908e2e70d24c5b225dc4d540d1132c5e5d","unresolved":false,"context_lines":[{"line_number":45,"context_line":""},{"line_number":46,"context_line":"            key_repo \u003d repos.transport_key_repo"},{"line_number":47,"context_line":"            key_model \u003d key_repo.get_latest_key(plugin_name)"},{"line_number":48,"context_line":"            if key_model:"},{"line_number":49,"context_line":"                if not store_plugin.is_transport_key_current("},{"line_number":50,"context_line":"                        key_model.transport_key):"},{"line_number":51,"context_line":"                    key_model \u003d None"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_7c2c1c4a","line":48,"updated":"2014-07-30 22:35:43.000000000","message":"Shouldn\u0027t this be something like :\n\n    if key_model and not store_plugin.is_transport_key_current(\n        key_model.transport_key):\n\n        key_model \u003d None\n    else:\n        ...\n\nThe if not key_model with prior conditional in context looks... odd.","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"93560ad99759aef0b46acbd159ace4fb0225b6ce","unresolved":false,"context_lines":[{"line_number":45,"context_line":""},{"line_number":46,"context_line":"            key_repo \u003d repos.transport_key_repo"},{"line_number":47,"context_line":"            key_model \u003d key_repo.get_latest_key(plugin_name)"},{"line_number":48,"context_line":"            if key_model:"},{"line_number":49,"context_line":"                if not store_plugin.is_transport_key_current("},{"line_number":50,"context_line":"                        key_model.transport_key):"},{"line_number":51,"context_line":"                    key_model \u003d None"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_03c1fb2e","line":48,"in_reply_to":"baada198_7c2c1c4a","updated":"2014-07-31 02:07:05.000000000","message":"No.  But maybe this would be clearer:\n\nif not key_model or not store_plugin.\\\n        is_transport_key_current(key_model.transport_key):\n    # transport key does not exist or is not current.\n    # need to get a new transport key\n    transport_key \u003d store_plugin.get_transport_key()\n    new_key_model \u003d \\\n        models.TransportKey(plugin_name,transport_key)\n    key_model \u003d key_repo.create_from(new_key_model)\n_save_secret(secret_model, tenant_model, repos)\n\nI\u0027ll change to the above.","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":6783,"name":"Nathan Reller","email":"nathan.s.reller@gmail.com","username":"rellerreller"},"change_message_id":"328b0ba94d4bf6637c048ed447a3821486b55464","unresolved":false,"context_lines":[{"line_number":53,"context_line":"                transport_key \u003d store_plugin.get_transport_key()"},{"line_number":54,"context_line":"                new_key_model \u003d models.TransportKey(plugin_name, transport_key)"},{"line_number":55,"context_line":"                key_model \u003d key_repo.create_from(new_key_model)"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        _save_secret(secret_model, tenant_model, repos)"},{"line_number":58,"context_line":"        return secret_model, key_model"},{"line_number":59,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_a5d41720","line":56,"updated":"2014-07-31 11:25:57.000000000","message":"If it is encrypted should the only case be that it needs a transport key?","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"6c21201fe727ecc58d977b48d55680fc7c81bb4d","unresolved":false,"context_lines":[{"line_number":53,"context_line":"                transport_key \u003d store_plugin.get_transport_key()"},{"line_number":54,"context_line":"                new_key_model \u003d models.TransportKey(plugin_name, transport_key)"},{"line_number":55,"context_line":"                key_model \u003d key_repo.create_from(new_key_model)"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        _save_secret(secret_model, tenant_model, repos)"},{"line_number":58,"context_line":"        return secret_model, key_model"},{"line_number":59,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_3dffe536","line":56,"in_reply_to":"baada198_a5d41720","updated":"2014-07-31 15:16:43.000000000","message":"No, this is a case where the client is asking for the plugin\u0027s transport key so that it can encrypt the data.  This is the two step storage process.","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":6783,"name":"Nathan Reller","email":"nathan.s.reller@gmail.com","username":"rellerreller"},"change_message_id":"4646b1fb57245fcda37aa1c67700564ecfb079ab","unresolved":false,"context_lines":[{"line_number":52,"context_line":"                # need to get a new transport key"},{"line_number":53,"context_line":"                transport_key \u003d store_plugin.get_transport_key()"},{"line_number":54,"context_line":"                new_key_model \u003d models.TransportKey(plugin_name, transport_key)"},{"line_number":55,"context_line":"                key_model \u003d key_repo.create_from(new_key_model)"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"        _save_secret(secret_model, tenant_model, repos)"},{"line_number":58,"context_line":"        return secret_model, key_model"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_ebf2fd03","line":55,"updated":"2014-07-31 20:36:21.000000000","message":"When and where do we delete?","commit_id":"cd9865f4faa621227e0a3efb8f2ceaab6d76cf07"}],"barbican/tests/api/test_resources.py":[{"author":{"_account_id":9234,"name":"Steve Heyman","email":"steve@heyman.com","username":"hockeynut"},"change_message_id":"cacd9e143256b0e305392c30574ba42403d570d2","unresolved":false,"context_lines":[{"line_number":1033,"context_line":"        mock_store_secret\\"},{"line_number":1034,"context_line":"            .assert_called_once_with(payload, \u0027application/octet-stream\u0027,"},{"line_number":1035,"context_line":"                                     \u0027base64\u0027,"},{"line_number":1036,"context_line":"                                     self.secret.to_dict_fields(),"},{"line_number":1037,"context_line":"                                     self.secret, self.tenant, mock.ANY)"},{"line_number":1038,"context_line":""},{"line_number":1039,"context_line":"    def test_should_raise_to_put_secret_with_unsupported_encoding(self):"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_809ef367","line":1036,"updated":"2014-07-30 16:31:18.000000000","message":"why reflowed?","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"},{"author":{"_account_id":9914,"name":"Ade Lee","email":"alee@redhat.com","username":"alee"},"change_message_id":"93560ad99759aef0b46acbd159ace4fb0225b6ce","unresolved":false,"context_lines":[{"line_number":1033,"context_line":"        mock_store_secret\\"},{"line_number":1034,"context_line":"            .assert_called_once_with(payload, \u0027application/octet-stream\u0027,"},{"line_number":1035,"context_line":"                                     \u0027base64\u0027,"},{"line_number":1036,"context_line":"                                     self.secret.to_dict_fields(),"},{"line_number":1037,"context_line":"                                     self.secret, self.tenant, mock.ANY)"},{"line_number":1038,"context_line":""},{"line_number":1039,"context_line":"    def test_should_raise_to_put_secret_with_unsupported_encoding(self):"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_c3cd4360","line":1036,"in_reply_to":"baada198_809ef367","updated":"2014-07-31 02:07:05.000000000","message":"Same explanation as before.  Will revert to pre-patch indentation.","commit_id":"ea496a0814aabfc77e0efe22ad2101e64bb50a93"}]}
