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 boolean isKeyExchangeAllowed() {
return !isKexDone() || transport.isAuthenticated();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isKeyExchangeAllowed
File: src/main/java/net/schmizz/sshj/transport/KeyExchanger.java
Repository: hierynomus/sshj
The code follows secure coding practices. | [
"CWE-354"
] | CVE-2023-48795 | MEDIUM | 5.9 | hierynomus/sshj | isKeyExchangeAllowed | src/main/java/net/schmizz/sshj/transport/KeyExchanger.java | 94fcc960e0fb198ddec0f7efc53f95ac627fe083 | 0 |
Analyze the following code function for security vulnerabilities | @SuppressWarnings("unused")
@CalledByNative
private void onRenderProcessChange() {
attachImeAdapter();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: onRenderProcessChange
File: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
Repository: chromium
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2014-3159 | MEDIUM | 6.4 | chromium | onRenderProcessChange | content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java | 98a50b76141f0b14f292f49ce376e6554142d5e2 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public ServerBuilder service(String pathPattern, HttpService service) {
requireNonNull(pathPattern, "pathPattern");
requireNonNull(service, "service");
warnIfServiceHasMultipleRoutes(pathPattern, service);
virtualHostTemplate.service(pathPattern, service);
return this;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: service
File: core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java
Repository: line/armeria
The code follows secure coding practices. | [
"CWE-400"
] | CVE-2023-44487 | HIGH | 7.5 | line/armeria | service | core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java | df7f85824a62e997b910b5d6194a3335841065fd | 0 |
Analyze the following code function for security vulnerabilities | @SuppressWarnings("unchecked")
@Override
public <T> T unwrap(Class<T> theType) {
if (theType == RoutingContext.class) {
return (T) context;
} else if (theType == HttpServerRequest.class) {
return (T) request;
} else if (theType == HttpServerResponse.class) {
return (T) response;
} else if (theType == ResteasyReactiveRequestContext.class) {
return (T) this;
}
return null;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: unwrap
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 | unwrap | 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 | @Override
public void onUidStateChanged(int uid, int procState, long procStateSeq,
int capability) {
if (uid == mUid) {
if (procState > ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE
&& procState != ActivityManager.PROCESS_STATE_NONEXISTENT) {
PackageInactivityListener.this.updateUidState(STATE_TIMER);
} else {
PackageInactivityListener.this.updateUidState(STATE_ACTIVE);
}
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: onUidStateChanged
File: services/core/java/com/android/server/pm/permission/OneTimePermissionUserManager.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-21254 | HIGH | 7.8 | android | onUidStateChanged | services/core/java/com/android/server/pm/permission/OneTimePermissionUserManager.java | fa539c85503dc63bfb53c76b6f12b3549f14a709 | 0 |
Analyze the following code function for security vulnerabilities | private void sendMultipartSms(SmsTracker tracker) {
ArrayList<String> parts;
ArrayList<PendingIntent> sentIntents;
ArrayList<PendingIntent> deliveryIntents;
HashMap<String, Object> map = tracker.getData();
String destinationAddress = (String) map.get("destination");
String scAddress = (String) map.get("scaddress");
parts = (ArrayList<String>) map.get("parts");
sentIntents = (ArrayList<PendingIntent>) map.get("sentIntents");
deliveryIntents = (ArrayList<PendingIntent>) map.get("deliveryIntents");
// check if in service
int ss = mPhone.getServiceState().getState();
// if sms over IMS is not supported on data and voice is not available...
if (!isIms() && ss != ServiceState.STATE_IN_SERVICE) {
for (int i = 0, count = parts.size(); i < count; i++) {
PendingIntent sentIntent = null;
if (sentIntents != null && sentIntents.size() > i) {
sentIntent = sentIntents.get(i);
}
handleNotInService(ss, sentIntent);
}
return;
}
sendMultipartText(destinationAddress, scAddress, parts, sentIntents, deliveryIntents,
null/*messageUri*/, null/*callingPkg*/, tracker.mPersistMessage);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: sendMultipartSms
File: src/java/com/android/internal/telephony/SMSDispatcher.java
Repository: android
The code follows secure coding practices. | [
"CWE-284"
] | CVE-2016-3883 | MEDIUM | 4.3 | android | sendMultipartSms | src/java/com/android/internal/telephony/SMSDispatcher.java | b2c89e6f8962dc7aff88cb38aa3ee67d751edda9 | 0 |
Analyze the following code function for security vulnerabilities | public void setPanelExpanded(boolean isExpanded) {
mPanelExpanded = isExpanded;
mStatusBarWindowManager.setPanelExpanded(isExpanded);
mVisualStabilityManager.setPanelExpanded(isExpanded);
if (isExpanded && getBarState() != StatusBarState.KEYGUARD) {
if (DEBUG) {
Log.v(TAG, "clearing notification effects from setPanelExpanded");
}
clearNotificationEffects();
}
if (!isExpanded) {
removeRemoteInputEntriesKeptUntilCollapsed();
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setPanelExpanded
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 | setPanelExpanded | packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java | c574568aaede7f652432deb7707f20ae54bbdf9a | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void stop() {
if (serverSocket != null) {
try {
serverSocket.close();
} catch (IOException e) {
traceError(e);
}
serverSocket = null;
}
if (listenerThread != null) {
try {
listenerThread.join(1000);
} catch (InterruptedException e) {
DbException.traceThrowable(e);
}
}
// TODO server: using a boolean 'now' argument? a timeout?
for (WebSession session : new ArrayList<>(sessions.values())) {
session.close();
}
for (WebThread c : new ArrayList<>(running)) {
try {
c.stopNow();
c.join(100);
} catch (Exception e) {
traceError(e);
}
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: stop
File: h2/src/main/org/h2/server/web/WebServer.java
Repository: h2database
The code follows secure coding practices. | [
"CWE-312"
] | CVE-2022-45868 | HIGH | 7.8 | h2database | stop | h2/src/main/org/h2/server/web/WebServer.java | 23ee3d0b973923c135fa01356c8eaed40b895393 | 0 |
Analyze the following code function for security vulnerabilities | public double readDouble() throws IOException {
return primitiveTypes.readDouble();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: readDouble
File: luni/src/main/java/java/io/ObjectInputStream.java
Repository: android
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2014-7911 | HIGH | 7.2 | android | readDouble | luni/src/main/java/java/io/ObjectInputStream.java | 738c833d38d41f8f76eb7e77ab39add82b1ae1e2 | 0 |
Analyze the following code function for security vulnerabilities | public void setParamOriginalParams(String paramOriginalParams) {
m_paramOriginalParams = paramOriginalParams;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setParamOriginalParams
File: src/org/opencms/workplace/CmsDialog.java
Repository: alkacon/opencms-core
The code follows secure coding practices. | [
"CWE-79"
] | CVE-2013-4600 | MEDIUM | 4.3 | alkacon/opencms-core | setParamOriginalParams | src/org/opencms/workplace/CmsDialog.java | 72a05e3ea1cf692e2efce002687272e63f98c14a | 0 |
Analyze the following code function for security vulnerabilities | @Override
public Map<Integer, String> getProcessesWithPendingBindMounts(int userId) {
return mProcessList.getProcessesWithPendingBindMounts(userId);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getProcessesWithPendingBindMounts
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 | getProcessesWithPendingBindMounts | services/core/java/com/android/server/am/ActivityManagerService.java | d10b27e539f7bc91c2360d429b9d05f05274670d | 0 |
Analyze the following code function for security vulnerabilities | @VisibleForTesting
protected boolean hasInsertion() {
return mHasInsertion;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: hasInsertion
File: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
Repository: chromium
The code follows secure coding practices. | [
"CWE-1021"
] | CVE-2015-1241 | MEDIUM | 4.3 | chromium | hasInsertion | content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java | 9d343ad2ea6ec395c377a4efa266057155bfa9c1 | 0 |
Analyze the following code function for security vulnerabilities | private void saveGlobalProxyLocked(String proxySpec, String exclusionList) {
if (exclusionList == null) {
exclusionList = "";
}
if (proxySpec == null) {
proxySpec = "";
}
// Remove white spaces
proxySpec = proxySpec.trim();
String data[] = proxySpec.split(":");
int proxyPort = 8080;
if (data.length > 1) {
try {
proxyPort = Integer.parseInt(data[1]);
} catch (NumberFormatException e) {}
}
exclusionList = exclusionList.trim();
ProxyInfo proxyProperties = ProxyInfo.buildDirectProxy(data[0], proxyPort,
ProxyUtils.exclusionStringAsList(exclusionList));
if (!proxyProperties.isValid()) {
Slogf.e(LOG_TAG, "Invalid proxy properties, ignoring: " + proxyProperties.toString());
return;
}
mInjector.settingsGlobalPutString(Settings.Global.GLOBAL_HTTP_PROXY_HOST, data[0]);
mInjector.settingsGlobalPutInt(Settings.Global.GLOBAL_HTTP_PROXY_PORT, proxyPort);
mInjector.settingsGlobalPutString(Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST,
exclusionList);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: saveGlobalProxyLocked
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 | saveGlobalProxyLocked | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | ed3f25b7222d4cff471f2b7d22d1150348146957 | 0 |
Analyze the following code function for security vulnerabilities | private static native void nativeSetResourceResolutionLoggingEnabled(long ptr, boolean enabled); | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: nativeSetResourceResolutionLoggingEnabled
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 | nativeSetResourceResolutionLoggingEnabled | core/java/android/content/res/AssetManager.java | c3bc12c484ef3bbca4cec19234437c45af5e584d | 0 |
Analyze the following code function for security vulnerabilities | private void revokeUriPermissionLocked(int callingUid, GrantUri grantUri, final int modeFlags) {
if (DEBUG_URI_PERMISSION) Slog.v(TAG, "Revoking all granted permissions to " + grantUri);
final IPackageManager pm = AppGlobals.getPackageManager();
final String authority = grantUri.uri.getAuthority();
final ProviderInfo pi = getProviderInfoLocked(authority, grantUri.sourceUserId);
if (pi == null) {
Slog.w(TAG, "No content provider found for permission revoke: "
+ grantUri.toSafeString());
return;
}
// Does the caller have this permission on the URI?
if (!checkHoldingPermissionsLocked(pm, pi, grantUri, callingUid, modeFlags)) {
// If they don't have direct access to the URI, then revoke any
// ownerless URI permissions that have been granted to them.
final ArrayMap<GrantUri, UriPermission> perms = mGrantedUriPermissions.get(callingUid);
if (perms != null) {
boolean persistChanged = false;
for (Iterator<UriPermission> it = perms.values().iterator(); it.hasNext();) {
final UriPermission perm = it.next();
if (perm.uri.sourceUserId == grantUri.sourceUserId
&& perm.uri.uri.isPathPrefixMatch(grantUri.uri)) {
if (DEBUG_URI_PERMISSION)
Slog.v(TAG, "Revoking non-owned " + perm.targetUid +
" permission to " + perm.uri);
persistChanged |= perm.revokeModes(
modeFlags | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION, false);
if (perm.modeFlags == 0) {
it.remove();
}
}
}
if (perms.isEmpty()) {
mGrantedUriPermissions.remove(callingUid);
}
if (persistChanged) {
schedulePersistUriGrants();
}
}
return;
}
boolean persistChanged = false;
// Go through all of the permissions and remove any that match.
int N = mGrantedUriPermissions.size();
for (int i = 0; i < N; i++) {
final int targetUid = mGrantedUriPermissions.keyAt(i);
final ArrayMap<GrantUri, UriPermission> perms = mGrantedUriPermissions.valueAt(i);
for (Iterator<UriPermission> it = perms.values().iterator(); it.hasNext();) {
final UriPermission perm = it.next();
if (perm.uri.sourceUserId == grantUri.sourceUserId
&& perm.uri.uri.isPathPrefixMatch(grantUri.uri)) {
if (DEBUG_URI_PERMISSION)
Slog.v(TAG,
"Revoking " + perm.targetUid + " permission to " + perm.uri);
persistChanged |= perm.revokeModes(
modeFlags | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION, true);
if (perm.modeFlags == 0) {
it.remove();
}
}
}
if (perms.isEmpty()) {
mGrantedUriPermissions.remove(targetUid);
N--;
i--;
}
}
if (persistChanged) {
schedulePersistUriGrants();
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: revokeUriPermissionLocked
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 | revokeUriPermissionLocked | services/core/java/com/android/server/am/ActivityManagerService.java | aaa0fee0d7a8da347a0c47cef5249c70efee209e | 0 |
Analyze the following code function for security vulnerabilities | InsetsState getInsetsState() {
return getInsetsState(false);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getInsetsState
File: services/core/java/com/android/server/wm/WindowState.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-35674 | HIGH | 7.8 | android | getInsetsState | services/core/java/com/android/server/wm/WindowState.java | 7428962d3b064ce1122809d87af65099d1129c9e | 0 |
Analyze the following code function for security vulnerabilities | @Override
public boolean isDeviceOwner(int uid) {
int cachedUid = mDeviceOwnerUid;
return uid >= 0 && cachedUid == uid;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isDeviceOwner
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 | isDeviceOwner | services/core/java/com/android/server/am/ActivityManagerService.java | d10b27e539f7bc91c2360d429b9d05f05274670d | 0 |
Analyze the following code function for security vulnerabilities | public String getHeader(String name) {
for (int n = 0; n < this.headers.size(); n++) {
String header = (String) this.headers.get(n);
if (header.startsWith(name + ": "))
return header.substring(name.length() + 2);
}
return null;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getHeader
File: src/java/winstone/WinstoneResponse.java
Repository: jenkinsci/winstone
The code follows secure coding practices. | [
"CWE-79"
] | CVE-2011-4344 | LOW | 2.6 | jenkinsci/winstone | getHeader | src/java/winstone/WinstoneResponse.java | 410ed3001d51c689cf59085b7417466caa2ded7b | 0 |
Analyze the following code function for security vulnerabilities | @Override
public InputStream read() {
try {
if (Utils.isNotNullOrEmpty(getContext().getFile())) {
return readFile(getContext().getFile());
} else if (Utils.isNotNullOrEmpty(getContext().getDir())) {
return readTar(getContext().getDir());
}
throw new IllegalStateException("No file or dir has been specified");
} catch (Exception e) {
throw KubernetesClientException.launderThrowable(e);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: read
File: kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/core/v1/PodOperationsImpl.java
Repository: fabric8io/kubernetes-client
The code follows secure coding practices. | [
"CWE-22"
] | CVE-2021-20218 | MEDIUM | 5.8 | fabric8io/kubernetes-client | read | kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/core/v1/PodOperationsImpl.java | 325d67cc80b73f049a5d0cea4917c1f2709a8d86 | 0 |
Analyze the following code function for security vulnerabilities | private byte[] makeKeyChecksum(String algorithm, byte[] pwBytes, byte[] salt, int rounds) {
char[] mkAsChar = new char[pwBytes.length];
for (int i = 0; i < pwBytes.length; i++) {
mkAsChar[i] = (char) pwBytes[i];
}
Key checksum = buildCharArrayKey(algorithm, mkAsChar, salt, rounds);
return checksum.getEncoded();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: makeKeyChecksum
File: services/backup/java/com/android/server/backup/BackupManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-200"
] | CVE-2016-3759 | MEDIUM | 5 | android | makeKeyChecksum | services/backup/java/com/android/server/backup/BackupManagerService.java | 9b8c6d2df35455ce9e67907edded1e4a2ecb9e28 | 0 |
Analyze the following code function for security vulnerabilities | KeyChainConnection keyChainBindAsUser(UserHandle user) throws InterruptedException {
return KeyChain.bindAsUser(mContext, user);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: keyChainBindAsUser
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 | keyChainBindAsUser | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | ed3f25b7222d4cff471f2b7d22d1150348146957 | 0 |
Analyze the following code function for security vulnerabilities | protected void removeFromHttpSession(WrappedSession wrappedSession) {
wrappedSession.removeAttribute(getSessionAttributeName());
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: removeFromHttpSession
File: flow-server/src/main/java/com/vaadin/flow/server/VaadinService.java
Repository: vaadin/flow
The code follows secure coding practices. | [
"CWE-203"
] | CVE-2021-31404 | LOW | 1.9 | vaadin/flow | removeFromHttpSession | flow-server/src/main/java/com/vaadin/flow/server/VaadinService.java | 621ef1b322737d963bee624b2d2e38cd739903d9 | 0 |
Analyze the following code function for security vulnerabilities | protected String getPropertiesPath()
{
return getSkinFolder() + "skin.properties";
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getPropertiesPath
File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/skin/AbstractResourceSkin.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices. | [
"CWE-22"
] | CVE-2022-29253 | MEDIUM | 4 | xwiki/xwiki-platform | getPropertiesPath | xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/skin/AbstractResourceSkin.java | 4917c8f355717bb636d763844528b1fe0f95e8e2 | 0 |
Analyze the following code function for security vulnerabilities | private void setXrefPartialObject(int idx, PdfObject obj) {
if (!partial || idx < 0)
return;
xrefObj.set(idx, obj);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setXrefPartialObject
File: java/com/gitlab/pdftk_java/com/lowagie/text/pdf/PdfReader.java
Repository: pdftk-java/pdftk
The code follows secure coding practices. | [
"CWE-835"
] | CVE-2021-37819 | HIGH | 7.5 | pdftk-java/pdftk | setXrefPartialObject | java/com/gitlab/pdftk_java/com/lowagie/text/pdf/PdfReader.java | 9b0cbb76c8434a8505f02ada02a94263dcae9247 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public int compare(WifiConfiguration a, WifiConfiguration b) {
int configAScore = getNetworkStatusScore(a);
int configBScore = getNetworkStatusScore(b);
if (configAScore == configBScore) {
return compareNetworksWithSameStatus(a, b);
} else {
return Integer.compare(configBScore, configAScore);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: compare
File: service/java/com/android/server/wifi/WifiConfigurationUtil.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-21252 | MEDIUM | 5.5 | android | compare | service/java/com/android/server/wifi/WifiConfigurationUtil.java | 50b08ee30e04d185e5ae97a5f717d436fd5a90f3 | 0 |
Analyze the following code function for security vulnerabilities | private static void logCopyAccountStatus(@CopyAccountStatus int status, String callerPackage) {
DevicePolicyEventLogger
.createEvent(DevicePolicyEnums.PLATFORM_PROVISIONING_COPY_ACCOUNT_STATUS)
.setInt(status)
.setStrings(callerPackage)
.write();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: logCopyAccountStatus
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 | logCopyAccountStatus | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | ed3f25b7222d4cff471f2b7d22d1150348146957 | 0 |
Analyze the following code function for security vulnerabilities | protected CompletableFuture<Void> internalSetSubscriptionTypesEnabled(
Set<SubscriptionType> subscriptionTypesEnabled) {
List<SubType> subTypes = Lists.newArrayList();
subscriptionTypesEnabled.forEach(subscriptionType -> subTypes.add(SubType.valueOf(subscriptionType.name())));
return getTopicPoliciesAsyncWithRetry(topicName)
.thenCompose(op -> {
TopicPolicies topicPolicies = op.orElseGet(TopicPolicies::new);
topicPolicies.setSubscriptionTypesEnabled(subTypes);
return pulsar().getTopicPoliciesService().updateTopicPoliciesAsync(topicName, topicPolicies);
});
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: internalSetSubscriptionTypesEnabled
File: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
Repository: apache/pulsar
The code follows secure coding practices. | [
"CWE-863"
] | CVE-2021-41571 | MEDIUM | 4 | apache/pulsar | internalSetSubscriptionTypesEnabled | pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java | 5b35bb81c31f1bc2ad98c9fde5b39ec68110ca52 | 0 |
Analyze the following code function for security vulnerabilities | public void transmit(Method m) throws IOException {
synchronized (_channelMutex) {
transmit(new AMQCommand(m));
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: transmit
File: src/main/java/com/rabbitmq/client/impl/AMQChannel.java
Repository: rabbitmq/rabbitmq-java-client
The code follows secure coding practices. | [
"CWE-400"
] | CVE-2023-46120 | HIGH | 7.5 | rabbitmq/rabbitmq-java-client | transmit | src/main/java/com/rabbitmq/client/impl/AMQChannel.java | 714aae602dcae6cb4b53cadf009323ebac313cc8 | 0 |
Analyze the following code function for security vulnerabilities | @RequestMapping({ "/resource" })
public String actionResource(HttpServletRequest theServletRequest, final ResourceRequest theRequest, final BindingResult theBindingResult, final ModelMap theModel) {
String resourceName = theRequest.getResource();
populateModelForResource(theServletRequest, theRequest, theModel);
if (isNotBlank(theRequest.getUpdateId())) {
String updateId = theRequest.getUpdateId();
String updateVid = defaultIfEmpty(theRequest.getUpdateVid(), null);
CaptureInterceptor interceptor = new CaptureInterceptor();
GenericClient client = theRequest.newClient(theServletRequest, getContext(theRequest), myConfig, interceptor);
RuntimeResourceDefinition def = getContext(theRequest).getResourceDefinition(theRequest.getResource());
IBaseResource updateResource = client.read(def.getImplementingClass(), new IdDt(resourceName, updateId, updateVid));
String updateResourceString = theRequest.newParser(getContext(theRequest)).setPrettyPrint(true).encodeResourceToString(updateResource);
theModel.put("updateResource", updateResourceString);
theModel.put("updateResourceId", updateId);
}
ourLog.info(logPrefix(theModel) + "Showing resource page: {}", resourceName);
return "resource";
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: actionResource
File: hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/Controller.java
Repository: hapifhir/hapi-fhir
The code follows secure coding practices. | [
"CWE-79"
] | CVE-2020-24301 | MEDIUM | 4.3 | hapifhir/hapi-fhir | actionResource | hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/Controller.java | adb3734fcbbf9a9165445e9ee5eef168dbcaedaf | 0 |
Analyze the following code function for security vulnerabilities | public BatchOperaResponse batchCopy(ApiScenarioBatchRequest batchRequest) {
ServiceUtils.getSelectAllIds(batchRequest, batchRequest.getCondition(),
(query) -> extApiScenarioMapper.selectIdsByQuery(query));
List<ApiScenarioWithBLOBs> apiScenarioList = extApiScenarioMapper.selectIds(batchRequest.getIds());
StringBuffer stringBuffer = new StringBuffer();
for (ApiScenarioWithBLOBs apiModel : apiScenarioList) {
long time = System.currentTimeMillis();
ApiScenarioWithBLOBs newModel = apiModel;
newModel.setId(UUID.randomUUID().toString());
newModel.setName("copy_" + apiModel.getName());
newModel.setCreateTime(time);
newModel.setUpdateTime(time);
newModel.setNum(getNextNum(newModel.getProjectId()));
ApiScenarioExample example = new ApiScenarioExample();
example.createCriteria().andNameEqualTo(newModel.getName()).
andProjectIdEqualTo(newModel.getProjectId()).andStatusNotEqualTo("Trash").andIdNotEqualTo(newModel.getId());
if (apiScenarioMapper.countByExample(example) > 0) {
stringBuffer.append(newModel.getName() + ";");
continue;
} else {
boolean insertFlag = true;
if (StringUtils.isNotBlank(newModel.getCustomNum())) {
insertFlag = false;
String projectId = newModel.getProjectId();
Project project = projectMapper.selectByPrimaryKey(projectId);
if (project != null) {
Boolean customNum = project.getScenarioCustomNum();
// 未开启自定义ID
if (!customNum) {
insertFlag = true;
newModel.setCustomNum(null);
} else {
boolean isCustomNumExist = true;
try {
isCustomNumExist = this.isCustomNumExist(newModel);
} catch (Exception e) {
}
insertFlag = !isCustomNumExist;
}
}
}
if (insertFlag) {
apiScenarioMapper.insert(newModel);
apiScenarioReferenceIdService.saveByApiScenario(newModel);
}
}
}
BatchOperaResponse result = new BatchOperaResponse();
if (stringBuffer.length() == 0) {
result.result = true;
} else {
result.result = false;
result.errorMsg = stringBuffer.substring(0, stringBuffer.length() - 1);
}
return result;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: batchCopy
File: backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java
Repository: metersphere
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2021-45789 | MEDIUM | 6.5 | metersphere | batchCopy | backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java | d74e02cdff47cdf7524d305d098db6ffb7f61b47 | 0 |
Analyze the following code function for security vulnerabilities | public void scrollTo(int xPix, int yPix) {
if (mNativeContentViewCore == 0) return;
final float xCurrentPix = mRenderCoordinates.getScrollXPix();
final float yCurrentPix = mRenderCoordinates.getScrollYPix();
final float dxPix = xPix - xCurrentPix;
final float dyPix = yPix - yCurrentPix;
if (dxPix != 0 || dyPix != 0) {
long time = SystemClock.uptimeMillis();
nativeScrollBegin(mNativeContentViewCore, time,
xCurrentPix, yCurrentPix, -dxPix, -dyPix);
nativeScrollBy(mNativeContentViewCore,
time, xCurrentPix, yCurrentPix, dxPix, dyPix);
nativeScrollEnd(mNativeContentViewCore, time);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: scrollTo
File: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
Repository: chromium
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2014-3159 | MEDIUM | 6.4 | chromium | scrollTo | content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java | 98a50b76141f0b14f292f49ce376e6554142d5e2 | 0 |
Analyze the following code function for security vulnerabilities | private void transformSurfaceInsetsPosition(Point outPos, Rect surfaceInsets) {
// Ignore the scale for child window because its insets have been scaled with the
// parent surface.
if (mGlobalScale == 1f || mIsChildWindow) {
outPos.x = surfaceInsets.left;
outPos.y = surfaceInsets.top;
return;
}
outPos.x = (int) (surfaceInsets.left * mGlobalScale + 0.5f);
outPos.y = (int) (surfaceInsets.top * mGlobalScale + 0.5f);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: transformSurfaceInsetsPosition
File: services/core/java/com/android/server/wm/WindowState.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-35674 | HIGH | 7.8 | android | transformSurfaceInsetsPosition | services/core/java/com/android/server/wm/WindowState.java | 7428962d3b064ce1122809d87af65099d1129c9e | 0 |
Analyze the following code function for security vulnerabilities | boolean getThemeValue(long theme, @AnyRes int resId, @NonNull TypedValue outValue,
boolean resolveRefs) {
Objects.requireNonNull(outValue, "outValue");
synchronized (this) {
ensureValidLocked();
final int cookie = nativeThemeGetAttributeValue(mObject, theme, resId, outValue,
resolveRefs);
if (cookie <= 0) {
return false;
}
// Convert the changing configurations flags populated by native code.
outValue.changingConfigurations = ActivityInfo.activityInfoConfigNativeToJava(
outValue.changingConfigurations);
if (outValue.type == TypedValue.TYPE_STRING) {
if ((outValue.string = getPooledStringForCookie(cookie, outValue.data)) == null) {
return false;
}
}
return true;
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getThemeValue
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 | getThemeValue | core/java/android/content/res/AssetManager.java | c3bc12c484ef3bbca4cec19234437c45af5e584d | 0 |
Analyze the following code function for security vulnerabilities | private native Profile nativeGetProfileAndroid(long nativeTabAndroid); | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: nativeGetProfileAndroid
File: chrome/android/java/src/org/chromium/chrome/browser/Tab.java
Repository: chromium
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2014-3159 | MEDIUM | 6.4 | chromium | nativeGetProfileAndroid | chrome/android/java/src/org/chromium/chrome/browser/Tab.java | 98a50b76141f0b14f292f49ce376e6554142d5e2 | 0 |
Analyze the following code function for security vulnerabilities | private static int getIntSafe(byte[] bytes, int offset) {
if (BIG_ENDIAN_NATIVE_ORDER) {
return bytes[offset] << 24 |
(bytes[offset + 1] & 0xff) << 16 |
(bytes[offset + 2] & 0xff) << 8 |
bytes[offset + 3] & 0xff;
}
return bytes[offset] & 0xff |
(bytes[offset + 1] & 0xff) << 8 |
(bytes[offset + 2] & 0xff) << 16 |
bytes[offset + 3] << 24;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getIntSafe
File: common/src/main/java/io/netty/util/internal/PlatformDependent.java
Repository: netty
The code follows secure coding practices. | [
"CWE-668",
"CWE-378",
"CWE-379"
] | CVE-2022-24823 | LOW | 1.9 | netty | getIntSafe | common/src/main/java/io/netty/util/internal/PlatformDependent.java | 185f8b2756a36aaa4f973f1a2a025e7d981823f1 | 0 |
Analyze the following code function for security vulnerabilities | private void statsTracker(String descriptionKey, String sql, long startNanoTime) {
long endNanoTime = System.nanoTime();
StatsTracker.addStatElement(STATS_KEY + DOT + descriptionKey, (endNanoTime - startNanoTime));
if (log.isDebugEnabled()) {
logTimer(descriptionKey, sql, startNanoTime, endNanoTime);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: statsTracker
File: domain-models-runtime/src/main/java/org/folio/rest/persist/PostgresClient.java
Repository: folio-org/raml-module-builder
The code follows secure coding practices. | [
"CWE-89"
] | CVE-2019-15534 | HIGH | 7.5 | folio-org/raml-module-builder | statsTracker | domain-models-runtime/src/main/java/org/folio/rest/persist/PostgresClient.java | b7ef741133e57add40aa4cb19430a0065f378a94 | 0 |
Analyze the following code function for security vulnerabilities | public void setBody(CharSequence text, boolean withSignature) {
LogUtils.i(LOG_TAG, "Body populated, len: %d, sig: %b", text.length(), withSignature);
mBodyView.setText(text);
if (withSignature) {
appendSignature();
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setBody
File: src/com/android/mail/compose/ComposeActivity.java
Repository: android
The code follows secure coding practices. | [
"CWE-200"
] | CVE-2016-2425 | MEDIUM | 4.3 | android | setBody | src/com/android/mail/compose/ComposeActivity.java | 0d9dfd649bae9c181e3afc5d571903f1eb5dc46f | 0 |
Analyze the following code function for security vulnerabilities | public String getType() {
return EditableUtils.getDisplayName(getClass());
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getType
File: server-core/src/main/java/io/onedev/server/model/support/inputspec/InputSpec.java
Repository: theonedev/onedev
The code follows secure coding practices. | [
"CWE-94"
] | CVE-2021-21248 | MEDIUM | 6.5 | theonedev/onedev | getType | server-core/src/main/java/io/onedev/server/model/support/inputspec/InputSpec.java | 39d95ab8122c5d9ed18e69dc024870cae08d2d60 | 0 |
Analyze the following code function for security vulnerabilities | private void runOnFutureComplete(DeploymentConfiguration config) {
try {
doStartDevModeServer(config);
} catch (ExecutionFailedException exception) {
getLogger().error(null, exception);
throw new CompletionException(exception);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: runOnFutureComplete
File: flow-server/src/main/java/com/vaadin/flow/server/DevModeHandler.java
Repository: vaadin/flow
The code follows secure coding practices. | [
"CWE-22"
] | CVE-2020-36321 | MEDIUM | 5 | vaadin/flow | runOnFutureComplete | flow-server/src/main/java/com/vaadin/flow/server/DevModeHandler.java | 6ae6460ca4f3a9b50bd46fbf49c807fe67718307 | 0 |
Analyze the following code function for security vulnerabilities | private Object lookup(final String name) throws NamespaceException {
final String nsName = KeyManipulator.getServiceLocation(name);
try {
return Namespace.lookup(nsName);
} catch (NamespaceException ne) {
logger.error("Could not lookup place using " + nsName, ne);
throw ne;
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: lookup
File: src/main/java/emissary/server/mvc/adapters/WorkSpaceAdapter.java
Repository: NationalSecurityAgency/emissary
The code follows secure coding practices. | [
"CWE-502"
] | CVE-2021-32634 | MEDIUM | 6.5 | NationalSecurityAgency/emissary | lookup | src/main/java/emissary/server/mvc/adapters/WorkSpaceAdapter.java | 40260b1ec1f76cc92361702cc14fa1e4388e19d7 | 0 |
Analyze the following code function for security vulnerabilities | public int getDaysOld() {
return daysOld;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getDaysOld
File: src/com/dotmarketing/portlets/workflows/model/WorkflowSearcher.java
Repository: dotCMS/core
The code follows secure coding practices. | [
"CWE-89"
] | CVE-2016-4040 | MEDIUM | 6.5 | dotCMS/core | getDaysOld | src/com/dotmarketing/portlets/workflows/model/WorkflowSearcher.java | bc4db5d71dc67015572f8e4c6fdf87e29b854d02 | 0 |
Analyze the following code function for security vulnerabilities | private ILockSettings getLockSettings() {
if (mLockSettingsService == null) {
ILockSettings service = ILockSettings.Stub.asInterface(
ServiceManager.getService("lock_settings"));
mLockSettingsService = service;
}
return mLockSettingsService;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getLockSettings
File: core/java/com/android/internal/widget/LockPatternUtils.java
Repository: android
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2016-3908 | MEDIUM | 4.3 | android | getLockSettings | core/java/com/android/internal/widget/LockPatternUtils.java | 96daf7d4893f614714761af2d53dfb93214a32e4 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public PageResult getNewBeeMallUsersPage(PageQueryUtil pageUtil) {
List<MallUser> mallUsers = mallUserMapper.findMallUserList(pageUtil);
int total = mallUserMapper.getTotalMallUsers(pageUtil);
PageResult pageResult = new PageResult(mallUsers, total, pageUtil.getLimit(), pageUtil.getPage());
return pageResult;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getNewBeeMallUsersPage
File: src/main/java/ltd/newbee/mall/service/impl/NewBeeMallUserServiceImpl.java
Repository: newbee-ltd/newbee-mall
The code follows secure coding practices. | [
"CWE-639"
] | CVE-2023-30216 | MEDIUM | 5.4 | newbee-ltd/newbee-mall | getNewBeeMallUsersPage | src/main/java/ltd/newbee/mall/service/impl/NewBeeMallUserServiceImpl.java | 4f8948579ddd6843a2e313fdd55aafc809246f63 | 0 |
Analyze the following code function for security vulnerabilities | private static void closeOpenedAttachmentFds(final SendOrSaveMessage sendOrSaveMessage) {
final Bundle openedFds = sendOrSaveMessage.attachmentFds();
if (openedFds != null) {
final Set<String> keys = openedFds.keySet();
for (final String key : keys) {
final ParcelFileDescriptor fd = openedFds.getParcelable(key);
if (fd != null) {
try {
fd.close();
} catch (IOException e) {
// Do nothing
}
}
}
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: closeOpenedAttachmentFds
File: src/com/android/mail/compose/ComposeActivity.java
Repository: android
The code follows secure coding practices. | [
"CWE-200"
] | CVE-2016-2425 | MEDIUM | 4.3 | android | closeOpenedAttachmentFds | src/com/android/mail/compose/ComposeActivity.java | 0d9dfd649bae9c181e3afc5d571903f1eb5dc46f | 0 |
Analyze the following code function for security vulnerabilities | @Override
public Map<java.awt.RenderingHints.Key, ?> getImplementationHints() {
return delegate.getImplementationHints();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getImplementationHints
File: modules/library/jdbc/src/main/java/org/geotools/jdbc/JDBCJNDIDataStoreFactory.java
Repository: geotools
The code follows secure coding practices. | [
"CWE-917"
] | CVE-2022-24818 | HIGH | 7.5 | geotools | getImplementationHints | modules/library/jdbc/src/main/java/org/geotools/jdbc/JDBCJNDIDataStoreFactory.java | 4f70fa3234391dd0cda883a20ab0ec75688cba49 | 0 |
Analyze the following code function for security vulnerabilities | public String getUsername() {
return username;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getUsername
File: components/apimgt/org.wso2.carbon.apimgt.hostobjects/src/main/java/org/wso2/carbon/apimgt/hostobjects/APIStoreHostObject.java
Repository: wso2/carbon-apimgt
The code follows secure coding practices. | [
"CWE-79"
] | CVE-2018-20736 | LOW | 3.5 | wso2/carbon-apimgt | getUsername | components/apimgt/org.wso2.carbon.apimgt.hostobjects/src/main/java/org/wso2/carbon/apimgt/hostobjects/APIStoreHostObject.java | 490f2860822f89d745b7c04fa9570bd86bef4236 | 0 |
Analyze the following code function for security vulnerabilities | public void loginAsAdminAndGotoPage(String pageURL)
{
loginAndGotoPage(ADMIN_CREDENTIALS.getUserName(), ADMIN_CREDENTIALS.getPassword(), pageURL);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: loginAsAdminAndGotoPage
File: xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-ui/src/main/java/org/xwiki/test/ui/TestUtils.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices. | [
"CWE-863"
] | CVE-2023-35166 | HIGH | 8.8 | xwiki/xwiki-platform | loginAsAdminAndGotoPage | xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-ui/src/main/java/org/xwiki/test/ui/TestUtils.java | 98208c5bb1e8cdf3ff1ac35d8b3d1cb3c28b3263 | 0 |
Analyze the following code function for security vulnerabilities | public String getURL(EntityReference reference, String action, XWikiContext context)
{
return getURL(reference, action, null, null, context);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getURL
File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices. | [
"CWE-863"
] | CVE-2021-32620 | MEDIUM | 4 | xwiki/xwiki-platform | getURL | xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java | f9a677408ffb06f309be46ef9d8df1915d9099a4 | 0 |
Analyze the following code function for security vulnerabilities | @RequiresPermission(value = MANAGE_DEVICE_POLICY_WIFI, conditional = true)
public void setWifiSsidPolicy(@Nullable WifiSsidPolicy policy) {
throwIfParentInstance("setWifiSsidPolicy");
if (mService == null) {
return;
}
try {
mService.setWifiSsidPolicy(mContext.getPackageName(), policy);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setWifiSsidPolicy
File: core/java/android/app/admin/DevicePolicyManager.java
Repository: android
The code follows secure coding practices. | [
"CWE-862"
] | CVE-2023-40089 | HIGH | 7.8 | android | setWifiSsidPolicy | core/java/android/app/admin/DevicePolicyManager.java | e2e05f488da6abc765a62e7faf10cb74e729732e | 0 |
Analyze the following code function for security vulnerabilities | @SuppressWarnings("unchecked")
public boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspace, final BuildListener listener, File changelogFile) throws IOException, InterruptedException {
EnvVars env = build.getEnvironment(listener);
EnvVarsUtils.overrideAll(env, build.getBuildVariables());
List<External> externals = null;
try {
externals = checkout(build,workspace,listener,env);
} catch (UpdaterException e) {
return false;
}
// write out the revision file
PrintWriter w = new PrintWriter(new FileOutputStream(getRevisionFile(build)));
try {
List<SvnInfoP> pList = workspace.act(new BuildRevisionMapTask(build, this, listener, externals, env));
List<SvnInfo> revList= new ArrayList<SvnInfo>(pList.size());
for (SvnInfoP p: pList) {
if (p.pinned)
w.println( p.info.url +'/'+ p.info.revision + "::p");
else
w.println( p.info.url +'/'+ p.info.revision);
revList.add(p.info);
}
build.addAction(new SubversionTagAction(build,revList));
} finally {
w.close();
}
// write out the externals info
new XmlFile(External.XSTREAM,getExternalsFile(build.getProject())).write(externals);
Map<AbstractProject, List<External>> projectExternalsCache = getProjectExternalsCache();
synchronized (projectExternalsCache) {
projectExternalsCache.put(build.getProject(), externals);
}
return calcChangeLog(build, changelogFile, listener, externals, env);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: checkout
File: src/main/java/hudson/scm/SubversionSCM.java
Repository: jenkinsci/subversion-plugin
The code follows secure coding practices. | [
"CWE-255"
] | CVE-2013-6372 | LOW | 2.1 | jenkinsci/subversion-plugin | checkout | src/main/java/hudson/scm/SubversionSCM.java | 7d4562d6f7e40de04bbe29577b51c79f07d05ba6 | 0 |
Analyze the following code function for security vulnerabilities | @SuppressWarnings({"unchecked", "rawtypes"})
private HashMap<String, String> createMap(Properties properties) {
return new HashMap(properties);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: createMap
File: activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java
Repository: apache/activemq
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2014-3576 | MEDIUM | 5 | apache/activemq | createMap | activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java | 00921f2 | 0 |
Analyze the following code function for security vulnerabilities | public ArtemisSecurityConfigurationBuilder withTrustedPackages(Set<PackageRule> trustedPackages) {
this.trustedPackages = Set.copyOf(trustedPackages);
return this;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: withTrustedPackages
File: src/main/java/de/tum/in/test/api/security/ArtemisSecurityConfigurationBuilder.java
Repository: ls1intum/Ares
The code follows secure coding practices. | [
"CWE-501",
"CWE-653"
] | CVE-2024-23682 | HIGH | 8.2 | ls1intum/Ares | withTrustedPackages | src/main/java/de/tum/in/test/api/security/ArtemisSecurityConfigurationBuilder.java | 4c146ff85a0fa6022087fb0cffa6b8021d51101f | 0 |
Analyze the following code function for security vulnerabilities | @SuppressWarnings("unchecked")
public static FlippingStrategy instanceFlippingStrategy(String uid, String className, Map<String, String> initparams) {
try {
Class<FlippingStrategy> clazz = (Class<FlippingStrategy>) (classLoader == null ? Class.forName(className) : classLoader.loadClass(className));
FlippingStrategy flipStrategy = clazz.newInstance();
flipStrategy.init(uid, initparams);
return flipStrategy;
} catch (Exception ie) {
throw new FeatureAccessException("Cannot instantiate Strategy, no default constructor available", ie);
}
} | Vulnerability Classification:
- CWE: CWE-Other
- CVE: CVE-2022-44262
- Severity: CRITICAL
- CVSS Score: 9.8
Description: fix: Validate FlippingStrategy in various parsers (#624)
Function: instanceFlippingStrategy
File: ff4j-core/src/main/java/org/ff4j/utils/MappingUtil.java
Repository: ff4j
Fixed Code:
@SuppressWarnings("unchecked")
public static FlippingStrategy instanceFlippingStrategy(String uid, String className, Map<String, String> initparams) {
try {
Class<FlippingStrategy> clazz = (Class<FlippingStrategy>) (classLoader == null ? Class.forName(className) : classLoader.loadClass(className));
if (!FlippingStrategy.class.isAssignableFrom(clazz)) {
throw new IllegalArgumentException("Invalid type " + className );
}
FlippingStrategy flipStrategy = clazz.newInstance();
flipStrategy.init(uid, initparams);
return flipStrategy;
} catch (Exception ie) {
throw new FeatureAccessException("Cannot instantiate Strategy, no default constructor available", ie);
}
} | [
"CWE-Other"
] | CVE-2022-44262 | CRITICAL | 9.8 | ff4j | instanceFlippingStrategy | ff4j-core/src/main/java/org/ff4j/utils/MappingUtil.java | 991df72725f78adbc413d9b0fbb676201f1882e0 | 1 |
Analyze the following code function for security vulnerabilities | private void readObjectForClass(Object object, ObjectStreamClass classDesc)
throws IOException, ClassNotFoundException, NotActiveException {
// Have to do this before calling defaultReadObject or anything that
// calls defaultReadObject
currentObject = object;
currentClass = classDesc;
boolean hadWriteMethod = (classDesc.getFlags() & SC_WRITE_METHOD) != 0;
Class<?> targetClass = classDesc.forClass();
final Method readMethod;
if (targetClass == null || !mustResolve) {
readMethod = null;
} else {
readMethod = classDesc.getMethodReadObject();
}
try {
if (readMethod != null) {
// We have to be able to fetch its value, even if it is private
readMethod.setAccessible(true);
try {
readMethod.invoke(object, this);
} catch (InvocationTargetException e) {
Throwable ex = e.getTargetException();
if (ex instanceof ClassNotFoundException) {
throw (ClassNotFoundException) ex;
} else if (ex instanceof RuntimeException) {
throw (RuntimeException) ex;
} else if (ex instanceof Error) {
throw (Error) ex;
}
throw (IOException) ex;
} catch (IllegalAccessException e) {
throw new RuntimeException(e.toString());
}
} else {
defaultReadObject();
}
if (hadWriteMethod) {
discardData();
}
} finally {
// Cleanup, needs to run always so that we can later detect invalid
// calls to defaultReadObject
currentObject = null; // We did not set this, so we do not need to
// clean it
currentClass = null;
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: readObjectForClass
File: luni/src/main/java/java/io/ObjectInputStream.java
Repository: android
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2014-7911 | HIGH | 7.2 | android | readObjectForClass | luni/src/main/java/java/io/ObjectInputStream.java | 738c833d38d41f8f76eb7e77ab39add82b1ae1e2 | 0 |
Analyze the following code function for security vulnerabilities | private HttpSessionContext getSessionContext() {
if (sessionContextCache == null) {
this.sessionContextCache = beanManager.instance().select(HttpSessionContext.class).get();
}
return sessionContextCache;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getSessionContext
File: impl/src/main/java/org/jboss/weld/servlet/HttpContextLifecycle.java
Repository: weld/core
The code follows secure coding practices. | [
"CWE-362"
] | CVE-2014-8122 | MEDIUM | 4.3 | weld/core | getSessionContext | impl/src/main/java/org/jboss/weld/servlet/HttpContextLifecycle.java | 8e413202fa1af08c09c580f444e4fd16874f9c65 | 0 |
Analyze the following code function for security vulnerabilities | void respondToRttRequest(
Call call, ParcelFileDescriptor fromInCall, ParcelFileDescriptor toInCall) {
final String callId = mCallIdMapper.getCallId(call);
if (callId != null && isServiceValid("respondToRttRequest")) {
try {
logOutgoing("respondToRttRequest: %s %s %s", callId, fromInCall, toInCall);
mServiceInterface.respondToRttUpgradeRequest(
callId, fromInCall, toInCall, Log.getExternalSession(TELECOM_ABBREVIATION));
} catch (RemoteException ignored) {
}
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: respondToRttRequest
File: src/com/android/server/telecom/ConnectionServiceWrapper.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-21283 | MEDIUM | 5.5 | android | respondToRttRequest | src/com/android/server/telecom/ConnectionServiceWrapper.java | 9b41a963f352fdb3da1da8c633d45280badfcb24 | 0 |
Analyze the following code function for security vulnerabilities | public boolean isFilterParameterEnabled() {
return myFilterParameterEnabled;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isFilterParameterEnabled
File: hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java
Repository: hapifhir/hapi-fhir
The code follows secure coding practices. | [
"CWE-400"
] | CVE-2021-32053 | MEDIUM | 5 | hapifhir/hapi-fhir | isFilterParameterEnabled | hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java | f2934b229c491235ab0e7782dea86b324521082a | 0 |
Analyze the following code function for security vulnerabilities | public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions opts)
throws RemoteException; | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: startInPlaceAnimationOnFrontMostApplication
File: core/java/android/app/IActivityManager.java
Repository: android
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2016-3832 | HIGH | 8.3 | android | startInPlaceAnimationOnFrontMostApplication | core/java/android/app/IActivityManager.java | e7cf91a198de995c7440b3b64352effd2e309906 | 0 |
Analyze the following code function for security vulnerabilities | private static int hashCodeAsciiSanitizeByte(char value) {
return value & 0x1f;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: hashCodeAsciiSanitizeByte
File: common/src/main/java/io/netty/util/internal/PlatformDependent.java
Repository: netty
The code follows secure coding practices. | [
"CWE-668",
"CWE-378",
"CWE-379"
] | CVE-2022-24823 | LOW | 1.9 | netty | hashCodeAsciiSanitizeByte | common/src/main/java/io/netty/util/internal/PlatformDependent.java | 185f8b2756a36aaa4f973f1a2a025e7d981823f1 | 0 |
Analyze the following code function for security vulnerabilities | public static void releaseLastXrefPartial(PdfObject obj) {
if (obj == null)
return;
if (!obj.isIndirect())
return;
if (!(obj instanceof PRIndirectReference))
return;
PRIndirectReference ref = (PRIndirectReference)obj;
PdfReader reader = ref.getReader();
if (reader.partial && reader.lastXrefPartial != -1 && reader.lastXrefPartial == ref.getNumber()) {
reader.xrefObj.set(reader.lastXrefPartial, null);
}
reader.lastXrefPartial = -1;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: releaseLastXrefPartial
File: java/com/gitlab/pdftk_java/com/lowagie/text/pdf/PdfReader.java
Repository: pdftk-java/pdftk
The code follows secure coding practices. | [
"CWE-835"
] | CVE-2021-37819 | HIGH | 7.5 | pdftk-java/pdftk | releaseLastXrefPartial | java/com/gitlab/pdftk_java/com/lowagie/text/pdf/PdfReader.java | 9b0cbb76c8434a8505f02ada02a94263dcae9247 | 0 |
Analyze the following code function for security vulnerabilities | public static Document parse(LSInput source)
{
try {
LSParser p = LS_IMPL.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
// Disable validation, since this takes a lot of time and causes unneeded network traffic
p.getDomConfig().setParameter("validate", false);
if (p.getDomConfig().canSetParameter(DISABLE_DTD_PARAM, false)) {
p.getDomConfig().setParameter(DISABLE_DTD_PARAM, false);
}
return p.parse(source);
} catch (Exception ex) {
LOGGER.warn("Cannot parse XML document: [{}]", ex.getMessage());
return null;
}
} | Vulnerability Classification:
- CWE: CWE-611
- CVE: CVE-2022-24898
- Severity: MEDIUM
- CVSS Score: 4.0
Description: XWIKI-18946: Improve the default XML parser
Function: parse
File: xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/XMLUtils.java
Repository: xwiki/xwiki-commons
Fixed Code:
public static Document parse(LSInput source)
{
try {
LSParser p = LS_IMPL.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
// Disable validation, since this takes a lot of time and causes unneeded network traffic
p.getDomConfig().setParameter("validate", false);
if (p.getDomConfig().canSetParameter(DISABLE_DTD_PARAM, false)) {
p.getDomConfig().setParameter(DISABLE_DTD_PARAM, false);
}
// Avoid XML eXternal Entity injection (XXE)
if (p.getDomConfig().canSetParameter(DISABLE_EXTERNAL_DOCTYPE_DECLARATION, false)) {
p.getDomConfig().setParameter(DISABLE_EXTERNAL_DOCTYPE_DECLARATION, false);
}
if (p.getDomConfig().canSetParameter(DISABLE_EXTERNAL_PARAMETER_ENTITIES, false)) {
p.getDomConfig().setParameter(DISABLE_EXTERNAL_PARAMETER_ENTITIES, false);
}
if (p.getDomConfig().canSetParameter(DISABLE_EXTERNAL_GENERAL_ENTITIES, false)) {
p.getDomConfig().setParameter(DISABLE_EXTERNAL_GENERAL_ENTITIES, false);
}
return p.parse(source);
} catch (Exception ex) {
LOGGER.warn("Cannot parse XML document: [{}]", ex.getMessage());
return null;
}
} | [
"CWE-611"
] | CVE-2022-24898 | MEDIUM | 4 | xwiki/xwiki-commons | parse | xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/XMLUtils.java | 947e8921ebd95462d5a7928f397dd1b64f77c7d5 | 1 |
Analyze the following code function for security vulnerabilities | @SuppressWarnings("deprecation")
public String getLegacyInstanceId() {
return Util.getDigestOf(getSecretKey());
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getLegacyInstanceId
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 | getLegacyInstanceId | core/src/main/java/jenkins/model/Jenkins.java | a0b00508eeb74d7033dc4100eb382df4e8fa72e7 | 0 |
Analyze the following code function for security vulnerabilities | protected PostMethod executePost(String uri, InputStream is, String userName, String password) throws Exception
{
HttpClient httpClient = new HttpClient();
httpClient.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(userName, password));
httpClient.getParams().setAuthenticationPreemptive(true);
PostMethod postMethod = new PostMethod(uri);
postMethod.addRequestHeader("Accept", MediaType.APPLICATION_XML.toString());
RequestEntity entity = new InputStreamRequestEntity(is);
postMethod.setRequestEntity(entity);
httpClient.executeMethod(postMethod);
return postMethod;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: executePost
File: xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-test/xwiki-platform-rest-test-tests/src/test/it/org/xwiki/rest/test/framework/AbstractHttpIT.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices. | [
"CWE-352"
] | CVE-2023-37277 | CRITICAL | 9.6 | xwiki/xwiki-platform | executePost | xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-test/xwiki-platform-rest-test-tests/src/test/it/org/xwiki/rest/test/framework/AbstractHttpIT.java | 4c175405faa0e62437df397811c7526dfc0fbae7 | 0 |
Analyze the following code function for security vulnerabilities | @NonNull
@Override
public LaunchAnimator.State createAnimatorState() {
final int width = getLaunchContainer().getWidth();
final int height = getLaunchContainer().getHeight();
final float initialHeight = height / 3f;
final float initialWidth = width / 3f;
if (mUpdateMonitor.isSecureCameraLaunchedOverKeyguard()) {
// Start the animation near the power button, at one-third size, since the
// camera was launched from the power button.
return new LaunchAnimator.State(
(int) (mPowerButtonY - initialHeight / 2f) /* top */,
(int) (mPowerButtonY + initialHeight / 2f) /* bottom */,
(int) (width - initialWidth) /* left */,
width /* right */,
mWindowCornerRadius, mWindowCornerRadius);
} else {
// Start the animation in the center of the screen, scaled down.
return new LaunchAnimator.State(
height / 2, height / 2, width / 2, width / 2,
mWindowCornerRadius, mWindowCornerRadius);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: createAnimatorState
File: packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-21267 | MEDIUM | 5.5 | android | createAnimatorState | packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java | d18d8b350756b0e89e051736c1f28744ed31e93a | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void setClip(Object graphics, Shape shape) {
//Path p = cn1ShapeToAndroidPath(shape);
((AndroidGraphics) graphics).setClip(shape);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setClip
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 | setClip | Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java | dad49c9ef26a598619fc48d2697151a02987d478 | 0 |
Analyze the following code function for security vulnerabilities | public static String addLimits(String query, long offSet, long limit) {
if ( offSet == 0 && limit == -1 ) {
//Nothing to do...
return query;
}
StringBuffer queryString = new StringBuffer();
int count = 0;
if(query!=null){
query = query.toLowerCase();
count = StringUtil.count(query, "select");
}
if(!UtilMethods.isSet(query)|| !query.trim().contains("select")|| count>1){
return query;
}else{
if(DbConnectionFactory.isPostgres()||
DbConnectionFactory.isMySql() || DbConnectionFactory.isH2()){
query = query +" LIMIT "+limit+" OFFSET " +offSet;
queryString.append(query);
}else if(DbConnectionFactory.isMsSql()){
String str = "";
if(query.startsWith("select")){
query = query.substring(6);
}
if(query.contains("order by")){
str = query.substring(query.indexOf("order by"), query.length());
query = query.replace(str,"").trim();
}
query = " SELECT TOP "+limit+" * FROM (SELECT ROW_NUMBER() "
+ " OVER ("+str+") AS RowNumber,"+query+") temp "
+ " WHERE RowNumber >"+offSet;
queryString.append(query);
}else if(DbConnectionFactory.isOracle()){
limit = limit + offSet;
query = "select * from ( select temp.*, ROWNUM rnum from ( "+
query+" ) temp where ROWNUM <= "+limit+" ) where rnum > "+offSet;
queryString.append(query);
}
}
return queryString.toString();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: addLimits
File: src/com/dotmarketing/common/util/SQLUtil.java
Repository: dotCMS/core
The code follows secure coding practices. | [
"CWE-89"
] | CVE-2016-2355 | HIGH | 7.5 | dotCMS/core | addLimits | src/com/dotmarketing/common/util/SQLUtil.java | 897f3632d7e471b7a73aabed5b19f6f53d4e5562 | 0 |
Analyze the following code function for security vulnerabilities | public void onHostEmulationData(byte[] data) {
Log.d(TAG, "notifyHostEmulationData");
String selectAid = findSelectAid(data);
ComponentName resolvedService = null;
ApduServiceInfo resolvedServiceInfo = null;
AidResolveInfo resolveInfo = null;
synchronized (mLock) {
if (mState == STATE_IDLE) {
Log.e(TAG, "Got data in idle state.");
return;
} else if (mState == STATE_W4_DEACTIVATE) {
Log.e(TAG, "Dropping APDU in STATE_W4_DECTIVATE");
return;
}
if (selectAid != null) {
if (selectAid.equals(ANDROID_HCE_AID)) {
NfcService.getInstance().sendData(ANDROID_HCE_RESPONSE);
return;
}
resolveInfo = mAidCache.resolveAid(selectAid);
if (resolveInfo == null || resolveInfo.services.size() == 0) {
// Tell the remote we don't handle this AID
NfcService.getInstance().sendData(AID_NOT_FOUND);
return;
}
mLastSelectedAid = selectAid;
if (resolveInfo.defaultService != null) {
// Resolve to default
// Check if resolvedService requires unlock
ApduServiceInfo defaultServiceInfo = resolveInfo.defaultService;
if (defaultServiceInfo.requiresUnlock() && mKeyguard.isKeyguardLocked()) {
NfcService.getInstance().sendRequireUnlockIntent();
NfcService.getInstance().sendData(AID_NOT_FOUND);
if (DBG) Log.d(TAG, "requiresUnlock()! show toast");
launchTapAgain(resolveInfo.defaultService, resolveInfo.category);
return;
}
if (defaultServiceInfo.requiresScreenOn() && !mPowerManager.isScreenOn()) {
NfcService.getInstance().sendRequireUnlockIntent();
NfcService.getInstance().sendData(AID_NOT_FOUND);
if (DBG) Log.d(TAG, "requiresScreenOn()!");
return;
}
// In no circumstance should this be an OffHostService -
// we should never get this AID on the host in the first place
if (!defaultServiceInfo.isOnHost()) {
Log.e(TAG, "AID that was meant to go off-host was routed to host." +
" Check routing table configuration.");
NfcService.getInstance().sendData(AID_NOT_FOUND);
return;
}
resolvedService = defaultServiceInfo.getComponent();
resolvedServiceInfo = defaultServiceInfo;
} else if (mActiveServiceName != null) {
for (ApduServiceInfo serviceInfo : resolveInfo.services) {
if (mActiveServiceName.equals(serviceInfo.getComponent())) {
resolvedService = mActiveServiceName;
resolvedServiceInfo = serviceInfo;
break;
}
}
}
if (resolvedService == null) {
// We have no default, and either one or more services.
// Ask the user to confirm.
// Just ignore all future APDUs until we resolve to only one
mState = STATE_W4_DEACTIVATE;
launchResolver((ArrayList<ApduServiceInfo>)resolveInfo.services, null,
resolveInfo.category);
return;
}
}
switch (mState) {
case STATE_W4_SELECT:
if (selectAid != null) {
UserHandle user =
UserHandle.getUserHandleForUid(resolvedServiceInfo.getUid());
Messenger existingService =
bindServiceIfNeededLocked(user.getIdentifier(), resolvedService);
if (existingService != null) {
Log.d(TAG, "Binding to existing service");
mState = STATE_XFER;
sendDataToServiceLocked(existingService, data);
} else {
// Waiting for service to be bound
Log.d(TAG, "Waiting for new service.");
// Queue SELECT APDU to be used
mSelectApdu = data;
mState = STATE_W4_SERVICE;
}
if (CardEmulation.CATEGORY_PAYMENT.equals(resolveInfo.category)) {
NfcStatsLog.write(NfcStatsLog.NFC_CARDEMULATION_OCCURRED,
NfcStatsLog.NFC_CARDEMULATION_OCCURRED__CATEGORY__HCE_PAYMENT,
"HCE");
} else {
NfcStatsLog.write(NfcStatsLog.NFC_CARDEMULATION_OCCURRED,
NfcStatsLog.NFC_CARDEMULATION_OCCURRED__CATEGORY__HCE_OTHER,
"HCE");
}
} else {
Log.d(TAG, "Dropping non-select APDU in STATE_W4_SELECT");
NfcService.getInstance().sendData(UNKNOWN_ERROR);
}
break;
case STATE_W4_SERVICE:
Log.d(TAG, "Unexpected APDU in STATE_W4_SERVICE");
break;
case STATE_XFER:
if (selectAid != null) {
UserHandle user =
UserHandle.getUserHandleForUid(resolvedServiceInfo.getUid());
Messenger existingService =
bindServiceIfNeededLocked(user.getIdentifier(), resolvedService);
if (existingService != null) {
sendDataToServiceLocked(existingService, data);
mState = STATE_XFER;
} else {
// Waiting for service to be bound
mSelectApdu = data;
mState = STATE_W4_SERVICE;
}
} else if (mActiveService != null) {
// Regular APDU data
sendDataToServiceLocked(mActiveService, data);
} else {
// No SELECT AID and no active service.
Log.d(TAG, "Service no longer bound, dropping APDU");
}
break;
}
}
} | Vulnerability Classification:
- CWE: CWE-Other
- CVE: CVE-2023-35671
- Severity: MEDIUM
- CVSS Score: 5.5
Description: Ensure that SecureNFC setting cannot be bypassed
Bug: 268038643
Test: ctsverifier
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:6cb53d963d376b97963120a4d2c7df961789e428)
Merged-In: I53a45c3600dc6bba7009921ca5135ee37b5edfd0
Change-Id: I53a45c3600dc6bba7009921ca5135ee37b5edfd0
Function: onHostEmulationData
File: src/com/android/nfc/cardemulation/HostEmulationManager.java
Repository: android
Fixed Code:
public void onHostEmulationData(byte[] data) {
Log.d(TAG, "notifyHostEmulationData");
String selectAid = findSelectAid(data);
ComponentName resolvedService = null;
ApduServiceInfo resolvedServiceInfo = null;
AidResolveInfo resolveInfo = null;
synchronized (mLock) {
if (mState == STATE_IDLE) {
Log.e(TAG, "Got data in idle state.");
return;
} else if (mState == STATE_W4_DEACTIVATE) {
Log.e(TAG, "Dropping APDU in STATE_W4_DECTIVATE");
return;
}
if (selectAid != null) {
if (selectAid.equals(ANDROID_HCE_AID)) {
NfcService.getInstance().sendData(ANDROID_HCE_RESPONSE);
return;
}
resolveInfo = mAidCache.resolveAid(selectAid);
if (resolveInfo == null || resolveInfo.services.size() == 0) {
// Tell the remote we don't handle this AID
NfcService.getInstance().sendData(AID_NOT_FOUND);
return;
}
mLastSelectedAid = selectAid;
if (resolveInfo.defaultService != null) {
// Resolve to default
// Check if resolvedService requires unlock
ApduServiceInfo defaultServiceInfo = resolveInfo.defaultService;
if ((defaultServiceInfo.requiresUnlock()
|| NfcService.getInstance().isSecureNfcEnabled())
&& mKeyguard.isKeyguardLocked()) {
NfcService.getInstance().sendRequireUnlockIntent();
NfcService.getInstance().sendData(AID_NOT_FOUND);
if (DBG) Log.d(TAG, "requiresUnlock()! show toast");
launchTapAgain(resolveInfo.defaultService, resolveInfo.category);
return;
}
if (defaultServiceInfo.requiresScreenOn() && !mPowerManager.isScreenOn()) {
NfcService.getInstance().sendRequireUnlockIntent();
NfcService.getInstance().sendData(AID_NOT_FOUND);
if (DBG) Log.d(TAG, "requiresScreenOn()!");
return;
}
// In no circumstance should this be an OffHostService -
// we should never get this AID on the host in the first place
if (!defaultServiceInfo.isOnHost()) {
Log.e(TAG, "AID that was meant to go off-host was routed to host." +
" Check routing table configuration.");
NfcService.getInstance().sendData(AID_NOT_FOUND);
return;
}
resolvedService = defaultServiceInfo.getComponent();
resolvedServiceInfo = defaultServiceInfo;
} else if (mActiveServiceName != null) {
for (ApduServiceInfo serviceInfo : resolveInfo.services) {
if (mActiveServiceName.equals(serviceInfo.getComponent())) {
resolvedService = mActiveServiceName;
resolvedServiceInfo = serviceInfo;
break;
}
}
}
if (resolvedService == null) {
// We have no default, and either one or more services.
// Ask the user to confirm.
// Just ignore all future APDUs until we resolve to only one
mState = STATE_W4_DEACTIVATE;
launchResolver((ArrayList<ApduServiceInfo>)resolveInfo.services, null,
resolveInfo.category);
return;
}
}
switch (mState) {
case STATE_W4_SELECT:
if (selectAid != null) {
UserHandle user =
UserHandle.getUserHandleForUid(resolvedServiceInfo.getUid());
Messenger existingService =
bindServiceIfNeededLocked(user.getIdentifier(), resolvedService);
if (existingService != null) {
Log.d(TAG, "Binding to existing service");
mState = STATE_XFER;
sendDataToServiceLocked(existingService, data);
} else {
// Waiting for service to be bound
Log.d(TAG, "Waiting for new service.");
// Queue SELECT APDU to be used
mSelectApdu = data;
mState = STATE_W4_SERVICE;
}
if (CardEmulation.CATEGORY_PAYMENT.equals(resolveInfo.category)) {
NfcStatsLog.write(NfcStatsLog.NFC_CARDEMULATION_OCCURRED,
NfcStatsLog.NFC_CARDEMULATION_OCCURRED__CATEGORY__HCE_PAYMENT,
"HCE");
} else {
NfcStatsLog.write(NfcStatsLog.NFC_CARDEMULATION_OCCURRED,
NfcStatsLog.NFC_CARDEMULATION_OCCURRED__CATEGORY__HCE_OTHER,
"HCE");
}
} else {
Log.d(TAG, "Dropping non-select APDU in STATE_W4_SELECT");
NfcService.getInstance().sendData(UNKNOWN_ERROR);
}
break;
case STATE_W4_SERVICE:
Log.d(TAG, "Unexpected APDU in STATE_W4_SERVICE");
break;
case STATE_XFER:
if (selectAid != null) {
UserHandle user =
UserHandle.getUserHandleForUid(resolvedServiceInfo.getUid());
Messenger existingService =
bindServiceIfNeededLocked(user.getIdentifier(), resolvedService);
if (existingService != null) {
sendDataToServiceLocked(existingService, data);
mState = STATE_XFER;
} else {
// Waiting for service to be bound
mSelectApdu = data;
mState = STATE_W4_SERVICE;
}
} else if (mActiveService != null) {
// Regular APDU data
sendDataToServiceLocked(mActiveService, data);
} else {
// No SELECT AID and no active service.
Log.d(TAG, "Service no longer bound, dropping APDU");
}
break;
}
}
} | [
"CWE-Other"
] | CVE-2023-35671 | MEDIUM | 5.5 | android | onHostEmulationData | src/com/android/nfc/cardemulation/HostEmulationManager.java | 745632835f3d97513a9c2a96e56e1dc06c4e4176 | 1 |
Analyze the following code function for security vulnerabilities | @Override
public String getRequestPath() {
return request.getServletPath();
} | Vulnerability Classification:
- CWE: CWE-Other
- CVE: CVE-2023-44794
- Severity: CRITICAL
- CVSS Score: 9.8
Description: 修复路由拦截鉴权可被绕过的问题 fix #515
Function: getRequestPath
File: sa-token-starter/sa-token-jakarta-servlet/src/main/java/cn/dev33/satoken/servlet/model/SaRequestForServlet.java
Repository: dromara/Sa-Token
Fixed Code:
@Override
public String getRequestPath() {
return ApplicationInfo.cutPathPrefix(request.getRequestURI());
} | [
"CWE-Other"
] | CVE-2023-44794 | CRITICAL | 9.8 | dromara/Sa-Token | getRequestPath | sa-token-starter/sa-token-jakarta-servlet/src/main/java/cn/dev33/satoken/servlet/model/SaRequestForServlet.java | 954efeb73277f924f836da2a25322ea35ee1bfa3 | 1 |
Analyze the following code function for security vulnerabilities | protected int getCacheTime(String filenameWithPath) {
/*
* GWT conventions:
*
* - files containing .nocache. will not be cached.
*
* - files containing .cache. will be cached for one year.
*
* https://developers.google.com/web-toolkit/doc/latest/
* DevGuideCompilingAndDebugging#perfect_caching
*/
if (filenameWithPath.contains(".nocache.")) {
return 0;
}
if (filenameWithPath.contains(".cache.")) {
return 60 * 60 * 24 * 365;
}
/*
* For all other files, the browser is allowed to cache for 1 hour
* without checking if the file has changed.
*/
return 3600;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getCacheTime
File: flow-server/src/main/java/com/vaadin/flow/server/StaticFileServer.java
Repository: vaadin/flow
The code follows secure coding practices. | [
"CWE-22"
] | CVE-2020-36321 | MEDIUM | 5 | vaadin/flow | getCacheTime | flow-server/src/main/java/com/vaadin/flow/server/StaticFileServer.java | 6ae6460ca4f3a9b50bd46fbf49c807fe67718307 | 0 |
Analyze the following code function for security vulnerabilities | private void scheduleNotifyAppWidgetViewDataChanged(Widget widget, int viewId) {
if (widget == null || widget.host == null || widget.host.zombie
|| widget.host.callbacks == null || widget.provider == null
|| widget.provider.zombie) {
return;
}
SomeArgs args = SomeArgs.obtain();
args.arg1 = widget.host;
args.arg2 = widget.host.callbacks;
args.argi1 = widget.appWidgetId;
args.argi2 = viewId;
mCallbackHandler.obtainMessage(
CallbackHandler.MSG_NOTIFY_VIEW_DATA_CHANGED,
args).sendToTarget();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: scheduleNotifyAppWidgetViewDataChanged
File: services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
Repository: android
The code follows secure coding practices. | [
"CWE-284"
] | CVE-2015-1541 | MEDIUM | 4.3 | android | scheduleNotifyAppWidgetViewDataChanged | services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java | 0b98d304c467184602b4c6bce76fda0b0274bc07 | 0 |
Analyze the following code function for security vulnerabilities | public void setQuarterlyVotes(Integer quarterlyVotes) {
this.quarterlyVotes = quarterlyVotes;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setQuarterlyVotes
File: src/main/java/com/erudika/scoold/core/Profile.java
Repository: Erudika/scoold
The code follows secure coding practices. | [
"CWE-130"
] | CVE-2022-1543 | MEDIUM | 6.5 | Erudika/scoold | setQuarterlyVotes | src/main/java/com/erudika/scoold/core/Profile.java | 62a0e92e1486ddc17676a7ead2c07ff653d167ce | 0 |
Analyze the following code function for security vulnerabilities | public ApiClient setOauthScope(String scope) {
for (Authentication auth : authentications.values()) {
if (auth instanceof OAuth) {
((OAuth) auth).setScope(scope);
return this;
}
}
throw new RuntimeException("No OAuth2 authentication configured!");
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setOauthScope
File: samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/ApiClient.java
Repository: OpenAPITools/openapi-generator
The code follows secure coding practices. | [
"CWE-668"
] | CVE-2021-21430 | LOW | 2.1 | OpenAPITools/openapi-generator | setOauthScope | samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/ApiClient.java | 2c576483f26f85b3979c6948a131f585c237109a | 0 |
Analyze the following code function for security vulnerabilities | public ApiClient setOauthScope(String scope) {
for (Authentication auth : authentications.values()) {
if (auth instanceof OAuth) {
((OAuth) auth).setScope(scope);
return this;
}
}
throw new RuntimeException("No OAuth2 authentication configured!");
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setOauthScope
File: samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java
Repository: OpenAPITools/openapi-generator
The code follows secure coding practices. | [
"CWE-668"
] | CVE-2021-21430 | LOW | 2.1 | OpenAPITools/openapi-generator | setOauthScope | samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java | 2c576483f26f85b3979c6948a131f585c237109a | 0 |
Analyze the following code function for security vulnerabilities | protected Client buildHttpClient() {
// use the default client config if not yet initialized
if (clientConfig == null) {
clientConfig = getDefaultClientConfig();
}
ClientBuilder clientBuilder = ClientBuilder.newBuilder();
customizeClientBuilder(clientBuilder);
clientBuilder = clientBuilder.withConfig(clientConfig);
return clientBuilder.build();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: buildHttpClient
File: samples/client/petstore/java/jersey2-java8/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 | buildHttpClient | samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java | 2c576483f26f85b3979c6948a131f585c237109a | 0 |
Analyze the following code function for security vulnerabilities | @Override
public Response processMessage(Message messageSend) throws Exception {
ProducerId producerId = messageSend.getProducerId();
ProducerBrokerExchange producerExchange = getProducerBrokerExchange(producerId);
if (producerExchange.canDispatch(messageSend)) {
broker.send(producerExchange, messageSend);
}
return null;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: processMessage
File: activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java
Repository: apache/activemq
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2014-3576 | MEDIUM | 5 | apache/activemq | processMessage | activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java | 00921f2 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void setSecondaryLockscreenEnabled(ComponentName who, boolean enabled) {
Objects.requireNonNull(who, "ComponentName is null");
// Check can set secondary lockscreen enabled
final CallerIdentity caller = getCallerIdentity(who);
Preconditions.checkCallAuthorization(
isDefaultDeviceOwner(caller) || isProfileOwner(caller));
Preconditions.checkCallAuthorization(!isManagedProfile(caller.getUserId()),
"User %d is not allowed to call setSecondaryLockscreenEnabled",
caller.getUserId());
synchronized (getLockObject()) {
// Allow testOnly admins to bypass supervision config requirement.
Preconditions.checkCallAuthorization(isAdminTestOnlyLocked(who, caller.getUserId())
|| isSupervisionComponentLocked(caller.getComponentName()), "Admin %s is not "
+ "the default supervision component", caller.getComponentName());
DevicePolicyData policy = getUserData(caller.getUserId());
policy.mSecondaryLockscreenEnabled = enabled;
saveSettingsLocked(caller.getUserId());
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setSecondaryLockscreenEnabled
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 | setSecondaryLockscreenEnabled | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | ed3f25b7222d4cff471f2b7d22d1150348146957 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public Mono<DatasourceTestResult> testDatasource(DatasourceConfiguration datasourceConfiguration) {
// At this point, the URL can be invalid because of mustache template keys inside it. Hence, connecting to
// and verifying the URL isn't feasible. Since validation happens just before testing, and since validation
// checks if a URL is present, there's nothing left to do here, but return a successful response.
return Mono.just(new DatasourceTestResult());
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: testDatasource
File: app/server/appsmith-plugins/restApiPlugin/src/main/java/com/external/plugins/RestApiPlugin.java
Repository: appsmithorg/appsmith
The code follows secure coding practices. | [
"CWE-918"
] | CVE-2022-38298 | HIGH | 8.8 | appsmithorg/appsmith | testDatasource | app/server/appsmith-plugins/restApiPlugin/src/main/java/com/external/plugins/RestApiPlugin.java | c59351ef94f9780c2a1ffc991e29b9272ab9fe64 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void binderDied() {
if (DEBUG_ALL) Slog.v(
TAG, "Death received in " + this
+ " for thread " + mAppThread.asBinder());
synchronized(ActivityManagerService.this) {
appDiedLocked(mApp, mPid, mAppThread, true);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: binderDied
File: services/core/java/com/android/server/am/ActivityManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-863"
] | CVE-2018-9492 | HIGH | 7.2 | android | binderDied | services/core/java/com/android/server/am/ActivityManagerService.java | 962fb40991f15be4f688d960aa00073683ebdd20 | 0 |
Analyze the following code function for security vulnerabilities | private static void interfacesConfigXmlGenerator(XmlGenerator gen, InterfacesConfig interfaces) {
gen.open("interfaces", "enabled", interfaces.isEnabled());
for (String i : interfaces.getInterfaces()) {
gen.node("interface", i);
}
gen.close();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: interfacesConfigXmlGenerator
File: hazelcast/src/main/java/com/hazelcast/config/ConfigXmlGenerator.java
Repository: hazelcast
The code follows secure coding practices. | [
"CWE-522"
] | CVE-2023-33264 | MEDIUM | 4.3 | hazelcast | interfacesConfigXmlGenerator | hazelcast/src/main/java/com/hazelcast/config/ConfigXmlGenerator.java | 80a502d53cc48bf895711ab55f95e3a51e344ac1 | 0 |
Analyze the following code function for security vulnerabilities | public @NonNull List<String> setMeteredDataDisabledPackages(@NonNull ComponentName admin,
@NonNull List<String> packageNames) {
throwIfParentInstance("setMeteredDataDisabled");
if (mService != null) {
try {
return mService.setMeteredDataDisabledPackages(admin, packageNames);
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
}
}
return packageNames;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setMeteredDataDisabledPackages
File: core/java/android/app/admin/DevicePolicyManager.java
Repository: android
The code follows secure coding practices. | [
"CWE-862"
] | CVE-2023-40089 | HIGH | 7.8 | android | setMeteredDataDisabledPackages | core/java/android/app/admin/DevicePolicyManager.java | e2e05f488da6abc765a62e7faf10cb74e729732e | 0 |
Analyze the following code function for security vulnerabilities | protected void updateKeyguardState(boolean goingToFullShade, boolean fromShadeLocked) {
Trace.beginSection("StatusBar#updateKeyguardState");
if (mState == StatusBarState.KEYGUARD) {
mKeyguardIndicationController.setVisible(true);
mNotificationPanel.resetViews();
if (mKeyguardUserSwitcher != null) {
mKeyguardUserSwitcher.setKeyguard(true, fromShadeLocked);
}
mStatusBarView.removePendingHideExpandedRunnables();
} else {
mKeyguardIndicationController.setVisible(false);
if (mKeyguardUserSwitcher != null) {
mKeyguardUserSwitcher.setKeyguard(false,
goingToFullShade ||
mState == StatusBarState.SHADE_LOCKED ||
fromShadeLocked);
}
}
if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) {
mScrimController.setKeyguardShowing(true);
} else {
mScrimController.setKeyguardShowing(false);
}
mNotificationPanel.setBarState(mState, mKeyguardFadingAway, goingToFullShade);
updateDozingState();
updatePublicMode();
updateStackScrollerState(goingToFullShade, fromShadeLocked);
updateNotifications();
checkBarModes();
updateMediaMetaData(false, mState != StatusBarState.KEYGUARD);
mKeyguardMonitor.notifyKeyguardState(mStatusBarKeyguardViewManager.isShowing(),
mUnlockMethodCache.isMethodSecure(),
mStatusBarKeyguardViewManager.isOccluded());
Trace.endSection();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: updateKeyguardState
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 | updateKeyguardState | packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java | c574568aaede7f652432deb7707f20ae54bbdf9a | 0 |
Analyze the following code function for security vulnerabilities | @Override
public List<String> getMeteredDataDisabledPackages(ComponentName who) {
Objects.requireNonNull(who);
if (!mHasFeature) {
return new ArrayList<>();
}
final CallerIdentity caller = getCallerIdentity(who);
Preconditions.checkCallAuthorization(
isDefaultDeviceOwner(caller) || isProfileOwner(caller),
"Admin %s does not own the profile", caller.getComponentName());
synchronized (getLockObject()) {
final ActiveAdmin admin = getProfileOwnerOrDeviceOwnerLocked(caller.getUserId());
return admin.meteredDisabledPackages == null
? new ArrayList<>() : admin.meteredDisabledPackages;
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getMeteredDataDisabledPackages
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 | getMeteredDataDisabledPackages | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | e2e05f488da6abc765a62e7faf10cb74e729732e | 0 |
Analyze the following code function for security vulnerabilities | private void invokeBinaryHandler(final BufferedBinaryMessage context, final HandlerWrapper handler, final boolean finalFragment) {
final Pooled<ByteBuffer[]> pooled = context.getData();
session.getContainer().invokeEndpointMethod(executor, new Runnable() {
@Override
public void run() {
try {
if (handler.isPartialHandler()) {
MessageHandler.Partial mHandler = (MessageHandler.Partial) handler.getHandler();
ByteBuffer[] payload = pooled.getResource();
if(handler.decodingNeeded) {
Object object = getSession().getEncoding().decodeBinary(handler.getMessageType(), toArray(payload));
mHandler.onMessage(object, finalFragment);
} else if (handler.getMessageType() == ByteBuffer.class) {
mHandler.onMessage(toBuffer(payload), finalFragment);
} else if (handler.getMessageType() == byte[].class) {
byte[] data = toArray(payload);
mHandler.onMessage(data, finalFragment);
} else if (handler.getMessageType() == InputStream.class) {
byte[] data = toArray(payload);
mHandler.onMessage(new ByteArrayInputStream(data), finalFragment);
}
} else {
MessageHandler.Whole mHandler = (MessageHandler.Whole) handler.getHandler();
ByteBuffer[] payload = pooled.getResource();
if(handler.decodingNeeded) {
Object object = getSession().getEncoding().decodeBinary(handler.getMessageType(), toArray(payload));
mHandler.onMessage(object);
} else if (handler.getMessageType() == ByteBuffer.class) {
mHandler.onMessage(toBuffer(payload));
} else if (handler.getMessageType() == byte[].class) {
byte[] data = toArray(payload);
mHandler.onMessage(data);
} else if (handler.getMessageType() == InputStream.class) {
byte[] data = toArray(payload);
mHandler.onMessage(new ByteArrayInputStream(data));
}
}
} catch (Exception e) {
invokeOnError(e);
} finally {
pooled.close();
}
}
});
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: invokeBinaryHandler
File: websockets-jsr/src/main/java/io/undertow/websockets/jsr/FrameHandler.java
Repository: undertow-io/undertow
The code follows secure coding practices. | [
"CWE-401"
] | CVE-2021-3690 | HIGH | 7.5 | undertow-io/undertow | invokeBinaryHandler | websockets-jsr/src/main/java/io/undertow/websockets/jsr/FrameHandler.java | c7e84a0b7efced38506d7d1dfea5902366973877 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void setPictureInPictureParams(IBinder token, final PictureInPictureParams params) {
final long origId = Binder.clearCallingIdentity();
try {
synchronized(this) {
final ActivityRecord r = ensureValidPictureInPictureActivityParamsLocked(
"setPictureInPictureParams", token, params);
// Only update the saved args from the args that are set
r.pictureInPictureArgs.copyOnlySet(params);
if (r.inPinnedWindowingMode()) {
// If the activity is already in picture-in-picture, update the pinned stack now
// if it is not already expanding to fullscreen. Otherwise, the arguments will
// be used the next time the activity enters PiP
final PinnedActivityStack stack = r.getStack();
if (!stack.isAnimatingBoundsToFullscreen()) {
stack.setPictureInPictureAspectRatio(
r.pictureInPictureArgs.getAspectRatio());
stack.setPictureInPictureActions(r.pictureInPictureArgs.getActions());
}
}
logPictureInPictureArgs(params);
}
} finally {
Binder.restoreCallingIdentity(origId);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setPictureInPictureParams
File: services/core/java/com/android/server/am/ActivityManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-863"
] | CVE-2018-9492 | HIGH | 7.2 | android | setPictureInPictureParams | services/core/java/com/android/server/am/ActivityManagerService.java | 962fb40991f15be4f688d960aa00073683ebdd20 | 0 |
Analyze the following code function for security vulnerabilities | protected void updateNotificationRanking(RankingMap ranking) {
mNotificationData.updateRanking(ranking);
updateNotifications();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: updateNotificationRanking
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 | updateNotificationRanking | packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java | c574568aaede7f652432deb7707f20ae54bbdf9a | 0 |
Analyze the following code function for security vulnerabilities | void onFirstWindowDrawn(WindowState win) {
firstWindowDrawn = true;
// stop tracking
mSplashScreenStyleSolidColor = true;
// We now have a good window to show, remove dead placeholders
removeDeadWindows();
if (mStartingWindow != null) {
ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Finish starting %s"
+ ": first real window is shown, no animation", win.mToken);
// If this initial window is animating, stop it -- we will do an animation to reveal
// it from behind the starting window, so there is no need for it to also be doing its
// own stuff.
win.cancelAnimation();
}
// Remove starting window directly if is in a pure task. Otherwise if it is associated with
// a task (e.g. nested task fragment), then remove only if all visible windows in the task
// are drawn.
final Task associatedTask =
mSharedStartingData != null ? mSharedStartingData.mAssociatedTask : null;
if (associatedTask == null) {
removeStartingWindow();
} else if (associatedTask.getActivity(r -> r.mVisibleRequested && !r.firstWindowDrawn
// Don't block starting window removal if an Activity can't be a starting window
// target.
&& r.mSharedStartingData != null) == null) {
// The last drawn activity may not be the one that owns the starting window.
final ActivityRecord r = associatedTask.topActivityContainsStartingWindow();
if (r != null) {
r.removeStartingWindow();
}
}
updateReportedVisibilityLocked();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: onFirstWindowDrawn
File: services/core/java/com/android/server/wm/ActivityRecord.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-21145 | HIGH | 7.8 | android | onFirstWindowDrawn | services/core/java/com/android/server/wm/ActivityRecord.java | 44aeef1b82ecf21187d4903c9e3666a118bdeaf3 | 0 |
Analyze the following code function for security vulnerabilities | private float getMinAspectRatio() {
return info.getMinAspectRatio(getRequestedOrientation());
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getMinAspectRatio
File: services/core/java/com/android/server/wm/ActivityRecord.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-21145 | HIGH | 7.8 | android | getMinAspectRatio | services/core/java/com/android/server/wm/ActivityRecord.java | 44aeef1b82ecf21187d4903c9e3666a118bdeaf3 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void setMaximumFailedPasswordsForWipe(ComponentName who, int num, boolean parent) {
if (!mHasFeature || !mLockPatternUtils.hasSecureLockScreen()) {
return;
}
Objects.requireNonNull(who, "ComponentName is null");
final int userId = mInjector.userHandleGetCallingUserId();
synchronized (getLockObject()) {
// This API can only be called by an active device admin,
// so try to retrieve it to check that the caller is one.
getActiveAdminForCallerLocked(
who, DeviceAdminInfo.USES_POLICY_WIPE_DATA, parent);
ActiveAdmin ap = getActiveAdminForCallerLocked(
who, DeviceAdminInfo.USES_POLICY_WATCH_LOGIN, parent);
if (ap.maximumFailedPasswordsForWipe != num) {
ap.maximumFailedPasswordsForWipe = num;
saveSettingsLocked(userId);
}
}
if (SecurityLog.isLoggingEnabled()) {
final int affectedUserId = parent ? getProfileParentId(userId) : userId;
SecurityLog.writeEvent(SecurityLog.TAG_MAX_PASSWORD_ATTEMPTS_SET, who.getPackageName(),
userId, affectedUserId, num);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setMaximumFailedPasswordsForWipe
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 | setMaximumFailedPasswordsForWipe | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | ed3f25b7222d4cff471f2b7d22d1150348146957 | 0 |
Analyze the following code function for security vulnerabilities | public IntentBuilder setForFace(boolean forFace) {
mIntent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, forFace);
return this;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setForFace
File: src/com/android/settings/password/ChooseLockPattern.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-40117 | HIGH | 7.8 | android | setForFace | src/com/android/settings/password/ChooseLockPattern.java | 11815817de2f2d70fe842b108356a1bc75d44ffb | 0 |
Analyze the following code function for security vulnerabilities | public static void unzipFilesToPath(String jarPath, String destinationDir) throws IOException {
File file = new File(jarPath);
try (JarFile jar = new JarFile(file)) {
// fist get all directories,
// then make those directory on the destination Path
/*for (Enumeration<JarEntry> enums = jar.entries(); enums.hasMoreElements(); ) {
JarEntry entry = (JarEntry) enums.nextElement();
String fileName = destinationDir + File.separator + entry.getName();
File f = new File(fileName);
if (fileName.endsWith("/")) {
f.mkdirs();
}
}*/
//now create all files
for (Enumeration<JarEntry> enums = jar.entries(); enums.hasMoreElements(); ) {
JarEntry entry = enums.nextElement();
String fileName = destinationDir + File.separator + entry.getName();
File f = new File(fileName);
File parent = f.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
if (!fileName.endsWith("/")) {
try (InputStream is = jar.getInputStream(entry);
FileOutputStream fos = new FileOutputStream(f)) {
// write contents of 'is' to 'fos'
while (is.available() > 0) {
fos.write(is.read());
}
}
}
}
}
} | Vulnerability Classification:
- CWE: CWE-22
- CVE: CVE-2022-21675
- Severity: MEDIUM
- CVSS Score: 6.8
Description: Mitigate Zip Slip exlpoit
Function: unzipFilesToPath
File: src/main/java/the/bytecode/club/bytecodeviewer/util/ZipUtils.java
Repository: Konloch/bytecode-viewer
Fixed Code:
public static void unzipFilesToPath(String jarPath, String destinationDir) throws IOException {
File file = new File(jarPath);
try (JarFile jar = new JarFile(file)) {
// fist get all directories,
// then make those directory on the destination Path
/*for (Enumeration<JarEntry> enums = jar.entries(); enums.hasMoreElements(); ) {
JarEntry entry = (JarEntry) enums.nextElement();
String fileName = destinationDir + File.separator + entry.getName();
File f = new File(fileName);
if (fileName.endsWith("/")) {
f.mkdirs();
}
}*/
//now create all files
for (Enumeration<JarEntry> enums = jar.entries(); enums.hasMoreElements(); ) {
JarEntry entry = enums.nextElement();
String fileName = destinationDir + File.separator + entry.getName();
File f = new File(fileName);
if (!f.getCanonicalPath().startsWith(destinationDir)) {
System.out.println("Zip Slip exploit detected. Skipping entry " + entry.getName());
continue;
}
File parent = f.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
if (!fileName.endsWith("/")) {
try (InputStream is = jar.getInputStream(entry);
FileOutputStream fos = new FileOutputStream(f)) {
// write contents of 'is' to 'fos'
while (is.available() > 0) {
fos.write(is.read());
}
}
}
}
}
} | [
"CWE-22"
] | CVE-2022-21675 | MEDIUM | 6.8 | Konloch/bytecode-viewer | unzipFilesToPath | src/main/java/the/bytecode/club/bytecodeviewer/util/ZipUtils.java | c968e94b2c93da434a4ecfac6d08eda162d615d0 | 1 |
Analyze the following code function for security vulnerabilities | protected void writeCollectionBegin(byte elemType, int size) throws TException {
if (size <= 14) {
writeByteDirect(size << 4 | getCompactType(elemType));
} else {
writeByteDirect(0xf0 | getCompactType(elemType));
writeVarint32(size);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: writeCollectionBegin
File: thrift/lib/java/src/main/java/com/facebook/thrift/protocol/TCompactProtocol.java
Repository: facebook/fbthrift
The code follows secure coding practices. | [
"CWE-770"
] | CVE-2019-11938 | MEDIUM | 5 | facebook/fbthrift | writeCollectionBegin | thrift/lib/java/src/main/java/com/facebook/thrift/protocol/TCompactProtocol.java | 08c2d412adb214c40bb03be7587057b25d053030 | 0 |
Analyze the following code function for security vulnerabilities | public void setFileResourceManager(FileResourceManager fileResourceManager) {
this.fileResourceManager = fileResourceManager;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setFileResourceManager
File: src/main/java/org/olat/modules/wiki/WikiManager.java
Repository: OpenOLAT
The code follows secure coding practices. | [
"CWE-22"
] | CVE-2021-39180 | HIGH | 9 | OpenOLAT | setFileResourceManager | src/main/java/org/olat/modules/wiki/WikiManager.java | 699490be8e931af0ef1f135c55384db1f4232637 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public synchronized boolean isInboundDone() {
return isInboundDone || engineClosed;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isInboundDone
File: handler/src/main/java/io/netty/handler/ssl/OpenSslEngine.java
Repository: netty
The code follows secure coding practices. | [
"CWE-835"
] | CVE-2016-4970 | HIGH | 7.8 | netty | isInboundDone | handler/src/main/java/io/netty/handler/ssl/OpenSslEngine.java | bc8291c80912a39fbd2303e18476d15751af0bf1 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void deleteAppWidgetId(String callingPackage, int appWidgetId) {
final int userId = UserHandle.getCallingUserId();
if (DEBUG) {
Slog.i(TAG, "deleteAppWidgetId() " + userId);
}
// Make sure the package runs under the caller uid.
mSecurityPolicy.enforceCallFromPackage(callingPackage);
synchronized (mLock) {
ensureGroupStateLoadedLocked(userId);
// NOTE: The lookup is enforcing security across users by making
// sure the caller can only access widgets it hosts or provides.
Widget widget = lookupWidgetLocked(appWidgetId,
Binder.getCallingUid(), callingPackage);
if (widget == null) {
return;
}
deleteAppWidgetLocked(widget);
saveGroupStateAsync(userId);
if (DEBUG) {
Slog.i(TAG, "Deleted widget id " + appWidgetId
+ " for host " + widget.host.id);
}
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: deleteAppWidgetId
File: services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
Repository: android
The code follows secure coding practices. | [
"CWE-284"
] | CVE-2015-1541 | MEDIUM | 4.3 | android | deleteAppWidgetId | services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java | 0b98d304c467184602b4c6bce76fda0b0274bc07 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
Jenkins.getInstance().doConfigExecutorsSubmit(req, rsp);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: doConfigSubmit
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 | doConfigSubmit | core/src/main/java/jenkins/model/Jenkins.java | a0b00508eeb74d7033dc4100eb382df4e8fa72e7 | 0 |
Analyze the following code function for security vulnerabilities | public String getRuntimeSource(Jiffle.RuntimeModel model, boolean scriptInDocs)
throws it.geosolutions.jaiext.jiffle.JiffleException {
return createRuntimeSource(model, getRuntimeBaseClass(model).getName(), scriptInDocs);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getRuntimeSource
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 | getRuntimeSource | jt-jiffle/jt-jiffle-language/src/main/java/it/geosolutions/jaiext/jiffle/Jiffle.java | cb1d6565d38954676b0a366da4f965fef38da1cb | 0 |
Analyze the following code function for security vulnerabilities | public FilePath obtain() throws IOException, InterruptedException {
return RemotingDiagnostics.getHeapDump(channel);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: obtain
File: core/src/main/java/hudson/util/RemotingDiagnostics.java
Repository: jenkinsci/jenkins
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2014-2068 | LOW | 3.5 | jenkinsci/jenkins | obtain | core/src/main/java/hudson/util/RemotingDiagnostics.java | 0530a6645aac10fec005614211660e98db44b5eb | 0 |
Analyze the following code function for security vulnerabilities | @VisibleForTesting
public static GameData parse(
final String mapName,
final InputStream stream,
final XmlGameElementMapper xmlGameElementMapper)
throws GameParseException, EngineVersionException {
checkNotNull(mapName);
checkNotNull(stream);
checkNotNull(xmlGameElementMapper);
return new GameParser(new GameData(), mapName, xmlGameElementMapper).parse(stream);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: parse
File: game-core/src/main/java/games/strategy/engine/data/GameParser.java
Repository: triplea-game/triplea
The code follows secure coding practices. | [
"CWE-611"
] | CVE-2018-1000546 | MEDIUM | 6.8 | triplea-game/triplea | parse | game-core/src/main/java/games/strategy/engine/data/GameParser.java | 0f23875a4c6e166218859a63c884995f15c53895 | 0 |
Analyze the following code function for security vulnerabilities | @VisibleForTesting
void initReplyRecipients(final Message refMessage, final int action) {
String[] sentToAddresses = refMessage.getToAddressesUnescaped();
final Collection<String> toAddresses;
final String[] fromAddresses = refMessage.getFromAddressesUnescaped();
final String fromAddress = fromAddresses.length > 0 ? fromAddresses[0] : null;
final String[] replyToAddresses = getReplyToAddresses(
refMessage.getReplyToAddressesUnescaped(), fromAddress);
// If this is a reply, the Cc list is empty. If this is a reply-all, the
// Cc list is the union of the To and Cc recipients of the original
// message, excluding the current user's email address and any addresses
// already on the To list.
if (action == ComposeActivity.REPLY) {
toAddresses = initToRecipients(fromAddress, replyToAddresses, sentToAddresses);
addToAddresses(toAddresses);
} else if (action == ComposeActivity.REPLY_ALL) {
final Set<String> ccAddresses = Sets.newHashSet();
toAddresses = initToRecipients(fromAddress, replyToAddresses, sentToAddresses);
addToAddresses(toAddresses);
addRecipients(ccAddresses, sentToAddresses);
addRecipients(ccAddresses, refMessage.getCcAddressesUnescaped());
addCcAddresses(ccAddresses, toAddresses);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: initReplyRecipients
File: src/com/android/mail/compose/ComposeActivity.java
Repository: android
The code follows secure coding practices. | [
"CWE-200"
] | CVE-2016-2425 | MEDIUM | 4.3 | android | initReplyRecipients | src/com/android/mail/compose/ComposeActivity.java | 0d9dfd649bae9c181e3afc5d571903f1eb5dc46f | 0 |
Analyze the following code function for security vulnerabilities | List<SubscriptionInfo> getSubscriptionInfo(boolean forceReload) {
List<SubscriptionInfo> sil = mSubscriptionInfo;
if (sil == null || forceReload) {
sil = mSubscriptionManager.getActiveSubscriptionInfoList();
}
if (sil == null) {
// getActiveSubscriptionInfoList was null callers expect an empty list.
mSubscriptionInfo = new ArrayList<SubscriptionInfo>();
} else {
mSubscriptionInfo = sil;
}
return mSubscriptionInfo;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getSubscriptionInfo
File: packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
Repository: android
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2016-3917 | HIGH | 7.2 | android | getSubscriptionInfo | packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java | f5334952131afa835dd3f08601fb3bced7b781cd | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.