Expose only extension-api to extensions

Unless a plugin declares "Gerrit-ApiType: plugin" in its manifest,
assume it is an extension and only make the gerrit-extension-api
available to it through the ClassLoader.

For non-plugins, do not make any Guice bindings available from the
server. This further restricts what an extension can see and do with
the system internals.

Change-Id: Ia38336c42786afb1419d64c06b0d908ae92a64d1
This commit is contained in:
Shawn O. Pearce
2012-05-10 16:54:28 -07:00
parent 6fa1e9121d
commit da4919abf6
8 changed files with 417 additions and 74 deletions

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.sshd.commands;
package com.google.gerrit.sshd;
import com.google.common.base.Preconditions;
import com.google.gerrit.extensions.annotations.PluginName;

View File

@@ -69,6 +69,6 @@ class SshAutoRegisterModuleGenerator
@Override
public Module create() throws InvalidPluginException {
Preconditions.checkState(command != null, "pluginName must be provided");
return this;
return !commands.isEmpty() ? this : null;
}
}