mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
#959 added option to disable ssl validation for scm mercurial hook
This commit is contained in:
@@ -123,6 +123,10 @@ public class HgConfig extends SimpleRepositoryConfig
|
|||||||
return useOptimizedBytecode;
|
return useOptimizedBytecode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDisableHookSSLValidation() {
|
||||||
|
return disableHookSSLValidation;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
@@ -204,6 +208,10 @@ public class HgConfig extends SimpleRepositoryConfig
|
|||||||
this.useOptimizedBytecode = useOptimizedBytecode;
|
this.useOptimizedBytecode = useOptimizedBytecode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDisableHookSSLValidation(boolean disableHookSSLValidation) {
|
||||||
|
this.disableHookSSLValidation = disableHookSSLValidation;
|
||||||
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
@@ -223,4 +231,10 @@ public class HgConfig extends SimpleRepositoryConfig
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private boolean showRevisionInId = false;
|
private boolean showRevisionInId = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* disable validation of ssl certificates for mercurial hook
|
||||||
|
* @see <a href="https://goo.gl/zH5eY8">Issue 959</a>
|
||||||
|
*/
|
||||||
|
private boolean disableHookSSLValidation = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
@@ -78,6 +79,8 @@ import javax.servlet.http.HttpSession;
|
|||||||
public class HgCGIServlet extends HttpServlet
|
public class HgCGIServlet extends HttpServlet
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static final String ENV_PYTHON_HTTPS_VERIFY = "PYTHONHTTPSVERIFY";
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
public static final String ENV_REPOSITORY_NAME = "REPO_NAME";
|
public static final String ENV_REPOSITORY_NAME = "REPO_NAME";
|
||||||
|
|
||||||
@@ -268,9 +271,16 @@ public class HgCGIServlet extends HttpServlet
|
|||||||
directory.getAbsolutePath());
|
directory.getAbsolutePath());
|
||||||
|
|
||||||
// add hook environment
|
// add hook environment
|
||||||
|
Map<String, String> environment = executor.getEnvironment().asMutableMap();
|
||||||
|
if (handler.getConfig().isDisableHookSSLValidation()) {
|
||||||
|
// disable ssl validation
|
||||||
|
// Issue 959: https://goo.gl/zH5eY8
|
||||||
|
environment.put(ENV_PYTHON_HTTPS_VERIFY, "0");
|
||||||
|
}
|
||||||
|
|
||||||
//J-
|
//J-
|
||||||
HgEnvironment.prepareEnvironment(
|
HgEnvironment.prepareEnvironment(
|
||||||
executor.getEnvironment().asMutableMap(),
|
environment,
|
||||||
handler,
|
handler,
|
||||||
hookManager,
|
hookManager,
|
||||||
request
|
request
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ Sonia.hg.ConfigPanel = Ext.extend(Sonia.config.ConfigForm, {
|
|||||||
encodingText: 'Encoding',
|
encodingText: 'Encoding',
|
||||||
disabledText: 'Disabled',
|
disabledText: 'Disabled',
|
||||||
showRevisionInIdText: 'Show Revision',
|
showRevisionInIdText: 'Show Revision',
|
||||||
|
// TODO: i18n
|
||||||
|
disableHookSSLValidationText: 'Disable SSL Validation on Hooks',
|
||||||
|
|
||||||
// helpText
|
// helpText
|
||||||
hgBinaryHelpText: 'Location of Mercurial binary.',
|
hgBinaryHelpText: 'Location of Mercurial binary.',
|
||||||
@@ -58,6 +60,9 @@ Sonia.hg.ConfigPanel = Ext.extend(Sonia.config.ConfigForm, {
|
|||||||
Note you have to reload the page, after changing this value.',
|
Note you have to reload the page, after changing this value.',
|
||||||
showRevisionInIdHelpText: 'Show revision as part of the node id. Note: \n\
|
showRevisionInIdHelpText: 'Show revision as part of the node id. Note: \n\
|
||||||
You have to restart the ApplicationServer to affect cached changesets.',
|
You have to restart the ApplicationServer to affect cached changesets.',
|
||||||
|
// TODO: i18n
|
||||||
|
disableHookSSLValidationHelpText: 'Disables the validation of ssl certificates for the mercurial hook, which forwards the repository changes back to scm-manager. \n\
|
||||||
|
This option should only be used, if SCM-Manager uses a self signed certificate.',
|
||||||
|
|
||||||
initComponent: function(){
|
initComponent: function(){
|
||||||
|
|
||||||
@@ -104,6 +109,12 @@ Sonia.hg.ConfigPanel = Ext.extend(Sonia.config.ConfigForm, {
|
|||||||
fieldLabel: this.showRevisionInIdText,
|
fieldLabel: this.showRevisionInIdText,
|
||||||
inputValue: 'true',
|
inputValue: 'true',
|
||||||
helpText: this.showRevisionInIdHelpText
|
helpText: this.showRevisionInIdHelpText
|
||||||
|
},{
|
||||||
|
xtype: 'checkbox',
|
||||||
|
name: 'disableHookSSLValidation',
|
||||||
|
fieldLabel: this.disableHookSSLValidationText,
|
||||||
|
inputValue: 'true',
|
||||||
|
helpText: this.disableHookSSLValidationHelpText
|
||||||
},{
|
},{
|
||||||
xtype: 'checkbox',
|
xtype: 'checkbox',
|
||||||
name: 'disabled',
|
name: 'disabled',
|
||||||
|
|||||||
Reference in New Issue
Block a user