instruction string | input string | output string | cwe_ids list | cve_id string | severity string | cvss_score float64 | repo_name string | func_name string | file_path string | commit_hash string | is_vulnerable int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Analyze the following code function for security vulnerabilities | private void parseSequence(final Node sequence) throws GameParseException {
parseSteps(getChildren("step", sequence));
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: parseSequence
File: game-core/src/main/java/games/strategy/engine/data/GameParser.java
Repository: triplea-game/triplea
The code follows secure coding practices. | [
"CWE-611"
] | CVE-2018-1000546 | MEDIUM | 6.8 | triplea-game/triplea | parseSequence | game-core/src/main/java/games/strategy/engine/data/GameParser.java | 0f23875a4c6e166218859a63c884995f15c53895 | 0 |
Analyze the following code function for security vulnerabilities | private static boolean copyShielded(net.sf.jazzlib.ZipInputStream oZip, VFSLeaf newEntry) {
try(InputStream in = new ShieldInputStream(oZip)) {
return VFSManager.copyContent(in, newEntry);
} catch(Exception e) {
handleIOException("", e);
return false;
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: copyShielded
File: src/main/java/org/olat/core/util/ZipUtil.java
Repository: OpenOLAT
The code follows secure coding practices. | [
"CWE-22"
] | CVE-2021-39180 | HIGH | 9 | OpenOLAT | copyShielded | src/main/java/org/olat/core/util/ZipUtil.java | 5668a41ab3f1753102a89757be013487544279d5 | 0 |
Analyze the following code function for security vulnerabilities | public boolean getMatchUrlCache() {
return myMatchUrlCache;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getMatchUrlCache
File: hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java
Repository: hapifhir/hapi-fhir
The code follows secure coding practices. | [
"CWE-400"
] | CVE-2021-32053 | MEDIUM | 5 | hapifhir/hapi-fhir | getMatchUrlCache | hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java | f2934b229c491235ab0e7782dea86b324521082a | 0 |
Analyze the following code function for security vulnerabilities | public void setFooterVisible(boolean visible) {
footer.setVisible(visible);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setFooterVisible
File: server/src/main/java/com/vaadin/ui/Grid.java
Repository: vaadin/framework
The code follows secure coding practices. | [
"CWE-79"
] | CVE-2019-25028 | MEDIUM | 4.3 | vaadin/framework | setFooterVisible | server/src/main/java/com/vaadin/ui/Grid.java | b9ba10adaa06a0977c531f878c3f0046b67f9cc0 | 0 |
Analyze the following code function for security vulnerabilities | WindowManager.LayoutParams getAttrs() {
return mAttrs;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getAttrs
File: services/core/java/com/android/server/wm/WindowState.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-35674 | HIGH | 7.8 | android | getAttrs | services/core/java/com/android/server/wm/WindowState.java | 7428962d3b064ce1122809d87af65099d1129c9e | 0 |
Analyze the following code function for security vulnerabilities | public boolean isShowingInterstitialPage() {
ContentViewCore contentViewCore = getContentViewCore();
return contentViewCore != null && contentViewCore.isShowingInterstitialPage();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isShowingInterstitialPage
File: chrome/android/java/src/org/chromium/chrome/browser/Tab.java
Repository: chromium
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2014-3159 | MEDIUM | 6.4 | chromium | isShowingInterstitialPage | chrome/android/java/src/org/chromium/chrome/browser/Tab.java | 98a50b76141f0b14f292f49ce376e6554142d5e2 | 0 |
Analyze the following code function for security vulnerabilities | private void cleanUnversionedFiles() {
runOrBomb(gitWd().withArgs("clean", gitCleanArgs()));
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: cleanUnversionedFiles
File: domain/src/main/java/com/thoughtworks/go/domain/materials/git/GitCommand.java
Repository: gocd
The code follows secure coding practices. | [
"CWE-77"
] | CVE-2021-43286 | MEDIUM | 6.5 | gocd | cleanUnversionedFiles | domain/src/main/java/com/thoughtworks/go/domain/materials/git/GitCommand.java | 6fa9fb7a7c91e760f1adc2593acdd50f2d78676b | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void deregister(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception {
ctx.deregister(promise);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: deregister
File: handler/src/main/java/io/netty/handler/ssl/SslClientHelloHandler.java
Repository: netty
The code follows secure coding practices. | [
"CWE-400"
] | CVE-2023-34462 | MEDIUM | 6.5 | netty | deregister | handler/src/main/java/io/netty/handler/ssl/SslClientHelloHandler.java | 535da17e45201ae4278c0479e6162bb4127d4c32 | 0 |
Analyze the following code function for security vulnerabilities | protected JSONObject newJSONObject() throws JSONException {
return new JSONObject(this);
} | Vulnerability Classification:
- CWE: CWE-674, CWE-787
- CVE: CVE-2022-45693
- Severity: HIGH
- CVSS Score: 7.5
Description: Fixing StackOverflow error
Function: newJSONObject
File: src/main/java/org/codehaus/jettison/json/JSONTokener.java
Repository: jettison-json/jettison
Fixed Code:
protected JSONObject newJSONObject() throws JSONException {
checkRecursionDepth();
return new JSONObject(this);
} | [
"CWE-674",
"CWE-787"
] | CVE-2022-45693 | HIGH | 7.5 | jettison-json/jettison | newJSONObject | src/main/java/org/codehaus/jettison/json/JSONTokener.java | cf6a4a1f85416b49b16a5b0c5c0bb81a4833dbc8 | 1 |
Analyze the following code function for security vulnerabilities | private Object[] resolveParams(MethodInvocationContext<?, ?> context, String[] parameterNames) {
Object[] parameterValues;
if (ArrayUtils.isEmpty(parameterNames)) {
parameterValues = context.getParameterValues();
} else {
List list = new ArrayList();
Map<String, MutableArgumentValue<?>> parameters = context.getParameters();
for (String name : parameterNames) {
list.add(parameters.get(name).getValue());
}
parameterValues = list.toArray();
}
return parameterValues;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: resolveParams
File: runtime/src/main/java/io/micronaut/cache/interceptor/CacheInterceptor.java
Repository: micronaut-projects/micronaut-core
The code follows secure coding practices. | [
"CWE-400"
] | CVE-2022-21700 | MEDIUM | 5 | micronaut-projects/micronaut-core | resolveParams | runtime/src/main/java/io/micronaut/cache/interceptor/CacheInterceptor.java | b8ec32c311689667c69ae7d9f9c3b3a8abc96fe3 | 0 |
Analyze the following code function for security vulnerabilities | public ValueRetriever getValueRetriever() {
return valueRetriever;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getValueRetriever
File: pac4j-oidc/src/main/java/org/pac4j/oidc/config/OidcConfiguration.java
Repository: pac4j
The code follows secure coding practices. | [
"CWE-347"
] | CVE-2021-44878 | MEDIUM | 5 | pac4j | getValueRetriever | pac4j-oidc/src/main/java/org/pac4j/oidc/config/OidcConfiguration.java | 22b82ffd702a132d9f09da60362fc6264fc281ae | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void setOrganizationIdForUser(
@NonNull String callerPackage, @NonNull String organizationId, int userId) {
if (!mHasFeature) {
return;
}
Objects.requireNonNull(callerPackage);
final CallerIdentity caller = getCallerIdentity(callerPackage);
// Only the DPC can set this ID.
Preconditions.checkCallAuthorization(isDefaultDeviceOwner(caller) || isProfileOwner(caller),
"Only a Device Owner or Profile Owner may set the Enterprise ID.");
// Empty enterprise ID must not be provided in calls to this method.
Preconditions.checkArgument(!TextUtils.isEmpty(organizationId),
"Enterprise ID may not be empty.");
Slogf.i(LOG_TAG, "Setting Enterprise ID to %s for user %d", organizationId, userId);
synchronized (mESIDInitilizationLock) {
if (mEsidCalculator == null) {
mInjector.binderWithCleanCallingIdentity(() -> {
mEsidCalculator = mInjector.newEnterpriseSpecificIdCalculator();
});
}
}
final String ownerPackage;
synchronized (getLockObject()) {
final ActiveAdmin owner = getDeviceOrProfileOwnerAdminLocked(userId);
// As the caller is the system, it must specify the component name of the profile owner
// as a safety check.
Preconditions.checkCallAuthorization(
owner != null && owner.getUserHandle().getIdentifier() == userId,
String.format("The Profile Owner or Device Owner may only set the Enterprise ID"
+ " on its own user, called on user %d but owner user is %d", userId,
owner.getUserHandle().getIdentifier()));
ownerPackage = owner.info.getPackageName();
Preconditions.checkState(
TextUtils.isEmpty(owner.mOrganizationId) || owner.mOrganizationId.equals(
organizationId),
"The organization ID has been previously set to a different value and cannot "
+ "be changed");
final String dpcPackage = owner.info.getPackageName();
final String esid = mEsidCalculator.calculateEnterpriseId(dpcPackage,
organizationId);
owner.mOrganizationId = organizationId;
owner.mEnrollmentSpecificId = esid;
saveSettingsLocked(userId);
}
DevicePolicyEventLogger
.createEvent(DevicePolicyEnums.SET_ORGANIZATION_ID)
.setAdmin(ownerPackage)
.setBoolean(isManagedProfile(userId))
.write();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setOrganizationIdForUser
File: services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2023-21284 | MEDIUM | 5.5 | android | setOrganizationIdForUser | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | ed3f25b7222d4cff471f2b7d22d1150348146957 | 0 |
Analyze the following code function for security vulnerabilities | public void setContinueNavigationAction(
ContinueNavigationAction continueNavigationAction) {
this.continueNavigationAction = continueNavigationAction;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setContinueNavigationAction
File: flow-server/src/main/java/com/vaadin/flow/component/internal/UIInternals.java
Repository: vaadin/flow
The code follows secure coding practices. | [
"CWE-200"
] | CVE-2023-25499 | MEDIUM | 6.5 | vaadin/flow | setContinueNavigationAction | flow-server/src/main/java/com/vaadin/flow/component/internal/UIInternals.java | 428cc97eaa9c89b1124e39f0089bbb741b6b21cc | 0 |
Analyze the following code function for security vulnerabilities | public static OutputStream newOutputStream(final ByteBuffer dst) {
return new OutputStream() {
public void write(int b) {
dst.put((byte) b);
}
public void write(byte[] bytes, int off, int len) {
dst.put(bytes, off, len);
}
};
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: newOutputStream
File: hazelcast/src/main/java/com/hazelcast/nio/IOUtil.java
Repository: hazelcast
The code follows secure coding practices. | [
"CWE-502"
] | CVE-2016-10750 | MEDIUM | 6.8 | hazelcast | newOutputStream | hazelcast/src/main/java/com/hazelcast/nio/IOUtil.java | c1c31359a1df953e79a9ca9b6c54b3cdbfef11e9 | 0 |
Analyze the following code function for security vulnerabilities | public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeInt(taskId);
if (options == null) {
data.writeInt(0);
} else {
data.writeInt(1);
options.writeToParcel(data, 0);
}
mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0);
reply.readException();
int result = reply.readInt();
reply.recycle();
data.recycle();
return result;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: startActivityFromRecents
File: core/java/android/app/ActivityManagerNative.java
Repository: android
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2016-3832 | HIGH | 8.3 | android | startActivityFromRecents | core/java/android/app/ActivityManagerNative.java | e7cf91a198de995c7440b3b64352effd2e309906 | 0 |
Analyze the following code function for security vulnerabilities | public List<ManagementLink> getManagementLinks() {
return ManagementLink.all();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getManagementLinks
File: core/src/main/java/jenkins/model/Jenkins.java
Repository: jenkinsci/jenkins
The code follows secure coding practices. | [
"CWE-79"
] | CVE-2014-2065 | MEDIUM | 4.3 | jenkinsci/jenkins | getManagementLinks | core/src/main/java/jenkins/model/Jenkins.java | a0b00508eeb74d7033dc4100eb382df4e8fa72e7 | 0 |
Analyze the following code function for security vulnerabilities | @Nullable
Resources injectGetResourcesForApplicationAsUser(String packageName, int userId) {
final long start = getStatStartTime();
final long token = injectClearCallingIdentity();
try {
return mContext.createContextAsUser(UserHandle.of(userId), /* flags */ 0)
.getPackageManager().getResourcesForApplication(packageName);
} catch (NameNotFoundException e) {
Slog.e(TAG, "Resources of package " + packageName + " for user " + userId
+ " not found");
return null;
} finally {
injectRestoreCallingIdentity(token);
logDurationStat(Stats.GET_APPLICATION_RESOURCES, start);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: injectGetResourcesForApplicationAsUser
File: services/core/java/com/android/server/pm/ShortcutService.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-40079 | HIGH | 7.8 | android | injectGetResourcesForApplicationAsUser | services/core/java/com/android/server/pm/ShortcutService.java | 96e0524c48c6e58af7d15a2caf35082186fc8de2 | 0 |
Analyze the following code function for security vulnerabilities | public static Object escapeXml(Object obj) {
if (obj == null) {
return null;
} else if (obj instanceof CharSequence) {
return escapeXml((CharSequence) obj);
} else {
return obj;
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: escapeXml
File: bundles/org.jkiss.utils/src/org/jkiss/utils/xml/XMLUtils.java
Repository: dbeaver
The code follows secure coding practices. | [
"CWE-611"
] | CVE-2021-3836 | MEDIUM | 4.3 | dbeaver | escapeXml | bundles/org.jkiss.utils/src/org/jkiss/utils/xml/XMLUtils.java | 4debf8f25184b7283681ed3fb5e9e887d9d4fe22 | 0 |
Analyze the following code function for security vulnerabilities | protected String getCookieValue(String name, HttpServletRequest request)
{
String val = null;
Cookie[] cookies = request.getCookies();
if (cookies != null)
{
for (Cookie cookie : cookies)
{
if (name.equals(cookie.getName()))
{
val = cookie.getValue();
break;
}
}
}
return val;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getCookieValue
File: src/main/java/com/mxgraph/online/AbsAuthServlet.java
Repository: jgraph/drawio
The code follows secure coding practices. | [
"CWE-601",
"CWE-918"
] | CVE-2022-1767 | MEDIUM | 5 | jgraph/drawio | getCookieValue | src/main/java/com/mxgraph/online/AbsAuthServlet.java | c63f3a04450f30798df47f9badbc74eb8a69fbdf | 0 |
Analyze the following code function for security vulnerabilities | @Override
public ObjectNode createParserUIInitializationData(
ImportingJob job, List<ObjectNode> fileRecords, String format) {
ObjectNode options = super.createParserUIInitializationData(job, fileRecords, format);
try {
if (fileRecords.size() > 0) {
ObjectNode firstFileRecord = fileRecords.get(0);
File file = ImportingUtilities.getFile(job, firstFileRecord);
InputStream is = new FileInputStream(file);
try {
XMLStreamReader parser = createXMLStreamReader(is);
PreviewParsingState state = new PreviewParsingState();
while (parser.hasNext() && state.tokenCount < PREVIEW_PARSING_LIMIT) {
int tokenType = parser.next();
state.tokenCount++;
if (tokenType == XMLStreamConstants.START_ELEMENT) {
ObjectNode rootElement = descendElement(parser, state);
if (rootElement != null) {
JSONUtilities.safePut(options, "dom", rootElement);
break;
}
} else {
// ignore everything else
}
}
} catch (XMLStreamException e) {
logger.warn("Error generating parser UI initialization data for XML file", e);
} finally {
is.close();
}
}
} catch (IOException e) {
logger.error("Error generating parser UI initialization data for XML file", e);
}
return options;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: createParserUIInitializationData
File: main/src/com/google/refine/importers/XmlImporter.java
Repository: OpenRefine
The code follows secure coding practices. | [
"CWE-611"
] | CVE-2018-20157 | MEDIUM | 5 | OpenRefine | createParserUIInitializationData | main/src/com/google/refine/importers/XmlImporter.java | 6a0d7d56e4ffb420316ce7849fde881344fbf881 | 0 |
Analyze the following code function for security vulnerabilities | private byte[] trimBytes(@Positive int columnIndex, byte[] bytes) throws SQLException {
// we need to trim if maxsize is set and the length is greater than maxsize and the
// type of this column is a candidate for trimming
if (maxFieldSize > 0 && bytes.length > maxFieldSize && isColumnTrimmable(columnIndex)) {
byte[] newBytes = new byte[maxFieldSize];
System.arraycopy(bytes, 0, newBytes, 0, maxFieldSize);
return newBytes;
} else {
return bytes;
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: trimBytes
File: pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
Repository: pgjdbc
The code follows secure coding practices. | [
"CWE-89"
] | CVE-2022-31197 | HIGH | 8 | pgjdbc | trimBytes | pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java | 739e599d52ad80f8dcd6efedc6157859b1a9d637 | 0 |
Analyze the following code function for security vulnerabilities | public void writeSetEnd() {} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: writeSetEnd
File: thrift/lib/java/src/main/java/com/facebook/thrift/protocol/TBinaryProtocol.java
Repository: facebook/fbthrift
The code follows secure coding practices. | [
"CWE-770"
] | CVE-2019-11938 | MEDIUM | 5 | facebook/fbthrift | writeSetEnd | thrift/lib/java/src/main/java/com/facebook/thrift/protocol/TBinaryProtocol.java | 08c2d412adb214c40bb03be7587057b25d053030 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public InputEventReceiver createInputEventReceiver(
InputChannel inputChannel, Looper looper) {
return new HideNavInputEventReceiver(inputChannel, looper);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: createInputEventReceiver
File: policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
Repository: android
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2016-0812 | MEDIUM | 6.6 | android | createInputEventReceiver | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 84669ca8de55d38073a0dcb01074233b0a417541 | 0 |
Analyze the following code function for security vulnerabilities | private void updateActionViews(int menuState, Rect stackBounds) {
ViewGroup expandContainer = findViewById(R.id.expand_container);
ViewGroup actionsContainer = findViewById(R.id.actions_container);
actionsContainer.setOnTouchListener((v, ev) -> {
// Do nothing, prevent click through to parent
return true;
});
// Update the expand button only if it should show with the menu
expandContainer.setVisibility(menuState == MENU_STATE_FULL
? View.VISIBLE
: View.INVISIBLE);
FrameLayout.LayoutParams expandedLp =
(FrameLayout.LayoutParams) expandContainer.getLayoutParams();
if (mActions.isEmpty() || menuState == MENU_STATE_NONE) {
actionsContainer.setVisibility(View.INVISIBLE);
// Update the expand container margin to adjust the center of the expand button to
// account for the existence of the action container
expandedLp.topMargin = 0;
expandedLp.bottomMargin = 0;
} else {
actionsContainer.setVisibility(View.VISIBLE);
if (mActionsGroup != null) {
// Ensure we have as many buttons as actions
final LayoutInflater inflater = LayoutInflater.from(mContext);
while (mActionsGroup.getChildCount() < mActions.size()) {
final PipMenuActionView actionView = (PipMenuActionView) inflater.inflate(
R.layout.pip_menu_action, mActionsGroup, false);
mActionsGroup.addView(actionView);
}
// Update the visibility of all views
for (int i = 0; i < mActionsGroup.getChildCount(); i++) {
mActionsGroup.getChildAt(i).setVisibility(i < mActions.size()
? View.VISIBLE
: View.GONE);
}
// Recreate the layout
final boolean isLandscapePip = stackBounds != null
&& (stackBounds.width() > stackBounds.height());
for (int i = 0; i < mActions.size(); i++) {
final RemoteAction action = mActions.get(i);
final PipMenuActionView actionView =
(PipMenuActionView) mActionsGroup.getChildAt(i);
final boolean isCloseAction = mCloseAction != null && Objects.equals(
mCloseAction.getActionIntent(), action.getActionIntent());
// TODO: Check if the action drawable has changed before we reload it
action.getIcon().loadDrawableAsync(mContext, d -> {
if (d != null) {
d.setTint(Color.WHITE);
actionView.setImageDrawable(d);
}
}, mMainHandler);
actionView.setCustomCloseBackgroundVisibility(
isCloseAction ? View.VISIBLE : View.GONE);
actionView.setContentDescription(action.getContentDescription());
if (action.isEnabled()) {
actionView.setOnClickListener(
v -> onActionViewClicked(action.getActionIntent(), isCloseAction));
}
actionView.setEnabled(action.isEnabled());
actionView.setAlpha(action.isEnabled() ? 1f : DISABLED_ACTION_ALPHA);
// Update the margin between actions
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)
actionView.getLayoutParams();
lp.leftMargin = (isLandscapePip && i > 0) ? mBetweenActionPaddingLand : 0;
}
}
// Update the expand container margin to adjust the center of the expand button to
// account for the existence of the action container
expandedLp.topMargin = getResources().getDimensionPixelSize(
R.dimen.pip_action_padding);
expandedLp.bottomMargin = getResources().getDimensionPixelSize(
R.dimen.pip_expand_container_edge_margin);
}
expandContainer.requestLayout();
} | Vulnerability Classification:
- CWE: CWE-Other
- CVE: CVE-2023-40123
- Severity: MEDIUM
- CVSS Score: 5.5
Description: Disallow loading icon from content URI to PipMenu
Bug: 278246904
Test: manually, with the PoC app attached to the bug
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:1aee65603e262affd815fa53dcc5416c605e4037)
Merged-In: Ib3f5b8b6b9ce644fdf1173548d9078e4d969ae2e
Change-Id: Ib3f5b8b6b9ce644fdf1173548d9078e4d969ae2e
Function: updateActionViews
File: libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java
Repository: android
Fixed Code:
private void updateActionViews(int menuState, Rect stackBounds) {
ViewGroup expandContainer = findViewById(R.id.expand_container);
ViewGroup actionsContainer = findViewById(R.id.actions_container);
actionsContainer.setOnTouchListener((v, ev) -> {
// Do nothing, prevent click through to parent
return true;
});
// Update the expand button only if it should show with the menu
expandContainer.setVisibility(menuState == MENU_STATE_FULL
? View.VISIBLE
: View.INVISIBLE);
FrameLayout.LayoutParams expandedLp =
(FrameLayout.LayoutParams) expandContainer.getLayoutParams();
if (mActions.isEmpty() || menuState == MENU_STATE_NONE) {
actionsContainer.setVisibility(View.INVISIBLE);
// Update the expand container margin to adjust the center of the expand button to
// account for the existence of the action container
expandedLp.topMargin = 0;
expandedLp.bottomMargin = 0;
} else {
actionsContainer.setVisibility(View.VISIBLE);
if (mActionsGroup != null) {
// Ensure we have as many buttons as actions
final LayoutInflater inflater = LayoutInflater.from(mContext);
while (mActionsGroup.getChildCount() < mActions.size()) {
final PipMenuActionView actionView = (PipMenuActionView) inflater.inflate(
R.layout.pip_menu_action, mActionsGroup, false);
mActionsGroup.addView(actionView);
}
// Update the visibility of all views
for (int i = 0; i < mActionsGroup.getChildCount(); i++) {
mActionsGroup.getChildAt(i).setVisibility(i < mActions.size()
? View.VISIBLE
: View.GONE);
}
// Recreate the layout
final boolean isLandscapePip = stackBounds != null
&& (stackBounds.width() > stackBounds.height());
for (int i = 0; i < mActions.size(); i++) {
final RemoteAction action = mActions.get(i);
final PipMenuActionView actionView =
(PipMenuActionView) mActionsGroup.getChildAt(i);
final boolean isCloseAction = mCloseAction != null && Objects.equals(
mCloseAction.getActionIntent(), action.getActionIntent());
final int iconType = action.getIcon().getType();
if (iconType == Icon.TYPE_URI || iconType == Icon.TYPE_URI_ADAPTIVE_BITMAP) {
// Disallow loading icon from content URI
actionView.setImageDrawable(null);
} else {
// TODO: Check if the action drawable has changed before we reload it
action.getIcon().loadDrawableAsync(mContext, d -> {
if (d != null) {
d.setTint(Color.WHITE);
actionView.setImageDrawable(d);
}
}, mMainHandler);
}
actionView.setCustomCloseBackgroundVisibility(
isCloseAction ? View.VISIBLE : View.GONE);
actionView.setContentDescription(action.getContentDescription());
if (action.isEnabled()) {
actionView.setOnClickListener(
v -> onActionViewClicked(action.getActionIntent(), isCloseAction));
}
actionView.setEnabled(action.isEnabled());
actionView.setAlpha(action.isEnabled() ? 1f : DISABLED_ACTION_ALPHA);
// Update the margin between actions
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams)
actionView.getLayoutParams();
lp.leftMargin = (isLandscapePip && i > 0) ? mBetweenActionPaddingLand : 0;
}
}
// Update the expand container margin to adjust the center of the expand button to
// account for the existence of the action container
expandedLp.topMargin = getResources().getDimensionPixelSize(
R.dimen.pip_action_padding);
expandedLp.bottomMargin = getResources().getDimensionPixelSize(
R.dimen.pip_expand_container_edge_margin);
}
expandContainer.requestLayout();
} | [
"CWE-Other"
] | CVE-2023-40123 | MEDIUM | 5.5 | android | updateActionViews | libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java | 7212a4bec2d2f1a74fa54a12a04255d6a183baa9 | 1 |
Analyze the following code function for security vulnerabilities | protected void createPage(List<String> spaces, String pageName, String content) throws Exception
{
String uri = buildURI(PageResource.class, getWiki(), spaces, pageName);
Page page = this.objectFactory.createPage();
page.setContent(content);
PutMethod putMethod = executePutXml(uri, page, TestUtils.SUPER_ADMIN_CREDENTIALS.getUserName(),
TestUtils.SUPER_ADMIN_CREDENTIALS.getPassword());
Assert.assertEquals(getHttpMethodInfo(putMethod), HttpStatus.SC_CREATED, putMethod.getStatusCode());
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: createPage
File: xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-test/xwiki-platform-rest-test-tests/src/test/it/org/xwiki/rest/test/framework/AbstractHttpIT.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices. | [
"CWE-352"
] | CVE-2023-37277 | CRITICAL | 9.6 | xwiki/xwiki-platform | createPage | xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-test/xwiki-platform-rest-test-tests/src/test/it/org/xwiki/rest/test/framework/AbstractHttpIT.java | 4c175405faa0e62437df397811c7526dfc0fbae7 | 0 |
Analyze the following code function for security vulnerabilities | @Deprecated
public String getContentAuthor()
{
return userReferenceToString(getContentAuthorReference());
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getContentAuthor
File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices. | [
"CWE-787"
] | CVE-2023-26470 | HIGH | 7.5 | xwiki/xwiki-platform | getContentAuthor | xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java | db3d1c62fc5fb59fefcda3b86065d2d362f55164 | 0 |
Analyze the following code function for security vulnerabilities | public <T> void streamGet(
String table, Class<T> clazz, String fieldName, String where,
boolean returnIdField, boolean setId, List<FacetField> facets, String distinctOn,
Handler<T> streamHandler, Handler<AsyncResult<Void>> replyHandler
) {
client.getConnection(res -> {
if (res.succeeded()) {
SQLConnection connection = res.result();
doStreamGet(connection, false, table, clazz, fieldName, where, returnIdField, setId, facets, distinctOn, streamHandler, replyHandler);
}
else{
replyHandler.handle(Future.failedFuture(res.cause()));
}
});
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: streamGet
File: domain-models-runtime/src/main/java/org/folio/rest/persist/PostgresClient.java
Repository: folio-org/raml-module-builder
The code follows secure coding practices. | [
"CWE-89"
] | CVE-2019-15534 | HIGH | 7.5 | folio-org/raml-module-builder | streamGet | domain-models-runtime/src/main/java/org/folio/rest/persist/PostgresClient.java | b7ef741133e57add40aa4cb19430a0065f378a94 | 0 |
Analyze the following code function for security vulnerabilities | protected void handleKexMessage(int cmd, Buffer buffer) throws Exception {
validateKexState(cmd, KexState.RUN);
boolean debugEnabled = log.isDebugEnabled();
if (kex.next(cmd, buffer)) {
if (debugEnabled) {
log.debug("handleKexMessage({})[{}] KEX processing complete after cmd={}",
this, kex.getName(), cmd);
}
checkKeys();
sendNewKeys();
} else {
if (debugEnabled) {
log.debug("handleKexMessage({})[{}] more KEX packets expected after cmd={}",
this, kex.getName(), cmd);
}
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: handleKexMessage
File: sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
Repository: apache/mina-sshd
The code follows secure coding practices. | [
"CWE-354"
] | CVE-2023-48795 | MEDIUM | 5.9 | apache/mina-sshd | handleKexMessage | sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java | 6b0fd46f64bcb75eeeee31d65f10242660aad7c1 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public Optional<ValidationError> error(String key) {
return super.error(asDynamicKey(key));
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: error
File: web/play-java-forms/src/main/java/play/data/DynamicForm.java
Repository: playframework
The code follows secure coding practices. | [
"CWE-400"
] | CVE-2022-31018 | MEDIUM | 5 | playframework | error | web/play-java-forms/src/main/java/play/data/DynamicForm.java | 15393b736df939e35e275af2347155f296c684f2 | 0 |
Analyze the following code function for security vulnerabilities | protected synchronized void setPendingStop(boolean pendingStop) {
this.pendingStop = pendingStop;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setPendingStop
File: activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java
Repository: apache/activemq
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2014-3576 | MEDIUM | 5 | apache/activemq | setPendingStop | activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java | 00921f2 | 0 |
Analyze the following code function for security vulnerabilities | ActivityOptions getOptions() {
return mPendingOptions;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getOptions
File: services/core/java/com/android/server/wm/ActivityRecord.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-21145 | HIGH | 7.8 | android | getOptions | services/core/java/com/android/server/wm/ActivityRecord.java | 44aeef1b82ecf21187d4903c9e3666a118bdeaf3 | 0 |
Analyze the following code function for security vulnerabilities | public static boolean shouldRunPrepareActivity(
Utils utils, Context context, ProvisioningParams params) {
// TODO(b/177849035): Remove NFC-specific logic
if (params.isNfc) {
return false;
}
if (params.wifiInfo != null) {
return true;
}
if (params.useMobileData) {
return true;
}
if (params.deviceAdminDownloadInfo != null) {
// Only prepare if a download is actually required
if (utils.packageRequiresUpdate(
params.inferDeviceAdminPackageName(),
params.deviceAdminDownloadInfo.minVersion,
context)) {
return true;
}
}
return false;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: shouldRunPrepareActivity
File: src/com/android/managedprovisioning/provisioning/AdminIntegratedFlowPrepareActivity.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-21275 | HIGH | 7.8 | android | shouldRunPrepareActivity | src/com/android/managedprovisioning/provisioning/AdminIntegratedFlowPrepareActivity.java | 8277a2a946e617a7ea65056e4cedeb1fecf3a5f5 | 0 |
Analyze the following code function for security vulnerabilities | @SuppressWarnings("unchecked")
static NameValidator<CharSequence> nameValidator(boolean validate) {
return validate ? HttpNameValidator : NameValidator.NOT_NULL;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: nameValidator
File: codec-http/src/main/java/io/netty/handler/codec/http/DefaultHttpHeaders.java
Repository: netty
The code follows secure coding practices. | [
"CWE-444"
] | CVE-2021-43797 | MEDIUM | 4.3 | netty | nameValidator | codec-http/src/main/java/io/netty/handler/codec/http/DefaultHttpHeaders.java | 07aa6b5938a8b6ed7a6586e066400e2643897323 | 0 |
Analyze the following code function for security vulnerabilities | public boolean isMultiLingual(XWikiContext context)
{
return "1".equals(getXWikiPreference("multilingual", "0", context));
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isMultiLingual
File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices. | [
"CWE-863"
] | CVE-2021-32620 | MEDIUM | 4 | xwiki/xwiki-platform | isMultiLingual | xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java | f9a677408ffb06f309be46ef9d8df1915d9099a4 | 0 |
Analyze the following code function for security vulnerabilities | public boolean isUploading(User user, OCFile file) {
if (user == null || file == null) {
return false;
}
return mPendingUploads.contains(user.getAccountName(), file.getRemotePath());
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isUploading
File: app/src/main/java/com/owncloud/android/files/services/FileUploader.java
Repository: nextcloud/android
The code follows secure coding practices. | [
"CWE-22"
] | CVE-2022-39210 | MEDIUM | 5.5 | nextcloud/android | isUploading | app/src/main/java/com/owncloud/android/files/services/FileUploader.java | cd3bd0845a97e1d43daa0607a122b66b0068c751 | 0 |
Analyze the following code function for security vulnerabilities | public ObjectOutputStream createObjectOutputStream(Writer writer, String rootNodeName) throws IOException {
return createObjectOutputStream(hierarchicalStreamDriver.createWriter(writer), rootNodeName);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: createObjectOutputStream
File: xstream/src/java/com/thoughtworks/xstream/XStream.java
Repository: x-stream/xstream
The code follows secure coding practices. | [
"CWE-400"
] | CVE-2021-43859 | MEDIUM | 5 | x-stream/xstream | createObjectOutputStream | xstream/src/java/com/thoughtworks/xstream/XStream.java | e8e88621ba1c85ac3b8620337dd672e0c0c3a846 | 0 |
Analyze the following code function for security vulnerabilities | public static long tableSize(Map<String, Object> table)
throws UnsupportedEncodingException
{
long acc = 0;
for(Map.Entry<String, Object> entry: table.entrySet()) {
acc += shortStrSize(entry.getKey());
acc += fieldValueSize(entry.getValue());
}
return acc;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: tableSize
File: src/main/java/com/rabbitmq/client/impl/Frame.java
Repository: rabbitmq/rabbitmq-java-client
The code follows secure coding practices. | [
"CWE-400"
] | CVE-2023-46120 | HIGH | 7.5 | rabbitmq/rabbitmq-java-client | tableSize | src/main/java/com/rabbitmq/client/impl/Frame.java | 714aae602dcae6cb4b53cadf009323ebac313cc8 | 0 |
Analyze the following code function for security vulnerabilities | public List<String> getAllowedUrls() {
String allowedURL = prop.getProperty(TS_ALLOWED_URLS, "file://.*|http(s)?://.*");
return Arrays.asList(allowedURL.split(","));
} | Vulnerability Classification:
- CWE: CWE-918
- CVE: CVE-2023-43654
- Severity: CRITICAL
- CVSS Score: 9.8
Description: Issue warning about allowed_urls when default value is used
Function: getAllowedUrls
File: frontend/server/src/main/java/org/pytorch/serve/util/ConfigManager.java
Repository: pytorch/serve
Fixed Code:
public List<String> getAllowedUrls() {
String allowedURL = prop.getProperty(TS_ALLOWED_URLS, DEFAULT_TS_ALLOWED_URLS);
return Arrays.asList(allowedURL.split(","));
} | [
"CWE-918"
] | CVE-2023-43654 | CRITICAL | 9.8 | pytorch/serve | getAllowedUrls | frontend/server/src/main/java/org/pytorch/serve/util/ConfigManager.java | 391bdec3348e30de173fbb7c7277970e0b53c8ad | 1 |
Analyze the following code function for security vulnerabilities | public Rectangle getBoxSize(int index, String boxName) {
return getBoxSize(pageRefs.getPageNRelease(index), boxName);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getBoxSize
File: java/com/gitlab/pdftk_java/com/lowagie/text/pdf/PdfReader.java
Repository: pdftk-java/pdftk
The code follows secure coding practices. | [
"CWE-835"
] | CVE-2021-37819 | HIGH | 7.5 | pdftk-java/pdftk | getBoxSize | java/com/gitlab/pdftk_java/com/lowagie/text/pdf/PdfReader.java | 9b0cbb76c8434a8505f02ada02a94263dcae9247 | 0 |
Analyze the following code function for security vulnerabilities | public void setPlaybackSpeed(String packageName, int pid, int uid, float speed) {
try {
final String reason = TAG + ":setPlaybackSpeed";
mService.tempAllowlistTargetPkgIfPossible(getUid(), getPackageName(),
pid, uid, packageName, reason);
mCb.onSetPlaybackSpeed(packageName, pid, uid, speed);
} catch (RemoteException e) {
Log.e(TAG, "Remote failure in setPlaybackSpeed.", e);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setPlaybackSpeed
File: services/core/java/com/android/server/media/MediaSessionRecord.java
Repository: android
The code follows secure coding practices. | [
"CWE-400"
] | CVE-2023-21280 | MEDIUM | 5.5 | android | setPlaybackSpeed | services/core/java/com/android/server/media/MediaSessionRecord.java | 06e772e05514af4aa427641784c5eec39a892ed3 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void savePlugin(String projectName, Plugin plugin, AsyncMethodCallback resultHandler) {
unimplemented(resultHandler);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: savePlugin
File: server/src/main/java/com/linecorp/centraldogma/server/internal/thrift/CentralDogmaServiceImpl.java
Repository: line/centraldogma
The code follows secure coding practices. | [
"CWE-862"
] | CVE-2021-38388 | MEDIUM | 6.5 | line/centraldogma | savePlugin | server/src/main/java/com/linecorp/centraldogma/server/internal/thrift/CentralDogmaServiceImpl.java | e83b558ef9eaa44f71b7d9236bdec9f68c85b8bd | 0 |
Analyze the following code function for security vulnerabilities | public void setRenewal(boolean renewal) {
this.renewal = renewal;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setRenewal
File: base/common/src/main/java/com/netscape/certsrv/cert/CertEnrollmentRequest.java
Repository: dogtagpki/pki
The code follows secure coding practices. | [
"CWE-611"
] | CVE-2022-2414 | HIGH | 7.5 | dogtagpki/pki | setRenewal | base/common/src/main/java/com/netscape/certsrv/cert/CertEnrollmentRequest.java | 16deffdf7548e305507982e246eb9fd1eac414fd | 0 |
Analyze the following code function for security vulnerabilities | private native void nativeReloadIgnoringCache(
long nativeContentViewCoreImpl, boolean checkForRepost); | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: nativeReloadIgnoringCache
File: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
Repository: chromium
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2014-3159 | MEDIUM | 6.4 | chromium | nativeReloadIgnoringCache | content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java | 98a50b76141f0b14f292f49ce376e6554142d5e2 | 0 |
Analyze the following code function for security vulnerabilities | private static void escapeXml(Object o, StringBuilder appendTo) {
if (o == null) {
appendTo.append("null");
return;
}
String s = o.toString();
int length = s.length();
appendTo.ensureCapacity(appendTo.length() + length + CAPACITY);
for (int i = 0; i < length; i++) {
char ch = s.charAt(i);
if (ch == '<') {
appendTo.append("<");
} else if (ch == '&') {
appendTo.append("&");
} else {
appendTo.append(ch);
}
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: escapeXml
File: hazelcast/src/main/java/com/hazelcast/config/ConfigXmlGenerator.java
Repository: hazelcast
The code follows secure coding practices. | [
"CWE-522"
] | CVE-2023-33264 | MEDIUM | 4.3 | hazelcast | escapeXml | hazelcast/src/main/java/com/hazelcast/config/ConfigXmlGenerator.java | 80a502d53cc48bf895711ab55f95e3a51e344ac1 | 0 |
Analyze the following code function for security vulnerabilities | private RunMap<R> createBuildRunMap() {
return new RunMap<R>(getBuildDir(), new Constructor<R>() {
public R create(File dir) throws IOException {
return loadBuild(dir);
}
});
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: createBuildRunMap
File: core/src/main/java/hudson/model/AbstractProject.java
Repository: jenkinsci/jenkins
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2013-7330 | MEDIUM | 4 | jenkinsci/jenkins | createBuildRunMap | core/src/main/java/hudson/model/AbstractProject.java | 36342d71e29e0620f803a7470ce96c61761648d8 | 0 |
Analyze the following code function for security vulnerabilities | public void init(ServletConfig servletConfig) throws ServletException {
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: init
File: src/com/dotmarketing/servlets/AudioCaptchaServlet.java
Repository: dotCMS/core
The code follows secure coding practices. | [
"CWE-254",
"CWE-264"
] | CVE-2016-8600 | MEDIUM | 5 | dotCMS/core | init | src/com/dotmarketing/servlets/AudioCaptchaServlet.java | cb84b130065c9eed1d1df9e4770ffa5d4bd30569 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void enforceCallerIsRecentsOrHasPermission(String permission, String func) {
ActivityManagerService.this.enforceCallerIsRecentsOrHasPermission(permission, func);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: enforceCallerIsRecentsOrHasPermission
File: services/core/java/com/android/server/am/ActivityManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-863"
] | CVE-2018-9492 | HIGH | 7.2 | android | enforceCallerIsRecentsOrHasPermission | services/core/java/com/android/server/am/ActivityManagerService.java | 962fb40991f15be4f688d960aa00073683ebdd20 | 0 |
Analyze the following code function for security vulnerabilities | public void setAppendable(boolean appendable) {
this.appendable = appendable;
if (appendable)
getPdfObject(trailer.get(PdfName.ROOT));
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setAppendable
File: java/com/gitlab/pdftk_java/com/lowagie/text/pdf/PdfReader.java
Repository: pdftk-java/pdftk
The code follows secure coding practices. | [
"CWE-835"
] | CVE-2021-37819 | HIGH | 7.5 | pdftk-java/pdftk | setAppendable | java/com/gitlab/pdftk_java/com/lowagie/text/pdf/PdfReader.java | 9b0cbb76c8434a8505f02ada02a94263dcae9247 | 0 |
Analyze the following code function for security vulnerabilities | private void handleSpaceWhenEndlement()
{
// Use case: <tag1>something </tag1>...
// All spaces are spaces since otherwise they'll be all stripped by browsers
if (!this.isInCData && !this.isInPreserveElement) {
for (int i = 0; i < this.spaceCount; i++) {
printEntity(" ");
}
} else {
super.printXML(StringUtils.repeat(' ', this.spaceCount));
}
this.spaceCount = 0;
this.elementEnded = false;
this.hasTextBeenPrinted = false;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: handleSpaceWhenEndlement
File: xwiki-rendering-xml/src/main/java/org/xwiki/rendering/renderer/printer/XHTMLWikiPrinter.java
Repository: xwiki/xwiki-rendering
The code follows secure coding practices. | [
"CWE-79"
] | CVE-2023-32070 | MEDIUM | 6.1 | xwiki/xwiki-rendering | handleSpaceWhenEndlement | xwiki-rendering-xml/src/main/java/org/xwiki/rendering/renderer/printer/XHTMLWikiPrinter.java | c40e2f5f9482ec6c3e71dbf1fff5ba8a5e44cdc1 | 0 |
Analyze the following code function for security vulnerabilities | void onClick(); | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: onClick
File: packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-40098 | MEDIUM | 5.5 | android | onClick | packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java | d21ffbe8a2eeb2a5e6da7efbb1a0430ba6b022e0 | 0 |
Analyze the following code function for security vulnerabilities | public byte[] getCalculatedAuthenticationBytes() {
return mac.doFinal();
} | Vulnerability Classification:
- CWE: CWE-346
- CVE: CVE-2023-22899
- Severity: MEDIUM
- CVSS Score: 5.9
Description: #485 Calculate AES mac with cache and push back functionality
Function: getCalculatedAuthenticationBytes
File: src/main/java/net/lingala/zip4j/crypto/AESDecrypter.java
Repository: srikanth-lingala/zip4j
Fixed Code:
public byte[] getCalculatedAuthenticationBytes(int numberOfBytesPushedBack) {
return mac.doFinal(numberOfBytesPushedBack);
} | [
"CWE-346"
] | CVE-2023-22899 | MEDIUM | 5.9 | srikanth-lingala/zip4j | getCalculatedAuthenticationBytes | src/main/java/net/lingala/zip4j/crypto/AESDecrypter.java | ddd8fdc8ad0583eb4a6172dc86c72c881485c55b | 1 |
Analyze the following code function for security vulnerabilities | public static long uncompressedLength(long inputAddr, long len)
throws IOException
{
return impl.uncompressedLength(inputAddr, len);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: uncompressedLength
File: src/main/java/org/xerial/snappy/Snappy.java
Repository: xerial/snappy-java
The code follows secure coding practices. | [
"CWE-190"
] | CVE-2023-34454 | HIGH | 7.5 | xerial/snappy-java | uncompressedLength | src/main/java/org/xerial/snappy/Snappy.java | d0042551e4a3509a725038eb9b2ad1f683674d94 | 0 |
Analyze the following code function for security vulnerabilities | public static void validate(EndElement endElement, String tag) {
String elementTag = getEndElementName(endElement);
if (!tag.equals(elementTag))
throw new RuntimeException(logger.parserExpectedEndTag("</" + tag + ">. Found </" + elementTag + ">"));
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: validate
File: saml-core/src/main/java/org/keycloak/saml/common/util/StaxParserUtil.java
Repository: keycloak
The code follows secure coding practices. | [
"CWE-200"
] | CVE-2017-2582 | MEDIUM | 4 | keycloak | validate | saml-core/src/main/java/org/keycloak/saml/common/util/StaxParserUtil.java | 0cb5ba0f6e83162d221681f47b470c3042eef237 | 0 |
Analyze the following code function for security vulnerabilities | public void recacheSecretToken()
{
// Save the current URL to be able to get back after we cache the secret token. We're not using the browser's
// Back button because if the current page is the result of a POST request then by going back we are re-sending
// the POST data which can have unexpected results. Moreover, some browsers pop up a modal confirmation box
// which blocks the test.
String previousURL = getDriver().getCurrentUrl();
// Go to the registration page because the registration form uses secret token.
gotoPage(getCurrentWiki(), "Register", "register");
recacheSecretTokenWhenOnRegisterPage();
// Return to the previous page.
getDriver().get(previousURL);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: recacheSecretToken
File: xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-ui/src/main/java/org/xwiki/test/ui/TestUtils.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices. | [
"CWE-863"
] | CVE-2023-35166 | HIGH | 8.8 | xwiki/xwiki-platform | recacheSecretToken | xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-ui/src/main/java/org/xwiki/test/ui/TestUtils.java | 98208c5bb1e8cdf3ff1ac35d8b3d1cb3c28b3263 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_ENABLE_POINTER_LOCATION:
enablePointerLocation();
break;
case MSG_DISABLE_POINTER_LOCATION:
disablePointerLocation();
break;
case MSG_DISPATCH_MEDIA_KEY_WITH_WAKE_LOCK:
dispatchMediaKeyWithWakeLock((KeyEvent)msg.obj);
break;
case MSG_DISPATCH_MEDIA_KEY_REPEAT_WITH_WAKE_LOCK:
dispatchMediaKeyRepeatWithWakeLock((KeyEvent)msg.obj);
break;
case MSG_DISPATCH_SHOW_RECENTS:
showRecentApps(false);
break;
case MSG_DISPATCH_SHOW_GLOBAL_ACTIONS:
showGlobalActionsInternal();
break;
case MSG_KEYGUARD_DRAWN_COMPLETE:
if (DEBUG_WAKEUP) Slog.w(TAG, "Setting mKeyguardDrawComplete");
finishKeyguardDrawn();
break;
case MSG_KEYGUARD_DRAWN_TIMEOUT:
Slog.w(TAG, "Keyguard drawn timeout. Setting mKeyguardDrawComplete");
finishKeyguardDrawn();
break;
case MSG_WINDOW_MANAGER_DRAWN_COMPLETE:
if (DEBUG_WAKEUP) Slog.w(TAG, "Setting mWindowManagerDrawComplete");
finishWindowsDrawn();
break;
case MSG_HIDE_BOOT_MESSAGE:
handleHideBootMessage();
break;
case MSG_LAUNCH_VOICE_ASSIST_WITH_WAKE_LOCK:
launchVoiceAssistWithWakeLock(msg.arg1 != 0);
break;
case MSG_POWER_DELAYED_PRESS:
powerPress((Long)msg.obj, msg.arg1 != 0, msg.arg2);
finishPowerKeyPress();
break;
case MSG_POWER_LONG_PRESS:
powerLongPress();
break;
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: handleMessage
File: policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
Repository: android
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2016-0812 | MEDIUM | 6.6 | android | handleMessage | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 84669ca8de55d38073a0dcb01074233b0a417541 | 0 |
Analyze the following code function for security vulnerabilities | native int getConnectionStateNative(byte[] address); | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getConnectionStateNative
File: src/com/android/bluetooth/btservice/AdapterService.java
Repository: android
The code follows secure coding practices. | [
"CWE-362",
"CWE-20"
] | CVE-2016-3760 | MEDIUM | 5.4 | android | getConnectionStateNative | src/com/android/bluetooth/btservice/AdapterService.java | 122feb9a0b04290f55183ff2f0384c6c53756bd8 | 0 |
Analyze the following code function for security vulnerabilities | protected RemoteViews makeMediaContentView(@Nullable RemoteViews customContent) {
final int numActions = mBuilder.mActions.size();
final int numActionsToShow = Math.min(mActionsToShowInCompact == null
? 0 : mActionsToShowInCompact.length, MAX_MEDIA_BUTTONS_IN_COMPACT);
if (numActionsToShow > numActions) {
throw new IllegalArgumentException(String.format(
"setShowActionsInCompactView: action %d out of bounds (max %d)",
numActions, numActions - 1));
}
StandardTemplateParams p = mBuilder.mParams.reset()
.viewType(StandardTemplateParams.VIEW_TYPE_NORMAL)
.hideTime(numActionsToShow > 1) // hide if actions wider than a right icon
.hideSubText(numActionsToShow > 1) // hide if actions wider than a right icon
.hideLeftIcon(false) // allow large icon on left when grouped
.hideRightIcon(numActionsToShow > 0) // right icon or actions; not both
.hideProgress(true)
.fillTextsFrom(mBuilder);
TemplateBindResult result = new TemplateBindResult();
RemoteViews template = mBuilder.applyStandardTemplate(
R.layout.notification_template_material_media, p,
null /* result */);
for (int i = 0; i < MAX_MEDIA_BUTTONS_IN_COMPACT; i++) {
if (i < numActionsToShow) {
final Action action = mBuilder.mActions.get(mActionsToShowInCompact[i]);
bindMediaActionButton(template, MEDIA_BUTTON_IDS[i], action, p);
} else {
template.setViewVisibility(MEDIA_BUTTON_IDS[i], View.GONE);
}
}
// Prevent a swooping expand animation when there are no actions
boolean hasActions = numActionsToShow != 0;
template.setViewVisibility(R.id.media_actions, hasActions ? View.VISIBLE : View.GONE);
// Add custom view if provided by subclass.
buildCustomContentIntoTemplate(mBuilder.mContext, template, customContent, p, result);
return template;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: makeMediaContentView
File: core/java/android/app/Notification.java
Repository: android
The code follows secure coding practices. | [
"CWE-862"
] | CVE-2023-21288 | MEDIUM | 5.5 | android | makeMediaContentView | core/java/android/app/Notification.java | 726247f4f53e8cc0746175265652fa415a123c0c | 0 |
Analyze the following code function for security vulnerabilities | public List<Cliente> buscarClienteEmail(String email) throws SQLException, ClassNotFoundException {
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
con = ConnectionFactory.getConnection();
stmt = con.prepareStatement(stmtBuscarEmail + "'%" + email + "%' and perfil = 1 and inativo=false order by nome");
rs = stmt.executeQuery();
return montaListaClientes(rs);
} catch (SQLException e) {
throw new RuntimeException(e);
} finally {
try {
rs.close();
} catch (Exception ex) {
System.out.println("Erro ao fechar result set.Erro: " + ex.getMessage());
}
try {
stmt.close();
} catch (SQLException ex) {
System.out.println("Erro ao fechar statement. Ex = " + ex.getMessage());
}
try {
con.close();
} catch (SQLException ex) {
System.out.println("Erro ao fechar a conexao. Ex = " + ex.getMessage());
}
}
} | Vulnerability Classification:
- CWE: CWE-89
- CVE: CVE-2015-10061
- Severity: MEDIUM
- CVSS Score: 5.2
Description: ClienteDAO - alterados statements para utilizar o metodo setString do PreparedStatement para evitar SQL Injection
- alterados statements para utilizar ilike ao inves de like para pesquisar sem case sensitivity
BancoDeDados - colocado ponto e virgula apos todas as queries.
Function: buscarClienteEmail
File: src/java/br/com/magazine/dao/ClienteDAO.java
Repository: evandro-machado/Trabalho-Web2
Fixed Code:
public List<Cliente> buscarClienteEmail(String email) throws SQLException, ClassNotFoundException {
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
con = ConnectionFactory.getConnection();
email = "%"+email+"%";
stmt = con.prepareStatement(stmtBuscarEmailCliente);
stmt.setString(1,email);
rs = stmt.executeQuery();
return montaListaClientes(rs);
} catch (SQLException e) {
throw new RuntimeException(e);
} finally {
try {
rs.close();
} catch (Exception ex) {
System.out.println("Erro ao fechar result set.Erro: " + ex.getMessage());
}
try {
stmt.close();
} catch (SQLException ex) {
System.out.println("Erro ao fechar statement. Ex = " + ex.getMessage());
}
try {
con.close();
} catch (SQLException ex) {
System.out.println("Erro ao fechar a conexao. Ex = " + ex.getMessage());
}
}
} | [
"CWE-89"
] | CVE-2015-10061 | MEDIUM | 5.2 | evandro-machado/Trabalho-Web2 | buscarClienteEmail | src/java/br/com/magazine/dao/ClienteDAO.java | f59ac954625d0a4f6d34f069a2e26686a7a20aeb | 1 |
Analyze the following code function for security vulnerabilities | @Override
public String getHostOrIP() {
try {
InetAddress i = java.net.InetAddress.getLocalHost();
if(i.isLoopbackAddress()) {
Enumeration<NetworkInterface> nie = NetworkInterface.getNetworkInterfaces();
while(nie.hasMoreElements()) {
NetworkInterface current = nie.nextElement();
if(!current.isLoopback()) {
Enumeration<InetAddress> iae = current.getInetAddresses();
while(iae.hasMoreElements()) {
InetAddress currentI = iae.nextElement();
if(!currentI.isLoopbackAddress()) {
return currentI.getHostAddress();
}
}
}
}
}
return i.getHostAddress();
} catch(Throwable t) {
com.codename1.io.Log.e(t);
return null;
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getHostOrIP
File: Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java
Repository: codenameone/CodenameOne
The code follows secure coding practices. | [
"CWE-668"
] | CVE-2022-4903 | MEDIUM | 5.1 | codenameone/CodenameOne | getHostOrIP | Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java | dad49c9ef26a598619fc48d2697151a02987d478 | 0 |
Analyze the following code function for security vulnerabilities | public static String verifyRedirectUri(KeycloakSession session, String rootUrl, String redirectUri, Set<String> validRedirects, boolean requireRedirectUri) {
KeycloakUriInfo uriInfo = session.getContext().getUri();
RealmModel realm = session.getContext().getRealm();
if (redirectUri == null) {
if (!requireRedirectUri) {
redirectUri = getSingleValidRedirectUri(validRedirects);
}
if (redirectUri == null) {
logger.debug("No Redirect URI parameter specified");
return null;
}
} else if (validRedirects.isEmpty()) {
logger.debug("No Redirect URIs supplied");
redirectUri = null;
} else {
// Make the validations against fully decoded and normalized redirect-url. This also allows wildcards (case when client configured "Valid redirect-urls" contain wildcards)
String decodedRedirectUri = decodeRedirectUri(redirectUri);
decodedRedirectUri = getNormalizedRedirectUri(decodedRedirectUri);
if (decodedRedirectUri == null) return null;
String r = decodedRedirectUri;
Set<String> resolveValidRedirects = resolveValidRedirects(session, rootUrl, validRedirects);
boolean valid = matchesRedirects(resolveValidRedirects, r, true);
if (!valid && (r.startsWith(Constants.INSTALLED_APP_URL) || r.startsWith(Constants.INSTALLED_APP_LOOPBACK)) && r.indexOf(':', Constants.INSTALLED_APP_URL.length()) >= 0) {
int i = r.indexOf(':', Constants.INSTALLED_APP_URL.length());
StringBuilder sb = new StringBuilder();
sb.append(r.substring(0, i));
i = r.indexOf('/', i);
if (i >= 0) {
sb.append(r.substring(i));
}
r = sb.toString();
valid = matchesRedirects(resolveValidRedirects, r, true);
}
// Return the original redirectUri, which can be partially encoded - for example http://localhost:8280/foo/bar%20bar%2092%2F72/3 . Just make sure it is normalized
redirectUri = getNormalizedRedirectUri(redirectUri);
// We try to check validity also for original (encoded) redirectUrl, but just in case it exactly matches some "Valid Redirect URL" specified for client (not wildcards allowed)
if (!valid) {
valid = matchesRedirects(resolveValidRedirects, redirectUri, false);
}
if (valid && redirectUri.startsWith("/")) {
redirectUri = relativeToAbsoluteURI(session, rootUrl, redirectUri);
}
redirectUri = valid ? redirectUri : null;
}
if (Constants.INSTALLED_APP_URN.equals(redirectUri)) {
return Urls.realmInstalledAppUrnCallback(uriInfo.getBaseUri(), realm.getName()).toString();
} else {
return redirectUri;
}
} | Vulnerability Classification:
- CWE: CWE-79
- CVE: CVE-2022-4361
- Severity: MEDIUM
- CVSS Score: 6.1
Description: Check the redirect URI is http(s) when used for a form Post (#22)
Closes https://github.com/keycloak/security/issues/22
Co-authored-by: Stian Thorgersen <stianst@gmail.com>
Function: verifyRedirectUri
File: services/src/main/java/org/keycloak/protocol/oidc/utils/RedirectUtils.java
Repository: keycloak
Fixed Code:
public static String verifyRedirectUri(KeycloakSession session, String rootUrl, String redirectUri, Set<String> validRedirects, boolean requireRedirectUri) {
KeycloakUriInfo uriInfo = session.getContext().getUri();
RealmModel realm = session.getContext().getRealm();
if (redirectUri == null) {
if (!requireRedirectUri) {
redirectUri = getSingleValidRedirectUri(validRedirects);
}
if (redirectUri == null) {
logger.debug("No Redirect URI parameter specified");
return null;
}
} else if (validRedirects.isEmpty()) {
logger.debug("No Redirect URIs supplied");
redirectUri = null;
} else {
// Make the validations against fully decoded and normalized redirect-url. This also allows wildcards (case when client configured "Valid redirect-urls" contain wildcards)
String decodedRedirectUri = decodeRedirectUri(redirectUri);
URI decodedRedirect = toUri(decodedRedirectUri);
decodedRedirectUri = getNormalizedRedirectUri(decodedRedirect);
if (decodedRedirectUri == null) return null;
String r = decodedRedirectUri;
Set<String> resolveValidRedirects = resolveValidRedirects(session, rootUrl, validRedirects);
String valid = matchesRedirects(resolveValidRedirects, r, true);
if (valid == null && (r.startsWith(Constants.INSTALLED_APP_URL) || r.startsWith(Constants.INSTALLED_APP_LOOPBACK)) && r.indexOf(':', Constants.INSTALLED_APP_URL.length()) >= 0) {
int i = r.indexOf(':', Constants.INSTALLED_APP_URL.length());
StringBuilder sb = new StringBuilder();
sb.append(r.substring(0, i));
i = r.indexOf('/', i);
if (i >= 0) {
sb.append(r.substring(i));
}
r = sb.toString();
valid = matchesRedirects(resolveValidRedirects, r, true);
}
// Return the original redirectUri, which can be partially encoded - for example http://localhost:8280/foo/bar%20bar%2092%2F72/3 . Just make sure it is normalized
URI redirect = toUri(redirectUri);
redirectUri = getNormalizedRedirectUri(redirect);
// We try to check validity also for original (encoded) redirectUrl, but just in case it exactly matches some "Valid Redirect URL" specified for client (not wildcards allowed)
if (valid == null) {
valid = matchesRedirects(resolveValidRedirects, redirectUri, false);
}
if (valid != null && redirectUri.startsWith("/")) {
redirectUri = relativeToAbsoluteURI(session, rootUrl, redirectUri);
}
String scheme = decodedRedirect.getScheme();
if (valid != null && scheme != null) {
// check the scheme is valid, it should be http(s) or explicitly allowed by the validation
if (!valid.startsWith(scheme + ":") && !"http".equalsIgnoreCase(scheme) && !"https".equalsIgnoreCase(scheme)) {
logger.debugf("Invalid URI because scheme is not allowed: %s", redirectUri);
valid = null;
}
}
redirectUri = valid != null ? redirectUri : null;
}
if (Constants.INSTALLED_APP_URN.equals(redirectUri)) {
return Urls.realmInstalledAppUrnCallback(uriInfo.getBaseUri(), realm.getName()).toString();
} else {
return redirectUri;
}
} | [
"CWE-79"
] | CVE-2022-4361 | MEDIUM | 6.1 | keycloak | verifyRedirectUri | services/src/main/java/org/keycloak/protocol/oidc/utils/RedirectUtils.java | a1cfe6e24e5b34792699a00b8b4a8016a5929e3a | 1 |
Analyze the following code function for security vulnerabilities | public ApiClient setOauthScope(String scope) {
for (Authentication auth : authentications.values()) {
if (auth instanceof OAuth) {
((OAuth) auth).setScope(scope);
return this;
}
}
throw new RuntimeException("No OAuth2 authentication configured!");
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setOauthScope
File: samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java
Repository: OpenAPITools/openapi-generator
The code follows secure coding practices. | [
"CWE-668"
] | CVE-2021-21430 | LOW | 2.1 | OpenAPITools/openapi-generator | setOauthScope | samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java | 2c576483f26f85b3979c6948a131f585c237109a | 0 |
Analyze the following code function for security vulnerabilities | private static boolean isCompatible(MergePolicyConfig c1, MergePolicyConfig c2) {
return c1 == c2 || !(c1 == null || c2 == null)
&& c1.getBatchSize() == c2.getBatchSize()
&& nullSafeEqual(c1.getPolicy(), c2.getPolicy());
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isCompatible
File: hazelcast/src/test/java/com/hazelcast/config/ConfigCompatibilityChecker.java
Repository: hazelcast
The code follows secure coding practices. | [
"CWE-502"
] | CVE-2016-10750 | MEDIUM | 6.8 | hazelcast | isCompatible | hazelcast/src/test/java/com/hazelcast/config/ConfigCompatibilityChecker.java | c1c31359a1df953e79a9ca9b6c54b3cdbfef11e9 | 0 |
Analyze the following code function for security vulnerabilities | static private int calculateProgressPercent(long totalExpectedSize, long totalRetrievedSize) {
return totalExpectedSize == 0 ? -1 : (int) (totalRetrievedSize * 100 / totalExpectedSize);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: calculateProgressPercent
File: main/src/com/google/refine/importing/ImportingUtilities.java
Repository: OpenRefine
The code follows secure coding practices. | [
"CWE-22"
] | CVE-2018-19859 | MEDIUM | 4 | OpenRefine | calculateProgressPercent | main/src/com/google/refine/importing/ImportingUtilities.java | e243e73e4064de87a913946bd320fbbe246da656 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public Float getFloatAndRemove(K name) {
V v = getAndRemove(name);
try {
return v != null ? toFloat(name, v) : null;
} catch (RuntimeException ignore) {
return null;
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getFloatAndRemove
File: codec/src/main/java/io/netty/handler/codec/DefaultHeaders.java
Repository: netty
The code follows secure coding practices. | [
"CWE-436",
"CWE-113"
] | CVE-2022-41915 | MEDIUM | 6.5 | netty | getFloatAndRemove | codec/src/main/java/io/netty/handler/codec/DefaultHeaders.java | fe18adff1c2b333acb135ab779a3b9ba3295a1c4 | 0 |
Analyze the following code function for security vulnerabilities | public Stage saveBuildingStage(Stage stage) {
for (JobInstance jobInstance : stage.getJobInstances()) {
JobInstanceMother.setBuildingState(jobInstance);
jobInstance.setAgentUuid(AGENT_UUID);
jobInstanceDao.updateAssignedInfo(jobInstance);
}
return stage;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: saveBuildingStage
File: server/src/test-shared/java/com/thoughtworks/go/server/dao/DatabaseAccessHelper.java
Repository: gocd
The code follows secure coding practices. | [
"CWE-697"
] | CVE-2022-39308 | MEDIUM | 5.9 | gocd | saveBuildingStage | server/src/test-shared/java/com/thoughtworks/go/server/dao/DatabaseAccessHelper.java | 236d4baf92e6607f2841c151c855adcc477238b8 | 0 |
Analyze the following code function for security vulnerabilities | public abstract BaseXMLBuilder xpathFind(String xpath, NamespaceContext nsContext)
throws XPathExpressionException; | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: xpathFind
File: src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java
Repository: jmurty/java-xmlbuilder
The code follows secure coding practices. | [
"CWE-611"
] | CVE-2014-125087 | MEDIUM | 5.2 | jmurty/java-xmlbuilder | xpathFind | src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java | e6fddca201790abab4f2c274341c0bb8835c3e73 | 0 |
Analyze the following code function for security vulnerabilities | private boolean updateNetworkSelectionStatus(@NonNull WifiConfiguration config, int reason) {
int prevNetworkSelectionStatus = config.getNetworkSelectionStatus()
.getNetworkSelectionStatus();
if (!mWifiBlocklistMonitor.updateNetworkSelectionStatus(config, reason)) {
return false;
}
int newNetworkSelectionStatus = config.getNetworkSelectionStatus()
.getNetworkSelectionStatus();
if (prevNetworkSelectionStatus != newNetworkSelectionStatus) {
sendNetworkSelectionStatusChangedUpdate(config, newNetworkSelectionStatus, reason);
sendConfiguredNetworkChangedBroadcast(WifiManager.CHANGE_REASON_CONFIG_CHANGE);
}
saveToStore(false);
return true;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: updateNetworkSelectionStatus
File: service/java/com/android/server/wifi/WifiConfigManager.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-21242 | CRITICAL | 9.8 | android | updateNetworkSelectionStatus | service/java/com/android/server/wifi/WifiConfigManager.java | 72e903f258b5040b8f492cf18edd124b5a1ac770 | 0 |
Analyze the following code function for security vulnerabilities | public static String encodeURIComponent(String s, String charset)
{
if (s == null)
{
return null;
}
else
{
String result;
try
{
result = URLEncoder.encode(s, charset).replaceAll("\\+", "%20")
.replaceAll("\\%21", "!").replaceAll("\\%27", "'")
.replaceAll("\\%28", "(").replaceAll("\\%29", ")")
.replaceAll("\\%7E", "~");
}
catch (UnsupportedEncodingException e)
{
// This exception should never occur
result = s;
}
return result;
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: encodeURIComponent
File: src/main/java/com/mxgraph/online/Utils.java
Repository: jgraph/drawio
The code follows secure coding practices. | [
"CWE-400"
] | CVE-2023-3398 | HIGH | 7.5 | jgraph/drawio | encodeURIComponent | src/main/java/com/mxgraph/online/Utils.java | 064729fec4262f9373d9fdcafda0be47cd18dd50 | 0 |
Analyze the following code function for security vulnerabilities | public String getMdnNumber() {
return mMdn;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getMdnNumber
File: src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
Repository: android
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2016-3831 | MEDIUM | 5 | android | getMdnNumber | src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java | f47bc301ccbc5e6d8110afab5a1e9bac1d4ef058 | 0 |
Analyze the following code function for security vulnerabilities | private ActiveAdmin getNetworkLoggingControllingAdminLocked() {
int affectedUserId = getNetworkLoggingAffectedUser();
if (affectedUserId < 0) {
return null;
}
return getDeviceOrProfileOwnerAdminLocked(affectedUserId);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getNetworkLoggingControllingAdminLocked
File: services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2023-21284 | MEDIUM | 5.5 | android | getNetworkLoggingControllingAdminLocked | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | ed3f25b7222d4cff471f2b7d22d1150348146957 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void run() {
synchronized (mProcessCpuTracker) {
mProcessCpuInitLatch.countDown();
mProcessCpuTracker.init();
}
while (true) {
try {
try {
synchronized(this) {
final long now = SystemClock.uptimeMillis();
long nextCpuDelay = (mLastCpuTime.get()+MONITOR_CPU_MAX_TIME)-now;
long nextWriteDelay = (mLastWriteTime+BATTERY_STATS_TIME)-now;
//Slog.i(TAG, "Cpu delay=" + nextCpuDelay
// + ", write delay=" + nextWriteDelay);
if (nextWriteDelay < nextCpuDelay) {
nextCpuDelay = nextWriteDelay;
}
if (nextCpuDelay > 0) {
mProcessCpuMutexFree.set(true);
this.wait(nextCpuDelay);
}
}
} catch (InterruptedException e) {
}
updateCpuStatsNow();
} catch (Exception e) {
Slog.e(TAG, "Unexpected exception collecting process stats", e);
}
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: run
File: services/core/java/com/android/server/am/ActivityManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-863"
] | CVE-2018-9492 | HIGH | 7.2 | android | run | services/core/java/com/android/server/am/ActivityManagerService.java | 962fb40991f15be4f688d960aa00073683ebdd20 | 0 |
Analyze the following code function for security vulnerabilities | private List<String> getResourceLibraryContracts(FacesContext context) {
UIViewRoot viewRoot = context.getViewRoot();
if(viewRoot == null) {
if(context.getApplication().getResourceHandler().isResourceRequest(context)) {
// it is a resource request. look at the parameter con=.
String param = context.getExternalContext().getRequestParameterMap().get("con");
if(!nameContainsForbiddenSequence(param) && param != null && param.trim().length() > 0) {
return Arrays.asList(param);
}
}
// PENDING(edburns): calculate the contracts!
return Collections.emptyList();
}
return context.getResourceLibraryContracts();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getResourceLibraryContracts
File: impl/src/main/java/com/sun/faces/application/resource/ResourceManager.java
Repository: eclipse-ee4j/mojarra
The code follows secure coding practices. | [
"CWE-22"
] | CVE-2018-14371 | MEDIUM | 5 | eclipse-ee4j/mojarra | getResourceLibraryContracts | impl/src/main/java/com/sun/faces/application/resource/ResourceManager.java | 1b434748d9239f42eae8aa7d37d7a0930c061e24 | 0 |
Analyze the following code function for security vulnerabilities | public void setUserEmailAttribute(String userEmailAttribute) {
this.userEmailAttribute = userEmailAttribute;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setUserEmailAttribute
File: server-plugin/server-plugin-authenticator-ldap/src/main/java/io/onedev/server/plugin/authenticator/ldap/LdapAuthenticator.java
Repository: theonedev/onedev
The code follows secure coding practices. | [
"CWE-90"
] | CVE-2021-32651 | MEDIUM | 4.3 | theonedev/onedev | setUserEmailAttribute | server-plugin/server-plugin-authenticator-ldap/src/main/java/io/onedev/server/plugin/authenticator/ldap/LdapAuthenticator.java | 4440f0c57e440488d7e653417b2547eaae8ad19c | 0 |
Analyze the following code function for security vulnerabilities | @Deprecated
public void removeServiceDestroyListener(ServiceDestroyListener listener) {
serviceDestroyListeners.remove(listener);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: removeServiceDestroyListener
File: server/src/main/java/com/vaadin/server/VaadinService.java
Repository: vaadin/framework
The code follows secure coding practices. | [
"CWE-203"
] | CVE-2021-31403 | LOW | 1.9 | vaadin/framework | removeServiceDestroyListener | server/src/main/java/com/vaadin/server/VaadinService.java | d852126ab6f0c43f937239305bd0e9594834fe34 | 0 |
Analyze the following code function for security vulnerabilities | protected KBTemplate getByUuid_PrevAndNext(Session session,
KBTemplate kbTemplate, String uuid,
OrderByComparator<KBTemplate> orderByComparator, boolean previous) {
StringBundler query = null;
if (orderByComparator != null) {
query = new StringBundler(4 +
(orderByComparator.getOrderByConditionFields().length * 3) +
(orderByComparator.getOrderByFields().length * 3));
}
else {
query = new StringBundler(3);
}
query.append(_SQL_SELECT_KBTEMPLATE_WHERE);
boolean bindUuid = false;
if (uuid == null) {
query.append(_FINDER_COLUMN_UUID_UUID_1);
}
else if (uuid.equals(StringPool.BLANK)) {
query.append(_FINDER_COLUMN_UUID_UUID_3);
}
else {
bindUuid = true;
query.append(_FINDER_COLUMN_UUID_UUID_2);
}
if (orderByComparator != null) {
String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
if (orderByConditionFields.length > 0) {
query.append(WHERE_AND);
}
for (int i = 0; i < orderByConditionFields.length; i++) {
query.append(_ORDER_BY_ENTITY_ALIAS);
query.append(orderByConditionFields[i]);
if ((i + 1) < orderByConditionFields.length) {
if (orderByComparator.isAscending() ^ previous) {
query.append(WHERE_GREATER_THAN_HAS_NEXT);
}
else {
query.append(WHERE_LESSER_THAN_HAS_NEXT);
}
}
else {
if (orderByComparator.isAscending() ^ previous) {
query.append(WHERE_GREATER_THAN);
}
else {
query.append(WHERE_LESSER_THAN);
}
}
}
query.append(ORDER_BY_CLAUSE);
String[] orderByFields = orderByComparator.getOrderByFields();
for (int i = 0; i < orderByFields.length; i++) {
query.append(_ORDER_BY_ENTITY_ALIAS);
query.append(orderByFields[i]);
if ((i + 1) < orderByFields.length) {
if (orderByComparator.isAscending() ^ previous) {
query.append(ORDER_BY_ASC_HAS_NEXT);
}
else {
query.append(ORDER_BY_DESC_HAS_NEXT);
}
}
else {
if (orderByComparator.isAscending() ^ previous) {
query.append(ORDER_BY_ASC);
}
else {
query.append(ORDER_BY_DESC);
}
}
}
}
else {
query.append(KBTemplateModelImpl.ORDER_BY_JPQL);
}
String sql = query.toString();
Query q = session.createQuery(sql);
q.setFirstResult(0);
q.setMaxResults(2);
QueryPos qPos = QueryPos.getInstance(q);
if (bindUuid) {
qPos.add(uuid);
}
if (orderByComparator != null) {
Object[] values = orderByComparator.getOrderByConditionValues(kbTemplate);
for (Object value : values) {
qPos.add(value);
}
}
List<KBTemplate> list = q.list();
if (list.size() == 2) {
return list.get(1);
}
else {
return null;
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getByUuid_PrevAndNext
File: modules/apps/knowledge-base/knowledge-base-service/src/main/java/com/liferay/knowledge/base/service/persistence/impl/KBTemplatePersistenceImpl.java
Repository: brianchandotcom/liferay-portal
The code follows secure coding practices. | [
"CWE-79"
] | CVE-2017-12647 | MEDIUM | 4.3 | brianchandotcom/liferay-portal | getByUuid_PrevAndNext | modules/apps/knowledge-base/knowledge-base-service/src/main/java/com/liferay/knowledge/base/service/persistence/impl/KBTemplatePersistenceImpl.java | ef93d984be9d4d478a5c4b1ca9a86f4e80174774 | 0 |
Analyze the following code function for security vulnerabilities | private void debugLog(String msg) {
if (DBG) Log.d(TAG, msg);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: debugLog
File: src/com/android/bluetooth/btservice/AdapterService.java
Repository: android
The code follows secure coding practices. | [
"CWE-362",
"CWE-20"
] | CVE-2016-3760 | MEDIUM | 5.4 | android | debugLog | src/com/android/bluetooth/btservice/AdapterService.java | 122feb9a0b04290f55183ff2f0384c6c53756bd8 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void processRequest() throws Exception {
String dir = SQLInitServlet.getField("filePath") + "crf" + File.separator + "new" + File.separator;
// YW 09-10-2007 << Now CRF_Design_Template_v2.xls is located at
// $CATALINA_HOME/webapps/OpenClinica-instanceName/properties
FormProcessor fp = new FormProcessor(request);
String crfIdString = fp.getString(CRF_ID);
int crfVersionId = fp.getInt(CRF_VERSION_ID);
CRFVersionDAO cvdao = new CRFVersionDAO(sm.getDataSource());
CRFVersionBean version = (CRFVersionBean) cvdao.findByPK(crfVersionId);
boolean isTemplate = fp.getBoolean("template");
String excelFileName = FilenameUtils.getName(crfIdString + version.getOid() + ".xls");
// aha, what if it's the old style? next line is for backwards compat,
// tbh 07/2008
File excelFile = null;
String oldExcelFileName = FilenameUtils.getName(crfIdString + version.getName() + ".xls");
if (isTemplate) {
// excelFile = new File(dir + CRF_VERSION_TEMPLATE);
excelFile = getCoreResources().getFile(CRF_VERSION_TEMPLATE, "crf" + File.separator + "original" + File.separator);
excelFileName = CRF_VERSION_TEMPLATE;
// FileOutputStream fos = new FileOutputStream(excelFile);
// IOUtils.copy(getCoreResources().getInputStream(CRF_VERSION_TEMPLATE), fos);
// IOUtils.closeQuietly(fos);
} else {
// fix path traversal issue
excelFile = new File(dir,excelFileName);
// backwards compat
File oldExcelFile = new File(dir, oldExcelFileName);
if (oldExcelFile.exists() && oldExcelFile.length() > 0) {
if (!excelFile.exists() || excelFile.length() <= 0) {
// if the old name exists and the new name does not...
excelFile = oldExcelFile;
excelFileName = oldExcelFileName;
}
}
}
logger.info("looking for : " + excelFile.getName());
if (!excelFile.exists() || excelFile.length() <= 0) {
addPageMessage(respage.getString("the_excel_is_not_available_on_server_contact"));
forwardPage(Page.CRF_LIST_SERVLET);
} else {
response.setHeader("Content-disposition", "attachment; filename=\"" + excelFileName + "\";");
response.setContentType("application/vnd.ms-excel");
response.setHeader("Pragma", "public");
ServletOutputStream op = response.getOutputStream();
DataInputStream in = null;
try {
response.setContentType("application/vnd.ms-excel");
response.setHeader("Pragma", "public");
response.setContentLength((int) excelFile.length());
byte[] bbuf = new byte[(int) excelFile.length()];
in = new DataInputStream(new FileInputStream(excelFile));
int length;
while ((in != null) && ((length = in.read(bbuf)) != -1)) {
op.write(bbuf, 0, length);
}
in.close();
op.flush();
op.close();
} catch (Exception ee) {
ee.printStackTrace();
} finally {
if (in != null) {
in.close();
}
if (op != null) {
op.close();
}
}
}
} | Vulnerability Classification:
- CWE: CWE-22
- CVE: CVE-2022-24830
- Severity: HIGH
- CVSS Score: 7.5
Description: OC-17139: code changes after code review
Function: processRequest
File: web/src/main/java/org/akaza/openclinica/control/admin/DownloadVersionSpreadSheetServlet.java
Repository: OpenClinica
Fixed Code:
@Override
public void processRequest() throws Exception {
String dir = SQLInitServlet.getField("filePath") + "crf" + File.separator + "new" + File.separator;
// YW 09-10-2007 << Now CRF_Design_Template_v2.xls is located at
// $CATALINA_HOME/webapps/OpenClinica-instanceName/properties
FormProcessor fp = new FormProcessor(request);
String crfIdString = fp.getString(CRF_ID);
int crfVersionId = fp.getInt(CRF_VERSION_ID);
CRFVersionDAO cvdao = new CRFVersionDAO(sm.getDataSource());
CRFVersionBean version = (CRFVersionBean) cvdao.findByPK(crfVersionId);
boolean isTemplate = fp.getBoolean("template");
String excelFileName = FilenameUtils.getName(crfIdString + version.getOid() + ".xls");
// aha, what if it's the old style? next line is for backwards compat,
// tbh 07/2008
File excelFile = null;
String oldExcelFileName = FilenameUtils.getName(crfIdString + version.getName() + ".xls");
if (isTemplate) {
// excelFile = new File(dir + CRF_VERSION_TEMPLATE);
excelFile = getCoreResources().getFile(CRF_VERSION_TEMPLATE, "crf" + File.separator + "original" + File.separator);
excelFileName = CRF_VERSION_TEMPLATE;
// FileOutputStream fos = new FileOutputStream(excelFile);
// IOUtils.copy(getCoreResources().getInputStream(CRF_VERSION_TEMPLATE), fos);
// IOUtils.closeQuietly(fos);
} else {
// fix path traversal issue
excelFile = new File(dir,excelFileName);
// backwards compat
File oldExcelFile = new File(dir, oldExcelFileName);
String canonicalPath1= excelFile.getCanonicalPath();
String canonicalPath2= oldExcelFile.getCanonicalPath();
if (canonicalPath1.startsWith(dir) && canonicalPath2.startsWith(dir)) {
if (oldExcelFile.exists() && oldExcelFile.length() > 0) {
if (!excelFile.exists() || excelFile.length() <= 0) {
// if the old name exists and the new name does not...
excelFile = oldExcelFile;
excelFileName = oldExcelFileName;
}
}
}else {
addPageMessage(respage.getString("the_excel_is_not_available_on_server_contact"));
forwardPage(Page.CRF_LIST_SERVLET);
}
}
logger.info("looking for : " + excelFile.getName());
if (!excelFile.exists() || excelFile.length() <= 0) {
addPageMessage(respage.getString("the_excel_is_not_available_on_server_contact"));
forwardPage(Page.CRF_LIST_SERVLET);
} else {
response.setHeader("Content-disposition", "attachment; filename=\"" + excelFileName + "\";");
response.setContentType("application/vnd.ms-excel");
response.setHeader("Pragma", "public");
ServletOutputStream op = response.getOutputStream();
DataInputStream in = null;
try {
response.setContentType("application/vnd.ms-excel");
response.setHeader("Pragma", "public");
response.setContentLength((int) excelFile.length());
byte[] bbuf = new byte[(int) excelFile.length()];
in = new DataInputStream(new FileInputStream(excelFile));
int length;
while ((in != null) && ((length = in.read(bbuf)) != -1)) {
op.write(bbuf, 0, length);
}
in.close();
op.flush();
op.close();
} catch (Exception ee) {
ee.printStackTrace();
} finally {
if (in != null) {
in.close();
}
if (op != null) {
op.close();
}
}
}
} | [
"CWE-22"
] | CVE-2022-24830 | HIGH | 7.5 | OpenClinica | processRequest | web/src/main/java/org/akaza/openclinica/control/admin/DownloadVersionSpreadSheetServlet.java | 6f864e86543f903bd20d6f9fc7056115106441f3 | 1 |
Analyze the following code function for security vulnerabilities | public void editarResponsavel(Responsavel responsavel) throws Exception{
ResultSet result = this.bancoConec.execConsulta("Select * from ACI_Responsavel where Email='"
+responsavel.getEmail()+"'");
if(!result.first()){
throw new Exception("Responsavel com esse email já inexistente");
}
result.close();
String comSql = "update ACI_Responsavel set Nome='"+responsavel.getNome()+
"', Telefone='" + responsavel.getTelefone() + "', Endereco='" + responsavel.getEndereco()
+ "' where Email='"+ responsavel.getEmail() + "'";
this.bancoConec.execComando(comSql);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: editarResponsavel
File: Escola Eclipse/Escola/src/banco_de_dados/dao/Responsaveis.java
Repository: marinaguimaraes/ACI_Escola
The code follows secure coding practices. | [
"CWE-89"
] | CVE-2015-10037 | MEDIUM | 5.2 | marinaguimaraes/ACI_Escola | editarResponsavel | Escola Eclipse/Escola/src/banco_de_dados/dao/Responsaveis.java | 34eed1f7b9295d1424912f79989d8aba5de41e9f | 0 |
Analyze the following code function for security vulnerabilities | public void setPid( long pid )
{
this.pid = pid;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setPid
File: src/main/java/org/codehaus/plexus/util/cli/Commandline.java
Repository: codehaus-plexus/plexus-utils
The code follows secure coding practices. | [
"CWE-78"
] | CVE-2017-1000487 | HIGH | 7.5 | codehaus-plexus/plexus-utils | setPid | src/main/java/org/codehaus/plexus/util/cli/Commandline.java | b38a1b3a4352303e4312b2bb601a0d7ec6e28f41 | 0 |
Analyze the following code function for security vulnerabilities | private void notifyMenuStateChangeStart(int menuState, boolean resize, Runnable callback) {
mController.onMenuStateChangeStart(menuState, resize, callback);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: notifyMenuStateChangeStart
File: libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-40123 | MEDIUM | 5.5 | android | notifyMenuStateChangeStart | libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java | 7212a4bec2d2f1a74fa54a12a04255d6a183baa9 | 0 |
Analyze the following code function for security vulnerabilities | public boolean isUseNonce() {
return useNonce;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isUseNonce
File: pac4j-oidc/src/main/java/org/pac4j/oidc/config/OidcConfiguration.java
Repository: pac4j
The code follows secure coding practices. | [
"CWE-347"
] | CVE-2021-44878 | MEDIUM | 5 | pac4j | isUseNonce | pac4j-oidc/src/main/java/org/pac4j/oidc/config/OidcConfiguration.java | 22b82ffd702a132d9f09da60362fc6264fc281ae | 0 |
Analyze the following code function for security vulnerabilities | public boolean hasElement(int element)
{
return ((this.elements & element) == element);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: hasElement
File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices. | [
"CWE-787"
] | CVE-2023-26470 | HIGH | 7.5 | xwiki/xwiki-platform | hasElement | xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java | db3d1c62fc5fb59fefcda3b86065d2d362f55164 | 0 |
Analyze the following code function for security vulnerabilities | public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeStrongBinder(observer != null ? observer.asBinder() : null);
mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
reply.readException();
data.recycle();
reply.recycle();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: registerProcessObserver
File: core/java/android/app/ActivityManagerNative.java
Repository: android
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2016-3832 | HIGH | 8.3 | android | registerProcessObserver | core/java/android/app/ActivityManagerNative.java | e7cf91a198de995c7440b3b64352effd2e309906 | 0 |
Analyze the following code function for security vulnerabilities | public void doIndex(StaplerResponse rsp) throws IOException {
rsp.sendRedirect("heapdump.hprof");
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: doIndex
File: core/src/main/java/hudson/util/RemotingDiagnostics.java
Repository: jenkinsci/jenkins
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2014-2068 | LOW | 3.5 | jenkinsci/jenkins | doIndex | core/src/main/java/hudson/util/RemotingDiagnostics.java | 0530a6645aac10fec005614211660e98db44b5eb | 0 |
Analyze the following code function for security vulnerabilities | public long setMaximumSize(long numBytes) {
long pageSize = getPageSize();
long numPages = numBytes / pageSize;
// If numBytes isn't a multiple of pageSize, bump up a page
if ((numBytes % pageSize) != 0) {
numPages++;
}
long newPageCount = DatabaseUtils.longForQuery(this, "PRAGMA max_page_count = " + numPages,
null);
return newPageCount * pageSize;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setMaximumSize
File: core/java/android/database/sqlite/SQLiteDatabase.java
Repository: android
The code follows secure coding practices. | [
"CWE-89"
] | CVE-2018-9493 | LOW | 2.1 | android | setMaximumSize | core/java/android/database/sqlite/SQLiteDatabase.java | ebc250d16c747f4161167b5ff58b3aea88b37acf | 0 |
Analyze the following code function for security vulnerabilities | public Jooby env(final Env.Builder env) {
this.env = requireNonNull(env, "Env builder is required.");
return this;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: env
File: jooby/src/main/java/org/jooby/Jooby.java
Repository: jooby-project/jooby
The code follows secure coding practices. | [
"CWE-22"
] | CVE-2020-7647 | MEDIUM | 5 | jooby-project/jooby | env | jooby/src/main/java/org/jooby/Jooby.java | 34f526028e6cd0652125baa33936ffb6a8a4a009 | 0 |
Analyze the following code function for security vulnerabilities | public ApiClient setClientConfig(ClientConfig clientConfig) {
this.clientConfig = clientConfig;
// Rebuild HTTP Client according to the new "clientConfig" value.
this.httpClient = buildHttpClient();
return this;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setClientConfig
File: samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java
Repository: OpenAPITools/openapi-generator
The code follows secure coding practices. | [
"CWE-668"
] | CVE-2021-21430 | LOW | 2.1 | OpenAPITools/openapi-generator | setClientConfig | samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java | 2c576483f26f85b3979c6948a131f585c237109a | 0 |
Analyze the following code function for security vulnerabilities | public boolean isReady() {
if (mNativeContentViewCore == 0) return false;
return nativeIsRenderWidgetHostViewReady(mNativeContentViewCore);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isReady
File: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
Repository: chromium
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2014-3159 | MEDIUM | 6.4 | chromium | isReady | content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java | 98a50b76141f0b14f292f49ce376e6554142d5e2 | 0 |
Analyze the following code function for security vulnerabilities | protected AppWidgetHostView onCreateView(Context context, int appWidgetId,
AppWidgetProviderInfo appWidget) {
return new AppWidgetHostView(context, mOnClickHandler);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: onCreateView
File: core/java/android/appwidget/AppWidgetHost.java
Repository: android
The code follows secure coding practices. | [
"CWE-284"
] | CVE-2015-1541 | MEDIUM | 4.3 | android | onCreateView | core/java/android/appwidget/AppWidgetHost.java | 0b98d304c467184602b4c6bce76fda0b0274bc07 | 0 |
Analyze the following code function for security vulnerabilities | public void cleanupBitmapsForPackage(@UserIdInt int userId, String packageName) {
final File packagePath = new File(getUserBitmapFilePath(userId), packageName);
if (!packagePath.isDirectory()) {
return;
}
// ShortcutPackage is already removed at this point, we can safely remove the folder.
if (!(FileUtils.deleteContents(packagePath) && packagePath.delete())) {
Slog.w(TAG, "Unable to remove directory " + packagePath);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: cleanupBitmapsForPackage
File: services/core/java/com/android/server/pm/ShortcutService.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-40079 | HIGH | 7.8 | android | cleanupBitmapsForPackage | services/core/java/com/android/server/pm/ShortcutService.java | 96e0524c48c6e58af7d15a2caf35082186fc8de2 | 0 |
Analyze the following code function for security vulnerabilities | private boolean canManageCaCerts(CallerIdentity caller) {
return (caller.hasAdminComponent() && (isDefaultDeviceOwner(caller)
|| isProfileOwner(caller)))
|| (caller.hasPackage() && isCallerDelegate(caller, DELEGATION_CERT_INSTALL))
|| hasCallingOrSelfPermission(MANAGE_CA_CERTIFICATES);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: canManageCaCerts
File: services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2023-21284 | MEDIUM | 5.5 | android | canManageCaCerts | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | ed3f25b7222d4cff471f2b7d22d1150348146957 | 0 |
Analyze the following code function for security vulnerabilities | final ProcessRecord startProcessLocked(String processName,
ApplicationInfo info, boolean knownToBeDead, int intentFlags,
String hostingType, ComponentName hostingName, boolean allowWhileBooting,
boolean isolated, boolean keepIfLarge) {
return startProcessLocked(processName, info, knownToBeDead, intentFlags, hostingType,
hostingName, allowWhileBooting, isolated, 0 /* isolatedUid */, keepIfLarge,
null /* ABI override */, null /* entryPoint */, null /* entryPointArgs */,
null /* crashHandler */);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: startProcessLocked
File: services/core/java/com/android/server/am/ActivityManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-284"
] | CVE-2015-3833 | MEDIUM | 4.3 | android | startProcessLocked | services/core/java/com/android/server/am/ActivityManagerService.java | aaa0fee0d7a8da347a0c47cef5249c70efee209e | 0 |
Analyze the following code function for security vulnerabilities | @Override
public View getLeftPreview() {
return getLayoutDirection() == LAYOUT_DIRECTION_RTL
? mKeyguardBottomArea.getRightPreview()
: mKeyguardBottomArea.getLeftPreview();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getLeftPreview
File: packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2017-0822 | HIGH | 7.5 | android | getLeftPreview | packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java | c574568aaede7f652432deb7707f20ae54bbdf9a | 0 |
Analyze the following code function for security vulnerabilities | public DocumentSection getDocumentSection(int sectionNumber) throws XWikiException
{
// return a document section according to section number
return getSections().get(sectionNumber - 1);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getDocumentSection
File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices. | [
"CWE-787"
] | CVE-2023-26470 | HIGH | 7.5 | xwiki/xwiki-platform | getDocumentSection | xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java | db3d1c62fc5fb59fefcda3b86065d2d362f55164 | 0 |
Analyze the following code function for security vulnerabilities | public void setShutdownTimeout(int shutdownTimeout) {
this.shutdownTimeout = shutdownTimeout;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setShutdownTimeout
File: src/main/java/com/rabbitmq/client/ConnectionFactory.java
Repository: rabbitmq/rabbitmq-java-client
The code follows secure coding practices. | [
"CWE-400"
] | CVE-2023-46120 | HIGH | 7.5 | rabbitmq/rabbitmq-java-client | setShutdownTimeout | src/main/java/com/rabbitmq/client/ConnectionFactory.java | 714aae602dcae6cb4b53cadf009323ebac313cc8 | 0 |
Analyze the following code function for security vulnerabilities | void setTransparentRegionWindow(Session session, IWindow client, Region region) {
long origId = Binder.clearCallingIdentity();
try {
synchronized (mWindowMap) {
WindowState w = windowForClientLocked(session, client, false);
if ((w != null) && w.mHasSurface) {
w.mWinAnimator.setTransparentRegionHintLocked(region);
}
}
} finally {
Binder.restoreCallingIdentity(origId);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setTransparentRegionWindow
File: services/core/java/com/android/server/wm/WindowManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2016-3875 | HIGH | 7.2 | android | setTransparentRegionWindow | services/core/java/com/android/server/wm/WindowManagerService.java | 69729fa8b13cadbf3173fe1f389fe4f3b7bd0f9c | 0 |
Analyze the following code function for security vulnerabilities | public ProfileOutput getOutputByID(String id) {
for (ProfileOutput output : outputs) {
if (output.getId().equals(id))
return output;
}
return null;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getOutputByID
File: base/common/src/main/java/com/netscape/certsrv/cert/CertEnrollmentRequest.java
Repository: dogtagpki/pki
The code follows secure coding practices. | [
"CWE-611"
] | CVE-2022-2414 | HIGH | 7.5 | dogtagpki/pki | getOutputByID | base/common/src/main/java/com/netscape/certsrv/cert/CertEnrollmentRequest.java | 16deffdf7548e305507982e246eb9fd1eac414fd | 0 |
Analyze the following code function for security vulnerabilities | public static void writeLines(Collection<String> lines, Path path) throws IOException {
Files.write(path, lines, StandardCharsets.UTF_8);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: writeLines
File: pf4j/src/main/java/org/pf4j/util/FileUtils.java
Repository: pf4j
The code follows secure coding practices. | [
"CWE-22"
] | CVE-2023-40827 | HIGH | 7.5 | pf4j | writeLines | pf4j/src/main/java/org/pf4j/util/FileUtils.java | ed9392069fe14c6c30d9f876710e5ad40f7ea8c1 | 0 |
Analyze the following code function for security vulnerabilities | protected Token mapToToken(int token) {
switch(token){
case XMLStreamConstants.START_ELEMENT: return Token.StartEntity;
case XMLStreamConstants.END_ELEMENT: return Token.EndEntity;
case XMLStreamConstants.CHARACTERS: return Token.Value;
case XMLStreamConstants.START_DOCUMENT: return Token.Ignorable;
case XMLStreamConstants.END_DOCUMENT: return Token.Ignorable;
case XMLStreamConstants.SPACE: return Token.Value;
case XMLStreamConstants.PROCESSING_INSTRUCTION: return Token.Ignorable;
case XMLStreamConstants.NOTATION_DECLARATION: return Token.Ignorable;
case XMLStreamConstants.NAMESPACE: return Token.Ignorable;
case XMLStreamConstants.ENTITY_REFERENCE: return Token.Ignorable;
case XMLStreamConstants.DTD: return Token.Ignorable;
case XMLStreamConstants.COMMENT: return Token.Ignorable;
case XMLStreamConstants.CDATA: return Token.Ignorable;
case XMLStreamConstants.ATTRIBUTE: return Token.Ignorable;
default:
return Token.Ignorable;
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: mapToToken
File: main/src/com/google/refine/importers/XmlImporter.java
Repository: OpenRefine
The code follows secure coding practices. | [
"CWE-611"
] | CVE-2018-20157 | MEDIUM | 5 | OpenRefine | mapToToken | main/src/com/google/refine/importers/XmlImporter.java | 6a0d7d56e4ffb420316ce7849fde881344fbf881 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public boolean setKeyGrantForApp(ComponentName who, String callerPackage, String alias,
String packageName, boolean hasGrant) {
Preconditions.checkStringNotEmpty(alias, "Alias to grant cannot be empty");
Preconditions.checkStringNotEmpty(packageName, "Package to grant to cannot be empty");
final CallerIdentity caller = getCallerIdentity(who, callerPackage);
Preconditions.checkCallAuthorization((caller.hasAdminComponent()
&& (isProfileOwner(caller) || isDefaultDeviceOwner(caller)))
|| (caller.hasPackage() && isCallerDelegate(caller, DELEGATION_CERT_SELECTION)));
final int granteeUid;
try {
ApplicationInfo ai = mInjector.getIPackageManager().getApplicationInfo(
packageName, 0, caller.getUserId());
Preconditions.checkArgument(ai != null,
"Provided package %s is not installed", packageName);
granteeUid = ai.uid;
} catch (RemoteException e) {
throw new IllegalStateException("Failure getting grantee uid", e);
}
return setKeyChainGrantInternal(alias, hasGrant, granteeUid, caller.getUserHandle());
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setKeyGrantForApp
File: services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2023-21284 | MEDIUM | 5.5 | android | setKeyGrantForApp | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | ed3f25b7222d4cff471f2b7d22d1150348146957 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.