Skip to content

Remove internal permissions types and most of SecurityHelper #969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Jun 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,7 @@ private ref class Util sealed
System::Exception^ e = System::Runtime::InteropServices::Marshal::GetExceptionForHR(hr);
if (dynamic_cast<System::Net::WebException^>(e) != nullptr)
{
if (IsFullTrustCaller())
{
throw e;//rethrow original exception for full trust case.
}
else
{
throw gcnew System::Net::WebException();// throw sanitized exception
}
throw e;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,27 +191,11 @@ internal override object GetBitmapFromBitmapSource(object source)
formatConverter.DestinationFormat = System.Windows.Media.PixelFormats.Bgr32;
formatConverter.EndInit();

CodeAccessPermission mediaAccessPermission = SecurityHelper.CreateMediaAccessPermission(null);

if (mediaAccessPermission != null)
{
mediaAccessPermission.Assert(); //BlessedAssert
}
try
{
formatConverter.CopyPixels(
new Int32Rect(0, 0, imageWidth, imageHeight),
bmData.Scan0,
bmData.Stride * (bmData.Height - 1) + (bmData.Width * 4),
bmData.Stride);
}
finally
{
if (mediaAccessPermission != null)
{
CodeAccessPermission.RevertAssert();
}
}
formatConverter.CopyPixels(
new Int32Rect(0, 0, imageWidth, imageHeight),
bmData.Scan0,
bmData.Stride * (bmData.Height - 1) + (bmData.Width * 4),
bmData.Stride);

bitmapFinal.UnlockBits(bmData);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ internal static void HandleWebResponse(WebResponse response)
Justification="It's okay now. Be careful on change.")]
internal static string GetCookie(Uri uri, bool throwIfNoCookie)
{
// Always demand in order to prevent any cross-domain information leak.
SecurityHelper.DemandWebPermission(uri);

UInt32 size = 0;
string uriString = BindUriHelper.UriToString(uri);
if (UnsafeNativeMethods.InternetGetCookieEx(uriString, null, null, ref size, 0, IntPtr.Zero))
Expand All @@ -134,8 +131,6 @@ internal static string GetCookie(Uri uri, bool throwIfNoCookie)
[FriendAccessAllowed] // called by PF.Application.SetCookie()
internal static bool SetCookie(Uri uri, string cookieData)
{
SecurityHelper.DemandWebPermission(uri);

return SetCookieUnsafe(uri, cookieData, null);
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,7 @@ internal static Text.TextInterface.FontCollection LegacyArabicFontCollection
if (_legacyArabicFontCollection == null)
{
Uri criticalSxSFontsLocation = new Uri(FamilyCollection.SxSFontsResourcePrefix);
SecurityHelper.CreateUriDiscoveryPermission(criticalSxSFontsLocation).Assert();
try
{
_legacyArabicFontCollection = DWriteFactory.GetFontCollectionFromFolder(criticalSxSFontsLocation);
}
finally
{
CodeAccessPermission.RevertAssert();
}
_legacyArabicFontCollection = DWriteFactory.GetFontCollectionFromFolder(criticalSxSFontsLocation);
}
}
}
Expand Down Expand Up @@ -312,7 +304,6 @@ private FamilyCollection(Uri folderUri, MS.Internal.Text.TextInterface.FontColle
/// <param name="folderUri">Absolute Uri of a folder</param>
internal static FamilyCollection FromUri(Uri folderUri)
{
SecurityHelper.DemandUriReadPermission(folderUri);
return new FamilyCollection(folderUri, DWriteFactory.GetFontCollectionFromFolder(folderUri));
}

Expand Down
Loading