-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19fa03f
commit bafaec2
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// ruleid: glide-library | ||
import com.bumptech.glide.load.DataSource; | ||
|
||
if (mBraveNewsController != null) { | ||
mBraveNewsController.getImageData(adImageUrl, imageData -> { | ||
if (imageData != null) { | ||
Bitmap decodedByte = | ||
BitmapFactory.decodeByteArray(imageData, 0, imageData.length); | ||
// ruleid: glide-library | ||
Glide.with(mActivity) | ||
.asBitmap() | ||
.load(decodedByte) | ||
.fitCenter() | ||
.priority(Priority.IMMEDIATE) | ||
.diskCacheStrategy(DiskCacheStrategy.ALL) | ||
.into(new CustomTarget<Bitmap>() { | ||
@Override | ||
public void onResourceReady(@NonNull Bitmap resource, | ||
@Nullable Transition<? super Bitmap> transition) { | ||
imageView.setImageBitmap(resource); | ||
} | ||
@Override | ||
public void onLoadCleared(@Nullable Drawable placeholder) {} | ||
}); | ||
imageView.setClipToOutline(true); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
rules: | ||
- id: glide-library | ||
metadata: | ||
author: Artem Chaikin | ||
references: | ||
- https://github.com/brave/reviews/issues/1391 | ||
source: https://github.com/brave/security-action/blob/main/assets/semgrep_rules/client/glide-library.yaml | ||
assignees: | | ||
stoletheminerals | ||
bridiver | ||
message: "The Glide image loading library is not yet approved, new usages should not be implemented until the security team has given their approval." | ||
languages: [java] | ||
severity: WARNING | ||
patterns: | ||
- pattern-either: | ||
- pattern: "import com.bumptech.glide" | ||
- pattern: "Glide.with(...)" |