instruction
string
input
string
output
string
cwe_ids
list
cve_id
string
severity
string
cvss_score
float64
repo_name
string
func_name
string
file_path
string
commit_hash
string
is_vulnerable
int64
Analyze the following code function for security vulnerabilities
private void validateApplicationConfigurations(ServiceProvider application, String tenantDomain, String username) throws IdentityApplicationManagementException { try { applicationValidatorManager.validateSPConfigurations(application, tenantDomain, username); } catch (IdentityApplicationManagementValidationException e) { String message = "Invalid application configuration for application: '" + application.getApplicationName() + "' of tenantDomain: " + tenantDomain + "."; String errorCode = INVALID_REQUEST.getCode(); throw new IdentityApplicationManagementValidationException(errorCode, message, e.getValidationMsg()); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: validateApplicationConfigurations 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
validateApplicationConfigurations
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
@Override public <T> T lookup(Class<T> serviceClass) { ServiceReference<T> reference = getWebAppBundle().getBundleContext() .getServiceReference(serviceClass); if (reference == null) { LoggerFactory.getLogger(OsgiLookupImpl.class) .debug("No service found for '{}' SPI", serviceClass); return null; } return getWebAppBundle().getBundleContext().getService(reference); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: lookup File: flow-osgi/src/main/java/com/vaadin/flow/osgi/support/AppConfigFactoryTracker.java Repository: vaadin/osgi The code follows secure coding practices.
[ "CWE-668" ]
CVE-2021-31407
MEDIUM
5
vaadin/osgi
lookup
flow-osgi/src/main/java/com/vaadin/flow/osgi/support/AppConfigFactoryTracker.java
3e17674c2e3f88b6e682872c42b7d0ad7d9c4ad8
0
Analyze the following code function for security vulnerabilities
@Override protected void onAttachedToWindow() { super.onAttachedToWindow(); if (mNavigationButton != null) mNavigationButton.addOnLayoutChangeListener(this); if (mUrlBar != null) mUrlBar.addOnLayoutChangeListener(this); if (mLocationBar != null) { mLocationBar.getContainerView().addOnLayoutChangeListener(this); } getRootView().addOnLayoutChangeListener(this); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onAttachedToWindow File: chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java Repository: chromium The code follows secure coding practices.
[ "CWE-254" ]
CVE-2016-5163
MEDIUM
4.3
chromium
onAttachedToWindow
chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java
3bd33fee094e863e5496ac24714c558bd58d28ef
0
Analyze the following code function for security vulnerabilities
@Deprecated public boolean getValidation() { return isValidating(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getValidation File: core/src/java/org/jdom2/input/SAXBuilder.java Repository: hunterhacker/jdom The code follows secure coding practices.
[ "CWE-611" ]
CVE-2021-33813
MEDIUM
5
hunterhacker/jdom
getValidation
core/src/java/org/jdom2/input/SAXBuilder.java
bd3ab78370098491911d7fe9d7a43b97144a234e
0
Analyze the following code function for security vulnerabilities
public static void downloadFile(Activity activity, Message message) { ConversationFragment fragment = findConversationFragment(activity); if (fragment != null) { fragment.startDownloadable(message); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: downloadFile File: src/main/java/eu/siacs/conversations/ui/ConversationFragment.java Repository: iNPUTmice/Conversations The code follows secure coding practices.
[ "CWE-200" ]
CVE-2018-18467
MEDIUM
5
iNPUTmice/Conversations
downloadFile
src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
7177c523a1b31988666b9337249a4f1d0c36f479
0
Analyze the following code function for security vulnerabilities
@Override public boolean onPreferenceClick(Preference pref) { if (pref == mMePreference) { if (mUserCaps.mIsGuest) { showDialog(DIALOG_CONFIRM_EXIT_GUEST); return true; } // If this is a limited user, launch the user info settings instead of profile editor if (mUserManager.isLinkedUser()) { onManageUserClicked(UserHandle.myUserId(), false); } else { showDialog(DIALOG_USER_PROFILE_EDITOR); } } else if (pref instanceof UserPreference) { int userId = ((UserPreference) pref).getUserId(); // Get the latest status of the user UserInfo user = mUserManager.getUserInfo(userId); if (!isInitialized(user)) { mHandler.sendMessage(mHandler.obtainMessage( MESSAGE_SETUP_USER, user.id, user.serialNumber)); } } else if (pref == mAddUser) { // If we allow both types, show a picker, otherwise directly go to // flow for full user. if (mUserCaps.mCanAddRestrictedProfile) { showDialog(DIALOG_CHOOSE_USER_TYPE); } else { onAddUserClicked(USER_TYPE_USER); } } else if (pref == mEmergencyInfoPreference) { Intent intent = new Intent(ACTION_EDIT_EMERGENCY_INFO); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } return false; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onPreferenceClick File: src/com/android/settings/users/UserSettings.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-3889
HIGH
7.2
android
onPreferenceClick
src/com/android/settings/users/UserSettings.java
bd5d5176c74021e8cf4970f93f273ba3023c3d72
0
Analyze the following code function for security vulnerabilities
public void showInstallPgpDialog() { Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.openkeychain_required)); builder.setIconAttribute(android.R.attr.alertDialogIcon); builder.setMessage(getText(R.string.openkeychain_required_long)); builder.setNegativeButton(getString(R.string.cancel), null); builder.setNeutralButton(getString(R.string.restart), (dialog, which) -> { if (xmppConnectionServiceBound) { unbindService(mConnection); xmppConnectionServiceBound = false; } stopService(new Intent(XmppActivity.this, XmppConnectionService.class)); finish(); }); builder.setPositiveButton(getString(R.string.install), (dialog, which) -> { Uri uri = Uri .parse("market://details?id=org.sufficientlysecure.keychain"); Intent marketIntent = new Intent(Intent.ACTION_VIEW, uri); PackageManager manager = getApplicationContext() .getPackageManager(); List<ResolveInfo> infos = manager .queryIntentActivities(marketIntent, 0); if (infos.size() > 0) { startActivity(marketIntent); } else { uri = Uri.parse("http://www.openkeychain.org/"); Intent browserIntent = new Intent( Intent.ACTION_VIEW, uri); startActivity(browserIntent); } finish(); }); builder.create().show(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: showInstallPgpDialog File: src/main/java/eu/siacs/conversations/ui/XmppActivity.java Repository: iNPUTmice/Conversations The code follows secure coding practices.
[ "CWE-200" ]
CVE-2018-18467
MEDIUM
5
iNPUTmice/Conversations
showInstallPgpDialog
src/main/java/eu/siacs/conversations/ui/XmppActivity.java
7177c523a1b31988666b9337249a4f1d0c36f479
0
Analyze the following code function for security vulnerabilities
@Override public void onReceive(Context context, Intent intent) { if (DEBUG || DEBUG_REBOOT) { Slog.d(TAG, "Shutdown broadcast received."); } // Since it cleans up the shortcut directory and rewrite the ShortcutPackageItems // in odrder during saveToXml(), it could lead to shortcuts missing when shutdown. // We need it so that it can finish up saving before shutdown. synchronized (mLock) { if (mHandler.hasCallbacks(mSaveDirtyInfoRunner)) { mHandler.removeCallbacks(mSaveDirtyInfoRunner); forEachLoadedUserLocked(ShortcutUser::cancelAllInFlightTasks); saveDirtyInfo(); } mShutdown.set(true); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onReceive File: services/core/java/com/android/server/pm/ShortcutService.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-40079
HIGH
7.8
android
onReceive
services/core/java/com/android/server/pm/ShortcutService.java
96e0524c48c6e58af7d15a2caf35082186fc8de2
0
Analyze the following code function for security vulnerabilities
public Object getEditedItemId() { return editedItemId; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getEditedItemId 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
getEditedItemId
server/src/main/java/com/vaadin/ui/Grid.java
b9ba10adaa06a0977c531f878c3f0046b67f9cc0
0
Analyze the following code function for security vulnerabilities
@Nullable public String getAuthToken() { return authToken; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getAuthToken File: spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/notify/TelegramNotifier.java Repository: codecentric/spring-boot-admin The code follows secure coding practices.
[ "CWE-94" ]
CVE-2022-46166
CRITICAL
9.8
codecentric/spring-boot-admin
getAuthToken
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/notify/TelegramNotifier.java
c14c3ec12533f71f84de9ce3ce5ceb7991975f75
0
Analyze the following code function for security vulnerabilities
@NonNull private Action makeNegativeAction() { if (mDeclineIntent == null) { return makeAction(R.drawable.ic_call_decline, R.string.call_notification_hang_up_action, mDeclineButtonColor, R.color.call_notification_decline_color, mHangUpIntent); } else { return makeAction(R.drawable.ic_call_decline, R.string.call_notification_decline_action, mDeclineButtonColor, R.color.call_notification_decline_color, mDeclineIntent); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: makeNegativeAction File: core/java/android/app/Notification.java Repository: android The code follows secure coding practices.
[ "CWE-862" ]
CVE-2023-21288
MEDIUM
5.5
android
makeNegativeAction
core/java/android/app/Notification.java
726247f4f53e8cc0746175265652fa415a123c0c
0
Analyze the following code function for security vulnerabilities
@Override public CompletionStage<Void> write(byte[] data) { CompletableFuture<Void> ret = new CompletableFuture<>(); response.write(Buffer.buffer(data), new Handler<AsyncResult<Void>>() { @Override public void handle(AsyncResult<Void> event) { if (event.failed()) { ret.completeExceptionally(event.cause()); } else { ret.complete(null); } } }); return ret; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: write File: independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxResteasyReactiveRequestContext.java Repository: quarkusio/quarkus The code follows secure coding practices.
[ "CWE-863" ]
CVE-2022-0981
MEDIUM
6.5
quarkusio/quarkus
write
independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxResteasyReactiveRequestContext.java
96c64fd8f09c02a497e2db366c64dd9196582442
0
Analyze the following code function for security vulnerabilities
private void updateStartedUserArrayLocked() { int num = 0; for (int i=0; i<mStartedUsers.size(); i++) { UserStartedState uss = mStartedUsers.valueAt(i); // This list does not include stopping users. if (uss.mState != UserStartedState.STATE_STOPPING && uss.mState != UserStartedState.STATE_SHUTDOWN) { num++; } } mStartedUserArray = new int[num]; num = 0; for (int i=0; i<mStartedUsers.size(); i++) { UserStartedState uss = mStartedUsers.valueAt(i); if (uss.mState != UserStartedState.STATE_STOPPING && uss.mState != UserStartedState.STATE_SHUTDOWN) { mStartedUserArray[num] = mStartedUsers.keyAt(i); num++; } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: updateStartedUserArrayLocked 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
updateStartedUserArrayLocked
services/core/java/com/android/server/am/ActivityManagerService.java
aaa0fee0d7a8da347a0c47cef5249c70efee209e
0
Analyze the following code function for security vulnerabilities
void injectPostToHandler(Runnable r) { mHandler.post(r); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: injectPostToHandler File: services/core/java/com/android/server/pm/ShortcutService.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-40079
HIGH
7.8
android
injectPostToHandler
services/core/java/com/android/server/pm/ShortcutService.java
96e0524c48c6e58af7d15a2caf35082186fc8de2
0
Analyze the following code function for security vulnerabilities
public String displayView(PropertyClass pclass, String prefix, BaseCollection object, XWikiContext context) { return (pclass == null) ? "" : pclass.displayView(pclass.getName(), prefix, object, context); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: displayView 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
displayView
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
static private byte[] flattenBundle(Bundle bundle) { byte[] flatData = null; Parcel parcel = Parcel.obtain(); try { bundle.writeToParcel(parcel, 0); flatData = parcel.marshall(); } finally { parcel.recycle(); } return flatData; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: flattenBundle File: services/core/java/com/android/server/content/SyncStorageEngine.java Repository: android The code follows secure coding practices.
[ "CWE-20" ]
CVE-2016-2424
HIGH
7.1
android
flattenBundle
services/core/java/com/android/server/content/SyncStorageEngine.java
d3383d5bfab296ba3adbc121ff8a7b542bde4afb
0
Analyze the following code function for security vulnerabilities
public RemoteTransition getRemoteTransition() { return mRemoteTransition; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getRemoteTransition File: core/java/android/app/ActivityOptions.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-20918
CRITICAL
9.8
android
getRemoteTransition
core/java/android/app/ActivityOptions.java
51051de4eb40bb502db448084a83fd6cbfb7d3cf
0
Analyze the following code function for security vulnerabilities
public static Map<String, Object> userLogin(DispatchContext ctx, Map<String, ?> context) { LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); Delegator delegator = ctx.getDelegator(); // load the external auth modules -- note: this will only run once and cache the objects if (!AuthHelper.authenticatorsLoaded()) { AuthHelper.loadAuthenticators(dispatcher); } // Authenticate to LDAP if configured to do so // TODO: this should be moved to using the NEW Authenticator API if ("true".equals(EntityUtilProperties.getPropertyValue("security", "security.ldap.enable", delegator))) { if (!LdapAuthenticationServices.userLogin(ctx, context)) { String errMsg = UtilProperties.getMessage(resource, "loginservices.ldap_authentication_failed", locale); if ("true".equals(EntityUtilProperties.getPropertyValue("security", "security.ldap.fail.login", delegator))) { return ServiceUtil.returnError(errMsg); } Debug.logInfo(errMsg, module); } } Map<String, Object> result = new LinkedHashMap<>(); boolean useEncryption = "true".equals(EntityUtilProperties.getPropertyValue("security", "password.encrypt", delegator)); // if isServiceAuth is not specified, default to not a service auth boolean isServiceAuth = context.get("isServiceAuth") != null && ((Boolean) context.get("isServiceAuth")).booleanValue(); String username = (String) context.get("login.username"); if (username == null) { username = (String) context.get("username"); } String password = (String) context.get("login.password"); if (password == null) { password = (String) context.get("password"); } // get the visitId for the history entity String visitId = (String) context.get("visitId"); String errMsg = ""; if (UtilValidate.isEmpty(username)) { errMsg = UtilProperties.getMessage(resource,"loginservices.username_missing", locale); } else if (UtilValidate.isEmpty(password)) { errMsg = UtilProperties.getMessage(resource,"loginservices.password_missing", locale); } else { if ("true".equalsIgnoreCase(EntityUtilProperties.getPropertyValue("security", "username.lowercase", delegator))) { username = username.toLowerCase(Locale.getDefault()); } if ("true".equalsIgnoreCase(EntityUtilProperties.getPropertyValue("security", "password.lowercase", delegator))) { password = password.toLowerCase(Locale.getDefault()); } boolean repeat = true; // starts at zero but it incremented at the beginning so in the first pass passNumber will be 1 int passNumber = 0; while (repeat) { repeat = false; // pass number is incremented here because there are continues in this loop so it may never get to the end passNumber++; GenericValue userLogin = null; try { // only get userLogin from cache for service calls; for web and other manual logins there is less time sensitivity userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", username).cache(isServiceAuth).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e, "", module); } // see if any external auth modules want to sync the user info if (userLogin == null) { try { AuthHelper.syncUser(username); } catch (AuthenticatorException e) { Debug.logWarning(e, module); } // check the user login object again try { userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", username).cache(isServiceAuth).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e, "", module); } } if (userLogin != null) { String ldmStr = EntityUtilProperties.getPropertyValue("security", "login.disable.minutes", delegator); long loginDisableMinutes; try { loginDisableMinutes = Long.parseLong(ldmStr); } catch (Exception e) { loginDisableMinutes = 30; Debug.logWarning("Could not parse login.disable.minutes from security.properties, using default of 30", module); } Timestamp disabledDateTime = userLogin.getTimestamp("disabledDateTime"); Timestamp reEnableTime = null; if (loginDisableMinutes > 0 && disabledDateTime != null) { reEnableTime = new Timestamp(disabledDateTime.getTime() + loginDisableMinutes * 60000); } boolean doStore = true; // we might change & store this userLogin, so we should clone it here to get a mutable copy userLogin = GenericValue.create(userLogin); // get the is system flag -- system accounts can only be used for service authentication boolean isSystem = (isServiceAuth && userLogin.get("isSystem") != null) ? "Y".equalsIgnoreCase(userLogin.getString("isSystem")) : false; // grab the hasLoggedOut flag Boolean hasLoggedOut = userLogin.getBoolean("hasLoggedOut"); if ((UtilValidate.isEmpty(userLogin.getString("enabled")) || "Y".equals(userLogin.getString("enabled")) || (reEnableTime != null && reEnableTime.before(UtilDateTime.nowTimestamp())) || (isSystem)) && UtilValidate.isEmpty(userLogin.getString("disabledBy"))) { String successfulLogin; if (!isSystem) { userLogin.set("enabled", "Y"); userLogin.set("disabledBy", null); } // attempt to authenticate with Authenticator class(es) boolean authFatalError = false; boolean externalAuth = false; try { externalAuth = AuthHelper.authenticate(username, password, isServiceAuth); } catch (AuthenticatorException e) { // fatal error -- or single authenticator found -- fail now Debug.logWarning(e, module); authFatalError = true; } // check whether to sign in with Tomcat SSO boolean useTomcatSSO = EntityUtilProperties.propertyValueEquals("security", "security.login.tomcat.sso", "true"); HttpServletRequest request = (javax.servlet.http.HttpServletRequest) context.get("request"); // when request is not supplied, we will treat that SSO is not required as // in the usage of userLogin service in ICalWorker.java and XmlRpcEventHandler.java. useTomcatSSO = useTomcatSSO && (request!=null); // if the password.accept.encrypted.and.plain property in security is set to true allow plain or encrypted passwords // if this is a system account don't bother checking the passwords // if externalAuth passed; this is run as well if ((!authFatalError && externalAuth) || (useTomcatSSO ? TomcatSSOLogin(request, username, password) : checkPassword(userLogin.getString("currentPassword"), useEncryption, password) )) { Debug.logVerbose("[LoginServices.userLogin] : Password Matched", module); // update the hasLoggedOut flag if (hasLoggedOut == null || hasLoggedOut) { userLogin.set("hasLoggedOut", "N"); } // reset failed login count if necessry Long currentFailedLogins = userLogin.getLong("successiveFailedLogins"); if (currentFailedLogins != null && currentFailedLogins.longValue() > 0) { userLogin.set("successiveFailedLogins", Long.valueOf(0)); } else if (hasLoggedOut != null && !hasLoggedOut) { // successful login & no loggout flag, no need to change anything, so don't do the store doStore = false; } successfulLogin = "Y"; if (!isServiceAuth) { // get the UserLoginSession if this is not a service auth Map<?, ?> userLoginSessionMap = LoginWorker.getUserLoginSession(userLogin); // return the UserLoginSession Map if (userLoginSessionMap != null) { result.put("userLoginSession", userLoginSessionMap); } } result.put("userLogin", userLogin); result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); } else { // password is incorrect, but this may be the result of a stale cache entry, // so lets clear the cache and try again if this is the first pass // but only if authFatalError is not true; this would mean the single authenticator failed if (!authFatalError && isServiceAuth && passNumber <= 1) { delegator.clearCacheLine("UserLogin", UtilMisc.toMap("userLoginId", username)); repeat = true; continue; } Debug.logInfo("[LoginServices.userLogin] : Password Incorrect", module); // password invalid... errMsg = UtilProperties.getMessage(resource,"loginservices.password_incorrect", locale); // increment failed login count Long currentFailedLogins = userLogin.getLong("successiveFailedLogins"); if (currentFailedLogins == null) { currentFailedLogins = Long.valueOf(1); } else { currentFailedLogins = Long.valueOf(currentFailedLogins.longValue() + 1); } userLogin.set("successiveFailedLogins", currentFailedLogins); // if failed logins over amount in properties file, disable account String mflStr = EntityUtilProperties.getPropertyValue("security", "max.failed.logins", delegator); long maxFailedLogins = 3; try { maxFailedLogins = Long.parseLong(mflStr); } catch (Exception e) { maxFailedLogins = 3; Debug.logWarning("Could not parse max.failed.logins from security.properties, using default of 3", module); } if (maxFailedLogins > 0 && currentFailedLogins.longValue() >= maxFailedLogins) { userLogin.set("enabled", "N"); userLogin.set("disabledDateTime", UtilDateTime.nowTimestamp()); } successfulLogin = "N"; } // this section is being done in its own transaction rather than in the //current/existing transaction because we may return error and we don't //want that to stop this from getting stored Transaction parentTx = null; boolean beganTransaction = false; try { try { parentTx = TransactionUtil.suspend(); } catch (GenericTransactionException e) { Debug.logError(e, "Could not suspend transaction: " + e.getMessage(), module); } try { beganTransaction = TransactionUtil.begin(); if (doStore) { userLogin.store(); } if ("true".equals(EntityUtilProperties.getPropertyValue("security", "store.login.history", delegator))) { boolean createHistory = true; // only save info on service auth if option set to true to do so if (isServiceAuth && !"true".equals(EntityUtilProperties.getPropertyValue("security", "store.login.history.on.service.auth", delegator))) { createHistory = false; } if (createHistory) { Map<String, Object> ulhCreateMap = UtilMisc.toMap("userLoginId", username, "visitId", visitId, "fromDate", UtilDateTime.nowTimestamp(), "successfulLogin", successfulLogin); ModelEntity modelUserLogin = userLogin.getModelEntity(); if (modelUserLogin.isField("partyId")) { ulhCreateMap.put("partyId", userLogin.get("partyId")); } // ONLY save the password if it was incorrect if ("N".equals(successfulLogin) && !"false".equals(EntityUtilProperties.getPropertyValue("security", "store.login.history.incorrect.password", delegator))) { ulhCreateMap.put("passwordUsed", password); } delegator.create("UserLoginHistory", ulhCreateMap); } } } catch (GenericEntityException e) { String geeErrMsg = "Error saving UserLoginHistory"; if (doStore) { geeErrMsg += " and updating login status to reset hasLoggedOut, unsuccessful login count, etc."; } geeErrMsg += ": " + e.toString(); try { TransactionUtil.rollback(beganTransaction, geeErrMsg, e); } catch (GenericTransactionException e2) { Debug.logError(e2, "Could not rollback nested transaction: " + e2.getMessage(), module); } // if doStore is true then this error should not be ignored and we shouldn't consider it a successful login if this happens as there is something very wrong lower down that will bite us again later if (doStore) { return ServiceUtil.returnError(geeErrMsg); } } finally { try { TransactionUtil.commit(beganTransaction); } catch (GenericTransactionException e) { Debug.logError(e, "Could not commit nested transaction: " + e.getMessage(), module); } } } finally { // resume/restore parent transaction if (parentTx != null) { try { TransactionUtil.resume(parentTx); Debug.logVerbose("Resumed the parent transaction.", module); } catch (GenericTransactionException e) { Debug.logError(e, "Could not resume parent nested transaction: " + e.getMessage(), module); } } } } else { // account is disabled, but this may be the result of a stale cache entry, // so lets clear the cache and try again if this is the first pass if (isServiceAuth && passNumber <= 1) { delegator.clearCacheLine("UserLogin", UtilMisc.toMap("userLoginId", username)); repeat = true; continue; } Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("username", username); errMsg = UtilProperties.getMessage(resource,"loginservices.account_for_user_login_id_disabled",messageMap ,locale); if (disabledDateTime != null) { messageMap = UtilMisc.<String, Object>toMap("disabledDateTime", disabledDateTime); errMsg += " " + UtilProperties.getMessage(resource,"loginservices.since_datetime",messageMap ,locale); } else { errMsg += "."; } if (loginDisableMinutes > 0 && reEnableTime != null) { messageMap = UtilMisc.<String, Object>toMap("reEnableTime", reEnableTime); errMsg += " " + UtilProperties.getMessage(resource,"loginservices.will_be_reenabled",messageMap ,locale); } else { errMsg += " " + UtilProperties.getMessage(resource,"loginservices.not_scheduled_to_be_reenabled",locale); } } } else { // no userLogin object; there may be a non-syncing authenticator boolean externalAuth = false; try { externalAuth = AuthHelper.authenticate(username, password, isServiceAuth); } catch (AuthenticatorException e) { errMsg = e.getMessage(); Debug.logError(e, "External Authenticator had fatal exception : " + e.getMessage(), module); } if (externalAuth) { // external auth passed - create a placeholder object for session userLogin = delegator.makeValue("UserLogin"); userLogin.set("userLoginId", username); userLogin.set("enabled", "Y"); userLogin.set("hasLoggedOut", "N"); result.put("userLogin", userLogin); result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); //TODO: more than this is needed to support 100% external authentication //TODO: party + security information is needed; Userlogin will need to be stored } else { // userLogin record not found, user does not exist errMsg = UtilProperties.getMessage(resource, "loginservices.user_not_found", locale); Debug.logInfo("[LoginServices.userLogin] Invalid User : '" + username + "'; " + errMsg, module); } } } } if (errMsg.length() > 0) { result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_FAIL); result.put(ModelService.ERROR_MESSAGE, errMsg); } return result; }
Vulnerability Classification: - CWE: CWE-209 - CVE: CVE-2021-25958 - Severity: MEDIUM - CVSS Score: 5.0 Description: Fixed: UserLoginHistory failed the store operation with large password (OFBIZ-12287) Backport 2aa68dc4de8892e8a7cbb38c10a3a3dd65d233e5 from trunk When you have a user with long password (greater than 256 characters) present in OFBiz and you try to log with, OFBiz return a long error message with sensitive information due to exceeding value size to store on the field UserLoginHistory.passwordUsed. To solve this we don't return any information on the genericValue that failed and analyze the field passwordUsed to escape the case where the password set to login is create than the database field capacity. Thanks to Daniel Elkabes <daniel.elkabes@whitesourcesoftware.com> and Hagai Wechsler <hagai.wechsler@whitesourcesoftware.com> from white source software to raise the problem. Function: userLogin File: framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java Repository: apache/ofbiz-framework Fixed Code: public static Map<String, Object> userLogin(DispatchContext ctx, Map<String, ?> context) { LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); Delegator delegator = ctx.getDelegator(); // load the external auth modules -- note: this will only run once and cache the objects if (!AuthHelper.authenticatorsLoaded()) { AuthHelper.loadAuthenticators(dispatcher); } // Authenticate to LDAP if configured to do so // TODO: this should be moved to using the NEW Authenticator API if ("true".equals(EntityUtilProperties.getPropertyValue("security", "security.ldap.enable", delegator))) { if (!LdapAuthenticationServices.userLogin(ctx, context)) { String errMsg = UtilProperties.getMessage(resource, "loginservices.ldap_authentication_failed", locale); if ("true".equals(EntityUtilProperties.getPropertyValue("security", "security.ldap.fail.login", delegator))) { return ServiceUtil.returnError(errMsg); } Debug.logInfo(errMsg, module); } } Map<String, Object> result = new LinkedHashMap<>(); boolean useEncryption = "true".equals(EntityUtilProperties.getPropertyValue("security", "password.encrypt", delegator)); // if isServiceAuth is not specified, default to not a service auth boolean isServiceAuth = context.get("isServiceAuth") != null && ((Boolean) context.get("isServiceAuth")).booleanValue(); String username = (String) context.get("login.username"); if (username == null) { username = (String) context.get("username"); } String password = (String) context.get("login.password"); if (password == null) { password = (String) context.get("password"); } // get the visitId for the history entity String visitId = (String) context.get("visitId"); String errMsg = ""; if (UtilValidate.isEmpty(username)) { errMsg = UtilProperties.getMessage(resource,"loginservices.username_missing", locale); } else if (UtilValidate.isEmpty(password)) { errMsg = UtilProperties.getMessage(resource,"loginservices.password_missing", locale); } else { if ("true".equalsIgnoreCase(EntityUtilProperties.getPropertyValue("security", "username.lowercase", delegator))) { username = username.toLowerCase(Locale.getDefault()); } if ("true".equalsIgnoreCase(EntityUtilProperties.getPropertyValue("security", "password.lowercase", delegator))) { password = password.toLowerCase(Locale.getDefault()); } boolean repeat = true; // starts at zero but it incremented at the beginning so in the first pass passNumber will be 1 int passNumber = 0; while (repeat) { repeat = false; // pass number is incremented here because there are continues in this loop so it may never get to the end passNumber++; GenericValue userLogin = null; try { // only get userLogin from cache for service calls; for web and other manual logins there is less time sensitivity userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", username).cache(isServiceAuth).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e, "", module); } // see if any external auth modules want to sync the user info if (userLogin == null) { try { AuthHelper.syncUser(username); } catch (AuthenticatorException e) { Debug.logWarning(e, module); } // check the user login object again try { userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", username).cache(isServiceAuth).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e, "", module); } } if (userLogin != null) { String ldmStr = EntityUtilProperties.getPropertyValue("security", "login.disable.minutes", delegator); long loginDisableMinutes; try { loginDisableMinutes = Long.parseLong(ldmStr); } catch (Exception e) { loginDisableMinutes = 30; Debug.logWarning("Could not parse login.disable.minutes from security.properties, using default of 30", module); } Timestamp disabledDateTime = userLogin.getTimestamp("disabledDateTime"); Timestamp reEnableTime = null; if (loginDisableMinutes > 0 && disabledDateTime != null) { reEnableTime = new Timestamp(disabledDateTime.getTime() + loginDisableMinutes * 60000); } boolean doStore = true; // we might change & store this userLogin, so we should clone it here to get a mutable copy userLogin = GenericValue.create(userLogin); // get the is system flag -- system accounts can only be used for service authentication boolean isSystem = (isServiceAuth && userLogin.get("isSystem") != null) ? "Y".equalsIgnoreCase(userLogin.getString("isSystem")) : false; // grab the hasLoggedOut flag Boolean hasLoggedOut = userLogin.getBoolean("hasLoggedOut"); if ((UtilValidate.isEmpty(userLogin.getString("enabled")) || "Y".equals(userLogin.getString("enabled")) || (reEnableTime != null && reEnableTime.before(UtilDateTime.nowTimestamp())) || (isSystem)) && UtilValidate.isEmpty(userLogin.getString("disabledBy"))) { String successfulLogin; if (!isSystem) { userLogin.set("enabled", "Y"); userLogin.set("disabledBy", null); } // attempt to authenticate with Authenticator class(es) boolean authFatalError = false; boolean externalAuth = false; try { externalAuth = AuthHelper.authenticate(username, password, isServiceAuth); } catch (AuthenticatorException e) { // fatal error -- or single authenticator found -- fail now Debug.logWarning(e, module); authFatalError = true; } // check whether to sign in with Tomcat SSO boolean useTomcatSSO = EntityUtilProperties.propertyValueEquals("security", "security.login.tomcat.sso", "true"); HttpServletRequest request = (javax.servlet.http.HttpServletRequest) context.get("request"); // when request is not supplied, we will treat that SSO is not required as // in the usage of userLogin service in ICalWorker.java and XmlRpcEventHandler.java. useTomcatSSO = useTomcatSSO && (request!=null); // if the password.accept.encrypted.and.plain property in security is set to true allow plain or encrypted passwords // if this is a system account don't bother checking the passwords // if externalAuth passed; this is run as well if ((!authFatalError && externalAuth) || (useTomcatSSO ? TomcatSSOLogin(request, username, password) : checkPassword(userLogin.getString("currentPassword"), useEncryption, password) )) { Debug.logVerbose("[LoginServices.userLogin] : Password Matched", module); // update the hasLoggedOut flag if (hasLoggedOut == null || hasLoggedOut) { userLogin.set("hasLoggedOut", "N"); } // reset failed login count if necessry Long currentFailedLogins = userLogin.getLong("successiveFailedLogins"); if (currentFailedLogins != null && currentFailedLogins.longValue() > 0) { userLogin.set("successiveFailedLogins", Long.valueOf(0)); } else if (hasLoggedOut != null && !hasLoggedOut) { // successful login & no loggout flag, no need to change anything, so don't do the store doStore = false; } successfulLogin = "Y"; if (!isServiceAuth) { // get the UserLoginSession if this is not a service auth Map<?, ?> userLoginSessionMap = LoginWorker.getUserLoginSession(userLogin); // return the UserLoginSession Map if (userLoginSessionMap != null) { result.put("userLoginSession", userLoginSessionMap); } } result.put("userLogin", userLogin); result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); } else { // password is incorrect, but this may be the result of a stale cache entry, // so lets clear the cache and try again if this is the first pass // but only if authFatalError is not true; this would mean the single authenticator failed if (!authFatalError && isServiceAuth && passNumber <= 1) { delegator.clearCacheLine("UserLogin", UtilMisc.toMap("userLoginId", username)); repeat = true; continue; } Debug.logInfo("[LoginServices.userLogin] : Password Incorrect", module); // password invalid... errMsg = UtilProperties.getMessage(resource,"loginservices.password_incorrect", locale); // increment failed login count Long currentFailedLogins = userLogin.getLong("successiveFailedLogins"); if (currentFailedLogins == null) { currentFailedLogins = Long.valueOf(1); } else { currentFailedLogins = Long.valueOf(currentFailedLogins.longValue() + 1); } userLogin.set("successiveFailedLogins", currentFailedLogins); // if failed logins over amount in properties file, disable account String mflStr = EntityUtilProperties.getPropertyValue("security", "max.failed.logins", delegator); long maxFailedLogins = 3; try { maxFailedLogins = Long.parseLong(mflStr); } catch (Exception e) { maxFailedLogins = 3; Debug.logWarning("Could not parse max.failed.logins from security.properties, using default of 3", module); } if (maxFailedLogins > 0 && currentFailedLogins.longValue() >= maxFailedLogins) { userLogin.set("enabled", "N"); userLogin.set("disabledDateTime", UtilDateTime.nowTimestamp()); } successfulLogin = "N"; } // this section is being done in its own transaction rather than in the //current/existing transaction because we may return error and we don't //want that to stop this from getting stored Transaction parentTx = null; boolean beganTransaction = false; try { try { parentTx = TransactionUtil.suspend(); } catch (GenericTransactionException e) { Debug.logError(e, "Could not suspend transaction: " + e.getMessage(), module); } try { beganTransaction = TransactionUtil.begin(); if (doStore) { userLogin.store(); } if ("true".equals(EntityUtilProperties.getPropertyValue("security", "store.login.history", delegator))) { boolean createHistory = true; // only save info on service auth if option set to true to do so if (isServiceAuth && !"true".equals(EntityUtilProperties.getPropertyValue("security", "store.login.history.on.service.auth", delegator))) { createHistory = false; } if (createHistory) { Map<String, Object> ulhCreateMap = UtilMisc.toMap("userLoginId", username, "visitId", visitId, "fromDate", UtilDateTime.nowTimestamp(), "successfulLogin", successfulLogin); ModelEntity modelUserLogin = userLogin.getModelEntity(); if (modelUserLogin.isField("partyId")) { ulhCreateMap.put("partyId", userLogin.get("partyId")); } // ONLY save the password if it was incorrect // we will check in the hash size isn't too huge for the store other wise store a fix string if ("N".equals(successfulLogin) && !"false".equals(EntityUtilProperties.getPropertyValue("security", "store.login.history.incorrect.password", delegator))) { ulhCreateMap.put("passwordUsed", isGivenPasswordCanBeStored(delegator, password) ? " TOO LONG FOR STORAGE " : password); } delegator.create("UserLoginHistory", ulhCreateMap); } } } catch (GenericEntityException e) { String geeErrMsg = "Error saving UserLoginHistory"; if (doStore) { geeErrMsg += " and updating login status to reset hasLoggedOut, unsuccessful login count, etc."; } try { TransactionUtil.rollback(beganTransaction, geeErrMsg, e); } catch (GenericTransactionException e2) { Debug.logError(e2, "Could not rollback nested transaction: " + e2.getMessage(), module); } // if doStore is true then this error should not be ignored and we shouldn't consider it a successful login if this happens as there is something very wrong lower down that will bite us again later if (doStore) { return ServiceUtil.returnError(geeErrMsg); } } finally { try { TransactionUtil.commit(beganTransaction); } catch (GenericTransactionException e) { Debug.logError(e, "Could not commit nested transaction: " + e.getMessage(), module); } } } finally { // resume/restore parent transaction if (parentTx != null) { try { TransactionUtil.resume(parentTx); Debug.logVerbose("Resumed the parent transaction.", module); } catch (GenericTransactionException e) { Debug.logError(e, "Could not resume parent nested transaction: " + e.getMessage(), module); } } } } else { // account is disabled, but this may be the result of a stale cache entry, // so lets clear the cache and try again if this is the first pass if (isServiceAuth && passNumber <= 1) { delegator.clearCacheLine("UserLogin", UtilMisc.toMap("userLoginId", username)); repeat = true; continue; } Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("username", username); errMsg = UtilProperties.getMessage(resource,"loginservices.account_for_user_login_id_disabled",messageMap ,locale); if (disabledDateTime != null) { messageMap = UtilMisc.<String, Object>toMap("disabledDateTime", disabledDateTime); errMsg += " " + UtilProperties.getMessage(resource,"loginservices.since_datetime",messageMap ,locale); } else { errMsg += "."; } if (loginDisableMinutes > 0 && reEnableTime != null) { messageMap = UtilMisc.<String, Object>toMap("reEnableTime", reEnableTime); errMsg += " " + UtilProperties.getMessage(resource,"loginservices.will_be_reenabled",messageMap ,locale); } else { errMsg += " " + UtilProperties.getMessage(resource,"loginservices.not_scheduled_to_be_reenabled",locale); } } } else { // no userLogin object; there may be a non-syncing authenticator boolean externalAuth = false; try { externalAuth = AuthHelper.authenticate(username, password, isServiceAuth); } catch (AuthenticatorException e) { errMsg = e.getMessage(); Debug.logError(e, "External Authenticator had fatal exception : " + e.getMessage(), module); } if (externalAuth) { // external auth passed - create a placeholder object for session userLogin = delegator.makeValue("UserLogin"); userLogin.set("userLoginId", username); userLogin.set("enabled", "Y"); userLogin.set("hasLoggedOut", "N"); result.put("userLogin", userLogin); result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); //TODO: more than this is needed to support 100% external authentication //TODO: party + security information is needed; Userlogin will need to be stored } else { // userLogin record not found, user does not exist errMsg = UtilProperties.getMessage(resource, "loginservices.user_not_found", locale); Debug.logInfo("[LoginServices.userLogin] Invalid User : '" + username + "'; " + errMsg, module); } } } } if (errMsg.length() > 0) { result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_FAIL); result.put(ModelService.ERROR_MESSAGE, errMsg); } return result; }
[ "CWE-209" ]
CVE-2021-25958
MEDIUM
5
apache/ofbiz-framework
userLogin
framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java
2f5b8d33e32c4d9a48243cf9e503236acd5aec5c
1
Analyze the following code function for security vulnerabilities
private BigDecimal scaleBigDecimal(BigDecimal val, int scale) throws PSQLException { if (scale == -1) { return val; } try { return val.setScale(scale); } catch (ArithmeticException e) { throw new PSQLException( GT.tr("Bad value for type {0} : {1}", "BigDecimal", val), PSQLState.NUMERIC_VALUE_OUT_OF_RANGE); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: scaleBigDecimal File: pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java Repository: pgjdbc The code follows secure coding practices.
[ "CWE-89" ]
CVE-2022-31197
HIGH
8
pgjdbc
scaleBigDecimal
pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
739e599d52ad80f8dcd6efedc6157859b1a9d637
0
Analyze the following code function for security vulnerabilities
@Test public void saveBatchJsonFail(TestContext context) { JsonArray array = new JsonArray() .add("{ \"x\" : \"a\" }") .add("{ \"y\" : \"'\" }"); createFoo(context).saveBatch(BAR, array, context.asyncAssertFailure()); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: saveBatchJsonFail File: domain-models-runtime/src/test/java/org/folio/rest/persist/PostgresClientIT.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
saveBatchJsonFail
domain-models-runtime/src/test/java/org/folio/rest/persist/PostgresClientIT.java
b7ef741133e57add40aa4cb19430a0065f378a94
0
Analyze the following code function for security vulnerabilities
public int getLineForVertical(int vertical) { int high = getLineCount(), low = -1, guess; while (high - low > 1) { guess = (high + low) / 2; if (getLineTop(guess) > vertical) high = guess; else low = guess; } if (low < 0) return 0; else return low; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getLineForVertical File: core/java/android/text/Layout.java Repository: android The code follows secure coding practices.
[ "CWE-20" ]
CVE-2018-9452
MEDIUM
4.3
android
getLineForVertical
core/java/android/text/Layout.java
3b6f84b77c30ec0bab5147b0cffc192c86ba2634
0
Analyze the following code function for security vulnerabilities
public boolean isTts() { return tts; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isTts File: spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/notify/DiscordNotifier.java Repository: codecentric/spring-boot-admin The code follows secure coding practices.
[ "CWE-94" ]
CVE-2022-46166
CRITICAL
9.8
codecentric/spring-boot-admin
isTts
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/notify/DiscordNotifier.java
c14c3ec12533f71f84de9ce3ce5ceb7991975f75
0
Analyze the following code function for security vulnerabilities
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { // 14-Jun-2017, tatu: [databind#1625]: may want to block merging, for root value boolean preventMerge = (property == null) && Boolean.FALSE.equals(ctxt.getConfig().getDefaultMergeable(Object.class)); // 20-Apr-2014, tatu: If nothing custom, let's use "vanilla" instance, // simpler and can avoid some of delegation if ((_stringDeserializer == null) && (_numberDeserializer == null) && (_mapDeserializer == null) && (_listDeserializer == null) && getClass() == UntypedObjectDeserializer.class) { return Vanilla.instance(preventMerge); } if (preventMerge != _nonMerging) { return new UntypedObjectDeserializer(this, preventMerge); } return this; }
Vulnerability Classification: - CWE: CWE-787 - CVE: CVE-2020-36518 - Severity: MEDIUM - CVSS Score: 5.0 Description: Fix #3473 (re-implementation of #2816 for 2.14) Function: createContextual File: src/main/java/com/fasterxml/jackson/databind/deser/std/UntypedObjectDeserializer.java Repository: FasterXML/jackson-databind Fixed Code: @Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { // 14-Jun-2017, tatu: [databind#1625]: may want to block merging, for root value boolean preventMerge = (property == null) && Boolean.FALSE.equals(ctxt.getConfig().getDefaultMergeable(Object.class)); // 20-Apr-2014, tatu: If nothing custom, let's use "vanilla" instance, // simpler and can avoid some of delegation if ((_stringDeserializer == null) && (_numberDeserializer == null) && (_mapDeserializer == null) && (_listDeserializer == null) && getClass() == UntypedObjectDeserializer.class) { return UntypedObjectDeserializerNR.instance(preventMerge); } if (preventMerge != _nonMerging) { return new UntypedObjectDeserializer(this, preventMerge); } return this; }
[ "CWE-787" ]
CVE-2020-36518
MEDIUM
5
FasterXML/jackson-databind
createContextual
src/main/java/com/fasterxml/jackson/databind/deser/std/UntypedObjectDeserializer.java
8238ab41d0350fb915797c89d46777b4496b74fd
1
Analyze the following code function for security vulnerabilities
@Override public KieServerSetup connect(KieServerInfo serverInfo) { KieServerState currentState = context.getStateRepository().load(KieServerEnvironment.getServerId()); Set<String> controllers = currentState.getControllers(); KieServerConfig config = currentState.getConfiguration(); if (controllers != null && !controllers.isEmpty()) { for (String controllerUrl : controllers) { if (controllerUrl != null && !controllerUrl.isEmpty()) { KieServerSetup kieServerSetup = connectToSingleController(serverInfo, config, controllerUrl); if (kieServerSetup != null) { return kieServerSetup; } } } throw new KieControllerNotConnectedException("Unable to connect to any controller"); } else { throw new KieControllerNotDefinedException("Unable to connect to any controller"); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: connect File: kie-server-parent/kie-server-services/kie-server-services-common/src/main/java/org/kie/server/services/impl/controller/DefaultRestControllerImpl.java Repository: kiegroup/droolsjbpm-integration The code follows secure coding practices.
[ "CWE-260" ]
CVE-2016-7043
MEDIUM
5
kiegroup/droolsjbpm-integration
connect
kie-server-parent/kie-server-services/kie-server-services-common/src/main/java/org/kie/server/services/impl/controller/DefaultRestControllerImpl.java
e916032edd47aa46d15f3a11909b4804ee20a7e8
0
Analyze the following code function for security vulnerabilities
protected void DoGetResumable(HttpServletRequest request, HttpServletResponse response) throws IOException { if (ConfigurationManager.getProperty("upload.temp.dir") != null) { tempDir = ConfigurationManager.getProperty("upload.temp.dir"); } else { tempDir = System.getProperty("java.io.tmpdir"); } String resumableIdentifier = request.getParameter("resumableIdentifier"); String resumableChunkNumber = request.getParameter("resumableChunkNumber"); long resumableCurrentChunkSize = Long.valueOf(request.getParameter("resumableCurrentChunkSize")); tempDir = tempDir + File.separator + resumableIdentifier; File fileDir = new File(tempDir); // create a new directory for each resumableIdentifier if (!fileDir.exists()) { fileDir.mkdir(); } // use the String "part" and the chunkNumber as filename of a chunk String chunkPath = tempDir + File.separator + "part" + resumableChunkNumber; File chunkFile = new File(chunkPath); // if the chunk was uploaded already, we send a status code of 200 if (chunkFile.exists()) { if (chunkFile.length() == resumableCurrentChunkSize) { response.setStatus(HttpServletResponse.SC_OK); return; } // The chunk file does not have the expected size, delete it and // pretend that it wasn't uploaded already. chunkFile.delete(); } // if we don't have the chunk send a http status code 404 response.sendError(HttpServletResponse.SC_NOT_FOUND); }
Vulnerability Classification: - CWE: CWE-22 - CVE: CVE-2022-31194 - Severity: HIGH - CVSS Score: 7.2 Description: [DS-4132] JPSUI resumable upload dir validation Function: DoGetResumable File: dspace-jspui/src/main/java/org/dspace/app/webui/servlet/SubmissionController.java Repository: DSpace Fixed Code: protected void DoGetResumable(Context context, HttpServletRequest request, HttpServletResponse response) throws IOException { String baseDir; if (ConfigurationManager.getProperty("upload.temp.dir") != null) { baseDir = ConfigurationManager.getProperty("upload.temp.dir"); } else { baseDir = System.getProperty("java.io.tmpdir"); } String resumableIdentifier = request.getParameter("resumableIdentifier"); String resumableChunkNumber = request.getParameter("resumableChunkNumber"); long resumableCurrentChunkSize = Long.valueOf(request.getParameter("resumableCurrentChunkSize")); tempDir = baseDir + File.separator + resumableIdentifier; File fileDir = new File(tempDir); // Test fileDir to see if canonical path is within the original baseDir if(!fileDir.getCanonicalPath().startsWith(baseDir)) { log.error("Error processing resumable upload chunk: temporary chunk file would be created outside " + "permissible temp dir ("+ baseDir +") for submitter: " + context.getCurrentUser().getEmail()); throw new IOException("Error processing resumableIdentifier: " + resumableIdentifier + " (submitter: " + context.getCurrentUser().getEmail() + ")" + ". Temporary upload directory would be created outside permissible base temp dir ("+ baseDir +")"); } // create a new directory for each resumableIdentifier if (!fileDir.exists()) { fileDir.mkdir(); } // use the String "part" and the chunkNumber as filename of a chunk String chunkPath = tempDir + File.separator + "part" + resumableChunkNumber; File chunkFile = new File(chunkPath); // Test chunkFile to see if canonical path is within the original baseDir if(!chunkFile.getCanonicalPath().startsWith(baseDir)) { log.error("Error processing resumable upload chunk: temporary chunk file would be created outside " + "permissible temp dir ("+ baseDir +") for submitter: " + context.getCurrentUser().getEmail()); throw new IOException("Error processing resumableIdentifier: " + resumableIdentifier + " (submitter: " + context.getCurrentUser().getEmail() + ")" + ". Temporary upload directory would be created outside permissible base temp dir ("+ baseDir +")"); } // if the chunk was uploaded already, we send a status code of 200 if (chunkFile.exists()) { if (chunkFile.length() == resumableCurrentChunkSize) { response.setStatus(HttpServletResponse.SC_OK); return; } // The chunk file does not have the expected size, delete it and // pretend that it wasn't uploaded already. chunkFile.delete(); } // if we don't have the chunk send a http status code 404 response.sendError(HttpServletResponse.SC_NOT_FOUND); }
[ "CWE-22" ]
CVE-2022-31194
HIGH
7.2
DSpace
DoGetResumable
dspace-jspui/src/main/java/org/dspace/app/webui/servlet/SubmissionController.java
d1dd7d23329ef055069759df15cfa200c8e3
1
Analyze the following code function for security vulnerabilities
@SuppressWarnings("unchecked") protected void readDesign(Element design, DesignContext designContext) { Attributes attributes = design.attributes(); if (design.hasAttr("sortable")) { setSortable(DesignAttributeHandler.readAttribute("sortable", attributes, boolean.class)); } else { setSortable(false); } if (design.hasAttr("editable")) { /** * This is a fake editor just to have something (otherwise * "setEditable" throws an exception. * * Let's use TextField here because we support only Strings as * inline data type. It will work incorrectly for other types * but we don't support them anyway. */ setEditorComponent((HasValue<V> & Component) new TextField(), (item, value) -> { // Ignore user value since we don't know the setter }); setEditable(DesignAttributeHandler.readAttribute("editable", attributes, boolean.class)); } if (design.hasAttr("resizable")) { setResizable(DesignAttributeHandler.readAttribute("resizable", attributes, boolean.class)); } if (design.hasAttr("hidable")) { setHidable(DesignAttributeHandler.readAttribute("hidable", attributes, boolean.class)); } if (design.hasAttr("hidden")) { setHidden(DesignAttributeHandler.readAttribute("hidden", attributes, boolean.class)); } if (design.hasAttr("hiding-toggle-caption")) { setHidingToggleCaption(DesignAttributeHandler.readAttribute( "hiding-toggle-caption", attributes, String.class)); } if (design.hasAttr("assistive-caption")) { setAssistiveCaption(DesignAttributeHandler.readAttribute( "assistive-caption", attributes, String.class)); } // Read size info where necessary. if (design.hasAttr("width")) { setWidth(DesignAttributeHandler.readAttribute("width", attributes, Double.class)); } if (design.hasAttr("min-width")) { setMinimumWidth(DesignAttributeHandler .readAttribute("min-width", attributes, Double.class)); } if (design.hasAttr("max-width")) { setMaximumWidth(DesignAttributeHandler .readAttribute("max-width", attributes, Double.class)); } if (design.hasAttr("expand")) { if (design.attr("expand").isEmpty()) { setExpandRatio(1); } else { setExpandRatio(DesignAttributeHandler.readAttribute( "expand", attributes, Integer.class)); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: readDesign 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
readDesign
server/src/main/java/com/vaadin/ui/Grid.java
c40bed109c3723b38694ed160ea647fef5b28593
0
Analyze the following code function for security vulnerabilities
public static byte[] hexStringToByteArray(String hexString) { int read = hexString.length(); byte[] byteArray = new byte[read/2]; for (int i=0, j=0; i < read; i++, j++) { String part = hexString.substring(i,i+2); byteArray[j] = new Short(Integer.toString(Integer.parseInt(part,16))). byteValue(); i++; } return byteArray; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: hexStringToByteArray File: openam-federation/openam-federation-library/src/main/java/com/sun/identity/saml/common/SAMLUtils.java Repository: OpenIdentityPlatform/OpenAM The code follows secure coding practices.
[ "CWE-287" ]
CVE-2023-37471
CRITICAL
9.8
OpenIdentityPlatform/OpenAM
hexStringToByteArray
openam-federation/openam-federation-library/src/main/java/com/sun/identity/saml/common/SAMLUtils.java
7c18543d126e8a567b83bb4535631825aaa9d742
0
Analyze the following code function for security vulnerabilities
@Override public void dismissLowBatteryWarning() { if (DEBUG) Slog.d(TAG, "dismissing low battery warning: level=" + mBatteryLevel); dismissLowBatteryNotification(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: dismissLowBatteryWarning File: packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java Repository: android The code follows secure coding practices.
[ "CWE-284" ]
CVE-2015-3854
MEDIUM
5
android
dismissLowBatteryWarning
packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
05e0705177d2078fa9f940ce6df723312cfab976
0
Analyze the following code function for security vulnerabilities
public static final void createNewFile(File file) throws IOException { if (!file.createNewFile()) { throw new IOException("Failed to create new file"); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: createNewFile File: src/main/java/net/sf/mpxj/common/FileHelper.java Repository: joniles/mpxj The code follows secure coding practices.
[ "CWE-377", "CWE-200" ]
CVE-2022-41954
LOW
3.3
joniles/mpxj
createNewFile
src/main/java/net/sf/mpxj/common/FileHelper.java
ae0af24345d79ad45705265d9927fe55e94a5721
0
Analyze the following code function for security vulnerabilities
ActivityStarter setErrorCallbackToken(@Nullable IBinder errorCallbackToken) { mRequest.errorCallbackToken = errorCallbackToken; return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setErrorCallbackToken File: services/core/java/com/android/server/wm/ActivityStarter.java Repository: android The code follows secure coding practices.
[ "CWE-269" ]
CVE-2023-21269
HIGH
7.8
android
setErrorCallbackToken
services/core/java/com/android/server/wm/ActivityStarter.java
70ec64dc5a2a816d6aa324190a726a85fd749b30
0
Analyze the following code function for security vulnerabilities
protected Buffer encode(Buffer buffer) throws IOException { try { // Check that the packet has some free space for the header int curPos = buffer.rpos(); int cmd = buffer.rawByte(curPos) & 0xFF; // usually the 1st byte is an SSH opcode Buffer nb = preProcessEncodeBuffer(cmd, buffer); if (nb != buffer) { buffer = nb; curPos = buffer.rpos(); int newCmd = buffer.rawByte(curPos) & 0xFF; if (cmd != newCmd) { log.warn("encode({}) - command changed from {}[{}] to {}[{}] by pre-processor", this, cmd, SshConstants.getCommandMessageName(cmd), newCmd, SshConstants.getCommandMessageName(newCmd)); cmd = newCmd; } } // Grab the length of the packet (excluding the 5 header bytes) int len = buffer.available(); if (log.isDebugEnabled()) { log.debug("encode({}) packet #{} sending command={}[{}] len={}", this, seqo, cmd, SshConstants.getCommandMessageName(cmd), len); } int off = curPos - SshConstants.SSH_PACKET_HEADER_LEN; // Debug log the packet boolean traceEnabled = log.isTraceEnabled(); if (traceEnabled) { buffer.dumpHex(getSimplifiedLogger(), Level.FINEST, "encode(" + this + ") packet #" + seqo, this); } // Compress the packet if needed if ((outCompression != null) && outCompression.isCompressionExecuted() && (isAuthenticated() || (!outCompression.isDelayed()))) { int oldLen = len; outCompression.compress(buffer); len = buffer.available(); if (traceEnabled) { log.trace("encode({}) packet #{} command={}[{}] compressed {} -> {}", this, seqo, cmd, SshConstants.getCommandMessageName(cmd), oldLen, len); } } // Compute padding length boolean etmMode = outMac != null && outMac.isEncryptThenMac(); int authSize = outCipher != null ? outCipher.getAuthenticationTagSize() : 0; boolean authMode = authSize > 0; int oldLen = len; int pad = calculatePadLength(len, outCipherSize, etmMode || authMode); len += Byte.BYTES + pad; if (traceEnabled) { log.trace("encode({}) packet #{} command={}[{}] len={}, pad={}, mac={}", this, seqo, cmd, SshConstants.getCommandMessageName(cmd), len, pad, outMac); } // Write 5 header bytes buffer.wpos(off); buffer.putUInt(len); buffer.putByte((byte) pad); // Make sure enough room for padding and then fill it buffer.wpos(off + oldLen + SshConstants.SSH_PACKET_HEADER_LEN + pad); synchronized (random) { random.fill(buffer.array(), buffer.wpos() - pad, pad); } if (authMode) { int wpos = buffer.wpos(); buffer.wpos(wpos + authSize); aeadOutgoingBuffer(buffer, off, len); } else if (etmMode) { // Do not encrypt the length field encryptOutgoingBuffer(buffer, off + Integer.BYTES, len); appendOutgoingMac(buffer, off, len); } else { appendOutgoingMac(buffer, off, len); encryptOutgoingBuffer(buffer, off, len + Integer.BYTES); } // Increment packet id seqo = (seqo + 1L) & 0x0ffffffffL; // Update counters used to track re-keying outPacketsCount.incrementAndGet(); outBytesCount.addAndGet(len); // Make buffer ready to be read buffer.rpos(off); return buffer; } catch (IOException e) { throw e; } catch (Exception e) { throw new SshException(e); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: encode File: sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java Repository: apache/mina-sshd The code follows secure coding practices.
[ "CWE-354" ]
CVE-2023-48795
MEDIUM
5.9
apache/mina-sshd
encode
sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
6b0fd46f64bcb75eeeee31d65f10242660aad7c1
0
Analyze the following code function for security vulnerabilities
private DocumentReferenceResolver<String> getCurrentMixedDocumentReferenceResolver() { if (this.currentMixedDocumentReferenceResolver == null) { this.currentMixedDocumentReferenceResolver = Utils.getComponent(DocumentReferenceResolver.TYPE_STRING, "currentmixed"); } return this.currentMixedDocumentReferenceResolver; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getCurrentMixedDocumentReferenceResolver 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
getCurrentMixedDocumentReferenceResolver
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
public static Map<String,String> getServiceProperties(Context a) { if (serviceProperties == null) { InputStream i = null; try { serviceProperties = new HashMap<String,String>(); try { i = a.openFileInput("CN1$AndroidServiceProperties"); } catch (FileNotFoundException notFoundEx){} if(i == null) { return serviceProperties; } DataInputStream is = new DataInputStream(i); int count = is.readInt(); for (int idx=0; idx<count; idx++) { String key = is.readUTF(); String value = is.readUTF(); serviceProperties.put(key, value); } } catch (IOException ex) { Logger.getLogger(AndroidImplementation.class.getName()).log(Level.SEVERE, null, ex); } finally { try { if (i != null) i.close(); } catch (Throwable ex) { Logger.getLogger(AndroidImplementation.class.getName()).log(Level.SEVERE, null, ex); } } } return serviceProperties; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getServiceProperties 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
getServiceProperties
Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java
dad49c9ef26a598619fc48d2697151a02987d478
0
Analyze the following code function for security vulnerabilities
@Override public int getKeyLength() { return 32; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getKeyLength File: src/main/java/com/southernstorm/noise/protocol/AESGCMFallbackCipherState.java Repository: rweather/noise-java The code follows secure coding practices.
[ "CWE-125", "CWE-787" ]
CVE-2020-25021
HIGH
7.5
rweather/noise-java
getKeyLength
src/main/java/com/southernstorm/noise/protocol/AESGCMFallbackCipherState.java
18e86b6f8bea7326934109aa9ffa705ebf4bde90
0
Analyze the following code function for security vulnerabilities
private void mergeMediaPackageElements(MediaPackage mp, MediaPackage scheduledMp) { // drop catalogs sent by the capture agent in favor of Opencast's own metadata if (skipCatalogs) { for (MediaPackageElement element : mp.getCatalogs()) { if (!element.getFlavor().equals(MediaPackageElements.SMIL)) { mp.remove(element); } } } // drop attachments the capture agent sent us in favor of Opencast's attachments // e.g. prevent capture agents from modifying security rules of schedules events if (skipAttachments) { for (MediaPackageElement element : mp.getAttachments()) { mp.remove(element); } } for (MediaPackageElement element : scheduledMp.getElements()) { if (MediaPackageElement.Type.Publication.equals(element.getElementType())) { // The Asset managed media package may have a publication element for a live event, if retract live has not run yet. // Publications do not have flavors and are never part of the mediapackage from the capture agent. // Therefore, ignore publication element because it is removed when the recorded media is published and causes complications (on short media) if added. logger.debug("Ignoring {}, not adding to ingested mediapackage {}", MediaPackageElement.Type.Publication, mp); continue; } else if (mp.getElementsByFlavor(element.getFlavor()).length > 0) { // The default is to overwrite matching flavored elements in the Asset managed mediapackage (e.g. catalogs) // If isOverwrite is true, changes made from the CA overwrite (update/revert) changes made from the Admin UI. // If isOverwrite is false, changes made from the CA do not overwrite (update/revert) changes made from the Admin UI. // regardless of overwrite, always keep new ingested tracks. if (!isAddOnlyNew || MediaPackageElement.Type.Track.equals(element.getElementType())) { // Allow updates made from the Capture Agent to overwrite existing metadata in Opencast logger.info( "Omitting Opencast (Asset Managed) element '{}', replacing with ingested element of same flavor '{}'", element, element.getFlavor()); continue; } // Remove flavored element from ingested mp and replaced it with maching element from Asset Managed mediapackage. // This protects updates made from the admin UI during an event capture from being reverted by artifacts from the ingested CA. for (MediaPackageElement el : mp.getElementsByFlavor(element.getFlavor())) { logger.info("Omitting ingested element '{}' {}, keeping existing (Asset Managed) element of same flavor '{}'", el, el.getURI(), element.getFlavor()); mp.remove(el); } } logger.info("Adding element {} from scheduled (Asset Managed) event '{}' into ingested mediapackage", element, mp); mp.add(element); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: mergeMediaPackageElements File: modules/ingest-service-impl/src/main/java/org/opencastproject/ingest/impl/IngestServiceImpl.java Repository: opencast The code follows secure coding practices.
[ "CWE-287" ]
CVE-2022-29237
MEDIUM
5.5
opencast
mergeMediaPackageElements
modules/ingest-service-impl/src/main/java/org/opencastproject/ingest/impl/IngestServiceImpl.java
8d5ec1614eed109b812bc27b0c6d3214e456d4e7
0
Analyze the following code function for security vulnerabilities
final WindowState windowForClientLocked(Session session, IBinder client, boolean throwOnError) { WindowState win = mWindowMap.get(client); if (localLOGV) Slog.v( TAG, "Looking up client " + client + ": " + win); if (win == null) { RuntimeException ex = new IllegalArgumentException( "Requested window " + client + " does not exist"); if (throwOnError) { throw ex; } Slog.w(TAG, "Failed looking up window", ex); return null; } if (session != null && win.mSession != session) { RuntimeException ex = new IllegalArgumentException( "Requested window " + client + " is in session " + win.mSession + ", not " + session); if (throwOnError) { throw ex; } Slog.w(TAG, "Failed looking up window", ex); return null; } return win; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: windowForClientLocked 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
windowForClientLocked
services/core/java/com/android/server/wm/WindowManagerService.java
69729fa8b13cadbf3173fe1f389fe4f3b7bd0f9c
0
Analyze the following code function for security vulnerabilities
public abstract BaseXMLBuilder t(String value);
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: t 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
t
src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java
e6fddca201790abab4f2c274341c0bb8835c3e73
0
Analyze the following code function for security vulnerabilities
private void suspendAutohide() { mHandler.removeCallbacks(mAutohide); mHandler.removeCallbacks(mCheckBarModes); mAutohideSuspended = (mSystemUiVisibility & STATUS_OR_NAV_TRANSIENT) != 0; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: suspendAutohide 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
suspendAutohide
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
c574568aaede7f652432deb7707f20ae54bbdf9a
0
Analyze the following code function for security vulnerabilities
@Override public void setApplicationRestrictions(ComponentName who, String callerPackage, String packageName, Bundle settings) { final CallerIdentity caller = getCallerIdentity(who, callerPackage); Preconditions.checkCallAuthorization((caller.hasAdminComponent() && (isProfileOwner(caller) || isDefaultDeviceOwner(caller))) || (caller.hasPackage() && isCallerDelegate(caller, DELEGATION_APP_RESTRICTIONS))); checkCanExecuteOrThrowUnsafe(DevicePolicyManager.OPERATION_SET_APPLICATION_RESTRICTIONS); mInjector.binderWithCleanCallingIdentity(() -> { mUserManager.setApplicationRestrictions(packageName, settings, caller.getUserHandle()); DevicePolicyEventLogger .createEvent(DevicePolicyEnums.SET_APPLICATION_RESTRICTIONS) .setAdmin(caller.getPackageName()) .setBoolean(/* isDelegate */ who == null) .setStrings(packageName) .write(); }); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setApplicationRestrictions 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
setApplicationRestrictions
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
ed3f25b7222d4cff471f2b7d22d1150348146957
0
Analyze the following code function for security vulnerabilities
protected void initIdentityServer() { IDPType idpConfiguration = getIdpConfiguration(); // The Identity Server on the servlet context gets set // in the implementation of IdentityServer // Create an Identity Server and set it on the context IdentityServer identityServer = (IdentityServer) getContext().getServletContext().getAttribute( GeneralConstants.IDENTITY_SERVER); if (identityServer == null) { identityServer = new IdentityServer(); getContext().getServletContext().setAttribute(GeneralConstants.IDENTITY_SERVER, identityServer); if (StringUtil.isNotNull(idpConfiguration.getIdentityParticipantStack())) { try { Class<?> clazz = SecurityActions.loadClass(getClass(), idpConfiguration.getIdentityParticipantStack()); if (clazz == null) { throw logger.classNotLoadedError(idpConfiguration.getIdentityParticipantStack()); } identityServer.setStack((IdentityParticipantStack) clazz.newInstance()); } catch (Exception e) { logger.samlIDPUnableToSetParticipantStackUsingDefault(e); } } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: initIdentityServer File: picketlink-tomcat-common/src/main/java/org/picketlink/identity/federation/bindings/tomcat/idp/AbstractIDPValve.java Repository: picketlink/picketlink-bindings The code follows secure coding practices.
[ "CWE-264" ]
CVE-2015-3158
MEDIUM
4
picketlink/picketlink-bindings
initIdentityServer
picketlink-tomcat-common/src/main/java/org/picketlink/identity/federation/bindings/tomcat/idp/AbstractIDPValve.java
341a37aefd69e67b6b5f6d775499730d6ccaff0d
0
Analyze the following code function for security vulnerabilities
@Override public boolean getApplicationHiddenSettingAsUser(String packageName, int userId) { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USERS, null); enforceCrossUserPermission(Binder.getCallingUid(), userId, true, false, "getApplicationHidden for user " + userId); PackageSetting pkgSetting; long callingId = Binder.clearCallingIdentity(); try { // writer synchronized (mPackages) { pkgSetting = mSettings.mPackages.get(packageName); if (pkgSetting == null) { return true; } return pkgSetting.getHidden(userId); } } finally { Binder.restoreCallingIdentity(callingId); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getApplicationHiddenSettingAsUser 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
getApplicationHiddenSettingAsUser
services/core/java/com/android/server/pm/PackageManagerService.java
a75537b496e9df71c74c1d045ba5569631a16298
0
Analyze the following code function for security vulnerabilities
@Override public VFSStatus canVersion() { return VFSRepositoryModule.canVersion(getBasefile()); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: canVersion File: src/main/java/org/olat/core/util/vfs/LocalFolderImpl.java Repository: OpenOLAT The code follows secure coding practices.
[ "CWE-22" ]
CVE-2021-41242
HIGH
7.9
OpenOLAT
canVersion
src/main/java/org/olat/core/util/vfs/LocalFolderImpl.java
336d5ce80681be61a0bbf4f73d2af5d1ff67e93a
0
Analyze the following code function for security vulnerabilities
@Deprecated @Override public IIntentSender getIntentSender(int type, String packageName, IBinder token, String resultWho, int requestCode, Intent[] intents, String[] resolvedTypes, int flags, Bundle bOptions, int userId) { return getIntentSenderWithFeature(type, packageName, null, token, resultWho, requestCode, intents, resolvedTypes, flags, bOptions, userId); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getIntentSender 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
getIntentSender
services/core/java/com/android/server/am/ActivityManagerService.java
d10b27e539f7bc91c2360d429b9d05f05274670d
0
Analyze the following code function for security vulnerabilities
public String getAcceptType() { return acceptType; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getAcceptType File: src/main/java/org/bedework/webdav/servlet/common/PostRequestPars.java Repository: Bedework/bw-webdav The code follows secure coding practices.
[ "CWE-611" ]
CVE-2018-20000
MEDIUM
5
Bedework/bw-webdav
getAcceptType
src/main/java/org/bedework/webdav/servlet/common/PostRequestPars.java
67283fb8b9609acdb1a8d2e7fefe195b4a261062
0
Analyze the following code function for security vulnerabilities
protected String getSystemIdForFileName(String fileName) { InputStream fileInputStream = null; try { String urlPath = null; File file = new File(fileName); // files in filesystem if (!file.exists()) { URL url = getURL(fileName); if (url != null) { try { urlPath = URLDecoder.decode(url.getPath(), "UTF-8"); } catch (UnsupportedEncodingException e) { log.warn("Unable to decode file path URL", e); } try { if(url != null) fileInputStream = url.openStream(); } catch (IOException ignore) { } } } else { try { fileInputStream = new FileInputStream(file); }catch (FileNotFoundException ignore) { } } if (fileInputStream == null) { log.debug("Unable to resolve '" + fileName + "' to full path, so using it as is for system id."); return fileName; } else { return (urlPath != null) ? urlPath : file.getAbsolutePath(); } } finally { try { if (fileInputStream != null) { fileInputStream.close(); } } catch (IOException ioe) { log.warn("Error closing jobs file: " + fileName, ioe); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getSystemIdForFileName File: quartz-core/src/main/java/org/quartz/xml/XMLSchedulingDataProcessor.java Repository: quartz-scheduler/quartz The code follows secure coding practices.
[ "CWE-611" ]
CVE-2019-13990
HIGH
7.5
quartz-scheduler/quartz
getSystemIdForFileName
quartz-core/src/main/java/org/quartz/xml/XMLSchedulingDataProcessor.java
a1395ba118df306c7fe67c24fb0c9a95a4473140
0
Analyze the following code function for security vulnerabilities
protected void convertNumberToBigInteger() throws IOException { if ((_numTypesValid & NR_BIGDECIMAL) != 0) { // here it'll just get truncated, no exceptions thrown _numberBigInt = _numberBigDecimal.toBigInteger(); } else if ((_numTypesValid & NR_LONG) != 0) { _numberBigInt = BigInteger.valueOf(_numberLong); } else if ((_numTypesValid & NR_INT) != 0) { _numberBigInt = BigInteger.valueOf(_numberInt); } else if ((_numTypesValid & NR_DOUBLE) != 0) { _numberBigInt = BigDecimal.valueOf(_numberDouble).toBigInteger(); } else if ((_numTypesValid & NR_FLOAT) != 0) { _numberBigInt = BigDecimal.valueOf(_numberFloat).toBigInteger(); } else { _throwInternal(); } _numTypesValid |= NR_BIGINT; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: convertNumberToBigInteger File: cbor/src/main/java/com/fasterxml/jackson/dataformat/cbor/CBORParser.java Repository: FasterXML/jackson-dataformats-binary The code follows secure coding practices.
[ "CWE-770" ]
CVE-2020-28491
MEDIUM
5
FasterXML/jackson-dataformats-binary
convertNumberToBigInteger
cbor/src/main/java/com/fasterxml/jackson/dataformat/cbor/CBORParser.java
de072d314af8f5f269c8abec6930652af67bc8e6
0
Analyze the following code function for security vulnerabilities
@Override public boolean setCountryCode(String countryCode) { return mWifiNative.setStaCountryCode(mInterfaceName, countryCode); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setCountryCode File: service/java/com/android/server/wifi/ClientModeImpl.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21242
CRITICAL
9.8
android
setCountryCode
service/java/com/android/server/wifi/ClientModeImpl.java
72e903f258b5040b8f492cf18edd124b5a1ac770
0
Analyze the following code function for security vulnerabilities
void updateUnlockMethodAndFinish(int quality, boolean disabled, boolean chooseLockSkipped) { // Sanity check. We should never get here without confirming user's existing password. if (!mPasswordConfirmed) { throw new IllegalStateException("Tried to update password without confirming it"); } quality = mController.upgradeQuality(quality); Intent intent = getIntentForUnlockMethod(quality); if (intent != null) { if (getIntent().getBooleanExtra(EXTRA_SHOW_OPTIONS_BUTTON, false)) { intent.putExtra(EXTRA_SHOW_OPTIONS_BUTTON, chooseLockSkipped); } intent.putExtra(EXTRA_CHOOSE_LOCK_GENERIC_EXTRAS, getIntent().getExtras()); startActivityForResult(intent, mIsSetNewPassword && mHasChallenge ? CHOOSE_LOCK_BEFORE_FINGERPRINT_REQUEST : CHOOSE_LOCK_REQUEST); return; } if (quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) { mChooseLockSettingsHelper.utils().clearLock(mUserPassword, mUserId); mChooseLockSettingsHelper.utils().setLockScreenDisabled(disabled, mUserId); getActivity().setResult(Activity.RESULT_OK); removeAllFingerprintForUserAndFinish(mUserId); } else { removeAllFingerprintForUserAndFinish(mUserId); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: updateUnlockMethodAndFinish File: src/com/android/settings/password/ChooseLockGeneric.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2018-9501
HIGH
7.2
android
updateUnlockMethodAndFinish
src/com/android/settings/password/ChooseLockGeneric.java
5e43341b8c7eddce88f79c9a5068362927c05b54
0
Analyze the following code function for security vulnerabilities
@Override public User getUser() throws IllegalStateException { Organization org = getOrganization(); if (org == null) throw new IllegalStateException("No organization is set in security context"); User delegatedUser = delegatedUserHolder.get(); if (delegatedUser != null) { return delegatedUser; } Authentication auth = SecurityContextHolder.getContext().getAuthentication(); JaxbOrganization jaxbOrganization = JaxbOrganization.fromOrganization(org); if (auth != null) { Object principal = auth.getPrincipal(); if ((principal != null) && (principal instanceof UserDetails)) { UserDetails userDetails = (UserDetails) principal; User user = null; // If user exists, fetch it from the userDirectory if (userDirectory != null) { user = userDirectory.loadUser(userDetails.getUsername()); if (user == null) { logger.debug( "Authenticated user '{}' could not be found in any of the current UserProviders. Continuing anyway...", userDetails.getUsername()); } } else { logger.debug("No UserDirectory was found when trying to search for user '{}'", userDetails.getUsername()); } // Add the roles (authorities) in the security context Set<JaxbRole> roles = new HashSet<JaxbRole>(); Collection<? extends GrantedAuthority> authorities = auth.getAuthorities(); if (authorities != null) { for (GrantedAuthority ga : authorities) { roles.add(new JaxbRole(ga.getAuthority(), jaxbOrganization)); } } if (user == null) { // No user was found. Create one to hold the auth information from the security context user = new JaxbUser(userDetails.getUsername(), null, jaxbOrganization, roles); } else { // Combine the existing user with the roles in the security context user = JaxbUser.fromUser(user, roles); } // Save the user to retrieve it quicker the next time(s) this method is called (by this thread) delegatedUserHolder.set(user); return user; } } // Return the anonymous user by default return SecurityUtil.createAnonymousUser(jaxbOrganization); }
Vulnerability Classification: - CWE: CWE-287 - CVE: CVE-2020-5206 - Severity: MEDIUM - CVSS Score: 6.4 Description: Authentication Bypass For Endpoints With Anonymous Access Using a remember-me cookie with an arbitrary username can cause Opencast to assume proper authentication for that user even if the remember-me cookie was incorrect given that the attacked endpoint also allows anonymous access. This way, an attacker can, for example, fake a remember-me token, assume the identity of the global system administrator and request non-public content from the search service without ever providing any proper authentication. The reason for this problem is that using a remember-me cookie will always cause the user in the request context to be populated, even if the cookie is invalid by now. This is usually no problem, except in combination with anonymous access where anonymous authentication is granted and the request may continue. In such a case, Opencast's security service would just check that a user existed in the request context and assume proper authentication of this user, never checking if it's actually anonymous authentication. This patch adds this additional check, falling back to the anonymous user in case of anonymous authentication. Function: getUser File: modules/kernel/src/main/java/org/opencastproject/kernel/security/SecurityServiceSpringImpl.java Repository: opencast Fixed Code: @Override public User getUser() throws IllegalStateException { Organization org = getOrganization(); if (org == null) throw new IllegalStateException("No organization is set in security context"); User delegatedUser = delegatedUserHolder.get(); Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (auth instanceof AnonymousAuthenticationToken) { return SecurityUtil.createAnonymousUser(org); } if (delegatedUser != null) { return delegatedUser; } JaxbOrganization jaxbOrganization = JaxbOrganization.fromOrganization(org); if (auth != null) { Object principal = auth.getPrincipal(); if ((principal instanceof UserDetails)) { UserDetails userDetails = (UserDetails) principal; User user = null; // If user exists, fetch it from the userDirectory if (userDirectory != null) { user = userDirectory.loadUser(userDetails.getUsername()); if (user == null) { logger.debug("Authenticated user '{}' could not be found in any of the current UserProviders. " + "Continuing anyway...", userDetails.getUsername()); } } else { logger.debug("No UserDirectory was found when trying to search for user '{}'", userDetails.getUsername()); } // Add the roles (authorities) in the security context Set<JaxbRole> roles = new HashSet<>(); Collection<? extends GrantedAuthority> authorities = auth.getAuthorities(); if (authorities != null) { for (GrantedAuthority ga : authorities) { roles.add(new JaxbRole(ga.getAuthority(), jaxbOrganization)); } } if (user == null) { // No user was found. Create one to hold the auth information from the security context user = new JaxbUser(userDetails.getUsername(), null, jaxbOrganization, roles); } else { // Combine the existing user with the roles in the security context user = JaxbUser.fromUser(user, roles); } // Save the user to retrieve it quicker the next time(s) this method is called (by this thread) delegatedUserHolder.set(user); return user; } } // Return the anonymous user by default return SecurityUtil.createAnonymousUser(jaxbOrganization); }
[ "CWE-287" ]
CVE-2020-5206
MEDIUM
6.4
opencast
getUser
modules/kernel/src/main/java/org/opencastproject/kernel/security/SecurityServiceSpringImpl.java
b157e1fb3b35991ca7bf59f0730329fbe7ce82e8
1
Analyze the following code function for security vulnerabilities
private boolean canDPCManagedUserUseLockTaskLocked(int userId) { if (isUserAffiliatedWithDeviceLocked(userId)) { return true; } // Unaffiliated profile owners are not allowed to use lock when there is a device owner. if (mOwners.hasDeviceOwner()) { return false; } final ComponentName profileOwner = getProfileOwnerAsUser(userId); if (profileOwner == null) { return false; } // Managed profiles are not allowed to use lock task if (isManagedProfile(userId)) { return false; } return true; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: canDPCManagedUserUseLockTaskLocked File: services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-862" ]
CVE-2023-40089
HIGH
7.8
android
canDPCManagedUserUseLockTaskLocked
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
e2e05f488da6abc765a62e7faf10cb74e729732e
0
Analyze the following code function for security vulnerabilities
public String getStatus() { return status; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getStatus File: src/main/java/cn/luischen/model/ContentDomain.java Repository: WinterChenS/my-site The code follows secure coding practices.
[ "CWE-79" ]
CVE-2023-29638
MEDIUM
5.4
WinterChenS/my-site
getStatus
src/main/java/cn/luischen/model/ContentDomain.java
d104f38aaae2f1b76c33fadfcf6b1ef1c6c340ed
0
Analyze the following code function for security vulnerabilities
public SocketConfigurator getSocketConfigurator() { return socketConf; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getSocketConfigurator File: src/main/java/com/rabbitmq/client/ConnectionFactory.java Repository: rabbitmq/rabbitmq-java-client The code follows secure coding practices.
[ "CWE-400" ]
CVE-2023-46120
HIGH
7.5
rabbitmq/rabbitmq-java-client
getSocketConfigurator
src/main/java/com/rabbitmq/client/ConnectionFactory.java
714aae602dcae6cb4b53cadf009323ebac313cc8
0
Analyze the following code function for security vulnerabilities
public AssetHandler lastModified(final boolean enabled) { this.lastModified = enabled; return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: lastModified File: jooby/src/main/java/org/jooby/handlers/AssetHandler.java Repository: jooby-project/jooby The code follows secure coding practices.
[ "CWE-22" ]
CVE-2020-7647
MEDIUM
5
jooby-project/jooby
lastModified
jooby/src/main/java/org/jooby/handlers/AssetHandler.java
34f526028e6cd0652125baa33936ffb6a8a4a009
0
Analyze the following code function for security vulnerabilities
public void addIntCreator(AnnotatedWithParams creator, boolean explicit) { verifyNonDup(creator, C_INT, explicit); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: addIntCreator File: src/main/java/com/fasterxml/jackson/databind/deser/impl/CreatorCollector.java Repository: FasterXML/jackson-databind The code follows secure coding practices.
[ "CWE-502" ]
CVE-2019-16942
HIGH
7.5
FasterXML/jackson-databind
addIntCreator
src/main/java/com/fasterxml/jackson/databind/deser/impl/CreatorCollector.java
54aa38d87dcffa5ccc23e64922e9536c82c1b9c8
0
Analyze the following code function for security vulnerabilities
private byte[] getPasswordVerifier() throws IOException { byte[] pvBytes = new byte[2]; readRaw(pvBytes); return pvBytes; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getPasswordVerifier File: src/main/java/net/lingala/zip4j/io/inputstream/AesCipherInputStream.java Repository: srikanth-lingala/zip4j The code follows secure coding practices.
[ "CWE-346" ]
CVE-2023-22899
MEDIUM
5.9
srikanth-lingala/zip4j
getPasswordVerifier
src/main/java/net/lingala/zip4j/io/inputstream/AesCipherInputStream.java
ddd8fdc8ad0583eb4a6172dc86c72c881485c55b
0
Analyze the following code function for security vulnerabilities
public void addChunkLoad(int cx, int cz) { if (world == null) { return; } world.checkLoadedChunk(BlockVector3.at(cx << 4, 0, cz << 4)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: addChunkLoad File: worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java Repository: IntellectualSites/FastAsyncWorldEdit The code follows secure coding practices.
[ "CWE-400" ]
CVE-2023-35925
MEDIUM
5.5
IntellectualSites/FastAsyncWorldEdit
addChunkLoad
worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java
3a8dfb4f7b858a439c35f7af1d56d21f796f61f5
0
Analyze the following code function for security vulnerabilities
@Override public int countTotal(Context context) throws SQLException { return collectionDAO.countRows(context); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: countTotal File: dspace-api/src/main/java/org/dspace/content/CollectionServiceImpl.java Repository: DSpace The code follows secure coding practices.
[ "CWE-863" ]
CVE-2021-41189
HIGH
9
DSpace
countTotal
dspace-api/src/main/java/org/dspace/content/CollectionServiceImpl.java
277b499a5cd3a4f5eb2370513a1b7e4ec2a6e041
0
Analyze the following code function for security vulnerabilities
public boolean hasBacklinks() throws XWikiException { return this.xwiki.hasBacklinks(getXWikiContext()); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: hasBacklinks 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
hasBacklinks
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
protected LogHandler createLogHandler(ServletConfig pServletConfig, final boolean pDebug) { return new LogHandler() { /** {@inheritDoc} */ public void debug(String message) { if (pDebug) { log(message); } } /** {@inheritDoc} */ public void info(String message) { log(message); } /** {@inheritDoc} */ public void error(String message, Throwable t) { log(message,t); } }; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: createLogHandler File: agent/core/src/main/java/org/jolokia/http/AgentServlet.java Repository: jolokia The code follows secure coding practices.
[ "CWE-352" ]
CVE-2014-0168
MEDIUM
6.8
jolokia
createLogHandler
agent/core/src/main/java/org/jolokia/http/AgentServlet.java
2d9b168cfbbf5a6d16fa6e8a5b34503e3dc42364
0
Analyze the following code function for security vulnerabilities
private GHResponse calcRoute(List<Double> favoredHeadings, List<GHPoint> requestPoints, String profileStr, String localeStr, boolean enableInstructions, double minPathPrecision) { GHRequest request; if (favoredHeadings.size() > 0) { request = new GHRequest(requestPoints, favoredHeadings); } else { request = new GHRequest(requestPoints); } request.setProfile(profileStr). setLocale(localeStr). putHint(CALC_POINTS, true). putHint(INSTRUCTIONS, enableInstructions). putHint(WAY_POINT_MAX_DISTANCE, minPathPrecision). putHint(Parameters.CH.DISABLE, true). putHint(Parameters.Routing.PASS_THROUGH, false); return graphHopper.route(request); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: calcRoute File: navigation/src/main/java/com/graphhopper/navigation/NavigateResource.java Repository: graphhopper The code follows secure coding practices.
[ "CWE-400" ]
CVE-2021-29506
MEDIUM
4
graphhopper
calcRoute
navigation/src/main/java/com/graphhopper/navigation/NavigateResource.java
eb189be1fa7443ebf4ae881e737a18f818c95f41
0
Analyze the following code function for security vulnerabilities
private void closeInactiveUIs(VaadinSession session) { final String sessionId = session.getSession().getId(); for (final UI ui : session.getUIs()) { if (!isUIActive(ui) && !ui.isClosing()) { ui.accessSynchronously(() -> { getLogger().log(Level.FINE, "Closing inactive UI #{0} in session {1}", new Object[] { ui.getUIId(), sessionId }); ui.close(); }); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: closeInactiveUIs 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
closeInactiveUIs
server/src/main/java/com/vaadin/server/VaadinService.java
d852126ab6f0c43f937239305bd0e9594834fe34
0
Analyze the following code function for security vulnerabilities
public static void move(File from, File to) throws IOException { checkNotNull(from); checkNotNull(to); checkArgument(!from.equals(to), "Source %s and destination %s must be different", from, to); if (!from.renameTo(to)) { copy(from, to); if (!from.delete()) { if (!to.delete()) { throw new IOException("Unable to delete " + to); } throw new IOException("Unable to delete " + from); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: move File: guava/src/com/google/common/io/Files.java Repository: google/guava The code follows secure coding practices.
[ "CWE-552" ]
CVE-2023-2976
HIGH
7.1
google/guava
move
guava/src/com/google/common/io/Files.java
feb83a1c8fd2e7670b244d5afd23cba5aca43284
0
Analyze the following code function for security vulnerabilities
@Override public void setNearbyNotificationStreamingPolicy(int policy) { if (!mHasFeature) { return; } final CallerIdentity caller = getCallerIdentity(); Preconditions.checkCallAuthorization( isDefaultDeviceOwner(caller) || isProfileOwner(caller)); synchronized (getLockObject()) { final ActiveAdmin admin = getProfileOwnerOrDeviceOwnerLocked(caller.getUserId()); if (admin.mNearbyNotificationStreamingPolicy != policy) { admin.mNearbyNotificationStreamingPolicy = policy; saveSettingsLocked(caller.getUserId()); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setNearbyNotificationStreamingPolicy File: services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-862" ]
CVE-2023-40089
HIGH
7.8
android
setNearbyNotificationStreamingPolicy
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
e2e05f488da6abc765a62e7faf10cb74e729732e
0
Analyze the following code function for security vulnerabilities
@Test public void removesOrderByInGeneratedCountQueryFromOriginalQueryIfPresent() { assertCountQuery("select distinct m.genre from Media m where m.user = ?1 OrDer By m.genre ASC", "select count(distinct m.genre) from Media m where m.user = ?1"); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: removesOrderByInGeneratedCountQueryFromOriginalQueryIfPresent File: src/test/java/org/springframework/data/jpa/repository/query/QueryUtilsUnitTests.java Repository: spring-projects/spring-data-jpa The code follows secure coding practices.
[ "CWE-89" ]
CVE-2016-6652
MEDIUM
6.8
spring-projects/spring-data-jpa
removesOrderByInGeneratedCountQueryFromOriginalQueryIfPresent
src/test/java/org/springframework/data/jpa/repository/query/QueryUtilsUnitTests.java
b8e7fe
0
Analyze the following code function for security vulnerabilities
public void updateNCharacterStream(@Positive int columnIndex, @Nullable Reader x, long length) throws SQLException { throw org.postgresql.Driver.notImplemented(this.getClass(), "updateNCharacterStream(int, Reader, long)"); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: updateNCharacterStream File: pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java Repository: pgjdbc The code follows secure coding practices.
[ "CWE-89" ]
CVE-2022-31197
HIGH
8
pgjdbc
updateNCharacterStream
pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
739e599d52ad80f8dcd6efedc6157859b1a9d637
0
Analyze the following code function for security vulnerabilities
@DeleteMapping("/{modelId}") @Authorize(action = Permission.ACTION_DELETE) public ResponseMessage<Void> delete(@PathVariable String modelId) { repositoryService.deleteModel(modelId); return ResponseMessage.ok(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: delete File: hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/src/main/java/org/hswebframework/web/workflow/web/FlowableModelManagerController.java Repository: hs-web/hsweb-framework The code follows secure coding practices.
[ "CWE-79" ]
CVE-2018-20594
MEDIUM
4.3
hs-web/hsweb-framework
delete
hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/src/main/java/org/hswebframework/web/workflow/web/FlowableModelManagerController.java
b72a2275ed21240296c6539bae1049c56abb542f
0
Analyze the following code function for security vulnerabilities
@Override public KBTemplate updateImpl(KBTemplate kbTemplate) { kbTemplate = toUnwrappedModel(kbTemplate); boolean isNew = kbTemplate.isNew(); KBTemplateModelImpl kbTemplateModelImpl = (KBTemplateModelImpl)kbTemplate; if (Validator.isNull(kbTemplate.getUuid())) { String uuid = PortalUUIDUtil.generate(); kbTemplate.setUuid(uuid); } ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext(); Date now = new Date(); if (isNew && (kbTemplate.getCreateDate() == null)) { if (serviceContext == null) { kbTemplate.setCreateDate(now); } else { kbTemplate.setCreateDate(serviceContext.getCreateDate(now)); } } if (!kbTemplateModelImpl.hasSetModifiedDate()) { if (serviceContext == null) { kbTemplate.setModifiedDate(now); } else { kbTemplate.setModifiedDate(serviceContext.getModifiedDate(now)); } } Session session = null; try { session = openSession(); if (kbTemplate.isNew()) { session.save(kbTemplate); kbTemplate.setNew(false); } else { kbTemplate = (KBTemplate)session.merge(kbTemplate); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); if (!KBTemplateModelImpl.COLUMN_BITMASK_ENABLED) { finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); } else if (isNew) { Object[] args = new Object[] { kbTemplateModelImpl.getUuid() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID, args); args = new Object[] { kbTemplateModelImpl.getUuid(), kbTemplateModelImpl.getCompanyId() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C, args); args = new Object[] { kbTemplateModelImpl.getGroupId() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID, args); finderCache.removeResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL, FINDER_ARGS_EMPTY); } else { if ((kbTemplateModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) { Object[] args = new Object[] { kbTemplateModelImpl.getOriginalUuid() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID, args); args = new Object[] { kbTemplateModelImpl.getUuid() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID, args); } if ((kbTemplateModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C.getColumnBitmask()) != 0) { Object[] args = new Object[] { kbTemplateModelImpl.getOriginalUuid(), kbTemplateModelImpl.getOriginalCompanyId() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C, args); args = new Object[] { kbTemplateModelImpl.getUuid(), kbTemplateModelImpl.getCompanyId() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C, args); } if ((kbTemplateModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) { Object[] args = new Object[] { kbTemplateModelImpl.getOriginalGroupId() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID, args); args = new Object[] { kbTemplateModelImpl.getGroupId() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID, args); } } entityCache.putResult(KBTemplateModelImpl.ENTITY_CACHE_ENABLED, KBTemplateImpl.class, kbTemplate.getPrimaryKey(), kbTemplate, false); clearUniqueFindersCache(kbTemplateModelImpl, false); cacheUniqueFindersCache(kbTemplateModelImpl); kbTemplate.resetOriginalValues(); return kbTemplate; }
Vulnerability Classification: - CWE: CWE-79 - CVE: CVE-2017-12647 - Severity: MEDIUM - CVSS Score: 4.3 Description: LPS-72090 Sanitize content to prevent XSS Function: updateImpl File: modules/apps/knowledge-base/knowledge-base-service/src/main/java/com/liferay/knowledge/base/service/persistence/impl/KBTemplatePersistenceImpl.java Repository: brianchandotcom/liferay-portal Fixed Code: @Override public KBTemplate updateImpl(KBTemplate kbTemplate) { kbTemplate = toUnwrappedModel(kbTemplate); boolean isNew = kbTemplate.isNew(); KBTemplateModelImpl kbTemplateModelImpl = (KBTemplateModelImpl)kbTemplate; if (Validator.isNull(kbTemplate.getUuid())) { String uuid = PortalUUIDUtil.generate(); kbTemplate.setUuid(uuid); } ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext(); Date now = new Date(); if (isNew && (kbTemplate.getCreateDate() == null)) { if (serviceContext == null) { kbTemplate.setCreateDate(now); } else { kbTemplate.setCreateDate(serviceContext.getCreateDate(now)); } } if (!kbTemplateModelImpl.hasSetModifiedDate()) { if (serviceContext == null) { kbTemplate.setModifiedDate(now); } else { kbTemplate.setModifiedDate(serviceContext.getModifiedDate(now)); } } long userId = GetterUtil.getLong(PrincipalThreadLocal.getName()); if (userId > 0) { long companyId = kbTemplate.getCompanyId(); long groupId = kbTemplate.getGroupId(); long kbTemplateId = 0; if (!isNew) { kbTemplateId = kbTemplate.getPrimaryKey(); } try { kbTemplate.setContent(SanitizerUtil.sanitize(companyId, groupId, userId, KBTemplate.class.getName(), kbTemplateId, ContentTypes.TEXT_HTML, Sanitizer.MODE_ALL, kbTemplate.getContent(), null)); } catch (SanitizerException se) { throw new SystemException(se); } } Session session = null; try { session = openSession(); if (kbTemplate.isNew()) { session.save(kbTemplate); kbTemplate.setNew(false); } else { kbTemplate = (KBTemplate)session.merge(kbTemplate); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); if (!KBTemplateModelImpl.COLUMN_BITMASK_ENABLED) { finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); } else if (isNew) { Object[] args = new Object[] { kbTemplateModelImpl.getUuid() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID, args); args = new Object[] { kbTemplateModelImpl.getUuid(), kbTemplateModelImpl.getCompanyId() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C, args); args = new Object[] { kbTemplateModelImpl.getGroupId() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID, args); finderCache.removeResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL, FINDER_ARGS_EMPTY); } else { if ((kbTemplateModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) { Object[] args = new Object[] { kbTemplateModelImpl.getOriginalUuid() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID, args); args = new Object[] { kbTemplateModelImpl.getUuid() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID, args); } if ((kbTemplateModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C.getColumnBitmask()) != 0) { Object[] args = new Object[] { kbTemplateModelImpl.getOriginalUuid(), kbTemplateModelImpl.getOriginalCompanyId() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C, args); args = new Object[] { kbTemplateModelImpl.getUuid(), kbTemplateModelImpl.getCompanyId() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C, args); } if ((kbTemplateModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) { Object[] args = new Object[] { kbTemplateModelImpl.getOriginalGroupId() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID, args); args = new Object[] { kbTemplateModelImpl.getGroupId() }; finderCache.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args); finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID, args); } } entityCache.putResult(KBTemplateModelImpl.ENTITY_CACHE_ENABLED, KBTemplateImpl.class, kbTemplate.getPrimaryKey(), kbTemplate, false); clearUniqueFindersCache(kbTemplateModelImpl, false); cacheUniqueFindersCache(kbTemplateModelImpl); kbTemplate.resetOriginalValues(); return kbTemplate; }
[ "CWE-79" ]
CVE-2017-12647
MEDIUM
4.3
brianchandotcom/liferay-portal
updateImpl
modules/apps/knowledge-base/knowledge-base-service/src/main/java/com/liferay/knowledge/base/service/persistence/impl/KBTemplatePersistenceImpl.java
ef93d984be9d4d478a5c4b1ca9a86f4e80174774
1
Analyze the following code function for security vulnerabilities
private static native @Nullable String nativeGetLastResourceResolution(long ptr);
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: nativeGetLastResourceResolution 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
nativeGetLastResourceResolution
core/java/android/content/res/AssetManager.java
c3bc12c484ef3bbca4cec19234437c45af5e584d
0
Analyze the following code function for security vulnerabilities
@Override public boolean refresh() { highlighters.clear(); return true; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: refresh File: console/src/main/java/org/jline/console/impl/DefaultPrinter.java Repository: jline/jline3 The code follows secure coding practices.
[ "CWE-787" ]
CVE-2023-50572
MEDIUM
5.5
jline/jline3
refresh
console/src/main/java/org/jline/console/impl/DefaultPrinter.java
f3c60a3e6255e8e0c20d5043a4fe248446f292bb
0
Analyze the following code function for security vulnerabilities
void recordPssSampleLocked(ProcessRecord proc, int procState, long pss, long uss, long now) { EventLogTags.writeAmPss(proc.pid, proc.uid, proc.processName, pss * 1024, uss * 1024); proc.lastPssTime = now; proc.baseProcessTracker.addPss(pss, uss, true, proc.pkgList); if (DEBUG_PSS) Slog.d(TAG_PSS, "PSS of " + proc.toShortString() + ": " + pss + " lastPss=" + proc.lastPss + " state=" + ProcessList.makeProcStateString(procState)); if (proc.initialIdlePss == 0) { proc.initialIdlePss = pss; } proc.lastPss = pss; if (procState >= ActivityManager.PROCESS_STATE_HOME) { proc.lastCachedPss = pss; } final SparseArray<Pair<Long, String>> watchUids = mMemWatchProcesses.getMap().get(proc.processName); Long check = null; if (watchUids != null) { Pair<Long, String> val = watchUids.get(proc.uid); if (val == null) { val = watchUids.get(0); } if (val != null) { check = val.first; } } if (check != null) { if ((pss * 1024) >= check && proc.thread != null && mMemWatchDumpProcName == null) { boolean isDebuggable = "1".equals(SystemProperties.get(SYSTEM_DEBUGGABLE, "0")); if (!isDebuggable) { if ((proc.info.flags&ApplicationInfo.FLAG_DEBUGGABLE) != 0) { isDebuggable = true; } } if (isDebuggable) { Slog.w(TAG, "Process " + proc + " exceeded pss limit " + check + "; reporting"); final ProcessRecord myProc = proc; final File heapdumpFile = DumpHeapProvider.getJavaFile(); mMemWatchDumpProcName = proc.processName; mMemWatchDumpFile = heapdumpFile.toString(); mMemWatchDumpPid = proc.pid; mMemWatchDumpUid = proc.uid; BackgroundThread.getHandler().post(new Runnable() { @Override public void run() { revokeUriPermission(ActivityThread.currentActivityThread() .getApplicationThread(), DumpHeapActivity.JAVA_URI, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION, UserHandle.myUserId()); ParcelFileDescriptor fd = null; try { heapdumpFile.delete(); fd = ParcelFileDescriptor.open(heapdumpFile, ParcelFileDescriptor.MODE_CREATE | ParcelFileDescriptor.MODE_TRUNCATE | ParcelFileDescriptor.MODE_WRITE_ONLY | ParcelFileDescriptor.MODE_APPEND); IApplicationThread thread = myProc.thread; if (thread != null) { try { if (DEBUG_PSS) Slog.d(TAG_PSS, "Requesting dump heap from " + myProc + " to " + heapdumpFile); thread.dumpHeap(true, heapdumpFile.toString(), fd); } catch (RemoteException e) { } } } catch (FileNotFoundException e) { e.printStackTrace(); } finally { if (fd != null) { try { fd.close(); } catch (IOException e) { } } } } }); } else { Slog.w(TAG, "Process " + proc + " exceeded pss limit " + check + ", but debugging not enabled"); } } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: recordPssSampleLocked File: services/core/java/com/android/server/am/ActivityManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-200" ]
CVE-2016-2500
MEDIUM
4.3
android
recordPssSampleLocked
services/core/java/com/android/server/am/ActivityManagerService.java
9878bb99b77c3681f0fda116e2964bac26f349c3
0
Analyze the following code function for security vulnerabilities
public ApiClient setServers(List<ServerConfiguration> servers) { this.servers = servers; updateBasePath(); return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setServers 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
setServers
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 void toggleBackupServiceActive(int userId, boolean makeActive) { long ident = mInjector.binderClearCallingIdentity(); try { if (mInjector.getIBackupManager() != null) { mInjector.getIBackupManager() .setBackupServiceActive(userId, makeActive); } } catch (RemoteException e) { throw new IllegalStateException(String.format("Failed %s backup service.", makeActive ? "activating" : "deactivating"), e); } finally { mInjector.binderRestoreCallingIdentity(ident); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: toggleBackupServiceActive 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
toggleBackupServiceActive
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
ed3f25b7222d4cff471f2b7d22d1150348146957
0
Analyze the following code function for security vulnerabilities
@Override boolean check(SerializationConfig c1, SerializationConfig c2) { return c1 == c2 || !(c1 == null || c2 == null) && nullSafeEqual(c1.getPortableVersion(), c2.getPortableVersion()) && nullSafeEqual(c1.getDataSerializableFactoryClasses(), c2.getDataSerializableFactoryClasses()) && nullSafeEqual(c1.getPortableFactoryClasses(), c2.getPortableFactoryClasses()) && isCompatible(c1.getGlobalSerializerConfig(), c2.getGlobalSerializerConfig()) && isCollectionCompatible(c1.getSerializerConfigs(), c2.getSerializerConfigs(), new SerializerConfigChecker()) && nullSafeEqual(c1.isCheckClassDefErrors(), c2.isCheckClassDefErrors()) && nullSafeEqual(c1.isUseNativeByteOrder(), c2.isUseNativeByteOrder()) && nullSafeEqual(c1.getByteOrder(), c2.getByteOrder()) && nullSafeEqual(c1.isEnableCompression(), c2.isEnableCompression()) && nullSafeEqual(c1.isEnableSharedObject(), c2.isEnableSharedObject()) && nullSafeEqual(c1.isAllowUnsafe(), c2.isAllowUnsafe()); }
Vulnerability Classification: - CWE: CWE-502 - CVE: CVE-2016-10750 - Severity: MEDIUM - CVSS Score: 6.8 Description: Add basic protection against untrusted deserialization. Function: check File: hazelcast/src/test/java/com/hazelcast/config/ConfigCompatibilityChecker.java Repository: hazelcast Fixed Code: @Override boolean check(SerializationConfig c1, SerializationConfig c2) { return c1 == c2 || !(c1 == null || c2 == null) && nullSafeEqual(c1.getPortableVersion(), c2.getPortableVersion()) && nullSafeEqual(c1.getDataSerializableFactoryClasses(), c2.getDataSerializableFactoryClasses()) && nullSafeEqual(c1.getPortableFactoryClasses(), c2.getPortableFactoryClasses()) && isCompatible(c1.getGlobalSerializerConfig(), c2.getGlobalSerializerConfig()) && isCollectionCompatible(c1.getSerializerConfigs(), c2.getSerializerConfigs(), new SerializerConfigChecker()) && nullSafeEqual(c1.isCheckClassDefErrors(), c2.isCheckClassDefErrors()) && nullSafeEqual(c1.isUseNativeByteOrder(), c2.isUseNativeByteOrder()) && nullSafeEqual(c1.getByteOrder(), c2.getByteOrder()) && nullSafeEqual(c1.isEnableCompression(), c2.isEnableCompression()) && nullSafeEqual(c1.isEnableSharedObject(), c2.isEnableSharedObject()) && nullSafeEqual(c1.isAllowUnsafe(), c2.isAllowUnsafe()) && nullSafeEqual(c1.getJavaSerializationFilterConfig(), c2.getJavaSerializationFilterConfig()); }
[ "CWE-502" ]
CVE-2016-10750
MEDIUM
6.8
hazelcast
check
hazelcast/src/test/java/com/hazelcast/config/ConfigCompatibilityChecker.java
c1c31359a1df953e79a9ca9b6c54b3cdbfef11e9
1
Analyze the following code function for security vulnerabilities
@Override public void channelConnected(final ChannelHandlerContext ctx, final ChannelStateEvent e) throws Exception { if (issueHandshake) { // issue and handshake and add a listener to it which will fire an exception event if // an exception was thrown while doing the handshake handshake().addListener(new ChannelFutureListener() { public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { // Send the event upstream after the handshake was completed without an error. // // See https://github.com/netty/netty/issues/358 ctx.sendUpstream(e); } } }); } else { super.channelConnected(ctx, e); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: channelConnected 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
channelConnected
src/main/java/org/jboss/netty/handler/ssl/SslHandler.java
2fa9400a59d0563a66908aba55c41e7285a04994
0
Analyze the following code function for security vulnerabilities
@Override public IPage<SysUser> getUserByRoleId(Page<SysUser> page, String roleId, String username) { return userMapper.getUserByRoleId(page,roleId,username); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getUserByRoleId File: jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java Repository: jeecgboot/jeecg-boot The code follows secure coding practices.
[ "CWE-89" ]
CVE-2022-45208
MEDIUM
4.3
jeecgboot/jeecg-boot
getUserByRoleId
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java
51e2227bfe54f5d67b09411ee9a336750164e73d
0
Analyze the following code function for security vulnerabilities
@Override public void configConstant(Constants con) { con.setDevMode(BlogBuildInfoUtil.isDev()); con.setViewType(ViewType.JSP); con.setEncoding("utf-8"); con.setI18nDefaultBaseName(com.zrlog.common.Constants.I18N); con.setI18nDefaultLocale("zh_CN"); con.setError404View(com.zrlog.common.Constants.NOT_FOUND_PAGE); con.setError500View(com.zrlog.common.Constants.ERROR_PAGE); con.setError403View(com.zrlog.common.Constants.FORBIDDEN_PAGE); con.setBaseUploadPath(PathKit.getWebRootPath() + com.zrlog.common.Constants.ATTACHED_FOLDER); //最大的提交的body的大小 con.setMaxPostSize(1024 * 1024 * 1024); }
Vulnerability Classification: - CWE: CWE-79 - CVE: CVE-2019-16643 - Severity: LOW - CVSS Score: 3.5 Description: Upgrade jar version & fix #54 Signed-off-by: xiaochun <xchun90@163.com> Function: configConstant File: web/src/main/java/com/zrlog/web/config/ZrLogConfig.java Repository: 94fzb/zrlog Fixed Code: @Override public void configConstant(Constants con) { con.setDevMode(BlogBuildInfoUtil.isDev()); con.setViewType(ViewType.JSP); con.setEncoding("utf-8"); con.setJsonDatePattern("yyyy-MM-dd"); con.setI18nDefaultBaseName(com.zrlog.common.Constants.I18N); con.setI18nDefaultLocale("zh_CN"); con.setError404View(com.zrlog.common.Constants.NOT_FOUND_PAGE); con.setError500View(com.zrlog.common.Constants.ERROR_PAGE); con.setError403View(com.zrlog.common.Constants.FORBIDDEN_PAGE); con.setBaseUploadPath(PathKit.getWebRootPath() + com.zrlog.common.Constants.ATTACHED_FOLDER); //最大的提交的body的大小 con.setMaxPostSize(1024 * 1024 * 1024); }
[ "CWE-79" ]
CVE-2019-16643
LOW
3.5
94fzb/zrlog
configConstant
web/src/main/java/com/zrlog/web/config/ZrLogConfig.java
4a91c83af669e31a22297c14f089d8911d353fa1
1
Analyze the following code function for security vulnerabilities
private void encrypt(byte[] plaintext, int plaintextOffset, byte[] ciphertext, int ciphertextOffset, int length) { while (length > 0) { int tempLen = 64; if (tempLen > length) tempLen = length; ChaChaCore.hash(output, input); xorBlock(plaintext, plaintextOffset, ciphertext, ciphertextOffset, tempLen, output); if (++(input[12]) == 0) ++(input[13]); plaintextOffset += tempLen; ciphertextOffset += tempLen; length -= tempLen; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: encrypt File: src/main/java/com/southernstorm/noise/protocol/ChaChaPolyCipherState.java Repository: rweather/noise-java The code follows secure coding practices.
[ "CWE-125", "CWE-787" ]
CVE-2020-25021
HIGH
7.5
rweather/noise-java
encrypt
src/main/java/com/southernstorm/noise/protocol/ChaChaPolyCipherState.java
18e86b6f8bea7326934109aa9ffa705ebf4bde90
0
Analyze the following code function for security vulnerabilities
private AttributedString highlight( Integer width, SyntaxHighlighter highlighter, String object, boolean doValueHighlight) { AttributedString out; AttributedStringBuilder asb = new AttributedStringBuilder(); String val = object; if (highlighter != null && doValueHighlight) { val = truncate4nanorc(object); } asb.append(val); if (highlighter != null && val.length() < NANORC_MAX_STRING_LENGTH && doValueHighlight) { out = highlighter.highlight(asb); } else { out = asb.toAttributedString(); } if (width != null) { out = out.columnSubSequence(0, width); } return out; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: highlight File: console/src/main/java/org/jline/console/impl/DefaultPrinter.java Repository: jline/jline3 The code follows secure coding practices.
[ "CWE-787" ]
CVE-2023-50572
MEDIUM
5.5
jline/jline3
highlight
console/src/main/java/org/jline/console/impl/DefaultPrinter.java
f3c60a3e6255e8e0c20d5043a4fe248446f292bb
0
Analyze the following code function for security vulnerabilities
protected synchronized boolean isIngestLimitEnabled() { return ingestLimit >= 0; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isIngestLimitEnabled File: modules/ingest-service-impl/src/main/java/org/opencastproject/ingest/endpoint/IngestRestService.java Repository: opencast The code follows secure coding practices.
[ "CWE-74" ]
CVE-2020-5230
MEDIUM
5
opencast
isIngestLimitEnabled
modules/ingest-service-impl/src/main/java/org/opencastproject/ingest/endpoint/IngestRestService.java
bbb473f34ab95497d6c432c81285efb0c739f317
0
Analyze the following code function for security vulnerabilities
@Override public void setPendingIntentAllowlistDuration(IIntentSender target, IBinder allowlistToken, long duration, int type, @ReasonCode int reasonCode, @Nullable String reason) { mPendingIntentController.setPendingIntentAllowlistDuration(target, allowlistToken, duration, type, reasonCode, reason); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setPendingIntentAllowlistDuration 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
setPendingIntentAllowlistDuration
services/core/java/com/android/server/am/ActivityManagerService.java
d10b27e539f7bc91c2360d429b9d05f05274670d
0
Analyze the following code function for security vulnerabilities
private void updateContact() { if (DBG) log("updateContact"); final String name = getNameFromTextField(); final String number = PhoneNumberUtils.convertAndStrip(getNumberFromTextField()); if (!isValidNumber(number)) { handleResult(false, true); return; } Uri uri = FdnList.getContentUri(mSubscriptionInfoHelper); ContentValues bundle = new ContentValues(); bundle.put("tag", mName); bundle.put("number", mNumber); bundle.put("newTag", name); bundle.put("newNumber", number); bundle.put("pin2", mPin2); mQueryHandler = new QueryHandler(getContentResolver()); mQueryHandler.startUpdate(0, null, uri, bundle, null, null); displayProgress(true); showStatus(getResources().getText(R.string.updating_fdn_contact)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: updateContact File: src/com/android/phone/settings/fdn/EditFdnContactScreen.java Repository: android The code follows secure coding practices.
[ "CWE-Other", "CWE-862" ]
CVE-2023-35665
HIGH
7.8
android
updateContact
src/com/android/phone/settings/fdn/EditFdnContactScreen.java
674039e70e1c5bf29b808899ac80c709acc82290
0
Analyze the following code function for security vulnerabilities
public boolean canDelete(View view) { return viewGroupMixIn.canDelete(view); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: canDelete File: core/src/main/java/jenkins/model/Jenkins.java Repository: jenkinsci/jenkins The code follows secure coding practices.
[ "CWE-79" ]
CVE-2014-2065
MEDIUM
4.3
jenkinsci/jenkins
canDelete
core/src/main/java/jenkins/model/Jenkins.java
a0b00508eeb74d7033dc4100eb382df4e8fa72e7
0
Analyze the following code function for security vulnerabilities
public boolean isIgnored() { return mIgnored; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isIgnored File: src/main/java/com/android/apksig/internal/apk/v1/V1SchemeVerifier.java Repository: android The code follows secure coding practices.
[ "CWE-400" ]
CVE-2023-21253
MEDIUM
5.5
android
isIgnored
src/main/java/com/android/apksig/internal/apk/v1/V1SchemeVerifier.java
41d882324288085fd32ae0bb70dc85f5fd0e2be7
0
Analyze the following code function for security vulnerabilities
private void mergeFrom(ApkSigResult source) { switch (source.signatureSchemeVersion) { case ApkSigningBlockUtils.VERSION_SOURCE_STAMP: mSourceStampVerified = source.verified; if (!source.mSigners.isEmpty()) { mSourceStampInfo = new SourceStampInfo(source.mSigners.get(0)); } break; default: throw new IllegalArgumentException( "Unknown ApkSigResult Signing Block Scheme Id " + source.signatureSchemeVersion); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: mergeFrom File: src/main/java/com/android/apksig/ApkVerifier.java Repository: android The code follows secure coding practices.
[ "CWE-400" ]
CVE-2023-21253
MEDIUM
5.5
android
mergeFrom
src/main/java/com/android/apksig/ApkVerifier.java
039f815895f62c9f8af23df66622b66246f3f61e
0
Analyze the following code function for security vulnerabilities
@NonNull public Builder setHideSmartReplies(boolean hideSmartReplies) { mN.extras.putBoolean(EXTRA_HIDE_SMART_REPLIES, hideSmartReplies); return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setHideSmartReplies File: core/java/android/app/Notification.java Repository: android The code follows secure coding practices.
[ "CWE-862" ]
CVE-2023-21288
MEDIUM
5.5
android
setHideSmartReplies
core/java/android/app/Notification.java
726247f4f53e8cc0746175265652fa415a123c0c
0
Analyze the following code function for security vulnerabilities
public JiffleDirectRuntime getRuntimeInstance() throws it.geosolutions.jaiext.jiffle.JiffleException { return (JiffleDirectRuntime) getRuntimeInstance(RuntimeModel.DIRECT); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getRuntimeInstance File: jt-jiffle/jt-jiffle-language/src/main/java/it/geosolutions/jaiext/jiffle/Jiffle.java Repository: geosolutions-it/jai-ext The code follows secure coding practices.
[ "CWE-94" ]
CVE-2022-24816
HIGH
7.5
geosolutions-it/jai-ext
getRuntimeInstance
jt-jiffle/jt-jiffle-language/src/main/java/it/geosolutions/jaiext/jiffle/Jiffle.java
cb1d6565d38954676b0a366da4f965fef38da1cb
0
Analyze the following code function for security vulnerabilities
@Override public String getStringProperty(String name) throws JMSException { Object o = this.getObjectProperty(name); if (o == null) return null; else if (o instanceof String) return (String) o; else return o.toString(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getStringProperty File: src/main/java/com/rabbitmq/jms/client/RMQMessage.java Repository: rabbitmq/rabbitmq-jms-client The code follows secure coding practices.
[ "CWE-502" ]
CVE-2020-36282
HIGH
7.5
rabbitmq/rabbitmq-jms-client
getStringProperty
src/main/java/com/rabbitmq/jms/client/RMQMessage.java
f647e5dbfe055a2ca8cbb16dd70f9d50d888b638
0
Analyze the following code function for security vulnerabilities
@Override public void verify(Record record) { // 自动只读字段忽略非空检查 final Set<String> autoReadonlyFields = EasyMetaFactory.getAutoReadonlyFields(entity.getName()); List<String> notNulls = new ArrayList<>(); // 非空 List<String> notWells = new ArrayList<>(); // 格式 // 新建 if (record.getPrimary() == null) { for (Field field : entity.getFields()) { if (MetadataHelper.isCommonsField(field)) continue; EasyField easyField = EasyMetaFactory.valueOf(field); if (easyField.getDisplayType() == DisplayType.SERIES || easyField.getDisplayType() == DisplayType.BARCODE) { continue; } Object hasVal = record.getObjectValue(field.getName()); boolean canNull = field.isNullable() || autoReadonlyFields.contains(field.getName()); if (NullValue.isNull(hasVal)) { if (!canNull) { notNulls.add(easyField.getLabel()); } } else { if (field.isCreatable()) { if (!patternMatches(easyField, hasVal)) { notWells.add(easyField.getLabel()); } } else { if (!isForceCreateable(field)) { log.warn("Remove non-creatable field : " + field); record.removeValue(field.getName()); } } } } } // 更新 else { for (String fieldName : record.getAvailableFields()) { Field field = entity.getField(fieldName); if (MetadataHelper.isCommonsField(field)) continue; Object hasVal = record.getObjectValue(field.getName()); boolean canNull = field.isNullable() || autoReadonlyFields.contains(field.getName()); EasyField easyField = EasyMetaFactory.valueOf(field); if (NullValue.isNull(hasVal)) { if (!canNull) { notNulls.add(easyField.getLabel()); } } else { if (field.isUpdatable()) { if (!patternMatches(easyField, hasVal)) { notWells.add(easyField.getLabel()); } } else { log.warn("Remove non-updatable field : " + field); record.removeValue(fieldName); } } } } if (!notNulls.isEmpty()) { throw new DataSpecificationException( Language.L("%s 不允许为空", StringUtils.join(notNulls, " / "))); } if (!notWells.isEmpty()) { throw new DataSpecificationException( Language.L("%s 格式不正确", StringUtils.join(notWells, " / "))); } // TODO 检查引用字段的ID是否正确(是否是其他实体的ID) }
Vulnerability Classification: - CWE: CWE-79 - CVE: CVE-2023-1613 - Severity: MEDIUM - CVSS Score: 4.0 Description: fix: #596 Function: verify File: src/main/java/com/rebuild/core/metadata/EntityRecordCreator.java Repository: getrebuild/rebuild Fixed Code: @Override public void verify(Record record) { // 自动只读字段忽略非空检查 final Set<String> autoReadonlyFields = EasyMetaFactory.getAutoReadonlyFields(entity.getName()); List<String> notNulls = new ArrayList<>(); // 非空 List<String> notWells = new ArrayList<>(); // 格式 // 新建 if (record.getPrimary() == null) { for (Field field : entity.getFields()) { if (MetadataHelper.isCommonsField(field)) continue; EasyField easyField = EasyMetaFactory.valueOf(field); if (easyField.getDisplayType() == DisplayType.SERIES || easyField.getDisplayType() == DisplayType.BARCODE) { continue; } Object hasVal = record.getObjectValue(field.getName()); boolean canNull = field.isNullable() || autoReadonlyFields.contains(field.getName()); if (NullValue.isNull(hasVal)) { if (!canNull) { notNulls.add(easyField.getLabel()); } } else { if (field.isCreatable()) { if (!patternMatches(easyField, hasVal)) { notWells.add(easyField.getLabel()); } } else { if (!isForceCreateable(field)) { log.warn("Remove non-creatable field : {}", field); record.removeValue(field.getName()); } } } } } // 更新 else { for (String fieldName : record.getAvailableFields()) { Field field = entity.getField(fieldName); if (MetadataHelper.isCommonsField(field)) continue; Object hasVal = record.getObjectValue(field.getName()); boolean canNull = field.isNullable() || autoReadonlyFields.contains(field.getName()); EasyField easyField = EasyMetaFactory.valueOf(field); if (NullValue.isNull(hasVal)) { if (!canNull) { notNulls.add(easyField.getLabel()); } } else { if (field.isUpdatable()) { if (!patternMatches(easyField, hasVal)) { notWells.add(easyField.getLabel()); } } else { log.warn("Remove non-updatable field : {}", field); record.removeValue(fieldName); } } } } if (!notNulls.isEmpty()) { throw new DataSpecificationException( Language.L("%s 不允许为空", StringUtils.join(notNulls, " / "))); } if (!notWells.isEmpty()) { throw new DataSpecificationException( Language.L("%s 格式不正确", StringUtils.join(notWells, " / "))); } if (safeCheck) removeFieldIfUnSafe(record); // TODO 检查引用字段的ID是否正确(是否是其他实体的ID) }
[ "CWE-79" ]
CVE-2023-1613
MEDIUM
4
getrebuild/rebuild
verify
src/main/java/com/rebuild/core/metadata/EntityRecordCreator.java
d422c1b9c0f6970bf7af0257a2c6b0f8be535963
1
Analyze the following code function for security vulnerabilities
private void handleProtocolVersionMismatch() throws IOException { // Probably an AMQP.... header indicating a version mismatch // Otherwise meaningless, so try to read the version, // and throw an exception, whether we read the version // okay or not. // Try to read everything from the network, this header // is small and should never require several network reads. byte[] expectedBytes = new byte[] { 'M', 'Q', 'P' }; int expectedBytesCount = 0; while (somethingToRead() && expectedBytesCount < 3) { // We expect the letters M, Q, P in that order: generate an informative error if they're not found int nextByte = readFromBuffer(); if (nextByte != expectedBytes[expectedBytesCount]) { throw new MalformedFrameException("Invalid AMQP protocol header from server: expected character " + expectedBytes[expectedBytesCount] + ", got " + nextByte); } expectedBytesCount++; } if (expectedBytesCount != 3) { throw new MalformedFrameException("Invalid AMQP protocol header from server: read only " + (expectedBytesCount + 1) + " byte(s) instead of 4"); } int[] signature = new int[4]; for (int i = 0; i < 4; i++) { if (somethingToRead()) { signature[i] = readFromBuffer(); } else { throw new MalformedFrameException("Invalid AMQP protocol header from server"); } } MalformedFrameException x; if (signature[0] == 1 && signature[1] == 1 && signature[2] == 8 && signature[3] == 0) { x = new MalformedFrameException("AMQP protocol version mismatch; we are version " + AMQP.PROTOCOL.MAJOR + "-" + AMQP.PROTOCOL.MINOR + "-" + AMQP.PROTOCOL.REVISION + ", server is 0-8"); } else { String sig = ""; for (int i = 0; i < 4; i++) { if (i != 0) sig += ","; sig += signature[i]; } x = new MalformedFrameException("AMQP protocol version mismatch; we are version " + AMQP.PROTOCOL.MAJOR + "-" + AMQP.PROTOCOL.MINOR + "-" + AMQP.PROTOCOL.REVISION + ", server sent signature " + sig); } throw x; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: handleProtocolVersionMismatch File: src/main/java/com/rabbitmq/client/impl/nio/FrameBuilder.java Repository: rabbitmq/rabbitmq-java-client The code follows secure coding practices.
[ "CWE-400" ]
CVE-2023-46120
HIGH
7.5
rabbitmq/rabbitmq-java-client
handleProtocolVersionMismatch
src/main/java/com/rabbitmq/client/impl/nio/FrameBuilder.java
714aae602dcae6cb4b53cadf009323ebac313cc8
0
Analyze the following code function for security vulnerabilities
@Override @Deprecated(since = "14.8RC1") public void deleteLinks(long docId, XWikiContext inputxcontext, boolean bTransaction) throws XWikiException { executeWrite(inputxcontext, session -> { try { Query<?> query = session.createQuery("delete from XWikiLink as link where link.id.docId = :docId"); query.setParameter("docId", docId); query.executeUpdate(); } catch (Exception e) { throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_HIBERNATE_DELETING_LINKS, "Exception while deleting links", e); } return null; }); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: deleteLinks File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java Repository: xwiki/xwiki-platform The code follows secure coding practices.
[ "CWE-459" ]
CVE-2023-36468
HIGH
8.8
xwiki/xwiki-platform
deleteLinks
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java
15a6f845d8206b0ae97f37aa092ca43d4f9d6e59
0
Analyze the following code function for security vulnerabilities
@Override public void onVerbatim(String content, boolean inline, Map<String, String> parameters) { if (inline) { // Note: We generate a tt element rather than a pre element since pre elements cannot be located inside // paragraphs for example. There also no tag in XHTML that has a semantic of preserving inline content so // tt is the closest to pre for inline. // The class is what is expected by wikimodel to understand the tt as meaning a verbatim and not a Monospace // element. getXHTMLWikiPrinter().printXMLStartElement("tt", new String[][] { { "class", "wikimodel-verbatim" } }); getXHTMLWikiPrinter().printXML(content); getXHTMLWikiPrinter().printXMLEndElement("tt"); } else { getXHTMLWikiPrinter().printXMLStartElement("pre", parameters); getXHTMLWikiPrinter().printXML(content); getXHTMLWikiPrinter().printXMLEndElement("pre"); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onVerbatim File: xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/XHTMLChainingRenderer.java Repository: xwiki/xwiki-rendering The code follows secure coding practices.
[ "CWE-79" ]
CVE-2023-32070
MEDIUM
6.1
xwiki/xwiki-rendering
onVerbatim
xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/XHTMLChainingRenderer.java
c40e2f5f9482ec6c3e71dbf1fff5ba8a5e44cdc1
0
Analyze the following code function for security vulnerabilities
public boolean isSchema() { return schema; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isSchema File: org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/settings/XMLValidationSettings.java Repository: eclipse/lemminx The code follows secure coding practices.
[ "CWE-611" ]
CVE-2019-18213
MEDIUM
6.5
eclipse/lemminx
isSchema
org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/settings/XMLValidationSettings.java
c8bf3245a72cace50ee2aae5eee69538c58ce056
0
Analyze the following code function for security vulnerabilities
static public synchronized void initialize(File dir) { if (singleton != null) { logger.warn("Overwriting singleton already set: " + singleton); } logger.info("Using workspace directory: {}", dir.getAbsolutePath()); singleton = new FileProjectManager(dir); // This needs our singleton set, thus the unconventional control flow ((FileProjectManager) singleton).recover(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: initialize 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
initialize
main/src/com/google/refine/io/FileProjectManager.java
e9c1e65d58b47aec8cd676bd5c07d97b002f205e
0
Analyze the following code function for security vulnerabilities
private InstallArgs createInstallArgsForExisting(int installFlags, String codePath, String resourcePath, String[] instructionSets) { final boolean isInAsec; if (installOnExternalAsec(installFlags)) { /* Apps on SD card are always in ASEC containers. */ isInAsec = true; } else if (installForwardLocked(installFlags) && !codePath.startsWith(mDrmAppPrivateInstallDir.getAbsolutePath())) { /* * Forward-locked apps are only in ASEC containers if they're the * new style */ isInAsec = true; } else { isInAsec = false; } if (isInAsec) { return new AsecInstallArgs(codePath, instructionSets, installOnExternalAsec(installFlags), installForwardLocked(installFlags)); } else { return new FileInstallArgs(codePath, resourcePath, instructionSets); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: createInstallArgsForExisting 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
createInstallArgsForExisting
services/core/java/com/android/server/pm/PackageManagerService.java
a75537b496e9df71c74c1d045ba5569631a16298
0
Analyze the following code function for security vulnerabilities
public String escapeString(String str) { try { return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); } catch (UnsupportedEncodingException e) { return str; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: escapeString File: samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java Repository: OpenAPITools/openapi-generator The code follows secure coding practices.
[ "CWE-668" ]
CVE-2021-21430
LOW
2.1
OpenAPITools/openapi-generator
escapeString
samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java
2c576483f26f85b3979c6948a131f585c237109a
0
Analyze the following code function for security vulnerabilities
private boolean pushOutExcessShortcuts() { final ShortcutService service = mShortcutUser.mService; final int maxShortcuts = service.getMaxActivityShortcuts(); boolean changed = false; final ArrayMap<ComponentName, ArrayList<ShortcutInfo>> all = sortShortcutsToActivities(); for (int outer = all.size() - 1; outer >= 0; outer--) { final ArrayList<ShortcutInfo> list = all.valueAt(outer); if (list.size() <= maxShortcuts) { continue; } // Sort by isManifestShortcut() and getRank(). Collections.sort(list, mShortcutTypeAndRankComparator); // Keep [0 .. max), and remove (as dynamic) [max .. size) for (int inner = list.size() - 1; inner >= maxShortcuts; inner--) { final ShortcutInfo shortcut = list.get(inner); if (shortcut.isManifestShortcut()) { // This shouldn't happen -- excess shortcuts should all be non-manifest. // But just in case. service.wtf("Found manifest shortcuts in excess list."); continue; } deleteDynamicWithId(shortcut.getId(), /*ignoreInvisible=*/ true, /*ignorePersistedShortcuts=*/ true); } } return changed; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: pushOutExcessShortcuts File: services/core/java/com/android/server/pm/ShortcutPackage.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-40075
MEDIUM
5.5
android
pushOutExcessShortcuts
services/core/java/com/android/server/pm/ShortcutPackage.java
ae768fbb9975fdab267f525831cb52f485ab0ecc
0
Analyze the following code function for security vulnerabilities
@Override public void setJMSReplyTo(Destination replyTo) throws JMSException { this.setObjectProperty(JMS_MESSAGE_REPLY_TO, replyTo); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setJMSReplyTo File: src/main/java/com/rabbitmq/jms/client/RMQMessage.java Repository: rabbitmq/rabbitmq-jms-client The code follows secure coding practices.
[ "CWE-502" ]
CVE-2020-36282
HIGH
7.5
rabbitmq/rabbitmq-jms-client
setJMSReplyTo
src/main/java/com/rabbitmq/jms/client/RMQMessage.java
f647e5dbfe055a2ca8cbb16dd70f9d50d888b638
0
Analyze the following code function for security vulnerabilities
private void adminPermission(Invocation ai) { Controller controller = ai.getController(); AdminTokenVO adminTokenVO = adminTokenService.getAdminTokenVO(controller.getRequest()); if (adminTokenVO != null) { try { User user = new User().findById(adminTokenVO.getUserId()); if (StringUtils.isEmpty(user.getStr("header"))) { user.set("header", Constants.DEFAULT_HEADER); } controller.setAttr("user", user); controller.setAttr("protocol", adminTokenVO.getProtocol()); TemplateHelper.fullTemplateInfo(controller, false); if (!"/admin/logout".equals(ai.getActionKey())) { adminTokenService.setAdminToken(user, adminTokenVO.getSessionId(), adminTokenVO.getProtocol(), controller.getRequest(), controller.getResponse()); } ai.invoke(); // 存在消息提示 if (controller.getAttr("message") != null) { AdminPageController.initIndex(controller.getRequest()); controller.render(new FreeMarkerRender("/admin/index.ftl")); } else { if (!tryDoRender(ai, controller)) { controller.renderHtml(IOUtil.getStringInputStream(new FileInputStream(PathKit.getWebRootPath() + Constants.NOT_FOUND_PAGE))); } } } catch (Exception e) { LOGGER.error("", e); exceptionHandler(ai, e); } finally { AdminTokenThreadLocal.remove(); } } else if ("/admin/login".equals(ai.getActionKey()) || "/api/admin/login".equals(ai.getActionKey())) { ai.invoke(); tryDoRender(ai, controller); } else { blockUnLoginRequestHandler(ai); } }
Vulnerability Classification: - CWE: CWE-79 - CVE: CVE-2019-16643 - Severity: LOW - CVSS Score: 3.5 Description: Upgrade jar version & fix #54 Signed-off-by: xiaochun <xchun90@163.com> Function: adminPermission File: web/src/main/java/com/zrlog/web/interceptor/AdminInterceptor.java Repository: 94fzb/zrlog Fixed Code: private void adminPermission(Invocation ai) { Controller controller = ai.getController(); AdminTokenVO adminTokenVO = adminTokenService.getAdminTokenVO(controller.getRequest()); if (adminTokenVO != null) { try { User user = new User().findById(adminTokenVO.getUserId()); if (StringUtils.isEmpty(user.getStr("header"))) { user.set("header", Constants.DEFAULT_HEADER); } controller.setAttr("user", user); controller.setAttr("protocol", adminTokenVO.getProtocol()); TemplateHelper.fullTemplateInfo(controller, false); if (!"/admin/logout".equals(ai.getActionKey())) { adminTokenService.setAdminToken(user, adminTokenVO.getSessionId(), adminTokenVO.getProtocol(), controller.getRequest(), controller.getResponse()); } ai.invoke(); // 存在消息提示 if (controller.getAttr("message") != null) { initIndex(controller.getRequest()); controller.render(new FreeMarkerRender("/admin/index.ftl")); } else { if (!tryDoRender(ai, controller)) { controller.renderHtml(IOUtil.getStringInputStream(new FileInputStream(PathKit.getWebRootPath() + Constants.NOT_FOUND_PAGE))); } } } catch (Exception e) { LOGGER.error("", e); exceptionHandler(ai, e); } finally { AdminTokenThreadLocal.remove(); } } else if ("/admin/login".equals(ai.getActionKey()) || "/api/admin/login".equals(ai.getActionKey())) { ai.invoke(); tryDoRender(ai, controller); } else { blockUnLoginRequestHandler(ai); } }
[ "CWE-79" ]
CVE-2019-16643
LOW
3.5
94fzb/zrlog
adminPermission
web/src/main/java/com/zrlog/web/interceptor/AdminInterceptor.java
4a91c83af669e31a22297c14f089d8911d353fa1
1
Analyze the following code function for security vulnerabilities
@GuardedBy("getLockObject()") private void enforceCanSetDeviceOwnerLocked( CallerIdentity caller, @Nullable ComponentName owner, @UserIdInt int deviceOwnerUserId, boolean hasIncompatibleAccountsOrNonAdb) { boolean showComponentOnError = false; if (!isAdb(caller)) { Preconditions.checkCallAuthorization( hasCallingOrSelfPermission(MANAGE_PROFILE_AND_DEVICE_OWNERS)); } else { showComponentOnError = true; } final int code = checkDeviceOwnerProvisioningPreConditionLocked(owner, /* deviceOwnerUserId= */ deviceOwnerUserId, /* callingUserId*/ caller.getUserId(), isAdb(caller), hasIncompatibleAccountsOrNonAdb); if (code != STATUS_OK) { final String provisioningErrorStringLocked = computeProvisioningErrorStringLocked(code, deviceOwnerUserId, owner, showComponentOnError); if (code == STATUS_HEADLESS_SYSTEM_USER_MODE_NOT_SUPPORTED) { throw new ServiceSpecificException(code, provisioningErrorStringLocked); } else { throw new IllegalStateException(provisioningErrorStringLocked); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: enforceCanSetDeviceOwnerLocked File: services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-862" ]
CVE-2023-40089
HIGH
7.8
android
enforceCanSetDeviceOwnerLocked
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
e2e05f488da6abc765a62e7faf10cb74e729732e
0
Analyze the following code function for security vulnerabilities
private boolean canUserModifyAccountsForType(int userId, String accountType, int callingUid) { // the managing app can always modify accounts if (isProfileOwner(callingUid)) { return true; } DevicePolicyManager dpm = (DevicePolicyManager) mContext .getSystemService(Context.DEVICE_POLICY_SERVICE); String[] typesArray = dpm.getAccountTypesWithManagementDisabledAsUser(userId); if (typesArray == null) { return true; } for (String forbiddenType : typesArray) { if (forbiddenType.equals(accountType)) { return false; } } return true; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: canUserModifyAccountsForType File: services/core/java/com/android/server/accounts/AccountManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-Other", "CWE-502" ]
CVE-2023-45777
HIGH
7.8
android
canUserModifyAccountsForType
services/core/java/com/android/server/accounts/AccountManagerService.java
f810d81839af38ee121c446105ca67cb12992fc6
0