Skip to content
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

Glide library detection rule #715

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
28 changes: 28 additions & 0 deletions assets/semgrep_rules/client/glide-library.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// ruleid: glide-library
import com.bumptech.glide.load.DataSource;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
[semgrep] The Glide image loading library is not yet approved, new usages should not be implemented until the security team has given their approval.

Source: https://github.com/brave/security-action/blob/main/assets/semgrep_rules/client/glide-library.yaml


Cc @stoletheminerals @bridiver


if (mBraveNewsController != null) {
mBraveNewsController.getImageData(adImageUrl, imageData -> {
if (imageData != null) {
Bitmap decodedByte =
BitmapFactory.decodeByteArray(imageData, 0, imageData.length);
// ruleid: glide-library
Glide.with(mActivity)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
[semgrep] The Glide image loading library is not yet approved, new usages should not be implemented until the security team has given their approval.

Source: https://github.com/brave/security-action/blob/main/assets/semgrep_rules/client/glide-library.yaml


Cc @stoletheminerals @bridiver

.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);
}
});
}
17 changes: 17 additions & 0 deletions assets/semgrep_rules/client/glide-library.yml
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(...)"