This commit is contained in:
DavidXanatos 2023-12-15 20:59:54 +01:00
parent c14d369ee9
commit 4acdf0fcf5
2 changed files with 40 additions and 21 deletions

View File

@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- without an active, non expired, supporter certificate, automatic updates/downloads are not longer available for the stable channel - without an active, non expired, supporter certificate, automatic updates/downloads are not longer available for the stable channel
- the autoamtic updater will still work and notify about new stable releases, the user will be guided to visit the download page and download the latest installer manually - the autoamtic updater will still work and notify about new stable releases, the user will be guided to visit the download page and download the latest installer manually
- cleanup button is also enabled when not connencted to core - cleanup button is also enabled when not connencted to core
- the box creation wizard now alows to create a black box based on any otehr box type
### Fixed ### Fixed
- fixed running sandboxed processes located in a imdisk volume [#3472](https://github.com/sandboxie-plus/Sandboxie/discussions/3472) - fixed running sandboxed processes located in a imdisk volume [#3472](https://github.com/sandboxie-plus/Sandboxie/discussions/3472)

View File

@ -55,10 +55,15 @@ SB_STATUS CNewBoxWizard::TryToCreateBox()
QString BoxName = field("boxName").toString(); QString BoxName = field("boxName").toString();
BoxName.replace(" ", "_"); BoxName.replace(" ", "_");
int BoxType = field("boxType").toInt(); int BoxType = field("boxType").toInt();
#ifndef USE_COMBO
bool BlackBox = field("blackBox").toBool();
#else
bool BlackBox = CSandBoxPlus::ePrivate;
#endif
QString Password; QString Password;
quint64 ImageSize = 0; quint64 ImageSize = 0;
if (BoxType == CSandBoxPlus::ePrivate) { if (BlackBox) {
CBoxImageWindow window(CBoxImageWindow::eNew, this); CBoxImageWindow window(CBoxImageWindow::eNew, this);
if (theGUI->SafeExec(&window) == 1) { if (theGUI->SafeExec(&window) == 1) {
Password = window.GetPassword(); Password = window.GetPassword();
@ -111,14 +116,13 @@ SB_STATUS CNewBoxWizard::TryToCreateBox()
//pBox->InsertText("Template", "NoUACProxy"); // proxy is always needed for exes in the box //pBox->InsertText("Template", "NoUACProxy"); // proxy is always needed for exes in the box
pBox->InsertText("Template", "RpcPortBindingsExt"); pBox->InsertText("Template", "RpcPortBindingsExt");
break; break;
case CSandBoxPlus::ePrivate: {
pBox->SetBool("UseFileImage", true);
pBox->SetBool("ConfidentialBox", true);
break;
}
} }
if (BlackBox) {
pBox->SetBool("UseFileImage", true);
pBox->SetBool("ConfidentialBox", true);
}
QRgb rgb = theGUI->GetBoxColor(BoxType); QRgb rgb = theGUI->GetBoxColor(BoxType);
pBox->SetText("BorderColor", QString("#%1%2%3").arg(qBlue(rgb), 2, 16, QChar('0')).arg(qGreen(rgb), 2, 16, QChar('0')).arg(qRed(rgb), 2, 16, QChar('0')) + ",ttl"); pBox->SetText("BorderColor", QString("#%1%2%3").arg(qBlue(rgb), 2, 16, QChar('0')).arg(qGreen(rgb), 2, 16, QChar('0')).arg(qRed(rgb), 2, 16, QChar('0')) + ",ttl");
@ -254,25 +258,25 @@ CBoxTypePage::CBoxTypePage(bool bAlowTemp, QWidget *parent)
m_TypeGroup = new QButtonGroup(); m_TypeGroup = new QButtonGroup();
auto AddBoxType = [&](const QString& label, int Type, const QString& tip = QString(), bool bCheck = false) { auto AddBoxType = [&](const QString& label, int Type, const QString& tip = QString(), bool bCheck = false) {
QWidget* pW = bCheck ? (QWidget*)new QCheckBox() : (QWidget*)new QRadioButton(); QAbstractButton* pC = bCheck ? (QAbstractButton*)new QCheckBox() : (QAbstractButton*)new QRadioButton();
if (theGUI->m_DarkTheme) { if (theGUI->m_DarkTheme) {
QPalette palette = QApplication::palette(); QPalette palette = QApplication::palette();
palette.setColor(QPalette::Base, Qt::white); palette.setColor(QPalette::Base, Qt::white);
palette.setColor(QPalette::Text, Qt::black); palette.setColor(QPalette::Text, Qt::black);
pW->setPalette(palette); pC->setPalette(palette);
} }
pW->setToolTip(tip); pC->setToolTip(tip);
if(!bCheck) m_TypeGroup->addButton((QRadioButton*)pW, Type); if(!bCheck) m_TypeGroup->addButton((QRadioButton*)pC, Type);
QHBoxLayout* pLayout = new QHBoxLayout(); QHBoxLayout* pLayout = new QHBoxLayout();
pLayout->setContentsMargins(0,0,0,0); pLayout->setContentsMargins(0,0,0,0);
pLayout->setSpacing(4); pLayout->setSpacing(4);
pW->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); pC->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
pLayout->addWidget(pW); pLayout->addWidget(pC);
QLabel* pLabel = new QLabel(label); QLabel* pLabel = new QLabel(label);
pLabel->setToolTip(tip); pLabel->setToolTip(tip);
pLayout->addWidget(pLabel); pLayout->addWidget(pLabel);
connect(pLabel, SIGNAL(linkActivated(const QString&)), theGUI, SLOT(OpenUrl(const QString&))); connect(pLabel, SIGNAL(linkActivated(const QString&)), theGUI, SLOT(OpenUrl(const QString&)));
pW = new QWidget(); QWidget* pW = new QWidget();
pW->setLayout(pLayout); pW->setLayout(pLayout);
layout->addWidget(pW, row, 1, 1, 2); layout->addWidget(pW, row, 1, 1, 2);
if (Type != -1) { if (Type != -1) {
@ -285,6 +289,7 @@ CBoxTypePage::CBoxTypePage(bool bAlowTemp, QWidget *parent)
} }
row++; row++;
//return qMakePair(pW, pIcon); //return qMakePair(pW, pIcon);
return pC;
}; };
AddBoxType(tr("<a href=\"sbie://docs/security-mode\">Security Hardened</a> Sandbox with <a href=\"sbie://docs/privacy-mode\">Data Protection</a>"), (int)CSandBoxPlus::eHardenedPlus, AddBoxType(tr("<a href=\"sbie://docs/security-mode\">Security Hardened</a> Sandbox with <a href=\"sbie://docs/privacy-mode\">Data Protection</a>"), (int)CSandBoxPlus::eHardenedPlus,
@ -306,16 +311,25 @@ CBoxTypePage::CBoxTypePage(bool bAlowTemp, QWidget *parent)
tr("This box type prioritizes compatibility while still providing a good level of isolation. It is designed for running trusted applications within separate compartments. \n" tr("This box type prioritizes compatibility while still providing a good level of isolation. It is designed for running trusted applications within separate compartments. \n"
"While the level of isolation is reduced compared to other box types, it offers improved compatibility with a wide range of applications, ensuring smooth operation within the sandboxed environment.")); "While the level of isolation is reduced compared to other box types, it offers improved compatibility with a wide range of applications, ensuring smooth operation within the sandboxed environment."));
AddBoxType(tr("<a href=\"sbie://docs/boxencryption\">Encrypted</a> <a href=\"sbie://docs/black-box\">Confidential</a> Box"), (int)CSandBoxPlus::ePrivate, QWidget* pGap = new QWidget();
pGap->setMinimumHeight(4);
layout->addWidget(pGap, row++, 1, 1, 2);
//AddBoxType(tr("<a href=\"sbie://docs/boxencryption\">Encrypted</a> <a href=\"sbie://docs/black-box\">Confidential</a> Box"), (int)CSandBoxPlus::ePrivate,
QWidget* pBlackBox = AddBoxType(tr("<a href=\"sbie://docs/boxencryption\">Encrypt</a> Box content and set <a href=\"sbie://docs/black-box\">Confidential</a>"), (int)CSandBoxPlus::ePrivate,
tr("In this box type the sandbox uses an encrypted disk image as its root folder. This provides an additional layer of privacy and security. \n" tr("In this box type the sandbox uses an encrypted disk image as its root folder. This provides an additional layer of privacy and security. \n"
"Access to the virtual disk when mounted is restricted to programs running within the sandbox. Sandboxie prevents other processes on the host system from accessing the sandboxed processes. \n" "Access to the virtual disk when mounted is restricted to programs running within the sandbox. Sandboxie prevents other processes on the host system from accessing the sandboxed processes. \n"
"This ensures the utmost level of privacy and data protection within the confidential sandbox environment."));//, true); "This ensures the utmost level of privacy and data protection within the confidential sandbox environment."), true);
connect(m_TypeGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SIGNAL(typeChanged())); connect(m_TypeGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SIGNAL(typeChanged()));
registerField("boxType", this, "currentType", "typeChanged"); registerField("boxType", this, "currentType", "typeChanged");
connect(m_TypeGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(OnBoxTypChanged())); connect(m_TypeGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(OnBoxTypChanged()));
connect(pBlackBox, SIGNAL(toggled(bool)), this, SIGNAL(typeChanged()));
registerField("blackBox", pBlackBox);
connect(pBlackBox, SIGNAL(toggled(bool)), this, SLOT(OnBoxTypChanged()));
//QCheckBox* pMore = new QCheckBox(tr("Show More Types")); //QCheckBox* pMore = new QCheckBox(tr("Show More Types"));
//layout->addWidget(pMore, 4, 3); //layout->addWidget(pMore, 4, 3);
//connect(pMore, &QCheckBox::toggled, [=](bool bValue) { //connect(pMore, &QCheckBox::toggled, [=](bool bValue) {
@ -385,14 +399,16 @@ void CBoxTypePage::OnBoxTypChanged()
{ {
#ifndef USE_COMBO #ifndef USE_COMBO
int BoxType = m_TypeGroup->checkedId(); int BoxType = m_TypeGroup->checkedId();
bool BlackBox = field("blackBox").toBool();
#else #else
int BoxType = m_pBoxType->currentData().toInt(); int BoxType = m_pBoxType->currentData().toInt();
bool BlackBox = CSandBoxPlus::ePrivate;
m_pInfoLabel->setText(theGUI->GetBoxDescription(BoxType)); m_pInfoLabel->setText(theGUI->GetBoxDescription(BoxType));
#endif #endif
if(BoxType != CSandBoxPlus::eDefault) if(BoxType != CSandBoxPlus::eDefault || BlackBox)
theGUI->CheckCertificate(this, BoxType == CSandBoxPlus::ePrivate); theGUI->CheckCertificate(this, BlackBox);
emit completeChanged(); emit completeChanged();
} }
@ -443,12 +459,14 @@ bool CBoxTypePage::validatePage()
#ifndef USE_COMBO #ifndef USE_COMBO
int BoxType = m_TypeGroup->checkedId(); int BoxType = m_TypeGroup->checkedId();
bool BlackBox = field("blackBox").toBool();
#else #else
int BoxType = m_pBoxType->currentData().toInt(); int BoxType = m_pBoxType->currentData().toInt();
bool BlackBox = (BoxType == CSandBoxPlus::ePrivate || BoxType == CSandBoxPlus::ePrivatePlus);
#endif #endif
if ((BoxType == CSandBoxPlus::ePrivate || BoxType == CSandBoxPlus::ePrivatePlus) && !theGUI->IsImDiskReady()) { if (BlackBox && !theGUI->IsImDiskReady()) {
theGUI->GetAddonManager()->TryInstallAddon("ImDisk", this, tr("To use encrypted boxes you need to install the ImDisk driver, do you want to download and install it?")); theGUI->GetAddonManager()->TryInstallAddon("ImDisk", this, tr("To use ancrypted boxes you need to install the ImDisk driver, do you want to download and install it?"));
return false; return false;
} }