mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 17:31:36 -06:00
Electron 324: allow only https in pod url config during installation (#319)
- add logic to validate pod url strictly with https - add logic to validate pod url strictly with https (windows) - fix url replacement in the post install script and regular expression for validating url in the installer pane
This commit is contained in:
parent
55e75cf5e5
commit
2757a58604
@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>17C88</string>
|
||||
<string>17D47</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
|
Binary file not shown.
@ -97,7 +97,7 @@
|
||||
TargetAttributes = {
|
||||
3A10EBCE1ED4336D0083702F = {
|
||||
CreatedOnToolsVersion = 8.3.2;
|
||||
DevelopmentTeam = NG92SF5D2E;
|
||||
DevelopmentTeam = 2CWJ37D7FB;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
@ -279,7 +279,7 @@
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_TEAM = NG92SF5D2E;
|
||||
DEVELOPMENT_TEAM = 2CWJ37D7FB;
|
||||
INFOPLIST_FILE = SymphonySettingsPlugin/Info.plist;
|
||||
INSTALL_PATH = "$(HOME)/Library/Bundles";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
@ -295,7 +295,7 @@
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_TEAM = NG92SF5D2E;
|
||||
DEVELOPMENT_TEAM = 2CWJ37D7FB;
|
||||
INFOPLIST_FILE = SymphonySettingsPlugin/Info.plist;
|
||||
INSTALL_PATH = "$(HOME)/Library/Bundles";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
|
@ -23,16 +23,8 @@
|
||||
|
||||
NSString *podUrl = [_podUrlTextBox stringValue];
|
||||
|
||||
// Check if the url contains a protocol, if not, prepend https to it
|
||||
NSString *securePrefix = @"https://";
|
||||
NSString *prefix = @"http://";
|
||||
if (![podUrl hasPrefix:securePrefix] && ![podUrl hasPrefix:prefix]) {
|
||||
podUrl = [securePrefix stringByAppendingString:podUrl];
|
||||
[_podUrlTextBox setStringValue:podUrl];
|
||||
}
|
||||
|
||||
// Now, validate the url against a url regex
|
||||
NSString *regex = @"^(https:\/\/|http:\/\/)(www.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,}(:[0-9]{1,5})?(\/[a-zA-Z0-9-_.+!*'(),;/?:@=&$]*)?$";
|
||||
NSString *regex = @"^(https:\\/\\/)?(www.)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,}(:[0-9]{1,5})?(\\/[a-zA-Z0-9-_.+!*'(),;\\/?:@=&$]*)?$";
|
||||
NSPredicate *podUrlTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
|
||||
if ([podUrlTest evaluateWithObject:podUrl]) {
|
||||
return YES;
|
||||
@ -48,7 +40,13 @@
|
||||
- (void)willExitPane:(InstallerSectionDirection)dir {
|
||||
|
||||
NSString *podUrl = [_podUrlTextBox stringValue];
|
||||
|
||||
|
||||
NSString *securePrefix = @"https://";
|
||||
if (![podUrl hasPrefix:securePrefix]) {
|
||||
podUrl = [securePrefix stringByAppendingString:podUrl];
|
||||
[_podUrlTextBox setStringValue:podUrl];
|
||||
}
|
||||
|
||||
// By default, set autoLaunchOnStart and minimizeOnClose to true
|
||||
NSString *autoLaunchOnStart = @"true";
|
||||
NSString *minimizeOnClose = @"true";
|
||||
|
@ -33,8 +33,10 @@ if [ "$bring_to_front" == "" ]; then
|
||||
bring_to_front=false;
|
||||
fi
|
||||
|
||||
pod_url_escaped=$(sed 's#[&/\]#\\&#g' <<<"$pod_url")
|
||||
|
||||
## Replace the default settings with the user selected settings ##
|
||||
sed -i "" -E "s#\"url\" ?: ?\".*\"#\"url\"\: \"$pod_url\"#g" ${newPath}
|
||||
sed -i "" -E "s#\"url\" ?: ?\".*\"#\"url\"\: \"$pod_url_escaped\"#g" ${newPath}
|
||||
sed -i "" -E "s#\"minimizeOnClose\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"minimizeOnClose\":\ $minimize_on_close#g" ${newPath}
|
||||
sed -i "" -E "s#\"alwaysOnTop\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"alwaysOnTop\":\ $always_on_top#g" ${newPath}
|
||||
sed -i "" -E "s#\"launchOnStartup\" ?: ?([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])#\"launchOnStartup\":\ $launch_on_startup#g" ${newPath}
|
||||
|
@ -560,7 +560,7 @@
|
||||
<ROW Action="AI_TxtUpdaterRollback" Type="11521" Source="TxtUpdater.dll" Target="OnTxtUpdaterRollback" WithoutSeq="true"/>
|
||||
<ROW Action="KillParagon" Type="1" Source="aicustact.dll" Target="StopProcess" Options="1" AdditionalSeq="AI_DATA_SETTER_2"/>
|
||||
<ROW Action="KillRenderer" Type="1" Source="aicustact.dll" Target="StopProcess" Options="1" AdditionalSeq="AI_DATA_SETTER"/>
|
||||
<ROW Action="PodUrlValidation" Type="37" Target="Script Text" TargetUnformatted="// First, check if the protocol is part of the url, if not, prepend it var prefix1 = "https://"; var prefix2 = "http://"; if (Session.Property("POD_URL").substr(0, prefix1.length) !== prefix1 && Session.Property("POD_URL").substr(0, prefix2.length) !== prefix2) { Session.Property("POD_URL") = prefix1 + Session.Property("POD_URL"); } // Check if the entered pod url is valid var podUrlRE = /^(https:\/\/|http:\/\/)(www.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,}(:[0-9]{1,5})?(\/[a-zA-Z0-9-_.+!*'(),;/?:@=&$]*)?$/; var podUrlTest = podUrlRE.test(Session.Property("POD_URL")); if (!podUrlTest) { 	Session.Property("INVALID_POD_URL") = "invalid"; } else { 	Session.Property("INVALID_POD_URL") = "valid"; } // By default, we set all the values to false and change based on conditions Session.Property("ALWAYS_ON_TOP_LABEL") = "false"; Session.Property("AUTO_START_LABEL") = "false"; Session.Property("MINIMIZE_ON_CLOSE_LABEL") = "false"; Session.Property("BRING_TO_FRONT_LABEL") = "false"; // If always on top is checked in the checkbox, set the label value to true if (Session.Property("ALWAYS_ON_TOP") && Session.Property("ALWAYS_ON_TOP") === "true") { Session.Property("ALWAYS_ON_TOP_LABEL") = "true"; } // If launch on startup is checked in the checkbox, set the label value to true if (Session.Property("MINIMIZE_ON_CLOSE") && Session.Property("MINIMIZE_ON_CLOSE") === "true") { Session.Property("MINIMIZE_ON_CLOSE_LABEL") = "true"; } // If minimise on close is checked in the checkbox, set the label value to true if (Session.Property("AUTO_START") && Session.Property("AUTO_START") === "true") { Session.Property("AUTO_START_LABEL") = "true"; } // If bring to front is checked in the checkbox, set the label value to true if (Session.Property("BRING_TO_FRONT") && Session.Property("BRING_TO_FRONT") === "true") { Session.Property("BRING_TO_FRONT_LABEL") = "true"; }" WithoutSeq="true"/>
|
||||
<ROW Action="PodUrlValidation" Type="37" Target="Script Text" TargetUnformatted="// First, check if the protocol is part of the url, if not, prepend it var prefix1 = "https://"; var prefix2 = "http://"; if (Session.Property("POD_URL").substr(0, prefix1.length) !== prefix1 && Session.Property("POD_URL").substr(0, prefix2.length) !== prefix2) { Session.Property("POD_URL") = prefix1 + Session.Property("POD_URL"); } // Check if the entered pod url is valid var podUrlRE = /^(https:\/\/)(www.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,}(:[0-9]{1,5})?(\/[a-zA-Z0-9-_.+!*'(),;/?:@=&$]*)?$/; var podUrlTest = podUrlRE.test(Session.Property("POD_URL")); if (!podUrlTest) { 	Session.Property("INVALID_POD_URL") = "invalid"; } else { 	Session.Property("INVALID_POD_URL") = "valid"; } // By default, we set all the values to false and change based on conditions Session.Property("ALWAYS_ON_TOP_LABEL") = "false"; Session.Property("AUTO_START_LABEL") = "false"; Session.Property("MINIMIZE_ON_CLOSE_LABEL") = "false"; Session.Property("BRING_TO_FRONT_LABEL") = "false"; // If always on top is checked in the checkbox, set the label value to true if (Session.Property("ALWAYS_ON_TOP") && Session.Property("ALWAYS_ON_TOP") === "true") { Session.Property("ALWAYS_ON_TOP_LABEL") = "true"; } // If launch on startup is checked in the checkbox, set the label value to true if (Session.Property("MINIMIZE_ON_CLOSE") && Session.Property("MINIMIZE_ON_CLOSE") === "true") { Session.Property("MINIMIZE_ON_CLOSE_LABEL") = "true"; } // If minimise on close is checked in the checkbox, set the label value to true if (Session.Property("AUTO_START") && Session.Property("AUTO_START") === "true") { Session.Property("AUTO_START_LABEL") = "true"; } // If bring to front is checked in the checkbox, set the label value to true if (Session.Property("BRING_TO_FRONT") && Session.Property("BRING_TO_FRONT") === "true") { Session.Property("BRING_TO_FRONT_LABEL") = "true"; }" WithoutSeq="true"/>
|
||||
<ROW Action="SET_APPDIR" Type="307" Source="APPDIR" Target="[ProgramFilesFolder][Manufacturer]\[ProductName]" MultiBuildTarget="DefaultBuild:[AI_UserProgramFiles][Manufacturer]\[ProductName]"/>
|
||||
<ROW Action="SET_SHORTCUTDIR" Type="307" Source="SHORTCUTDIR" Target="[ProgramMenuFolder][ProductName]"/>
|
||||
<ROW Action="SET_TARGETDIR_TO_APPDIR" Type="51" Source="TARGETDIR" Target="[APPDIR]"/>
|
||||
|
@ -537,7 +537,7 @@
|
||||
<ROW Action="AI_STORE_LOCATION" Type="51" Source="ARPINSTALLLOCATION" Target="[APPDIR]"/>
|
||||
<ROW Action="KillParagon" Type="1" Source="aicustact.dll" Target="StopProcess" Options="1" AdditionalSeq="AI_DATA_SETTER_2"/>
|
||||
<ROW Action="KillRenderer" Type="1" Source="aicustact.dll" Target="StopProcess" Options="1" AdditionalSeq="AI_DATA_SETTER"/>
|
||||
<ROW Action="PodUrlValidation" Type="37" Target="Script Text" TargetUnformatted="// First, check if the protocol is part of the url, if not, prepend it var prefix1 = "https://"; var prefix2 = "http://"; if (Session.Property("POD_URL").substr(0, prefix1.length) !== prefix1 && Session.Property("POD_URL").substr(0, prefix2.length) !== prefix2) { Session.Property("POD_URL") = prefix1 + Session.Property("POD_URL"); } // Check if the entered pod url is valid var podUrlRE = /^(https:\/\/|http:\/\/)(www.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,}(:[0-9]{1,5})?(\/[a-zA-Z0-9-_.+!*'(),;/?:@=&$]*)?$/; var podUrlTest = podUrlRE.test(Session.Property("POD_URL")); if (!podUrlTest) { 	Session.Property("INVALID_POD_URL") = "invalid"; } else { 	Session.Property("INVALID_POD_URL") = "valid"; } // By default, we set all the values to false and change based on conditions Session.Property("ALWAYS_ON_TOP_LABEL") = "false"; Session.Property("AUTO_START_LABEL") = "false"; Session.Property("MINIMIZE_ON_CLOSE_LABEL") = "false"; Session.Property("BRING_TO_FRONT_LABEL") = "false"; // If always on top is checked in the checkbox, set the label value to true if (Session.Property("ALWAYS_ON_TOP") && Session.Property("ALWAYS_ON_TOP") === "true") { Session.Property("ALWAYS_ON_TOP_LABEL") = "true"; } // If launch on startup is checked in the checkbox, set the label value to true if (Session.Property("MINIMIZE_ON_CLOSE") && Session.Property("MINIMIZE_ON_CLOSE") === "true") { Session.Property("MINIMIZE_ON_CLOSE_LABEL") = "true"; } // If minimise on close is checked in the checkbox, set the label value to true if (Session.Property("AUTO_START") && Session.Property("AUTO_START") === "true") { Session.Property("AUTO_START_LABEL") = "true"; } // If bring to front is checked in the checkbox, set the label value to true if (Session.Property("BRING_TO_FRONT") && Session.Property("BRING_TO_FRONT") === "true") { Session.Property("BRING_TO_FRONT_LABEL") = "true"; }" WithoutSeq="true"/>
|
||||
<ROW Action="PodUrlValidation" Type="37" Target="Script Text" TargetUnformatted="// First, check if the protocol is part of the url, if not, prepend it var prefix1 = "https://"; var prefix2 = "http://"; if (Session.Property("POD_URL").substr(0, prefix1.length) !== prefix1 && Session.Property("POD_URL").substr(0, prefix2.length) !== prefix2) { Session.Property("POD_URL") = prefix1 + Session.Property("POD_URL"); } // Check if the entered pod url is valid var podUrlRE = /^(https:\/\/)(www.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,}(:[0-9]{1,5})?(\/[a-zA-Z0-9-_.+!*'(),;/?:@=&$]*)?$/; var podUrlTest = podUrlRE.test(Session.Property("POD_URL")); if (!podUrlTest) { 	Session.Property("INVALID_POD_URL") = "invalid"; } else { 	Session.Property("INVALID_POD_URL") = "valid"; } // By default, we set all the values to false and change based on conditions Session.Property("ALWAYS_ON_TOP_LABEL") = "false"; Session.Property("AUTO_START_LABEL") = "false"; Session.Property("MINIMIZE_ON_CLOSE_LABEL") = "false"; Session.Property("BRING_TO_FRONT_LABEL") = "false"; // If always on top is checked in the checkbox, set the label value to true if (Session.Property("ALWAYS_ON_TOP") && Session.Property("ALWAYS_ON_TOP") === "true") { Session.Property("ALWAYS_ON_TOP_LABEL") = "true"; } // If launch on startup is checked in the checkbox, set the label value to true if (Session.Property("MINIMIZE_ON_CLOSE") && Session.Property("MINIMIZE_ON_CLOSE") === "true") { Session.Property("MINIMIZE_ON_CLOSE_LABEL") = "true"; } // If minimise on close is checked in the checkbox, set the label value to true if (Session.Property("AUTO_START") && Session.Property("AUTO_START") === "true") { Session.Property("AUTO_START_LABEL") = "true"; } // If bring to front is checked in the checkbox, set the label value to true if (Session.Property("BRING_TO_FRONT") && Session.Property("BRING_TO_FRONT") === "true") { Session.Property("BRING_TO_FRONT_LABEL") = "true"; }" WithoutSeq="true"/>
|
||||
<ROW Action="SET_APPDIR" Type="307" Source="APPDIR" Target="[ProgramFilesFolder][Manufacturer]\[ProductName]" MultiBuildTarget="DefaultBuild:[AI_UserProgramFiles][Manufacturer]\[ProductName]"/>
|
||||
<ROW Action="SET_SHORTCUTDIR" Type="307" Source="SHORTCUTDIR" Target="[ProgramMenuFolder][ProductName]"/>
|
||||
<ROW Action="SET_TARGETDIR_TO_APPDIR" Type="51" Source="TARGETDIR" Target="[APPDIR]"/>
|
||||
|
Loading…
Reference in New Issue
Block a user