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
@Deprecated(since = "4.1M2") public void addToZip(ZipOutputStream zos, String zipname, boolean withVersions, XWikiContext context) throws XWikiException, IOException { ZipEntry zipentry = new ZipEntry(zipname); zos.putNextEntry(zipentry); toXML(zos, true, false, true, withVersions, context); zos.closeEntry(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: addToZip 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-74" ]
CVE-2023-29523
HIGH
8.8
xwiki/xwiki-platform
addToZip
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
0d547181389f7941e53291af940966413823f61c
0
Analyze the following code function for security vulnerabilities
private void setupAndInitiateWebSocketsConnection() { if (webSocketConnectionHelper == null) { webSocketConnectionHelper = new WebSocketConnectionHelper(); } if (webSocketClient == null) { webSocketClient = WebSocketConnectionHelper.getExternalSignalingInstanceForServer( externalSignalingServer.getExternalSignalingServer(), conversationUser, externalSignalingServer.getExternalSignalingTicket(), TextUtils.isEmpty(credentials)); } else { if (webSocketClient.isConnected() && currentCallStatus.equals(CallStatus.PUBLISHER_FAILED)) { webSocketClient.restartWebSocket(); } } joinRoomAndCall(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setupAndInitiateWebSocketsConnection File: app/src/main/java/com/nextcloud/talk/activities/CallActivity.java Repository: nextcloud/talk-android The code follows secure coding practices.
[ "CWE-732", "CWE-200" ]
CVE-2022-41926
MEDIUM
5.5
nextcloud/talk-android
setupAndInitiateWebSocketsConnection
app/src/main/java/com/nextcloud/talk/activities/CallActivity.java
bb7e82fbcbd8c10d0d0128d736c41cec0f79e7d0
0
Analyze the following code function for security vulnerabilities
public void setUniqueIndexesEnabled(boolean theUniqueIndexesEnabled) { myUniqueIndexesEnabled = theUniqueIndexesEnabled; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setUniqueIndexesEnabled 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
setUniqueIndexesEnabled
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 boolean isAppOnSdcard(String packageName, UserHandle user) { ApplicationInfo info = getApplicationInfo( packageName, user, PackageManager.MATCH_UNINSTALLED_PACKAGES); return info != null && (info.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isAppOnSdcard File: src/com/android/launcher3/util/PackageManagerHelper.java Repository: android The code follows secure coding practices.
[ "CWE-20" ]
CVE-2023-40097
HIGH
7.8
android
isAppOnSdcard
src/com/android/launcher3/util/PackageManagerHelper.java
6c9a41117d5a9365cf34e770bbb00138f6bf997e
0
Analyze the following code function for security vulnerabilities
@CalledByNative private void updateImeAdapter(long nativeImeAdapterAndroid, int textInputType, String text, int selectionStart, int selectionEnd, int compositionStart, int compositionEnd, boolean showImeIfNeeded, boolean isNonImeChange) { TraceEvent.begin(); mSelectionEditable = (textInputType != ImeAdapter.getTextInputTypeNone()); if (mActionMode != null) mActionMode.invalidate(); mImeAdapter.updateKeyboardVisibility( nativeImeAdapterAndroid, textInputType, showImeIfNeeded); if (mInputConnection != null) { mInputConnection.updateState(text, selectionStart, selectionEnd, compositionStart, compositionEnd, isNonImeChange); } TraceEvent.end(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: updateImeAdapter 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
updateImeAdapter
content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
98a50b76141f0b14f292f49ce376e6554142d5e2
0
Analyze the following code function for security vulnerabilities
@Override public BytesLimitTerminateTimeTailPrettyLoggable<String, LogWatch> limitBytes(int limitBytes) { return new PodOperationsImpl(getContext().withLimitBytes(limitBytes)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: limitBytes File: kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/core/v1/PodOperationsImpl.java Repository: fabric8io/kubernetes-client The code follows secure coding practices.
[ "CWE-22" ]
CVE-2021-20218
MEDIUM
5.8
fabric8io/kubernetes-client
limitBytes
kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/core/v1/PodOperationsImpl.java
325d67cc80b73f049a5d0cea4917c1f2709a8d86
0
Analyze the following code function for security vulnerabilities
@POST @Path("/upload-outcomes") @Consumes(MediaType.APPLICATION_OCTET_STREAM) public Response uploadOutcomes(InputStream is) { JobContext context = jobManager.getJobContext(getJobToken(), true); TarUtils.untar(is, context.getServerWorkspace()); return Response.ok().build(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: uploadOutcomes File: server-plugin/server-plugin-executor-kubernetes/src/main/java/io/onedev/server/plugin/executor/kubernetes/KubernetesResource.java Repository: theonedev/onedev The code follows secure coding practices.
[ "CWE-502" ]
CVE-2021-21243
HIGH
7.5
theonedev/onedev
uploadOutcomes
server-plugin/server-plugin-executor-kubernetes/src/main/java/io/onedev/server/plugin/executor/kubernetes/KubernetesResource.java
9637fc8fa461c5777282a0021c3deb1e7a48f137
0
Analyze the following code function for security vulnerabilities
public StateTree getStateTree() { return stateTree; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getStateTree 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
getStateTree
flow-server/src/main/java/com/vaadin/flow/component/internal/UIInternals.java
428cc97eaa9c89b1124e39f0089bbb741b6b21cc
0
Analyze the following code function for security vulnerabilities
public Builder setAsyncHttpClientProviderConfig(AsyncHttpProviderConfig<?, ?> providerConfig) { this.providerConfig = providerConfig; return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setAsyncHttpClientProviderConfig File: api/src/main/java/org/asynchttpclient/AsyncHttpClientConfig.java Repository: AsyncHttpClient/async-http-client The code follows secure coding practices.
[ "CWE-345" ]
CVE-2013-7397
MEDIUM
4.3
AsyncHttpClient/async-http-client
setAsyncHttpClientProviderConfig
api/src/main/java/org/asynchttpclient/AsyncHttpClientConfig.java
df6ed70e86c8fc340ed75563e016c8baa94d7e72
0
Analyze the following code function for security vulnerabilities
private void handleOnPermissionsChanged(int uid) { final int count = mPermissionListeners.beginBroadcast(); try { for (int i = 0; i < count; i++) { IOnPermissionsChangeListener callback = mPermissionListeners .getBroadcastItem(i); try { callback.onPermissionsChanged(uid); } catch (RemoteException e) { Log.e(TAG, "Permission listener is dead", e); } } } finally { mPermissionListeners.finishBroadcast(); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: handleOnPermissionsChanged File: services/core/java/com/android/server/pm/PackageManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-119" ]
CVE-2016-2497
HIGH
7.5
android
handleOnPermissionsChanged
services/core/java/com/android/server/pm/PackageManagerService.java
a75537b496e9df71c74c1d045ba5569631a16298
0
Analyze the following code function for security vulnerabilities
@Override public List<Pattern> getProtectedUrlPattern() { return Collections.singletonList(staticFilePattern); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getProtectedUrlPattern File: modules/search-service-impl/src/main/java/org/opencastproject/search/impl/SearchServiceImpl.java Repository: opencast The code follows secure coding practices.
[ "CWE-863" ]
CVE-2021-21318
MEDIUM
5.5
opencast
getProtectedUrlPattern
modules/search-service-impl/src/main/java/org/opencastproject/search/impl/SearchServiceImpl.java
b18c6a7f81f08ed14884592a6c14c9ab611ad450
0
Analyze the following code function for security vulnerabilities
boolean setRemoteAlias(BluetoothDevice device, String name) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); DeviceProperties deviceProp = mRemoteDevices.getDeviceProperties(device); if (deviceProp == null) return false; deviceProp.setAlias(device, name); return true; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setRemoteAlias 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
setRemoteAlias
src/com/android/bluetooth/btservice/AdapterService.java
122feb9a0b04290f55183ff2f0384c6c53756bd8
0
Analyze the following code function for security vulnerabilities
void readLidState() { mLidState = mWindowManagerFuncs.getLidState(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: readLidState 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
readLidState
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
84669ca8de55d38073a0dcb01074233b0a417541
0
Analyze the following code function for security vulnerabilities
@Override public int logoutUser(ComponentName who) { Objects.requireNonNull(who, "ComponentName is null"); final CallerIdentity caller = getCallerIdentity(who); Preconditions.checkCallAuthorization( isProfileOwner(caller) || isDefaultDeviceOwner(caller)); checkCanExecuteOrThrowUnsafe(DevicePolicyManager.OPERATION_LOGOUT_USER); final int callingUserId = caller.getUserId(); synchronized (getLockObject()) { if (!isUserAffiliatedWithDeviceLocked(callingUserId)) { throw new SecurityException("Admin " + who + " is neither the device owner or affiliated user's profile owner."); } } if (isManagedProfile(callingUserId)) { Slogf.w(LOG_TAG, "Managed profile cannot be logout"); return UserManager.USER_OPERATION_ERROR_MANAGED_PROFILE; } if (callingUserId != mInjector .binderWithCleanCallingIdentity(() -> getCurrentForegroundUserId())) { Slogf.d(LOG_TAG, "logoutUser(): user %d is in background, just stopping, not switching", callingUserId); return stopUserUnchecked(callingUserId); } return logoutUserUnchecked(/* userIdToStop= */ callingUserId); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: logoutUser 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
logoutUser
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
ed3f25b7222d4cff471f2b7d22d1150348146957
0
Analyze the following code function for security vulnerabilities
public static void retryFailedUploads( @NonNull final Context context, @Nullable final Account account, @NonNull final UploadsStorageManager uploadsStorageManager, @NonNull final ConnectivityService connectivityService, @NonNull final UserAccountManager accountManager, @NonNull final PowerManagementService powerManagementService, @Nullable final UploadResult uploadResult ) { OCUpload[] failedUploads = uploadsStorageManager.getFailedUploads(); if(failedUploads.length == 0) { //nothing to do return; } Account currentAccount = null; boolean resultMatch; boolean accountMatch; final Connectivity connectivity = connectivityService.getConnectivity(); final boolean gotNetwork = connectivity.isConnected() && !connectivityService.isInternetWalled(); final boolean gotWifi = connectivity.isWifi(); final BatteryStatus batteryStatus = powerManagementService.getBattery(); final boolean charging = batteryStatus.isCharging() || batteryStatus.isFull(); final boolean isPowerSaving = powerManagementService.isPowerSavingEnabled(); for (OCUpload failedUpload : failedUploads) { accountMatch = account == null || account.name.equals(failedUpload.getAccountName()); resultMatch = uploadResult == null || uploadResult == failedUpload.getLastResult(); if (accountMatch && resultMatch) { if (currentAccount == null || !currentAccount.name.equals(failedUpload.getAccountName())) { currentAccount = failedUpload.getAccount(accountManager); } if (!new File(failedUpload.getLocalPath()).exists()) { if (failedUpload.getLastResult() != UploadResult.FILE_NOT_FOUND) { failedUpload.setLastResult(UploadResult.FILE_NOT_FOUND); uploadsStorageManager.updateUpload(failedUpload); } } else { if (!isPowerSaving && gotNetwork && canUploadBeRetried(failedUpload, gotWifi, charging)) { retryUpload(context, currentAccount, failedUpload); } } } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: retryFailedUploads File: src/main/java/com/owncloud/android/files/services/FileUploader.java Repository: nextcloud/android The code follows secure coding practices.
[ "CWE-200" ]
CVE-2021-32695
MEDIUM
4.3
nextcloud/android
retryFailedUploads
src/main/java/com/owncloud/android/files/services/FileUploader.java
97d6f2954c879f3bfebcd241993147bced5fd50b
0
Analyze the following code function for security vulnerabilities
private boolean listenForDiscoveryMcRequests(Configuration pConfig) { String enable = pConfig.get(ConfigKey.DISCOVERY_ENABLED); String url = pConfig.get(ConfigKey.DISCOVERY_AGENT_URL); return url != null || enable == null || Boolean.valueOf(enable); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: listenForDiscoveryMcRequests File: agent/jvm/src/main/java/org/jolokia/jvmagent/JolokiaHttpHandler.java Repository: jolokia The code follows secure coding practices.
[ "CWE-352" ]
CVE-2014-0168
MEDIUM
6.8
jolokia
listenForDiscoveryMcRequests
agent/jvm/src/main/java/org/jolokia/jvmagent/JolokiaHttpHandler.java
2d9b168cfbbf5a6d16fa6e8a5b34503e3dc42364
0
Analyze the following code function for security vulnerabilities
@Nullable @Deprecated public Icon getBubbleIcon() { return mIcon; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getBubbleIcon File: core/java/android/app/Notification.java Repository: android The code follows secure coding practices.
[ "CWE-862" ]
CVE-2023-21288
MEDIUM
5.5
android
getBubbleIcon
core/java/android/app/Notification.java
726247f4f53e8cc0746175265652fa415a123c0c
0
Analyze the following code function for security vulnerabilities
@SuppressWarnings("unused") @CalledByNative private void onFlingCancelEventAck() { updateGestureStateListener(GestureEventType.FLING_CANCEL); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onFlingCancelEventAck 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
onFlingCancelEventAck
content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
98a50b76141f0b14f292f49ce376e6554142d5e2
0
Analyze the following code function for security vulnerabilities
private TaskExample buildExample(TaskDTO queryVO) { return new TaskExample(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: buildExample File: rackshift-server/src/main/java/io/rackshift/service/TaskService.java Repository: fit2cloud/rackshift The code follows secure coding practices.
[ "CWE-89" ]
CVE-2023-42405
CRITICAL
9.8
fit2cloud/rackshift
buildExample
rackshift-server/src/main/java/io/rackshift/service/TaskService.java
305aea3b20d36591d519f7d04e0a25be05a51e93
0
Analyze the following code function for security vulnerabilities
public static boolean hasFieldVars(JSONObject filterExpr) { for (Object o : filterExpr.getJSONArray("items")) { JSONObject item = (JSONObject) o; String value = item.getString("value"); if (value != null && value.matches(PATT_FIELDVAR)) return true; String value2 = item.getString("value2"); if (value2 != null && value2.matches(PATT_FIELDVAR)) return true; } return false; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: hasFieldVars File: src/main/java/com/rebuild/core/service/query/AdvFilterParser.java Repository: getrebuild/rebuild The code follows secure coding practices.
[ "CWE-89" ]
CVE-2023-1495
MEDIUM
6.5
getrebuild/rebuild
hasFieldVars
src/main/java/com/rebuild/core/service/query/AdvFilterParser.java
c9474f84e5f376dd2ade2078e3039961a9425da7
0
Analyze the following code function for security vulnerabilities
private ImportResponse importApplication(ServiceProvider serviceProvider, String tenantDomain, String username, boolean isUpdate) throws IdentityApplicationManagementException { Collection<ApplicationMgtListener> listeners = getApplicationMgtListeners(); ServiceProvider savedSP = null; String appName = serviceProvider.getApplicationName(); try { if (isUpdate) { savedSP = getApplicationExcludingFileBasedSPs(appName, tenantDomain); if (savedSP == null) { String errorMsg = String.format("Service provider %s@%s is not found", appName, tenantDomain); throw new IdentityApplicationManagementClientException(APPLICATION_NOT_FOUND.getCode(), errorMsg); } } if (!isUpdate) { ServiceProvider basicApplication = new ServiceProvider(); basicApplication.setApplicationName(serviceProvider.getApplicationName()); basicApplication.setDescription(serviceProvider.getDescription()); String resourceId = createApplication(basicApplication, tenantDomain, username); savedSP = getApplicationByResourceId(resourceId, tenantDomain); } serviceProvider.setApplicationResourceId(savedSP.getApplicationResourceId()); serviceProvider.setApplicationID(savedSP.getApplicationID()); serviceProvider.setOwner(getUser(tenantDomain, username)); for (ApplicationMgtListener listener : listeners) { if (listener.isEnable()) { listener.onPreCreateInbound(serviceProvider, isUpdate); } } updateApplication(serviceProvider, tenantDomain, username); for (ApplicationMgtListener listener : listeners) { if (listener.isEnable()) { listener.doImportServiceProvider(serviceProvider); } } ImportResponse importResponse = new ImportResponse(); if (isUpdate) { importResponse.setResponseCode(ImportResponse.UPDATED); } else { importResponse.setResponseCode(ImportResponse.CREATED); } importResponse.setApplicationName(appName); importResponse.setApplicationResourceId(serviceProvider.getApplicationResourceId()); importResponse.setErrors(new String[0]); return importResponse; } catch (IdentityApplicationManagementClientException e) { deleteCreatedSP(savedSP, tenantDomain, username, isUpdate); return buildImportErrorResponse(e); } catch (IdentityApplicationManagementException e) { deleteCreatedSP(savedSP, tenantDomain, username, isUpdate); String errorMsg = String.format("Error in importing provided service provider %s@%s from file ", appName, tenantDomain); throw new IdentityApplicationManagementException(errorMsg, e); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: importApplication File: components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/ApplicationManagementServiceImpl.java Repository: wso2/carbon-identity-framework The code follows secure coding practices.
[ "CWE-611" ]
CVE-2021-42646
MEDIUM
6.4
wso2/carbon-identity-framework
importApplication
components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/ApplicationManagementServiceImpl.java
e9119883ee02a884f3c76c7bbc4022a4f4c58fc0
0
Analyze the following code function for security vulnerabilities
public boolean shouldAutocomplete() { if (mLastUrlEditWasDelete) return false; Editable text = getText(); return isCursorAtEndOfTypedText() && !isPastedText() && !isHandlingBatchInput() && BaseInputConnection.getComposingSpanEnd(text) == BaseInputConnection.getComposingSpanStart(text); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: shouldAutocomplete File: chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java Repository: chromium The code follows secure coding practices.
[ "CWE-254" ]
CVE-2016-5163
MEDIUM
4.3
chromium
shouldAutocomplete
chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
3bd33fee094e863e5496ac24714c558bd58d28ef
0
Analyze the following code function for security vulnerabilities
protected void addComponentToGrid(Component c) { getParent().addExtensionComponent(c); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: addComponentToGrid 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
addComponentToGrid
server/src/main/java/com/vaadin/ui/Grid.java
c40bed109c3723b38694ed160ea647fef5b28593
0
Analyze the following code function for security vulnerabilities
public ApiClient setPassword(String password) { for (Authentication auth : authentications.values()) { if (auth instanceof HttpBasicAuth) { ((HttpBasicAuth) auth).setPassword(password); return this; } } throw new RuntimeException("No HTTP basic authentication configured!"); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setPassword File: samples/client/petstore/java/okhttp-gson-parcelableModel/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
setPassword
samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java
2c576483f26f85b3979c6948a131f585c237109a
0
Analyze the following code function for security vulnerabilities
private boolean isLockTaskAuthorized(String pkg) { final DevicePolicyManager dpm = (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE); try { int uid = mContext.getPackageManager().getPackageUid(pkg, Binder.getCallingUserHandle().getIdentifier()); return (uid == Binder.getCallingUid()) && dpm != null && dpm.isLockTaskPermitted(pkg); } catch (NameNotFoundException e) { return false; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isLockTaskAuthorized 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
isLockTaskAuthorized
services/core/java/com/android/server/am/ActivityManagerService.java
aaa0fee0d7a8da347a0c47cef5249c70efee209e
0
Analyze the following code function for security vulnerabilities
@Override public PendingIntent getPendingIntentActivityAsApp( int requestCode, @NonNull Intent[] intents, int flags, Bundle options, String ownerPkg, int ownerUid) { // system callers must explicitly set mutability state final boolean flagImmutableSet = (flags & PendingIntent.FLAG_IMMUTABLE) != 0; final boolean flagMutableSet = (flags & PendingIntent.FLAG_MUTABLE) != 0; if (flagImmutableSet == flagMutableSet) { throw new IllegalArgumentException( "Must set exactly one of FLAG_IMMUTABLE or FLAG_MUTABLE"); } final Context context = ActivityManagerService.this.mContext; final ContentResolver resolver = context.getContentResolver(); final int len = intents.length; final String[] resolvedTypes = new String[len]; for (int i = 0; i < len; i++) { final Intent intent = intents[i]; resolvedTypes[i] = intent.resolveTypeIfNeeded(resolver); intent.migrateExtraStreamToClipData(context); intent.prepareToLeaveProcess(context); } IIntentSender target = ActivityManagerService.this.getIntentSenderWithFeatureAsApp( INTENT_SENDER_ACTIVITY, ownerPkg, context.getAttributionTag(), null, null, requestCode, intents, resolvedTypes, flags, options, UserHandle.getUserId(ownerUid), ownerUid); return target != null ? new PendingIntent(target) : null; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getPendingIntentActivityAsApp File: services/core/java/com/android/server/am/ActivityManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21292
MEDIUM
5.5
android
getPendingIntentActivityAsApp
services/core/java/com/android/server/am/ActivityManagerService.java
d10b27e539f7bc91c2360d429b9d05f05274670d
0
Analyze the following code function for security vulnerabilities
public long getLastHeartbeatTimestamp() { return lastHeartbeatTimestamp; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getLastHeartbeatTimestamp 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
getLastHeartbeatTimestamp
flow-server/src/main/java/com/vaadin/flow/component/internal/UIInternals.java
428cc97eaa9c89b1124e39f0089bbb741b6b21cc
0
Analyze the following code function for security vulnerabilities
private void init() throws Exception { /** check if in pom.xml this prop is declared in order to work with encrypted * passwords for postgres embedded - this is a dev mode only feature */ String secretKey = System.getProperty("postgres_secretkey_4_embeddedmode"); if(secretKey != null){ AES.setSecretKey(secretKey); } postgreSQLClientConfig = getPostgreSQLClientConfig(tenantId, schemaName, Envs.allDBConfs()); logPostgresConfig(); if (isEmbedded()) { startEmbeddedPostgres(); } client = io.vertx.ext.asyncsql.PostgreSQLClient.createNonShared(vertx, postgreSQLClientConfig); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: init 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
init
domain-models-runtime/src/main/java/org/folio/rest/persist/PostgresClient.java
b7ef741133e57add40aa4cb19430a0065f378a94
0
Analyze the following code function for security vulnerabilities
private List<String> getIncludedPagesInternal(XWikiContext context) { if (is10Syntax()) { return getIncludedPagesForXWiki10Syntax(getContent(), context); } else { // Find all include macros listed on the page XDOM dom = getXDOM(); List<String> result = new ArrayList<String>(); List<MacroBlock> macroBlocks = dom.getBlocks(new ClassBlockMatcher(MacroBlock.class), Block.Axes.DESCENDANT); for (MacroBlock macroBlock : macroBlocks) { // - Add each document pointed to by the include macro // - Also add all the included pages found in the velocity macro when using the deprecated #include* // macros // This should be removed when we fully drop support for the XWiki Syntax 1.0 but for now we want to // play nice with people migrating from 1.0 to 2.0 syntax if (macroBlock.getId().equalsIgnoreCase("include") || macroBlock.getId().equalsIgnoreCase("display")) { String documentName = macroBlock.getParameters().get("reference"); if (StringUtils.isEmpty(documentName)) { documentName = macroBlock.getParameters().get("document"); if (StringUtils.isEmpty(documentName)) { continue; } } DocumentReference documentReference = getExplicitDocumentReferenceResolver().resolve(documentName, getDocumentReference()); if (this.getDocumentReference().equals(documentReference)) { // Skip auto-includes since they are not allowed anyway. continue; } documentName = LOCAL_REFERENCE_SERIALIZER.serialize(documentReference); result.add(documentName); } else if (macroBlock.getId().equalsIgnoreCase("velocity") && !StringUtils.isEmpty(macroBlock.getContent())) { // Try to find matching content inside each velocity macro result.addAll(getIncludedPagesForXWiki10Syntax(macroBlock.getContent(), context)); } } return result; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getIncludedPagesInternal 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
getIncludedPagesInternal
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
private Type<?> parseTypeImpl(String input) throws InvalidSyntaxException { BiFunction<GraphqlParser, GraphqlAntlrToLanguage, Object[]> nodeFunction = (parser, toLanguage) -> { final GraphqlParser.TypeContext documentContext = parser.type(); Type<?> value = toLanguage.createType(documentContext); return new Object[]{documentContext, value}; }; MultiSourceReader multiSourceReader = MultiSourceReader.newMultiSourceReader() .string(input, null) .trackData(true) .build(); ParserEnvironment parserEnvironment = ParserEnvironment.newParserEnvironment().document(multiSourceReader).build(); return (Type<?>) parseImpl(parserEnvironment, nodeFunction); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: parseTypeImpl File: src/main/java/graphql/parser/Parser.java Repository: graphql-java The code follows secure coding practices.
[ "CWE-770" ]
CVE-2023-28867
HIGH
7.5
graphql-java
parseTypeImpl
src/main/java/graphql/parser/Parser.java
8a1c884c81c0b656db201cfd95881feb0f430a55
0
Analyze the following code function for security vulnerabilities
public static ResponseHeaders setOrRemoveContentLength(ResponseHeaders headers, HttpData content, HttpHeaders trailers) { requireNonNull(headers, "headers"); requireNonNull(content, "content"); requireNonNull(trailers, "trailers"); final HttpStatus status = headers.status(); if (isContentAlwaysEmptyWithValidation(status, content, trailers)) { if (status != HttpStatus.NOT_MODIFIED) { if (headers.contains(HttpHeaderNames.CONTENT_LENGTH)) { final ResponseHeadersBuilder builder = headers.toBuilder(); builder.remove(HttpHeaderNames.CONTENT_LENGTH); return builder.build(); } } else { // 304 response can have the "content-length" header when it is a response to a conditional // GET request. See https://tools.ietf.org/html/rfc7230#section-3.3.2 } return headers; } if (!trailers.isEmpty()) { // Some of the client implementations such as "curl" ignores trailers if // the "content-length" header is present. We should not set "content-length" header when // trailers exists so that those clients can receive the trailers. // The response is sent using chunked transfer encoding in HTTP/1 or a DATA frame payload // in HTTP/2, so it's no worry. if (headers.contains(HttpHeaderNames.CONTENT_LENGTH)) { final ResponseHeadersBuilder builder = headers.toBuilder(); builder.remove(HttpHeaderNames.CONTENT_LENGTH); return builder.build(); } return headers; } if (!headers.contains(HttpHeaderNames.CONTENT_LENGTH) || !content.isEmpty()) { return headers.toBuilder() .setInt(HttpHeaderNames.CONTENT_LENGTH, content.length()) .build(); } // The header contains "content-length" header and the content is empty. // Do not overwrite the header because a response to a HEAD request // will have no content even if it has non-zero content-length header. return headers; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setOrRemoveContentLength File: core/src/main/java/com/linecorp/armeria/internal/ArmeriaHttpUtil.java Repository: line/armeria The code follows secure coding practices.
[ "CWE-74" ]
CVE-2019-16771
MEDIUM
5
line/armeria
setOrRemoveContentLength
core/src/main/java/com/linecorp/armeria/internal/ArmeriaHttpUtil.java
b597f7a865a527a84ee3d6937075cfbb4470ed20
0
Analyze the following code function for security vulnerabilities
@Override public boolean isUsbDataSignalingEnabled(String packageName) { final CallerIdentity caller = getCallerIdentity(packageName); synchronized (getLockObject()) { // If the caller is an admin, return the policy set by itself. Otherwise // return the device-wide policy. if (isDefaultDeviceOwner(caller) || isProfileOwnerOfOrganizationOwnedDevice(caller)) { return getProfileOwnerOrDeviceOwnerLocked(caller).mUsbDataSignalingEnabled; } else { return isUsbDataSignalingEnabledInternalLocked(); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isUsbDataSignalingEnabled 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
isUsbDataSignalingEnabled
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
ed3f25b7222d4cff471f2b7d22d1150348146957
0
Analyze the following code function for security vulnerabilities
@Override public void onSuccessfulOutgoingCall(Call call, int callState) { Log.v(this, "onSuccessfulOutgoingCall, %s", call); setCallState(call, callState); if (!mCalls.contains(call)) { // Call was not added previously in startOutgoingCall due to it being a potential MMI // code, so add it now. addCall(call); } // The call's ConnectionService has been updated. for (CallsManagerListener listener : mListeners) { listener.onConnectionServiceChanged(call, null, call.getConnectionService()); } markCallAsDialing(call); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onSuccessfulOutgoingCall File: src/com/android/server/telecom/CallsManager.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-2423
MEDIUM
6.6
android
onSuccessfulOutgoingCall
src/com/android/server/telecom/CallsManager.java
a06c9a4aef69ae27b951523cf72bf72412bf48fa
0
Analyze the following code function for security vulnerabilities
@JRubyMethod(name = "io", meta = true) public static IRubyObject parse_io(ThreadContext context, IRubyObject klass, IRubyObject data, IRubyObject encoding) { Html4SaxParserContext ctx = Html4SaxParserContext.newInstance(context.runtime, (RubyClass) klass); ctx.setIOInputSource(context, data, context.nil); String javaEncoding = findEncodingName(context, encoding); if (javaEncoding != null) { ctx.getInputSource().setEncoding(javaEncoding); } return ctx; }
Vulnerability Classification: - CWE: CWE-241 - CVE: CVE-2022-29181 - Severity: MEDIUM - CVSS Score: 6.4 Description: fix: {HTML4,XML}::SAX::{Parser,ParserContext} check arg types Previously, arguments of the wrong type might cause segfault on CRuby. Function: parse_io File: ext/java/nokogiri/Html4SaxParserContext.java Repository: sparklemotion/nokogiri Fixed Code: @JRubyMethod(name = "io", meta = true) public static IRubyObject parse_io(ThreadContext context, IRubyObject klass, IRubyObject data, IRubyObject encoding) { if (!(encoding instanceof RubyFixnum)) { throw context.getRuntime().newTypeError("encoding must be kind_of String"); } Html4SaxParserContext ctx = Html4SaxParserContext.newInstance(context.runtime, (RubyClass) klass); ctx.setIOInputSource(context, data, context.nil); String javaEncoding = findEncodingName(context, encoding); if (javaEncoding != null) { ctx.getInputSource().setEncoding(javaEncoding); } return ctx; }
[ "CWE-241" ]
CVE-2022-29181
MEDIUM
6.4
sparklemotion/nokogiri
parse_io
ext/java/nokogiri/Html4SaxParserContext.java
db05ba9a1bd4b90aa6c76742cf6102a7c7297267
1
Analyze the following code function for security vulnerabilities
private static boolean isApplicationAccessTokenNeverExpire(long validityPeriod) { return validityPeriod < 0 || validityPeriod == Long.MAX_VALUE; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isApplicationAccessTokenNeverExpire File: components/apimgt/org.wso2.carbon.apimgt.hostobjects/src/main/java/org/wso2/carbon/apimgt/hostobjects/APIStoreHostObject.java Repository: wso2/carbon-apimgt The code follows secure coding practices.
[ "CWE-79" ]
CVE-2018-20736
LOW
3.5
wso2/carbon-apimgt
isApplicationAccessTokenNeverExpire
components/apimgt/org.wso2.carbon.apimgt.hostobjects/src/main/java/org/wso2/carbon/apimgt/hostobjects/APIStoreHostObject.java
490f2860822f89d745b7c04fa9570bd86bef4236
0
Analyze the following code function for security vulnerabilities
public AlgorithmParameters engineGetParameters() { if (engineParam == null && engineSpec != null) { try { engineParam = helper.createAlgorithmParameters("IES"); engineParam.init(engineSpec); } catch (Exception e) { throw new RuntimeException(e.toString()); } } return engineParam; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: engineGetParameters File: prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/dh/IESCipher.java Repository: bcgit/bc-java The code follows secure coding practices.
[ "CWE-361" ]
CVE-2016-1000345
MEDIUM
4.3
bcgit/bc-java
engineGetParameters
prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/dh/IESCipher.java
21dcb3d9744c83dcf2ff8fcee06dbca7bfa4ef35
0
Analyze the following code function for security vulnerabilities
@Test public void testParsePercentile() { final String s = "percentile[0.98,0.95,0.99]"; final String ss = "percentile [0.98,0.95,0.99]"; final String sss = "percentile[ 0.98,0.95,0.99]"; final String ssss = "percentile[0.98,0.95,0.99 ]"; final String sssss = "percentile[ 0.98, 0.95,0.99]"; List<String> strs = new ArrayList<String>(); strs.add(sssss); strs.add(ssss); strs.add(sss); strs.add(ss); strs.add(s); for (String str : strs) { List<Float> fs = QueryRpc.parsePercentiles(str); assertEquals(3, fs.size()); assertEquals(0.98, fs.get(0), 0.0001); assertEquals(0.95, fs.get(1), 0.0001); assertEquals(0.99, fs.get(2), 0.0001); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: testParsePercentile File: test/tsd/TestQueryRpc.java Repository: OpenTSDB/opentsdb The code follows secure coding practices.
[ "CWE-79" ]
CVE-2023-25827
MEDIUM
6.1
OpenTSDB/opentsdb
testParsePercentile
test/tsd/TestQueryRpc.java
ff02c1e95e60528275f69b31bcbf7b2ac625cea8
0
Analyze the following code function for security vulnerabilities
@Override public void update(@Nonnull Actor actor, @Nonnull World world) { LocalSession session = WorldEdit.getInstance().getSessionManager().getIfPresent(actor); if (session == null) { return; } MutablePair<World, Set<BlockVector2>> existing = cancelAndGet(actor); try { Region region = session.getSelection(world); if (region == null) { return; } if (existing == null) { update.put( actor.getUniqueId(), existing = new MutablePair<>() ); } synchronized (existing) { // Ensure key & value are mutated together existing.setKey(world); existing.setValue(ImmutableSet.copyOf(Iterables.limit( region.getChunks(), Settings.settings().QUEUE.PRELOAD_CHUNK_COUNT ))); } synchronized (update) { update.notify(); } } catch (IncompleteRegionException ignored) { } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: update File: worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/preloader/AsyncPreloader.java Repository: IntellectualSites/FastAsyncWorldEdit The code follows secure coding practices.
[ "CWE-400" ]
CVE-2023-35925
MEDIUM
5.5
IntellectualSites/FastAsyncWorldEdit
update
worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/preloader/AsyncPreloader.java
3a8dfb4f7b858a439c35f7af1d56d21f796f61f5
0
Analyze the following code function for security vulnerabilities
@Override public void setDataProvider(DataProvider<T, ?> dataProvider) { internalSetDataProvider(dataProvider); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setDataProvider 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
setDataProvider
server/src/main/java/com/vaadin/ui/Grid.java
c40bed109c3723b38694ed160ea647fef5b28593
0
Analyze the following code function for security vulnerabilities
private Set getEndCertificates(X509CertSelector xselector) throws CertStoreException { String[] attrs = {params.getUserCertificateAttribute()}; String attrName = params.getLdapUserCertificateAttributeName(); String subjectAttributeName = params.getUserCertificateSubjectAttributeName(); Set set = certSubjectSerialSearch(xselector, attrs, attrName, subjectAttributeName); return set; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getEndCertificates File: prov/src/main/java/org/bouncycastle/jce/provider/X509LDAPCertStoreSpi.java Repository: bcgit/bc-java The code follows secure coding practices.
[ "CWE-295" ]
CVE-2023-33201
MEDIUM
5.3
bcgit/bc-java
getEndCertificates
prov/src/main/java/org/bouncycastle/jce/provider/X509LDAPCertStoreSpi.java
e8c409a8389c815ea3fda5e8b94c92fdfe583bcc
0
Analyze the following code function for security vulnerabilities
private static native long nativeCreate();
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: nativeCreate File: core/java/android/content/res/AssetManager.java Repository: android The code follows secure coding practices.
[ "CWE-415" ]
CVE-2023-40103
HIGH
7.8
android
nativeCreate
core/java/android/content/res/AssetManager.java
c3bc12c484ef3bbca4cec19234437c45af5e584d
0
Analyze the following code function for security vulnerabilities
@Override public void success(final Conversation conversation) { runOnUiThread(() -> { hideToast(); switchToConversation(conversation); }); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: success File: src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java Repository: iNPUTmice/Conversations The code follows secure coding practices.
[ "CWE-200" ]
CVE-2018-18467
MEDIUM
5
iNPUTmice/Conversations
success
src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
7177c523a1b31988666b9337249a4f1d0c36f479
0
Analyze the following code function for security vulnerabilities
@Temporal(TemporalType.TIMESTAMP) @Column(name = "payment_date", length = 19) public Date getPaymentDate() { return this.paymentDate; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getPaymentDate File: publiccms-parent/publiccms-core/src/main/java/com/publiccms/entities/trade/TradeOrder.java Repository: sanluan/PublicCMS The code follows secure coding practices.
[ "CWE-79" ]
CVE-2020-21333
LOW
3.5
sanluan/PublicCMS
getPaymentDate
publiccms-parent/publiccms-core/src/main/java/com/publiccms/entities/trade/TradeOrder.java
b4d5956e65b14347b162424abb197a180229b3db
0
Analyze the following code function for security vulnerabilities
private static void setCancellationInProgress(HttpServletRequest request, boolean cancellationInProgress) { request.setAttribute("submission.cancellation", Boolean.valueOf(cancellationInProgress)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setCancellationInProgress File: dspace-jspui/src/main/java/org/dspace/app/webui/servlet/SubmissionController.java Repository: DSpace The code follows secure coding practices.
[ "CWE-22" ]
CVE-2022-31194
HIGH
7.2
DSpace
setCancellationInProgress
dspace-jspui/src/main/java/org/dspace/app/webui/servlet/SubmissionController.java
d1dd7d23329ef055069759df15cfa200c8e3
0
Analyze the following code function for security vulnerabilities
@JRubyMethod(meta=true) public static IRubyObject from_document(ThreadContext context, IRubyObject klazz, IRubyObject document) { XmlDocument doc = ((XmlDocument) ((XmlNode) document).document(context)); RubyArray errors = (RubyArray) doc.getInstanceVariable("@errors"); if (!errors.isEmpty()) { throw ((XmlSyntaxError) errors.first()).toThrowable(); } DOMSource source = new DOMSource(doc.getDocument()); IRubyObject uri = doc.url(context); if (!uri.isNil()) { source.setSystemId(uri.convertToString().asJavaString()); } return getSchema(context, (RubyClass)klazz, source); }
Vulnerability Classification: - CWE: CWE-611 - CVE: CVE-2020-26247 - Severity: MEDIUM - CVSS Score: 4.0 Description: feat: XML::Schema and RelaxNG creation accept optional ParseOptions I'm trying out a new pattern, which is that the parsed object carries around the ParseOptions it was created with, which should make some testing a bit easier. I'm also not implementing the "config block" pattern in use for Documents, because I think the UX is weird and I'm hoping to change everything to use kwargs in a 2.0 release, anyway. Function: from_document File: ext/java/nokogiri/XmlSchema.java Repository: sparklemotion/nokogiri Fixed Code: @JRubyMethod(meta=true, required=1, optional=1) public static IRubyObject from_document(ThreadContext context, IRubyObject klazz, IRubyObject[] args) { IRubyObject document = args[0]; IRubyObject parseOptions = null; if (args.length > 1) { parseOptions = args[1]; } XmlDocument doc = ((XmlDocument) ((XmlNode) document).document(context)); RubyArray errors = (RubyArray) doc.getInstanceVariable("@errors"); if (!errors.isEmpty()) { throw ((XmlSyntaxError) errors.first()).toThrowable(); } DOMSource source = new DOMSource(doc.getDocument()); IRubyObject uri = doc.url(context); if (!uri.isNil()) { source.setSystemId(uri.convertToString().asJavaString()); } return getSchema(context, (RubyClass)klazz, source, parseOptions); }
[ "CWE-611" ]
CVE-2020-26247
MEDIUM
4
sparklemotion/nokogiri
from_document
ext/java/nokogiri/XmlSchema.java
9c87439d9afa14a365ff13e73adc809cb2c3d97b
1
Analyze the following code function for security vulnerabilities
public static Object stringToValue(String string) { if ("".equals(string)) { return string; } // check JSON key words true/false/null if ("true".equalsIgnoreCase(string)) { return Boolean.TRUE; } if ("false".equalsIgnoreCase(string)) { return Boolean.FALSE; } if ("null".equalsIgnoreCase(string)) { return JSONObject.NULL; } /* * If it might be a number, try converting it. If a number cannot be * produced, then the value will just be a string. */ char initial = string.charAt(0); if ((initial >= '0' && initial <= '9') || initial == '-') { try { return stringToNumber(string); } catch (Exception ignore) { } } return string; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: stringToValue File: src/main/java/org/json/JSONObject.java Repository: stleary/JSON-java The code follows secure coding practices.
[ "CWE-770" ]
CVE-2023-5072
HIGH
7.5
stleary/JSON-java
stringToValue
src/main/java/org/json/JSONObject.java
661114c50dcfd53bb041aab66f14bb91e0a87c8a
0
Analyze the following code function for security vulnerabilities
void updateMultiWindowMode() { if (task == null || task.getRootTask() == null || !attachedToProcess()) { return; } // An activity is considered to be in multi-window mode if its task isn't fullscreen. final boolean inMultiWindowMode = inMultiWindowMode(); if (inMultiWindowMode != mLastReportedMultiWindowMode) { if (!inMultiWindowMode && mLastReportedPictureInPictureMode) { updatePictureInPictureMode(null, false); } else { mLastReportedMultiWindowMode = inMultiWindowMode; ensureActivityConfiguration(0 /* globalChanges */, PRESERVE_WINDOWS, false /* ignoreVisibility */); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: updateMultiWindowMode 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
updateMultiWindowMode
services/core/java/com/android/server/wm/ActivityRecord.java
44aeef1b82ecf21187d4903c9e3666a118bdeaf3
0
Analyze the following code function for security vulnerabilities
public Map<String, Integer> getJarSignableEntries() { return Collections.unmodifiableMap(jarSignableEntries); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getJarSignableEntries File: core/src/main/java/net/sourceforge/jnlp/tools/JarCertVerifier.java Repository: AdoptOpenJDK/IcedTea-Web The code follows secure coding practices.
[ "CWE-345", "CWE-94", "CWE-22" ]
CVE-2019-10182
MEDIUM
5.8
AdoptOpenJDK/IcedTea-Web
getJarSignableEntries
core/src/main/java/net/sourceforge/jnlp/tools/JarCertVerifier.java
2fd1e4b769911f2c6f7f3902f7ea21568ddc2f99
0
Analyze the following code function for security vulnerabilities
@Override public void captureVideo(ActionListener response) { captureVideo(null, response); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: captureVideo 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
captureVideo
Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java
dad49c9ef26a598619fc48d2697151a02987d478
0
Analyze the following code function for security vulnerabilities
@Override public void showGlobalActions() { WindowManagerService.this.showGlobalActions(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: showGlobalActions 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
showGlobalActions
services/core/java/com/android/server/wm/WindowManagerService.java
69729fa8b13cadbf3173fe1f389fe4f3b7bd0f9c
0
Analyze the following code function for security vulnerabilities
@Override protected void bindListener() { final Class bgListenerClass = getBackgroundLocationListener(); Thread t = new Thread(new Runnable() { @Override public void run() { //wait until the client is connected, otherwise the call to //requestLocationUpdates will fail while (!getmGoogleApiClient().isConnected()) { try { Thread.sleep(300); } catch (Exception ex) { } } Handler mHandler = new Handler(Looper.getMainLooper()); mHandler.post(new Runnable() { public void run() { LocationRequest r = locationRequest; com.codename1.location.LocationRequest request = getRequest(); if (request != null) { LocationRequest lr = LocationRequest.create(); if (request.getPriority() == com.codename1.location.LocationRequest.PRIORITY_HIGH_ACCUARCY) { lr.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); } else if (request.getPriority() == com.codename1.location.LocationRequest.PRIORITY_MEDIUM_ACCUARCY) { lr.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY); } else { lr.setPriority(LocationRequest.PRIORITY_LOW_POWER); } lr.setInterval(request.getInterval()); r = lr; } if (AndroidImplementation.getActivity() == null) { // we are in the background // Sometimes using regular locations in the background causes a crash // so we need to use the pending intent version. Context context = AndroidNativeUtil.getContext(); Intent intent = new Intent(context, BackgroundLocationHandler.class); //there is an bug that causes this to not to workhttps://code.google.com/p/android/issues/detail?id=81812 //intent.putExtra("backgroundClass", getBackgroundLocationListener().getName()); //an ugly workaround to the putExtra bug if (bgListenerClass != null) { intent.setData(Uri.parse("http://codenameone.com/a?" + bgListenerClass.getName())); } PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); inMemoryBackgroundLocationListener = AndroidLocationPlayServiceManager.this; //LocationServices.FusedLocationApi.requestLocationUpdates(getmGoogleApiClient(), r, pendingIntent); requestLocationUpdates(context, r, pendingIntent); } else { //LocationServices.FusedLocationApi.requestLocationUpdates(getmGoogleApiClient(), r, AndroidLocationPlayServiceManager.this); requestLocationUpdates(AndroidNativeUtil.getContext(), r, AndroidLocationPlayServiceManager.this); } } }); } }); t.setUncaughtExceptionHandler(AndroidImplementation.exceptionHandler); t.start(); }
Vulnerability Classification: - CWE: CWE-668 - CVE: CVE-2022-4903 - Severity: MEDIUM - CVSS Score: 5.1 Description: Fixed #3583 Pending Intent vulnerability Function: bindListener File: Ports/Android/src/com/codename1/location/AndroidLocationPlayServiceManager.java Repository: codenameone/CodenameOne Fixed Code: @Override protected void bindListener() { final Class bgListenerClass = getBackgroundLocationListener(); Thread t = new Thread(new Runnable() { @Override public void run() { //wait until the client is connected, otherwise the call to //requestLocationUpdates will fail while (!getmGoogleApiClient().isConnected()) { try { Thread.sleep(300); } catch (Exception ex) { } } Handler mHandler = new Handler(Looper.getMainLooper()); mHandler.post(new Runnable() { public void run() { LocationRequest r = locationRequest; com.codename1.location.LocationRequest request = getRequest(); if (request != null) { LocationRequest lr = LocationRequest.create(); if (request.getPriority() == com.codename1.location.LocationRequest.PRIORITY_HIGH_ACCUARCY) { lr.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); } else if (request.getPriority() == com.codename1.location.LocationRequest.PRIORITY_MEDIUM_ACCUARCY) { lr.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY); } else { lr.setPriority(LocationRequest.PRIORITY_LOW_POWER); } lr.setInterval(request.getInterval()); r = lr; } if (AndroidImplementation.getActivity() == null) { // we are in the background // Sometimes using regular locations in the background causes a crash // so we need to use the pending intent version. Context context = AndroidNativeUtil.getContext(); Intent intent = new Intent(context, BackgroundLocationHandler.class); //there is an bug that causes this to not to workhttps://code.google.com/p/android/issues/detail?id=81812 //intent.putExtra("backgroundClass", getBackgroundLocationListener().getName()); //an ugly workaround to the putExtra bug if (bgListenerClass != null) { intent.setData(Uri.parse("http://codenameone.com/a?" + bgListenerClass.getName())); } PendingIntent pendingIntent = AndroidImplementation.getPendingIntent(context, 0, intent); inMemoryBackgroundLocationListener = AndroidLocationPlayServiceManager.this; //LocationServices.FusedLocationApi.requestLocationUpdates(getmGoogleApiClient(), r, pendingIntent); requestLocationUpdates(context, r, pendingIntent); } else { //LocationServices.FusedLocationApi.requestLocationUpdates(getmGoogleApiClient(), r, AndroidLocationPlayServiceManager.this); requestLocationUpdates(AndroidNativeUtil.getContext(), r, AndroidLocationPlayServiceManager.this); } } }); } }); t.setUncaughtExceptionHandler(AndroidImplementation.exceptionHandler); t.start(); }
[ "CWE-668" ]
CVE-2022-4903
MEDIUM
5.1
codenameone/CodenameOne
bindListener
Ports/Android/src/com/codename1/location/AndroidLocationPlayServiceManager.java
dad49c9ef26a598619fc48d2697151a02987d478
1
Analyze the following code function for security vulnerabilities
@Override public ParceledListSlice<PhoneAccountHandle> getPhoneAccountsForPackage( String packageName) { //TODO: Deprecate this in S try { enforceCallingPackage(packageName, "getPhoneAccountsForPackage"); } catch (SecurityException se1) { EventLog.writeEvent(0x534e4554, "153995334", Binder.getCallingUid(), "getPhoneAccountsForPackage: invalid calling package"); throw se1; } try { enforcePermission(READ_PRIVILEGED_PHONE_STATE); } catch (SecurityException se2) { EventLog.writeEvent(0x534e4554, "153995334", Binder.getCallingUid(), "getPhoneAccountsForPackage: no permission"); throw se2; } synchronized (mLock) { final UserHandle callingUserHandle = Binder.getCallingUserHandle(); long token = Binder.clearCallingIdentity(); try { Log.startSession("TSI.gPAFP"); return new ParceledListSlice<>(mPhoneAccountRegistrar .getAllPhoneAccountHandlesForPackage(callingUserHandle, packageName)); } catch (Exception e) { Log.e(this, e, "getPhoneAccountsForPackage %s", packageName); throw e; } finally { Binder.restoreCallingIdentity(token); Log.endSession(); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getPhoneAccountsForPackage File: src/com/android/server/telecom/TelecomServiceImpl.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21394
MEDIUM
5.5
android
getPhoneAccountsForPackage
src/com/android/server/telecom/TelecomServiceImpl.java
68dca62035c49e14ad26a54f614199cb29a3393f
0
Analyze the following code function for security vulnerabilities
private static boolean servicePropertiesDirty() { for (String key : servicePropertyKeys) { if (Display.getInstance().getProperty(key, null) != null) { return true; } } return false; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: servicePropertiesDirty 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
servicePropertiesDirty
Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java
dad49c9ef26a598619fc48d2697151a02987d478
0
Analyze the following code function for security vulnerabilities
protected void handleTransferEncodingChunkedWithContentLength(HttpMessage message) { message.headers().remove(HttpHeaderNames.CONTENT_LENGTH); contentLength = Long.MIN_VALUE; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: handleTransferEncodingChunkedWithContentLength File: codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java Repository: netty The code follows secure coding practices.
[ "CWE-444" ]
CVE-2021-43797
MEDIUM
4.3
netty
handleTransferEncodingChunkedWithContentLength
codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java
07aa6b5938a8b6ed7a6586e066400e2643897323
0
Analyze the following code function for security vulnerabilities
@Get("/projects/{projectName}/repos/{repoName}/merge") public <T> CompletableFuture<MergedEntryDto<T>> mergeFiles( @Param @Default("-1") String revision, Repository repository, @RequestConverter(MergeQueryRequestConverter.class) MergeQuery<T> query) { return repository.mergeFiles(new Revision(revision), query).thenApply(DtoConverter::convert); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: mergeFiles File: server/src/main/java/com/linecorp/centraldogma/server/internal/api/ContentServiceV1.java Repository: line/centraldogma The code follows secure coding practices.
[ "CWE-862" ]
CVE-2021-38388
MEDIUM
6.5
line/centraldogma
mergeFiles
server/src/main/java/com/linecorp/centraldogma/server/internal/api/ContentServiceV1.java
6a395aed73f0b009cf8174a3ebf3ed826521c11d
0
Analyze the following code function for security vulnerabilities
@Override public void onLocalVoiceInteractionStarted(IBinder activity, IVoiceInteractionSession voiceSession, IVoiceInteractor voiceInteractor) { synchronized (mGlobalLock) { onLocalVoiceInteractionStartedLocked(activity, voiceSession, voiceInteractor); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onLocalVoiceInteractionStarted File: services/core/java/com/android/server/wm/ActivityTaskManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-862" ]
CVE-2023-40094
HIGH
7.8
android
onLocalVoiceInteractionStarted
services/core/java/com/android/server/wm/ActivityTaskManagerService.java
1120bc7e511710b1b774adf29ba47106292365e7
0
Analyze the following code function for security vulnerabilities
protected void disableCertificateValidation(ClientBuilder clientBuilder) throws KeyManagementException, NoSuchAlgorithmException { TrustManager[] trustAllCerts = new X509TrustManager[] { new X509TrustManager() { @Override public X509Certificate[] getAcceptedIssuers() { return null; } @Override public void checkClientTrusted(X509Certificate[] certs, String authType) { } @Override public void checkServerTrusted(X509Certificate[] certs, String authType) { } } }; SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, trustAllCerts, new SecureRandom()); clientBuilder.sslContext(sslContext); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: disableCertificateValidation File: samples/client/petstore/java/retrofit2-play26/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
disableCertificateValidation
samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/ApiClient.java
2c576483f26f85b3979c6948a131f585c237109a
0
Analyze the following code function for security vulnerabilities
@Override public void onUpdateUrl(String url) { for (TabObserver observer : mObservers) observer.onUpdateUrl(Tab.this, url); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onUpdateUrl 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
onUpdateUrl
chrome/android/java/src/org/chromium/chrome/browser/Tab.java
98a50b76141f0b14f292f49ce376e6554142d5e2
0
Analyze the following code function for security vulnerabilities
public DocumentReference getDocumentReference() { return this.doc.getDocumentReference(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getDocumentReference File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/Document.java Repository: xwiki/xwiki-platform The code follows secure coding practices.
[ "CWE-863" ]
CVE-2022-23615
MEDIUM
5.5
xwiki/xwiki-platform
getDocumentReference
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/Document.java
7ab0fe7b96809c7a3881454147598d46a1c9bbbe
0
Analyze the following code function for security vulnerabilities
private boolean validateSelection(int selStart, int selEnd) { int spanStart = getText().getSpanStart(mAutocompleteSpan); int spanEnd = getText().getSpanEnd(mAutocompleteSpan); if (spanStart >= 0 && (spanStart != selStart || spanEnd != selEnd)) { // On selection changes, the autocomplete text has been accepted by the user or needs // to be deleted below. mAutocompleteSpan.clearSpan(); // The autocomplete text will be deleted any time the selection occurs entirely before // the start of the autocomplete text. This is required because certain keyboards will // insert characters temporarily when starting a key entry gesture (whether it be // swyping a word or long pressing to get a special character). When this temporary // character appears, Chrome may decide to append some autocomplete, but the keyboard // will then remove this temporary character only while leaving the autocomplete text // alone. See crbug/273763 for more details. if (selEnd <= spanStart) getText().delete(spanStart, getText().length()); return true; } return false; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: validateSelection File: chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java Repository: chromium The code follows secure coding practices.
[ "CWE-254" ]
CVE-2016-5163
MEDIUM
4.3
chromium
validateSelection
chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
3bd33fee094e863e5496ac24714c558bd58d28ef
0
Analyze the following code function for security vulnerabilities
@JsonProperty("Status") public String getStatus() { return status; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getStatus File: base/common/src/main/java/com/netscape/certsrv/cert/CertDataInfo.java Repository: dogtagpki/pki The code follows secure coding practices.
[ "CWE-611" ]
CVE-2022-2414
HIGH
7.5
dogtagpki/pki
getStatus
base/common/src/main/java/com/netscape/certsrv/cert/CertDataInfo.java
16deffdf7548e305507982e246eb9fd1eac414fd
0
Analyze the following code function for security vulnerabilities
private Cursor getAllGlobalSettings(String[] projection) { if (DEBUG) { Slog.v(LOG_TAG, "getAllGlobalSettings()"); } synchronized (mLock) { // Get the settings. SettingsState settingsState = mSettingsRegistry.getSettingsLocked( SETTINGS_TYPE_GLOBAL, UserHandle.USER_SYSTEM); List<String> names = settingsState.getSettingNamesLocked(); final int nameCount = names.size(); String[] normalizedProjection = normalizeProjection(projection); MatrixCursor result = new MatrixCursor(normalizedProjection, nameCount); // Anyone can get the global settings, so no security checks. for (int i = 0; i < nameCount; i++) { String name = names.get(i); Setting setting = settingsState.getSettingLocked(name); appendSettingToCursor(result, setting); } return result; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getAllGlobalSettings File: packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-3876
HIGH
7.2
android
getAllGlobalSettings
packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
91fc934bb2e5ea59929bb2f574de6db9b5100745
0
Analyze the following code function for security vulnerabilities
@Override protected void onSaveInstanceState(Bundle state) { super.onSaveInstanceState(state); final Bundle inner = new Bundle(); saveState(inner); state.putBundle(KEY_INNER_SAVED_STATE, inner); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onSaveInstanceState File: src/com/android/mail/compose/ComposeActivity.java Repository: android The code follows secure coding practices.
[ "CWE-200" ]
CVE-2016-2425
MEDIUM
4.3
android
onSaveInstanceState
src/com/android/mail/compose/ComposeActivity.java
0d9dfd649bae9c181e3afc5d571903f1eb5dc46f
0
Analyze the following code function for security vulnerabilities
@Override public Project loadProject(long id) { return ProjectUtilities.load(getProjectDir(id), id); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: loadProject File: main/src/com/google/refine/io/FileProjectManager.java Repository: OpenRefine The code follows secure coding practices.
[ "CWE-22" ]
CVE-2023-37476
HIGH
7.8
OpenRefine
loadProject
main/src/com/google/refine/io/FileProjectManager.java
e9c1e65d58b47aec8cd676bd5c07d97b002f205e
0
Analyze the following code function for security vulnerabilities
public boolean removeClient(RealmModel realm, ClientModel client) { if (realm.removeClient(client.getId())) { UserSessionProvider sessions = realmManager.getSession().sessions(); if (sessions != null) { sessions.onClientRemoved(realm, client); } UserSessionPersisterProvider sessionsPersister = realmManager.getSession().getProvider(UserSessionPersisterProvider.class); if (sessionsPersister != null) { sessionsPersister.onClientRemoved(realm, client); } AuthenticationSessionProvider authSessions = realmManager.getSession().authenticationSessions(); if (authSessions != null) { authSessions.onClientRemoved(realm, client); } UserModel serviceAccountUser = realmManager.getSession().users().getServiceAccount(client); if (serviceAccountUser != null) { new UserManager(realmManager.getSession()).removeUser(realm, serviceAccountUser); } return true; } else { return false; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: removeClient File: services/src/main/java/org/keycloak/services/managers/ClientManager.java Repository: keycloak The code follows secure coding practices.
[ "CWE-798" ]
CVE-2019-14837
MEDIUM
6.4
keycloak
removeClient
services/src/main/java/org/keycloak/services/managers/ClientManager.java
9a7c1a91a59ab85e7f8889a505be04a71580777f
0
Analyze the following code function for security vulnerabilities
@SuppressWarnings("unchecked") private void highlightAndPrint(Map<String, Object> options, Object obj) { int width = (int) options.get(Printer.WIDTH); totLines = 0; String message = null; RuntimeException runtimeException = null; if (obj == null) { // do nothing } else if (obj instanceof Map) { highlightMap(options, keysToString((Map<Object, Object>) obj), width); } else if (collectionObject(obj)) { List<Object> collection = objectToList(obj); if (collection.size() > (int) options.get(Printer.MAXROWS)) { message = "Truncated output: " + options.get(Printer.MAXROWS) + "/" + collection.size(); collection = collection.subList(collection.size() - (int) options.get(Printer.MAXROWS), collection.size()); } if (!collection.isEmpty()) { if (collection.size() == 1 && !options.containsKey(Printer.ONE_ROW_TABLE)) { Object elem = collection.iterator().next(); if (elem instanceof Map) { highlightMap(options, keysToString((Map<Object, Object>) elem), width); } else if (canConvert(elem) && !options.containsKey(Printer.TO_STRING)) { highlightMap(options, objectToMap(options, elem), width); } else if (elem instanceof String && options.get(Printer.STYLE) != null) { highlightAndPrint(width, (SyntaxHighlighter) options.get(Printer.STYLE), (String) elem, true); } else { highlightValue(options, null, objectToString(options, obj)) .println(terminal()); } } else { String columnSep = ""; TableRows tableRows = null; boolean rownum = options.containsKey(Printer.ROWNUM); try { columnSep = (String) options.getOrDefault(Printer.BORDER, ""); tableRows = optionRowHighlight(options.getOrDefault(Printer.ROW_HIGHLIGHT, null)); } catch (Exception e) { runtimeException = new BadOptionValueException( "Option " + Printer.BORDER + " or " + Printer.ROW_HIGHLIGHT + " has a bad value!"); runtimeException.addSuppressed(e); } try { Object elem = collection.iterator().next(); boolean convert = canConvert(elem); if ((elem instanceof Map || convert) && !options.containsKey(Printer.TO_STRING)) { List<Map<String, Object>> convertedCollection = new ArrayList<>(); Set<String> keys = new HashSet<>(); for (Object o : collection) { Map<String, Object> m = convert ? objectToMap(options, o) : keysToString((Map<Object, Object>) o); convertedCollection.add(m); keys.addAll(m.keySet()); } List<String> _header; List<String> columnsIn = optionList(Printer.COLUMNS_IN, options); List<String> columnsOut = !options.containsKey("all") ? optionList(Printer.COLUMNS_OUT, options) : new ArrayList<>(); if (options.containsKey(Printer.COLUMNS)) { _header = (List<String>) options.get(Printer.COLUMNS); } else { _header = columnsIn; _header.addAll(keys.stream() .filter(k -> !columnsIn.contains(k) && !hasMatch(columnsOut, k)) .collect(Collectors.toList())); } List<String> header = new ArrayList<>(); List<Integer> columns = new ArrayList<>(); int headerWidth = 0; List<String> refKeys = new ArrayList<>(); for (String v : _header) { String value = v.split("\\.")[0]; if (!keys.contains(value) && !keys.contains(v)) { continue; } boolean addKey = false; for (Map<String, Object> m : convertedCollection) { Object val = mapValue(options, v, m); if (val != null) { addKey = simpleObject(val) || options.containsKey(Printer.COLUMNS) || options.containsKey(Printer.STRUCT_ON_TABLE); break; } } if (!addKey) { continue; } refKeys.add(value); header.add(v); String cn = columnName(v, options.containsKey(Printer.SHORT_NAMES)); columns.add(cn.length() + 1); headerWidth += cn.length() + 1; if (headerWidth > width) { break; } } if (header.size() == 0) { throw new Exception("No columns for table!"); } double mapSimilarity = ((BigDecimal) options.getOrDefault(Printer.MAP_SIMILARITY, new BigDecimal("0.8"))) .doubleValue(); int matchLimit = (int) Math.ceil(header.size() * mapSimilarity); for (Map<String, Object> m : convertedCollection) { if (!similarSets(refKeys, m.keySet(), matchLimit)) { throw new Exception("Not homogenous list!"); } for (int i = 0; i < header.size(); i++) { int cw = highlightMapValue(options, header.get(i), m) .columnLength(); if (cw > columns.get(i) - 1) { columns.set(i, cw + 1); } } } toTabStops(columns, collection.size(), rownum, columnSep); AttributedStringBuilder asb = new AttributedStringBuilder().tabs(columns); asb.style(prntStyle.resolve(".th")); int firstColumn = 0; if (rownum) { asb.append(addPadding("", columns.get(0) - columnSep.length() - 1)); asb.append(columnSep); asb.append("\t"); firstColumn = 1; } boolean first = true; for (String s : header) { if (!first) { asb.append(columnSep); } asb.append(columnName(s, options.containsKey(Printer.SHORT_NAMES))); asb.append("\t"); first = false; } asb.columnSubSequence(0, width).println(terminal()); int row = 0; for (Map<String, Object> m : convertedCollection) { AttributedStringBuilder asb2 = new AttributedStringBuilder().tabs(columns); if (doRowHighlight(row, tableRows)) { asb2.style(prntStyle.resolve(".rs")); } if (rownum) { asb2.styled( prntStyle.resolve(".rn"), addPadding(Integer.toString(row), columns.get(0) - columnSep.length() - 1)); asb2.append(columnSep); asb2.append("\t"); } row++; for (int i = 0; i < header.size(); i++) { if (i > 0) { asb2.append(columnSep); } AttributedString v = highlightMapValue(options, header.get(i), m); if (isNumber(v.toString())) { v = addPadding(v, cellWidth(firstColumn + i, columns, rownum, columnSep) - 1); } asb2.append(v); asb2.append("\t"); } asb2.columnSubSequence(0, width).println(terminal()); } } else if (collectionObject(elem) && !options.containsKey(Printer.TO_STRING)) { List<Integer> columns = new ArrayList<>(); for (Object o : collection) { List<Object> inner = objectToList(o); for (int i = 0; i < inner.size(); i++) { int len1 = objectToString(options, inner.get(i)) .length() + 1; if (columns.size() <= i) { columns.add(len1); } else if (len1 > columns.get(i)) { columns.set(i, len1); } } } toTabStops(columns, collection.size(), rownum, columnSep); int row = 0; int firstColumn = rownum ? 1 : 0; for (Object o : collection) { AttributedStringBuilder asb = new AttributedStringBuilder().tabs(columns); if (doRowHighlight(row, tableRows)) { asb.style(prntStyle.resolve(".rs")); } if (rownum) { asb.styled( prntStyle.resolve(".rn"), addPadding(Integer.toString(row), columns.get(0) - columnSep.length() - 1)); asb.append(columnSep); asb.append("\t"); } row++; List<Object> inner = objectToList(o); for (int i = 0; i < inner.size(); i++) { if (i > 0) { asb.append(columnSep); } AttributedString v = highlightValue(options, null, inner.get(i)); if (isNumber(v.toString())) { v = addPadding(v, cellWidth(firstColumn + i, columns, rownum, columnSep) - 1); } asb.append(v); asb.append("\t"); } asb.columnSubSequence(0, width).println(terminal()); } } else { highlightList(options, collection, width); } } catch (Exception e) { Log.debug("Stack: ", e); highlightList(options, collection, width); } } } else { highlightValue(options, null, objectToString(options, obj)).println(terminal()); } } else if (canConvert(obj) && !options.containsKey(Printer.TO_STRING)) { highlightMap(options, objectToMap(options, obj), width); } else { highlightValue(options, null, objectToString(options, obj)).println(terminal()); } if (message != null) { AttributedStringBuilder asb = new AttributedStringBuilder(); asb.styled(prntStyle.resolve(".em"), message); asb.println(terminal()); } if (runtimeException != null) { throw runtimeException; } }
Vulnerability Classification: - CWE: CWE-787 - CVE: CVE-2023-50572 - Severity: MEDIUM - CVSS Score: 5.5 Description: GroovyEngine.execute cause an OOM exception, fixes #909 Function: highlightAndPrint File: console/src/main/java/org/jline/console/impl/DefaultPrinter.java Repository: jline/jline3 Fixed Code: @SuppressWarnings("unchecked") private void highlightAndPrint(Map<String, Object> options, Object obj) { int width = (int) options.get(Printer.WIDTH); int maxrows = (int) options.get(Printer.MAXROWS); totLines = 0; String message = null; RuntimeException runtimeException = null; if (obj == null) { // do nothing } else if (obj instanceof Map) { highlightMap(options, keysToString((Map<Object, Object>) obj), width); } else if (collectionObject(obj)) { List<Object> collection = objectToList(obj); if (collection.size() > maxrows) { message = "Truncated output: " + maxrows + "/" + collection.size(); collection = collection.subList(collection.size() - maxrows, collection.size()); } if (!collection.isEmpty()) { if (collection.size() == 1 && !options.containsKey(Printer.ONE_ROW_TABLE)) { Object elem = collection.iterator().next(); if (elem instanceof Map) { highlightMap(options, keysToString((Map<Object, Object>) elem), width); } else if (canConvert(elem) && !options.containsKey(Printer.TO_STRING)) { highlightMap(options, objectToMap(options, elem), width); } else if (elem instanceof String && options.get(Printer.STYLE) != null) { highlightAndPrint( width, (SyntaxHighlighter) options.get(Printer.STYLE), (String) elem, true, maxrows); } else { highlightValue(options, null, objectToString(options, obj)) .println(terminal()); } } else { String columnSep = ""; TableRows tableRows = null; boolean rownum = options.containsKey(Printer.ROWNUM); try { columnSep = (String) options.getOrDefault(Printer.BORDER, ""); tableRows = optionRowHighlight(options.getOrDefault(Printer.ROW_HIGHLIGHT, null)); } catch (Exception e) { runtimeException = new BadOptionValueException( "Option " + Printer.BORDER + " or " + Printer.ROW_HIGHLIGHT + " has a bad value!"); runtimeException.addSuppressed(e); } try { Object elem = collection.iterator().next(); boolean convert = canConvert(elem); if ((elem instanceof Map || convert) && !options.containsKey(Printer.TO_STRING)) { List<Map<String, Object>> convertedCollection = new ArrayList<>(); Set<String> keys = new HashSet<>(); for (Object o : collection) { Map<String, Object> m = convert ? objectToMap(options, o) : keysToString((Map<Object, Object>) o); convertedCollection.add(m); keys.addAll(m.keySet()); } List<String> _header; List<String> columnsIn = optionList(Printer.COLUMNS_IN, options); List<String> columnsOut = !options.containsKey("all") ? optionList(Printer.COLUMNS_OUT, options) : new ArrayList<>(); if (options.containsKey(Printer.COLUMNS)) { _header = (List<String>) options.get(Printer.COLUMNS); } else { _header = columnsIn; _header.addAll(keys.stream() .filter(k -> !columnsIn.contains(k) && !hasMatch(columnsOut, k)) .collect(Collectors.toList())); } List<String> header = new ArrayList<>(); List<Integer> columns = new ArrayList<>(); int headerWidth = 0; List<String> refKeys = new ArrayList<>(); for (String v : _header) { String value = v.split("\\.")[0]; if (!keys.contains(value) && !keys.contains(v)) { continue; } boolean addKey = false; for (Map<String, Object> m : convertedCollection) { Object val = mapValue(options, v, m); if (val != null) { addKey = simpleObject(val) || options.containsKey(Printer.COLUMNS) || options.containsKey(Printer.STRUCT_ON_TABLE); break; } } if (!addKey) { continue; } refKeys.add(value); header.add(v); String cn = columnName(v, options.containsKey(Printer.SHORT_NAMES)); columns.add(cn.length() + 1); headerWidth += cn.length() + 1; if (headerWidth > width) { break; } } if (header.size() == 0) { throw new Exception("No columns for table!"); } double mapSimilarity = ((BigDecimal) options.getOrDefault(Printer.MAP_SIMILARITY, new BigDecimal("0.8"))) .doubleValue(); int matchLimit = (int) Math.ceil(header.size() * mapSimilarity); for (Map<String, Object> m : convertedCollection) { if (!similarSets(refKeys, m.keySet(), matchLimit)) { throw new Exception("Not homogenous list!"); } for (int i = 0; i < header.size(); i++) { int cw = highlightMapValue(options, header.get(i), m) .columnLength(); if (cw > columns.get(i) - 1) { columns.set(i, cw + 1); } } } toTabStops(columns, collection.size(), rownum, columnSep); AttributedStringBuilder asb = new AttributedStringBuilder().tabs(columns); asb.style(prntStyle.resolve(".th")); int firstColumn = 0; if (rownum) { asb.append(addPadding("", columns.get(0) - columnSep.length() - 1)); asb.append(columnSep); asb.append("\t"); firstColumn = 1; } boolean first = true; for (String s : header) { if (!first) { asb.append(columnSep); } asb.append(columnName(s, options.containsKey(Printer.SHORT_NAMES))); asb.append("\t"); first = false; } asb.columnSubSequence(0, width).println(terminal()); int row = 0; for (Map<String, Object> m : convertedCollection) { AttributedStringBuilder asb2 = new AttributedStringBuilder().tabs(columns); if (doRowHighlight(row, tableRows)) { asb2.style(prntStyle.resolve(".rs")); } if (rownum) { asb2.styled( prntStyle.resolve(".rn"), addPadding(Integer.toString(row), columns.get(0) - columnSep.length() - 1)); asb2.append(columnSep); asb2.append("\t"); } row++; for (int i = 0; i < header.size(); i++) { if (i > 0) { asb2.append(columnSep); } AttributedString v = highlightMapValue(options, header.get(i), m); if (isNumber(v.toString())) { v = addPadding(v, cellWidth(firstColumn + i, columns, rownum, columnSep) - 1); } asb2.append(v); asb2.append("\t"); } asb2.columnSubSequence(0, width).println(terminal()); } } else if (collectionObject(elem) && !options.containsKey(Printer.TO_STRING)) { List<Integer> columns = new ArrayList<>(); for (Object o : collection) { List<Object> inner = objectToList(o); for (int i = 0; i < inner.size(); i++) { int len1 = objectToString(options, inner.get(i)) .length() + 1; if (columns.size() <= i) { columns.add(len1); } else if (len1 > columns.get(i)) { columns.set(i, len1); } } } toTabStops(columns, collection.size(), rownum, columnSep); int row = 0; int firstColumn = rownum ? 1 : 0; for (Object o : collection) { AttributedStringBuilder asb = new AttributedStringBuilder().tabs(columns); if (doRowHighlight(row, tableRows)) { asb.style(prntStyle.resolve(".rs")); } if (rownum) { asb.styled( prntStyle.resolve(".rn"), addPadding(Integer.toString(row), columns.get(0) - columnSep.length() - 1)); asb.append(columnSep); asb.append("\t"); } row++; List<Object> inner = objectToList(o); for (int i = 0; i < inner.size(); i++) { if (i > 0) { asb.append(columnSep); } AttributedString v = highlightValue(options, null, inner.get(i)); if (isNumber(v.toString())) { v = addPadding(v, cellWidth(firstColumn + i, columns, rownum, columnSep) - 1); } asb.append(v); asb.append("\t"); } asb.columnSubSequence(0, width).println(terminal()); } } else { highlightList(options, collection, width); } } catch (Exception e) { Log.debug("Stack: ", e); highlightList(options, collection, width); } } } else { highlightValue(options, null, objectToString(options, obj)).println(terminal()); } } else if (canConvert(obj) && !options.containsKey(Printer.TO_STRING)) { highlightMap(options, objectToMap(options, obj), width); } else { highlightValue(options, null, objectToString(options, obj)).println(terminal()); } if (message != null) { AttributedStringBuilder asb = new AttributedStringBuilder(); asb.styled(prntStyle.resolve(".em"), message); asb.println(terminal()); } if (runtimeException != null) { throw runtimeException; } }
[ "CWE-787" ]
CVE-2023-50572
MEDIUM
5.5
jline/jline3
highlightAndPrint
console/src/main/java/org/jline/console/impl/DefaultPrinter.java
f3c60a3e6255e8e0c20d5043a4fe248446f292bb
1
Analyze the following code function for security vulnerabilities
@Override public int getTaskForActivity(IBinder token, boolean onlyRoot) { synchronized(this) { return ActivityRecord.getTaskForActivityLocked(token, onlyRoot); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getTaskForActivity 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
getTaskForActivity
services/core/java/com/android/server/am/ActivityManagerService.java
962fb40991f15be4f688d960aa00073683ebdd20
0
Analyze the following code function for security vulnerabilities
public void clearUserRestriction(@NonNull ComponentName admin, @UserManager.UserRestrictionKey String key) { if (mService != null) { try { mService.setUserRestriction( admin, mContext.getPackageName(), key, false, mParentInstance); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: clearUserRestriction File: core/java/android/app/admin/DevicePolicyManager.java Repository: android The code follows secure coding practices.
[ "CWE-862" ]
CVE-2023-40089
HIGH
7.8
android
clearUserRestriction
core/java/android/app/admin/DevicePolicyManager.java
e2e05f488da6abc765a62e7faf10cb74e729732e
0
Analyze the following code function for security vulnerabilities
public String elementAsString(Properties outputProperties) throws TransformerException { StringWriter writer = new StringWriter(); toWriter(false, writer, outputProperties); return writer.toString(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: elementAsString 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
elementAsString
src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java
e6fddca201790abab4f2c274341c0bb8835c3e73
0
Analyze the following code function for security vulnerabilities
void setCacheStatus(SearchCacheStatusEnum theSearchCacheStatusEnum) { myCacheStatus = theSearchCacheStatusEnum; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setCacheStatus File: hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java Repository: hapifhir/hapi-fhir The code follows secure coding practices.
[ "CWE-400" ]
CVE-2021-32053
MEDIUM
5
hapifhir/hapi-fhir
setCacheStatus
hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java
a5e4f56e1c6f55093ff334cf698ffdeea2f33960
0
Analyze the following code function for security vulnerabilities
@Override public DynamicForm bindFromRequestData( Lang lang, TypedMap attrs, Map<String, String[]> requestData, Map<String, Http.MultipartFormData.FilePart<?>> requestFileData, String... allowedFields) { Map<String, String> data = new HashMap<>(); fillDataWith(data, requestData); return bind(lang, attrs, data, requestFileData, allowedFields); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: bindFromRequestData 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
bindFromRequestData
web/play-java-forms/src/main/java/play/data/DynamicForm.java
15393b736df939e35e275af2347155f296c684f2
0
Analyze the following code function for security vulnerabilities
public String formatDate(Date date) { return dateFormat.format(date); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: formatDate File: samples/client/petstore/java/resteasy/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
formatDate
samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/ApiClient.java
2c576483f26f85b3979c6948a131f585c237109a
0
Analyze the following code function for security vulnerabilities
@Override public ParceledListSlice<PhoneAccount> getAllPhoneAccounts() { synchronized (mLock) { try { Log.startSession("TSI.gAPA"); try { enforceModifyPermission( "getAllPhoneAccounts requires MODIFY_PHONE_STATE permission."); } catch (SecurityException e) { EventLog.writeEvent(0x534e4554, "62347125", Binder.getCallingUid(), "getAllPhoneAccounts"); throw e; } final UserHandle callingUserHandle = Binder.getCallingUserHandle(); long token = Binder.clearCallingIdentity(); try { return new ParceledListSlice<>(mPhoneAccountRegistrar .getAllPhoneAccounts(callingUserHandle)); } catch (Exception e) { Log.e(this, e, "getAllPhoneAccounts"); throw e; } finally { Binder.restoreCallingIdentity(token); } } finally { Log.endSession(); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getAllPhoneAccounts File: src/com/android/server/telecom/TelecomServiceImpl.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21394
MEDIUM
5.5
android
getAllPhoneAccounts
src/com/android/server/telecom/TelecomServiceImpl.java
68dca62035c49e14ad26a54f614199cb29a3393f
0
Analyze the following code function for security vulnerabilities
public int getMaximumBssLoadValue() { return mMaximumBssLoadValue; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getMaximumBssLoadValue File: framework/java/android/net/wifi/hotspot2/pps/Policy.java Repository: android The code follows secure coding practices.
[ "CWE-400" ]
CVE-2023-21240
MEDIUM
5.5
android
getMaximumBssLoadValue
framework/java/android/net/wifi/hotspot2/pps/Policy.java
69119d1d3102e27b6473c785125696881bce9563
0
Analyze the following code function for security vulnerabilities
@Override public void exitKeyguardSecurely(final IOnKeyguardExitResult callback) { if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DISABLE_KEYGUARD) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("Requires DISABLE_KEYGUARD permission"); } if (callback == null) { throw new IllegalArgumentException("callback == null"); } mPolicy.exitKeyguardSecurely(new WindowManagerPolicy.OnKeyguardExitResult() { @Override public void onKeyguardExitResult(boolean success) { try { callback.onKeyguardExitResult(success); } catch (RemoteException e) { // Client has died, we don't care. } } }); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: exitKeyguardSecurely 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
exitKeyguardSecurely
services/core/java/com/android/server/wm/WindowManagerService.java
69729fa8b13cadbf3173fe1f389fe4f3b7bd0f9c
0
Analyze the following code function for security vulnerabilities
@Override public HttpHeaders add(String name, Object value) { headers.addObject(name, value); return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: add 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
add
codec-http/src/main/java/io/netty/handler/codec/http/DefaultHttpHeaders.java
07aa6b5938a8b6ed7a6586e066400e2643897323
0
Analyze the following code function for security vulnerabilities
public void handleDownstream( final ChannelHandlerContext context, final ChannelEvent evt) throws Exception { if (evt instanceof ChannelStateEvent) { ChannelStateEvent e = (ChannelStateEvent) evt; switch (e.getState()) { case OPEN: case CONNECTED: case BOUND: if (Boolean.FALSE.equals(e.getValue()) || e.getValue() == null) { closeOutboundAndChannel(context, e); return; } } } if (!(evt instanceof MessageEvent)) { context.sendDownstream(evt); return; } MessageEvent e = (MessageEvent) evt; if (!(e.getMessage() instanceof ChannelBuffer)) { context.sendDownstream(evt); return; } // Do not encrypt the first write request if this handler is // created with startTLS flag turned on. if (startTls && SENT_FIRST_MESSAGE_UPDATER.compareAndSet(this, 0, 1)) { context.sendDownstream(evt); return; } // Otherwise, all messages are encrypted. ChannelBuffer msg = (ChannelBuffer) e.getMessage(); PendingWrite pendingWrite; if (msg.readable()) { pendingWrite = new PendingWrite(evt.getFuture(), msg.toByteBuffer(msg.readerIndex(), msg.readableBytes())); } else { pendingWrite = new PendingWrite(evt.getFuture(), null); } pendingUnencryptedWritesLock.lock(); try { pendingUnencryptedWrites.add(pendingWrite); } finally { pendingUnencryptedWritesLock.unlock(); } if (handshakeFuture == null || !handshakeFuture.isDone()) { writeBeforeHandshakeDone = true; } wrap(context, evt.getChannel()); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: handleDownstream File: src/main/java/org/jboss/netty/handler/ssl/SslHandler.java Repository: netty The code follows secure coding practices.
[ "CWE-119" ]
CVE-2014-3488
MEDIUM
5
netty
handleDownstream
src/main/java/org/jboss/netty/handler/ssl/SslHandler.java
2fa9400a59d0563a66908aba55c41e7285a04994
0
Analyze the following code function for security vulnerabilities
private void handleTrialConnectResult(Map<String, List<String>> requestHeader, ConnectTask connectTask, FileDownloadConnection connection) throws IOException, RetryDirectly, IllegalArgumentException { final int id = model.getId(); final int code = connection.getResponseCode(); acceptPartial = FileDownloadUtils.isAcceptRange(code, connection); final boolean onlyFromBeginning = (code == HttpURLConnection.HTTP_OK || code == HttpURLConnection.HTTP_CREATED || code == FileDownloadConnection.NO_RESPONSE_CODE); final String oldEtag = model.getETag(); String newEtag = FileDownloadUtils.findEtag(id, connection); // handle whether need retry because of etag is overdue boolean isPreconditionFailed = false; do { if (code == HttpURLConnection.HTTP_PRECON_FAILED) { isPreconditionFailed = true; break; } if (oldEtag != null && !oldEtag.equals(newEtag)) { // etag changed. if (onlyFromBeginning || acceptPartial) { // 200 or 206 isPreconditionFailed = true; break; } } if (code == HttpURLConnection.HTTP_CREATED && connectTask.isRangeNotFromBeginning()) { // The request has been fulfilled and has resulted in one or more new resources // being created. mark this case is precondition failed for // 1. checkout whether accept partial // 2. 201 means new resources so range must be from beginning otherwise it can't // match local range. isPreconditionFailed = true; break; } if (code == HTTP_REQUESTED_RANGE_NOT_SATISFIABLE) { if (model.getSoFar() > 0) { // On the first connection range not satisfiable, there must something wrong, // so have to retry. isPreconditionFailed = true; break; } else { // range is right, but get 416 if (!isNeedForceDiscardRange) { // if range is still added, but range is right with 416 response, so we // discard range on header and try again isNeedForceDiscardRange = true; isPreconditionFailed = true; } } } } while (false); if (isPreconditionFailed) { // the file on remote is changed if (isResumeAvailableOnDB) { FileDownloadLog.w(this, "there is precondition failed on this request[%d] " + "with old etag[%s]、new etag[%s]、response code is %d", id, oldEtag, newEtag, code); } database.removeConnections(model.getId()); FileDownloadUtils.deleteTaskFiles(model.getTargetFilePath(), model.getTempFilePath()); isResumeAvailableOnDB = false; if (oldEtag != null && oldEtag.equals(newEtag)) { FileDownloadLog.w(this, "the old etag[%s] is the same to the new etag[%s], " + "but the response status code is %d not Partial(206), so wo have" + " to start this task from very beginning for task[%d]!", oldEtag, newEtag, code, id); newEtag = null; } model.setSoFar(0); model.setTotal(0); model.setETag(newEtag); model.resetConnectionCount(); database.updateOldEtagOverdue(id, model.getETag(), model.getSoFar(), model.getTotal(), model.getConnectionCount()); // retry to check whether support partial or not. throw new RetryDirectly(); } redirectedUrl = connectTask.getFinalRedirectedUrl(); if (acceptPartial || onlyFromBeginning) { final long totalLength = FileDownloadUtils.findInstanceLengthForTrial(connection); // update model String fileName = null; if (model.isPathAsDirectory()) { // filename fileName = FileDownloadUtils.findFilename(connection, model.getUrl()); } isChunked = (totalLength == TOTAL_VALUE_IN_CHUNKED_RESOURCE); // callback statusCallback.onConnected(isResumeAvailableOnDB && acceptPartial, totalLength, newEtag, fileName); } else { throw new FileDownloadHttpException(code, requestHeader, connection.getResponseHeaderFields()); } }
Vulnerability Classification: - CWE: CWE-22 - CVE: CVE-2018-11248 - Severity: HIGH - CVSS Score: 7.5 Description: fix: fix directory traversal vulnerability security issue closes #1028 Function: handleTrialConnectResult File: library/src/main/java/com/liulishuo/filedownloader/download/DownloadLaunchRunnable.java Repository: lingochamp/FileDownloader Fixed Code: private void handleTrialConnectResult(Map<String, List<String>> requestHeader, ConnectTask connectTask, FileDownloadConnection connection) throws IOException, RetryDirectly, IllegalArgumentException, FileDownloadSecurityException { final int id = model.getId(); final int code = connection.getResponseCode(); acceptPartial = FileDownloadUtils.isAcceptRange(code, connection); final boolean onlyFromBeginning = (code == HttpURLConnection.HTTP_OK || code == HttpURLConnection.HTTP_CREATED || code == FileDownloadConnection.NO_RESPONSE_CODE); final String oldEtag = model.getETag(); String newEtag = FileDownloadUtils.findEtag(id, connection); // handle whether need retry because of etag is overdue boolean isPreconditionFailed = false; do { if (code == HttpURLConnection.HTTP_PRECON_FAILED) { isPreconditionFailed = true; break; } if (oldEtag != null && !oldEtag.equals(newEtag)) { // etag changed. if (onlyFromBeginning || acceptPartial) { // 200 or 206 isPreconditionFailed = true; break; } } if (code == HttpURLConnection.HTTP_CREATED && connectTask.isRangeNotFromBeginning()) { // The request has been fulfilled and has resulted in one or more new resources // being created. mark this case is precondition failed for // 1. checkout whether accept partial // 2. 201 means new resources so range must be from beginning otherwise it can't // match local range. isPreconditionFailed = true; break; } if (code == HTTP_REQUESTED_RANGE_NOT_SATISFIABLE) { if (model.getSoFar() > 0) { // On the first connection range not satisfiable, there must something wrong, // so have to retry. isPreconditionFailed = true; break; } else { // range is right, but get 416 if (!isNeedForceDiscardRange) { // if range is still added, but range is right with 416 response, so we // discard range on header and try again isNeedForceDiscardRange = true; isPreconditionFailed = true; } } } } while (false); if (isPreconditionFailed) { // the file on remote is changed if (isResumeAvailableOnDB) { FileDownloadLog.w(this, "there is precondition failed on this request[%d] " + "with old etag[%s]、new etag[%s]、response code is %d", id, oldEtag, newEtag, code); } database.removeConnections(model.getId()); FileDownloadUtils.deleteTaskFiles(model.getTargetFilePath(), model.getTempFilePath()); isResumeAvailableOnDB = false; if (oldEtag != null && oldEtag.equals(newEtag)) { FileDownloadLog.w(this, "the old etag[%s] is the same to the new etag[%s], " + "but the response status code is %d not Partial(206), so wo have" + " to start this task from very beginning for task[%d]!", oldEtag, newEtag, code, id); newEtag = null; } model.setSoFar(0); model.setTotal(0); model.setETag(newEtag); model.resetConnectionCount(); database.updateOldEtagOverdue(id, model.getETag(), model.getSoFar(), model.getTotal(), model.getConnectionCount()); // retry to check whether support partial or not. throw new RetryDirectly(); } redirectedUrl = connectTask.getFinalRedirectedUrl(); if (acceptPartial || onlyFromBeginning) { final long totalLength = FileDownloadUtils.findInstanceLengthForTrial(connection); // update model String fileName = null; if (model.isPathAsDirectory()) { // filename fileName = FileDownloadUtils.findFilename(connection, model.getUrl()); } isChunked = (totalLength == TOTAL_VALUE_IN_CHUNKED_RESOURCE); // callback statusCallback.onConnected(isResumeAvailableOnDB && acceptPartial, totalLength, newEtag, fileName); } else { throw new FileDownloadHttpException(code, requestHeader, connection.getResponseHeaderFields()); } }
[ "CWE-22" ]
CVE-2018-11248
HIGH
7.5
lingochamp/FileDownloader
handleTrialConnectResult
library/src/main/java/com/liulishuo/filedownloader/download/DownloadLaunchRunnable.java
b023cc081bbecdd2a9f3549a3ae5c12a9647ed7f
1
Analyze the following code function for security vulnerabilities
private UserReferenceResolver<CurrentUserReference> getCurrentUserReferenceResolver() { return Utils.getComponent(new DefaultParameterizedType(null, UserReferenceResolver.class, CurrentUserReference.class)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getCurrentUserReferenceResolver File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/Document.java Repository: xwiki/xwiki-platform The code follows secure coding practices.
[ "CWE-648" ]
CVE-2023-29507
HIGH
7.2
xwiki/xwiki-platform
getCurrentUserReferenceResolver
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/Document.java
905cdd7c421dbf8c565557cdc773ab1aa9028f83
0
Analyze the following code function for security vulnerabilities
public int getPort() { return port; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getPort File: vaadin-dev-server/src/main/java/com/vaadin/base/devserver/DevModeHandlerImpl.java Repository: vaadin/flow The code follows secure coding practices.
[ "CWE-172" ]
CVE-2021-33604
LOW
1.2
vaadin/flow
getPort
vaadin-dev-server/src/main/java/com/vaadin/base/devserver/DevModeHandlerImpl.java
2a801c42b406a00c44f4a85b4b4e4a4c5bf89adc
0
Analyze the following code function for security vulnerabilities
@Override public boolean isCallingUserAffiliated() { if (!mHasFeature) { return false; } synchronized (getLockObject()) { return isUserAffiliatedWithDeviceLocked(mInjector.userHandleGetCallingUserId()); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isCallingUserAffiliated 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
isCallingUserAffiliated
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
ed3f25b7222d4cff471f2b7d22d1150348146957
0
Analyze the following code function for security vulnerabilities
public List<?> getByXPath(final String xpathExpr, final PrefixResolver resolver) { return XPathHelper.getByXPath(this, xpathExpr, resolver); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getByXPath File: src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java Repository: HtmlUnit/htmlunit The code follows secure coding practices.
[ "CWE-787" ]
CVE-2023-2798
HIGH
7.5
HtmlUnit/htmlunit
getByXPath
src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java
940dc7fd
0
Analyze the following code function for security vulnerabilities
private List<FileEntry> sortFiles(List<FileEntry> files, SortBy sortBy, boolean desc) { Comparator<FileEntry> comparator = null; switch (sortBy) { case FILENAME: comparator = (a, b) -> a.getFilename().compareTo(b.getFilename()); break; case SIZE: comparator = (a, b) -> Long.compare(a.getSize(), b.getSize()); break; case MODIFIED: comparator = (a, b) -> Long.compare(a.getModified().toMillis(), b.getModified().toMillis()); break; } List<FileEntry> sortedFiles = files.stream().sorted(comparator).collect(toList()); if (desc) { Collections.reverse(sortedFiles); } return sortedFiles; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: sortFiles File: lib/src/main/java/eu/hinsch/spring/boot/actuator/logview/LogViewEndpoint.java Repository: lukashinsch/spring-boot-actuator-logview The code follows secure coding practices.
[ "CWE-22" ]
CVE-2021-21234
MEDIUM
4
lukashinsch/spring-boot-actuator-logview
sortFiles
lib/src/main/java/eu/hinsch/spring/boot/actuator/logview/LogViewEndpoint.java
760acbb939a8d1f7d1a7dfcd51ca848eea04e772
0
Analyze the following code function for security vulnerabilities
private void handleRstStream(int streamId) { StreamHolder holder = currentStreams.remove(streamId); if(holder != null) { if(streamId % 2 == (isClient() ? 1 : 0)) { sendConcurrentStreamsAtomicUpdater.getAndDecrement(this); } else { receiveConcurrentStreamsAtomicUpdater.getAndDecrement(this); } if (holder.sinkChannel != null) { holder.sinkChannel.rstStream(); } if (holder.sourceChannel != null) { holder.sourceChannel.rstStream(); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: handleRstStream File: core/src/main/java/io/undertow/protocols/http2/Http2Channel.java Repository: undertow-io/undertow The code follows secure coding practices.
[ "CWE-214" ]
CVE-2021-3859
HIGH
7.5
undertow-io/undertow
handleRstStream
core/src/main/java/io/undertow/protocols/http2/Http2Channel.java
e43f0ada3f4da6e8579e0020cec3cb1a81e487c2
0
Analyze the following code function for security vulnerabilities
private int getDeviceOwnerUserIdUncheckedLocked() { return mOwners.hasDeviceOwner() ? mOwners.getDeviceOwnerUserId() : UserHandle.USER_NULL; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getDeviceOwnerUserIdUncheckedLocked 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
getDeviceOwnerUserIdUncheckedLocked
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
ed3f25b7222d4cff471f2b7d22d1150348146957
0
Analyze the following code function for security vulnerabilities
protected void setAreThereNotifications() { if (SPEW) { final boolean clearable = hasActiveNotifications() && hasActiveClearableNotifications(); Log.d(TAG, "setAreThereNotifications: N=" + mNotificationData.getActiveNotifications().size() + " any=" + hasActiveNotifications() + " clearable=" + clearable); } if (mStatusBarView != null) { final View nlo = mStatusBarView.findViewById(R.id.notification_lights_out); final boolean showDot = hasActiveNotifications() && !areLightsOn(); if (showDot != (nlo.getAlpha() == 1.0f)) { if (showDot) { nlo.setAlpha(0f); nlo.setVisibility(View.VISIBLE); } nlo.animate() .alpha(showDot ? 1 : 0) .setDuration(showDot ? 750 : 250) .setInterpolator(new AccelerateInterpolator(2.0f)) .setListener(showDot ? null : new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator _a) { nlo.setVisibility(View.GONE); } }) .start(); } } findAndUpdateMediaNotifications(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setAreThereNotifications File: packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2017-0822
HIGH
7.5
android
setAreThereNotifications
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
c574568aaede7f652432deb7707f20ae54bbdf9a
0
Analyze the following code function for security vulnerabilities
public Document getDocument(DocumentReference reference) throws XWikiException { try { XWikiDocument doc = this.xwiki.getDocument(reference, getXWikiContext()); if (this.xwiki.getRightService().hasAccessLevel("view", getXWikiContext().getUser(), doc.getPrefixedFullName(), getXWikiContext()) == false) { return null; } return doc.newDocument(getXWikiContext()); } catch (Exception ex) { LOGGER.warn("Failed to access document [{}]. Root reason: [{}]", reference, ExceptionUtils.getRootCauseMessage(ex)); return new Document(new XWikiDocument(reference), getXWikiContext()); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getDocument File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/XWiki.java Repository: xwiki/xwiki-platform The code follows secure coding practices.
[ "CWE-668" ]
CVE-2023-37911
MEDIUM
6.5
xwiki/xwiki-platform
getDocument
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/XWiki.java
f471f2a392aeeb9e51d59fdfe1d76fccf532523f
0
Analyze the following code function for security vulnerabilities
@SuppressWarnings("deprecation") private static void mapConfigXmlGenerator(XmlGenerator gen, Config config) { Collection<MapConfig> mapConfigs = config.getMapConfigs().values(); for (MapConfig m : mapConfigs) { String cacheDeserializedVal = m.getCacheDeserializedValues() != null ? m.getCacheDeserializedValues().name().replaceAll("_", "-") : null; MergePolicyConfig mergePolicyConfig = m.getMergePolicyConfig(); gen.open("map", "name", m.getName()) .node("in-memory-format", m.getInMemoryFormat()) .node("statistics-enabled", m.isStatisticsEnabled()) .node("optimize-queries", m.isOptimizeQueries()) .node("cache-deserialized-values", cacheDeserializedVal) .node("backup-count", m.getBackupCount()) .node("async-backup-count", m.getAsyncBackupCount()) .node("time-to-live-seconds", m.getTimeToLiveSeconds()) .node("max-idle-seconds", m.getMaxIdleSeconds()) .node("eviction-policy", m.getEvictionPolicy()) .node("max-size", m.getMaxSizeConfig().getSize(), "policy", m.getMaxSizeConfig().getMaxSizePolicy()) .node("eviction-percentage", m.getEvictionPercentage()) .node("min-eviction-check-millis", m.getMinEvictionCheckMillis()) .node("merge-policy", mergePolicyConfig.getPolicy(), "batch-size", mergePolicyConfig.getBatchSize()) .node("quorum-ref", m.getQuorumName()) .node("read-backup-data", m.isReadBackupData()); appendHotRestartConfig(gen, m.getHotRestartConfig()); mapStoreConfigXmlGenerator(gen, m); mapNearCacheConfigXmlGenerator(gen, m.getNearCacheConfig()); wanReplicationConfigXmlGenerator(gen, m.getWanReplicationRef()); mapIndexConfigXmlGenerator(gen, m); mapAttributeConfigXmlGenerator(gen, m); entryListenerConfigXmlGenerator(gen, m); mapPartitionLostListenerConfigXmlGenerator(gen, m); mapPartitionStrategyConfigXmlGenerator(gen, m); mapQueryCachesConfigXmlGenerator(gen, m); gen.close(); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: mapConfigXmlGenerator File: hazelcast/src/main/java/com/hazelcast/config/ConfigXmlGenerator.java Repository: hazelcast The code follows secure coding practices.
[ "CWE-502" ]
CVE-2016-10750
MEDIUM
6.8
hazelcast
mapConfigXmlGenerator
hazelcast/src/main/java/com/hazelcast/config/ConfigXmlGenerator.java
c1c31359a1df953e79a9ca9b6c54b3cdbfef11e9
0
Analyze the following code function for security vulnerabilities
public XWikiAttachment setAttachment(String fileName, InputStream content, XWikiContext context) throws IOException { int i = fileName.indexOf('\\'); if (i == -1) { i = fileName.indexOf('/'); } String filename = fileName.substring(i + 1); XWikiAttachment attachment = getExactAttachment(filename); if (attachment == null) { attachment = new XWikiAttachment(this, filename); // Add the attachment in the current doc setAttachment(attachment); } attachment.setContent(content); attachment.setAuthorReference(context.getUserReference()); return attachment; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setAttachment 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-74" ]
CVE-2023-29523
HIGH
8.8
xwiki/xwiki-platform
setAttachment
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
0d547181389f7941e53291af940966413823f61c
0
Analyze the following code function for security vulnerabilities
void orientationChangeTimedOut() { mOrientationChangeTimedOut = true; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: orientationChangeTimedOut 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
orientationChangeTimedOut
services/core/java/com/android/server/wm/WindowState.java
7428962d3b064ce1122809d87af65099d1129c9e
0
Analyze the following code function for security vulnerabilities
public boolean outboundBundleCompletion(final String space, final String place, final String bundleId, final boolean itWorked) { final String placeUrl = KeyManipulator.getServiceHostURL(space); final HttpPost method = createHttpPost(placeUrl, CONTEXT, "/WorkBundleCompleted.action"); final List<NameValuePair> nvps = new ArrayList<NameValuePair>(); nvps.add(new BasicNameValuePair(CLIENT_NAME, place)); nvps.add(new BasicNameValuePair(SPACE_NAME, space)); nvps.add(new BasicNameValuePair(WORK_BUNDLE_ID, bundleId)); nvps.add(new BasicNameValuePair(WORK_BUNDLE_STATUS, Boolean.toString(itWorked))); method.setEntity(new UrlEncodedFormEntity(nvps, java.nio.charset.Charset.defaultCharset())); final EmissaryResponse status = send(method); // TODO Look at putting this method in the EmissaryResponse return (status.getStatus() == HttpStatus.SC_OK); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: outboundBundleCompletion File: src/main/java/emissary/server/mvc/adapters/WorkSpaceAdapter.java Repository: NationalSecurityAgency/emissary The code follows secure coding practices.
[ "CWE-502" ]
CVE-2021-32634
MEDIUM
6.5
NationalSecurityAgency/emissary
outboundBundleCompletion
src/main/java/emissary/server/mvc/adapters/WorkSpaceAdapter.java
40260b1ec1f76cc92361702cc14fa1e4388e19d7
0
Analyze the following code function for security vulnerabilities
public String buildLockConfirmationMessageJS() { StringBuffer html = new StringBuffer(512); html.append("<script type='text/javascript'><!--\n"); html.append("function setConfirmationMessage(locks, blockinglocks) {\n"); html.append("\tvar confMsg = document.getElementById('conf-msg');\n"); html.append("\tif (locks > -1) {\n"); html.append("\t\tif (blockinglocks > '0') {\n"); html.append("\t\t\tshowAjaxReportContent();\n"); html.append("\t\t\tdocument.getElementById('lock-body-id').className = '';\n"); html.append("\t\t\tdocument.getElementById('butClose').className = '';\n"); html.append("\t\t\tdocument.getElementById('butContinue').className = 'hide';\n"); html.append("\t\t\tconfMsg.innerHTML = '"); html.append(key(org.opencms.workplace.commons.Messages.GUI_OPERATION_BLOCKING_LOCKS_0)); html.append("';\n"); html.append("\t\t} else {\n"); html.append("\t\t\tsubmitAction('"); html.append(CmsDialog.DIALOG_OK); html.append("', null, 'main');\n"); html.append("\t\t\tdocument.forms['main'].submit();\n"); html.append("\t\t}\n"); html.append("\t} else {\n"); html.append("\t\tdocument.getElementById('butClose').className = '';\n"); html.append("\t\tdocument.getElementById('butContinue').className = 'hide';\n"); html.append("\t\tconfMsg.innerHTML = '"); html.append(key(Messages.GUI_AJAX_REPORT_WAIT_0)); html.append("';\n"); html.append("\t}\n"); html.append("}\n"); html.append("// -->\n"); html.append("</script>\n"); return html.toString(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: buildLockConfirmationMessageJS File: src/org/opencms/workplace/CmsDialog.java Repository: alkacon/opencms-core The code follows secure coding practices.
[ "CWE-79" ]
CVE-2013-4600
MEDIUM
4.3
alkacon/opencms-core
buildLockConfirmationMessageJS
src/org/opencms/workplace/CmsDialog.java
72a05e3ea1cf692e2efce002687272e63f98c14a
0
Analyze the following code function for security vulnerabilities
@Override public void navigationEntryCommitted() { if (getNativePage() != null) { pushNativePageStateToNavigationEntry(); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: navigationEntryCommitted 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
navigationEntryCommitted
chrome/android/java/src/org/chromium/chrome/browser/Tab.java
98a50b76141f0b14f292f49ce376e6554142d5e2
0
Analyze the following code function for security vulnerabilities
@Override public String render(XWikiContext context) throws XWikiException { XWikiRequest request = context.getRequest(); String content = request.getParameter("content"); XWikiDocument doc = context.getDoc(); XWikiForm form = context.getForm(); synchronized (doc) { XWikiDocument tdoc = (XWikiDocument) context.get("tdoc"); EditForm peform = (EditForm) form; String parent = peform.getParent(); if (parent != null) { doc.setParent(parent); } String creator = peform.getCreator(); if (creator != null) { doc.setCreator(creator); } String defaultTemplate = peform.getDefaultTemplate(); if (defaultTemplate != null) { doc.setDefaultTemplate(defaultTemplate); } String defaultLanguage = peform.getDefaultLanguage(); if ((defaultLanguage != null) && !defaultLanguage.equals("")) { doc.setDefaultLanguage(defaultLanguage); } if (doc.getDefaultLanguage().equals("")) { doc.setDefaultLanguage(context.getWiki().getLanguagePreference(context)); } String language = context.getWiki().getLanguagePreference(context); String languagefromrequest = context.getRequest().getParameter("language"); String languagetoedit = ((languagefromrequest == null) || (languagefromrequest.equals(""))) ? language : languagefromrequest; if ((languagetoedit == null) || (languagetoedit.equals("default"))) { languagetoedit = ""; } if (doc.isNew() || (doc.getDefaultLanguage().equals(languagetoedit))) { languagetoedit = ""; } if (languagetoedit.equals("")) { // In this case the created document is going to be the default document tdoc = doc; context.put("tdoc", doc); if (doc.isNew()) { doc.setDefaultLanguage(language); doc.setLanguage(""); } } else { // If the translated doc object is the same as the doc object // this means the translated doc did not exists so we need to create it if ((tdoc == doc)) { tdoc = new XWikiDocument(doc.getDocumentReference()); tdoc.setLanguage(languagetoedit); tdoc.setContent(doc.getContent()); tdoc.setSyntax(doc.getSyntax()); tdoc.setAuthor(context.getUser()); tdoc.setStore(doc.getStore()); context.put("tdoc", tdoc); } } XWikiDocument tdoc2 = tdoc.clone(); if (content != null && !content.isEmpty()) { tdoc2.setContent(content); } context.put("tdoc", tdoc2); try { tdoc2.readFromTemplate(peform, context); } catch (XWikiException e) { if (e.getCode() == XWikiException.ERROR_XWIKI_APP_DOCUMENT_NOT_EMPTY) { context.put("exception", e); return "docalreadyexists"; } } /* Setup a lock */ try { XWikiLock lock = tdoc.getLock(context); if ((lock == null) || (lock.getUserName().equals(context.getUser())) || (peform.isLockForce())) { tdoc.setLock(context.getUser(), context); } } catch (Exception e) { // Lock should never make XWiki fail // But we should log any related information LOGGER.error("Exception while setting up lock", e); } } return "admin"; }
Vulnerability Classification: - CWE: CWE-862 - CVE: CVE-2022-23617 - Severity: MEDIUM - CVSS Score: 4.0 Description: XWIKI-18430: Page content is revealed to users that don't have rights if used as a template for the creation of another page Function: render File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/AdminAction.java Repository: xwiki/xwiki-platform Fixed Code: @Override public String render(XWikiContext context) throws XWikiException { XWikiRequest request = context.getRequest(); String content = request.getParameter("content"); XWikiDocument doc = context.getDoc(); XWikiForm form = context.getForm(); synchronized (doc) { XWikiDocument tdoc = (XWikiDocument) context.get("tdoc"); EditForm peform = (EditForm) form; String parent = peform.getParent(); if (parent != null) { doc.setParent(parent); } String creator = peform.getCreator(); if (creator != null) { doc.setCreator(creator); } String defaultTemplate = peform.getDefaultTemplate(); if (defaultTemplate != null) { doc.setDefaultTemplate(defaultTemplate); } String defaultLanguage = peform.getDefaultLanguage(); if ((defaultLanguage != null) && !defaultLanguage.equals("")) { doc.setDefaultLanguage(defaultLanguage); } if (doc.getDefaultLanguage().equals("")) { doc.setDefaultLanguage(context.getWiki().getLanguagePreference(context)); } String language = context.getWiki().getLanguagePreference(context); String languagefromrequest = context.getRequest().getParameter("language"); String languagetoedit = ((languagefromrequest == null) || (languagefromrequest.equals(""))) ? language : languagefromrequest; if ((languagetoedit == null) || (languagetoedit.equals("default"))) { languagetoedit = ""; } if (doc.isNew() || (doc.getDefaultLanguage().equals(languagetoedit))) { languagetoedit = ""; } if (languagetoedit.equals("")) { // In this case the created document is going to be the default document tdoc = doc; context.put("tdoc", doc); if (doc.isNew()) { doc.setDefaultLanguage(language); doc.setLanguage(""); } } else { // If the translated doc object is the same as the doc object // this means the translated doc did not exists so we need to create it if ((tdoc == doc)) { tdoc = new XWikiDocument(doc.getDocumentReference()); tdoc.setLanguage(languagetoedit); tdoc.setContent(doc.getContent()); tdoc.setSyntax(doc.getSyntax()); tdoc.setAuthor(context.getUser()); tdoc.setStore(doc.getStore()); context.put("tdoc", tdoc); } } XWikiDocument tdoc2 = tdoc.clone(); if (content != null && !content.isEmpty()) { tdoc2.setContent(content); } context.put("tdoc", tdoc2); try { readFromTemplate(tdoc2, peform.getTemplate(), context); } catch (XWikiException e) { if (e.getCode() == XWikiException.ERROR_XWIKI_APP_DOCUMENT_NOT_EMPTY) { context.put("exception", e); return "docalreadyexists"; } } /* Setup a lock */ try { XWikiLock lock = tdoc.getLock(context); if ((lock == null) || (lock.getUserName().equals(context.getUser())) || (peform.isLockForce())) { tdoc.setLock(context.getUser(), context); } } catch (Exception e) { // Lock should never make XWiki fail // But we should log any related information LOGGER.error("Exception while setting up lock", e); } } return "admin"; }
[ "CWE-862" ]
CVE-2022-23617
MEDIUM
4
xwiki/xwiki-platform
render
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/AdminAction.java
30c52b01559b8ef5ed1035dac7c34aaf805764d5
1
Analyze the following code function for security vulnerabilities
@Override public void onCameraLaunchGestureDetected(int source) { mLastCameraLaunchSource = source; if (mStartedGoingToSleep) { mLaunchCameraOnFinishedGoingToSleep = true; return; } if (!mNotificationPanel.canCameraGestureBeLaunched( mStatusBarKeyguardViewManager.isShowing() && mExpandedVisible)) { return; } if (!mDeviceInteractive) { PowerManager pm = mContext.getSystemService(PowerManager.class); pm.wakeUp(SystemClock.uptimeMillis(), "com.android.systemui:CAMERA_GESTURE"); mStatusBarKeyguardViewManager.notifyDeviceWakeUpRequested(); } vibrateForCameraGesture(); if (!mStatusBarKeyguardViewManager.isShowing()) { startActivity(KeyguardBottomAreaView.INSECURE_CAMERA_INTENT, true /* dismissShade */); } else { if (!mDeviceInteractive) { // Avoid flickering of the scrim when we instant launch the camera and the bouncer // comes on. mScrimController.dontAnimateBouncerChangesUntilNextFrame(); mGestureWakeLock.acquire(LAUNCH_TRANSITION_TIMEOUT_MS + 1000L); } if (mScreenTurningOn || mStatusBarKeyguardViewManager.isScreenTurnedOn()) { mNotificationPanel.launchCamera(mDeviceInteractive /* animate */, source); } else { // We need to defer the camera launch until the screen comes on, since otherwise // we will dismiss us too early since we are waiting on an activity to be drawn and // incorrectly get notified because of the screen on event (which resumes and pauses // some activities) mLaunchCameraOnScreenTurningOn = true; } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onCameraLaunchGestureDetected File: packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2017-0822
HIGH
7.5
android
onCameraLaunchGestureDetected
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
c574568aaede7f652432deb7707f20ae54bbdf9a
0
Analyze the following code function for security vulnerabilities
private void dumpInternal(PrintWriter pw) { synchronized (mQueueLock) { pw.println("Backup Manager is " + (mEnabled ? "enabled" : "disabled") + " / " + (!mProvisioned ? "not " : "") + "provisioned / " + (this.mPendingInits.size() == 0 ? "not " : "") + "pending init"); pw.println("Auto-restore is " + (mAutoRestore ? "enabled" : "disabled")); if (mBackupRunning) pw.println("Backup currently running"); pw.println("Last backup pass started: " + mLastBackupPass + " (now = " + System.currentTimeMillis() + ')'); pw.println(" next scheduled: " + KeyValueBackupJob.nextScheduled()); pw.println("Available transports:"); final String[] transports = listAllTransports(); if (transports != null) { for (String t : listAllTransports()) { pw.println((t.equals(mCurrentTransport) ? " * " : " ") + t); try { IBackupTransport transport = getTransport(t); File dir = new File(mBaseStateDir, transport.transportDirName()); pw.println(" destination: " + transport.currentDestinationString()); pw.println(" intent: " + transport.configurationIntent()); for (File f : dir.listFiles()) { pw.println(" " + f.getName() + " - " + f.length() + " state bytes"); } } catch (Exception e) { Slog.e(TAG, "Error in transport", e); pw.println(" Error: " + e); } } } pw.println("Pending init: " + mPendingInits.size()); for (String s : mPendingInits) { pw.println(" " + s); } if (DEBUG_BACKUP_TRACE) { synchronized (mBackupTrace) { if (!mBackupTrace.isEmpty()) { pw.println("Most recent backup trace:"); for (String s : mBackupTrace) { pw.println(" " + s); } } } } pw.print("Ancestral: "); pw.println(Long.toHexString(mAncestralToken)); pw.print("Current: "); pw.println(Long.toHexString(mCurrentToken)); int N = mBackupParticipants.size(); pw.println("Participants:"); for (int i=0; i<N; i++) { int uid = mBackupParticipants.keyAt(i); pw.print(" uid: "); pw.println(uid); HashSet<String> participants = mBackupParticipants.valueAt(i); for (String app: participants) { pw.println(" " + app); } } pw.println("Ancestral packages: " + (mAncestralPackages == null ? "none" : mAncestralPackages.size())); if (mAncestralPackages != null) { for (String pkg : mAncestralPackages) { pw.println(" " + pkg); } } pw.println("Ever backed up: " + mEverStoredApps.size()); for (String pkg : mEverStoredApps) { pw.println(" " + pkg); } pw.println("Pending key/value backup: " + mPendingBackups.size()); for (BackupRequest req : mPendingBackups.values()) { pw.println(" " + req); } pw.println("Full backup queue:" + mFullBackupQueue.size()); for (FullBackupEntry entry : mFullBackupQueue) { pw.print(" "); pw.print(entry.lastBackup); pw.print(" : "); pw.println(entry.packageName); } } }
Vulnerability Classification: - CWE: CWE-200 - CVE: CVE-2016-3759 - Severity: MEDIUM - CVSS Score: 5.0 Description: Backport of backup transport whitelist Sysconfig define a whitelist of permitted backup transports Previously any apk bundled in priv-app could insert a backup transport. Reduce risk surface by giving the OEM explicit control over who is allowed to handle backup data. Bug 28406080 Backport of 494df791728f4d42d67e935c327910975993ad29 from N Change-Id: I9f90e324169a68720d608f74754d284a7e59cf87 Function: dumpInternal File: services/backup/java/com/android/server/backup/BackupManagerService.java Repository: android Fixed Code: private void dumpInternal(PrintWriter pw) { synchronized (mQueueLock) { pw.println("Backup Manager is " + (mEnabled ? "enabled" : "disabled") + " / " + (!mProvisioned ? "not " : "") + "provisioned / " + (this.mPendingInits.size() == 0 ? "not " : "") + "pending init"); pw.println("Auto-restore is " + (mAutoRestore ? "enabled" : "disabled")); if (mBackupRunning) pw.println("Backup currently running"); pw.println("Last backup pass started: " + mLastBackupPass + " (now = " + System.currentTimeMillis() + ')'); pw.println(" next scheduled: " + KeyValueBackupJob.nextScheduled()); pw.println("Transport whitelist:"); for (ComponentName transport : mTransportWhitelist) { pw.print(" "); pw.println(transport.flattenToShortString()); } pw.println("Available transports:"); final String[] transports = listAllTransports(); if (transports != null) { for (String t : listAllTransports()) { pw.println((t.equals(mCurrentTransport) ? " * " : " ") + t); try { IBackupTransport transport = getTransport(t); File dir = new File(mBaseStateDir, transport.transportDirName()); pw.println(" destination: " + transport.currentDestinationString()); pw.println(" intent: " + transport.configurationIntent()); for (File f : dir.listFiles()) { pw.println(" " + f.getName() + " - " + f.length() + " state bytes"); } } catch (Exception e) { Slog.e(TAG, "Error in transport", e); pw.println(" Error: " + e); } } } pw.println("Pending init: " + mPendingInits.size()); for (String s : mPendingInits) { pw.println(" " + s); } if (DEBUG_BACKUP_TRACE) { synchronized (mBackupTrace) { if (!mBackupTrace.isEmpty()) { pw.println("Most recent backup trace:"); for (String s : mBackupTrace) { pw.println(" " + s); } } } } pw.print("Ancestral: "); pw.println(Long.toHexString(mAncestralToken)); pw.print("Current: "); pw.println(Long.toHexString(mCurrentToken)); int N = mBackupParticipants.size(); pw.println("Participants:"); for (int i=0; i<N; i++) { int uid = mBackupParticipants.keyAt(i); pw.print(" uid: "); pw.println(uid); HashSet<String> participants = mBackupParticipants.valueAt(i); for (String app: participants) { pw.println(" " + app); } } pw.println("Ancestral packages: " + (mAncestralPackages == null ? "none" : mAncestralPackages.size())); if (mAncestralPackages != null) { for (String pkg : mAncestralPackages) { pw.println(" " + pkg); } } pw.println("Ever backed up: " + mEverStoredApps.size()); for (String pkg : mEverStoredApps) { pw.println(" " + pkg); } pw.println("Pending key/value backup: " + mPendingBackups.size()); for (BackupRequest req : mPendingBackups.values()) { pw.println(" " + req); } pw.println("Full backup queue:" + mFullBackupQueue.size()); for (FullBackupEntry entry : mFullBackupQueue) { pw.print(" "); pw.print(entry.lastBackup); pw.print(" : "); pw.println(entry.packageName); } } }
[ "CWE-200" ]
CVE-2016-3759
MEDIUM
5
android
dumpInternal
services/backup/java/com/android/server/backup/BackupManagerService.java
9b8c6d2df35455ce9e67907edded1e4a2ecb9e28
1
Analyze the following code function for security vulnerabilities
public boolean isHidable() { return getState(false).hidable; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isHidable 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
isHidable
server/src/main/java/com/vaadin/ui/Grid.java
c40bed109c3723b38694ed160ea647fef5b28593
0
Analyze the following code function for security vulnerabilities
private SettingsState getSystemSettingsLocked(int userId) { return getSettingsLocked(SETTINGS_TYPE_SYSTEM, userId); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getSystemSettingsLocked File: packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-3876
HIGH
7.2
android
getSystemSettingsLocked
packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
91fc934bb2e5ea59929bb2f574de6db9b5100745
0
Analyze the following code function for security vulnerabilities
public abstract boolean isStandalone(VaadinRequest request);
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isStandalone 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
isStandalone
server/src/main/java/com/vaadin/server/VaadinService.java
d852126ab6f0c43f937239305bd0e9594834fe34
0
Analyze the following code function for security vulnerabilities
public int getEventType() throws XmlPullParserException { return mEventType; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getEventType File: core/java/android/content/res/XmlBlock.java Repository: android The code follows secure coding practices.
[ "CWE-415" ]
CVE-2023-40103
HIGH
7.8
android
getEventType
core/java/android/content/res/XmlBlock.java
c3bc12c484ef3bbca4cec19234437c45af5e584d
0