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
public static PersistableBundle restoreFromXml(XmlPullParser in) throws IOException, XmlPullParserException { return restoreFromXml(XmlUtils.makeTyped(in)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: restoreFromXml File: core/java/android/os/PersistableBundle.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-40074
MEDIUM
5.5
android
restoreFromXml
core/java/android/os/PersistableBundle.java
40e4ea759743737958dde018f3606d778f7a53f3
0
Analyze the following code function for security vulnerabilities
static ClickHouseCredentials extract(String rawUserInfo, Map<String, String> params, ClickHouseCredentials defaultCredentials) { ClickHouseCredentials credentials = defaultCredentials; String user = ""; String passwd = ""; if (credentials != null && !credentials.useAccessToken()) { user = credentials.getUserName(); passwd = credentials.getPassword(); } if (!ClickHouseChecker.isNullOrEmpty(rawUserInfo)) { int index = rawUserInfo.indexOf(':'); if (index < 0) { user = ClickHouseUtils.decode(rawUserInfo); } else { String str = ClickHouseUtils.decode(rawUserInfo.substring(0, index)); if (!ClickHouseChecker.isNullOrEmpty(str)) { user = str; } passwd = ClickHouseUtils.decode(rawUserInfo.substring(index + 1)); } } String str = params.remove(ClickHouseDefaults.USER.getKey()); if (!ClickHouseChecker.isNullOrEmpty(str)) { user = str; } str = params.remove(ClickHouseDefaults.PASSWORD.getKey()); if (str != null) { passwd = str; } if (!ClickHouseChecker.isNullOrEmpty(user)) { credentials = ClickHouseCredentials.fromUserAndPassword(user, passwd); } else if (!ClickHouseChecker.isNullOrEmpty(passwd)) { credentials = ClickHouseCredentials .fromUserAndPassword((String) ClickHouseDefaults.USER.getEffectiveDefaultValue(), passwd); } return credentials; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: extract File: clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseNode.java Repository: ClickHouse/clickhouse-java The code follows secure coding practices.
[ "CWE-209" ]
CVE-2024-23689
HIGH
8.8
ClickHouse/clickhouse-java
extract
clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseNode.java
4f8d9303eb991b39ec7e7e34825241efa082238a
0
Analyze the following code function for security vulnerabilities
@Override public List<ApnSetting> getOverrideApns(@NonNull ComponentName who) { if (!mHasFeature || !mHasTelephonyFeature) { return Collections.emptyList(); } Objects.requireNonNull(who, "ComponentName is null"); final CallerIdentity caller = getCallerIdentity(who); Preconditions.checkCallAuthorization(isDefaultDeviceOwner(caller) || isManagedProfileOwner(caller)); List<ApnSetting> apnSettings = getOverrideApnsUnchecked(); if (isProfileOwner(caller)) { List<ApnSetting> apnSettingList = new ArrayList<>(); for (ApnSetting apnSetting : apnSettings) { if (apnSetting.getApnTypeBitmask() == ApnSetting.TYPE_ENTERPRISE) { apnSettingList.add(apnSetting); } } return apnSettingList; } else { return apnSettings; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getOverrideApns 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
getOverrideApns
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
ed3f25b7222d4cff471f2b7d22d1150348146957
0
Analyze the following code function for security vulnerabilities
@Override protected boolean isUpgradeSupported() { return false; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isUpgradeSupported File: servlet/src/main/java/io/undertow/servlet/handlers/ServletInitialHandler.java Repository: undertow-io/undertow The code follows secure coding practices.
[ "CWE-862" ]
CVE-2019-10184
MEDIUM
5
undertow-io/undertow
isUpgradeSupported
servlet/src/main/java/io/undertow/servlet/handlers/ServletInitialHandler.java
d2715e3afa13f50deaa19643676816ce391551e9
0
Analyze the following code function for security vulnerabilities
@Override public void onModeChange(AjaxRequestTarget target, Mode mode, boolean viewPlain, @Nullable String newPath) { state.viewPlain = viewPlain; state.initialNewPath = newPath; /* * User might be changing blob name when adding a file, and onModeChange will be called. * In this case, we only need to re-create blob content */ if (mode != Mode.ADD || state.mode != Mode.ADD) { state.mode = mode; pushState(target); if (state.mode == Mode.VIEW || state.mode == Mode.EDIT || state.mode == Mode.ADD) { newBlobNavigator(target); newBlobOperations(target); } } newBuildSupportNote(target); newBlobContent(target); resizeWindow(target); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onModeChange File: server-core/src/main/java/io/onedev/server/web/page/project/blob/ProjectBlobPage.java Repository: theonedev/onedev The code follows secure coding practices.
[ "CWE-434" ]
CVE-2021-21245
HIGH
7.5
theonedev/onedev
onModeChange
server-core/src/main/java/io/onedev/server/web/page/project/blob/ProjectBlobPage.java
0c060153fb97c0288a1917efdb17cc426934dacb
0
Analyze the following code function for security vulnerabilities
public boolean setLowLatencyMode(boolean enabled) { if (mVerboseLoggingEnabled) { Log.d(getTag(), "Setting low latency mode to " + enabled); } if (!mWifiNative.setLowLatencyMode(enabled)) { Log.e(getTag(), "Failed to setLowLatencyMode"); return false; } return true; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setLowLatencyMode File: service/java/com/android/server/wifi/ClientModeImpl.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21242
CRITICAL
9.8
android
setLowLatencyMode
service/java/com/android/server/wifi/ClientModeImpl.java
72e903f258b5040b8f492cf18edd124b5a1ac770
0
Analyze the following code function for security vulnerabilities
@Deprecated(since = "2.2M2") public List<String> getChildren(int nb, int start, XWikiContext context) throws XWikiException { List<String> childrenNames = new ArrayList<String>(); for (DocumentReference reference : getChildrenReferences(nb, start, context)) { childrenNames.add(LOCAL_REFERENCE_SERIALIZER.serialize(reference)); } return childrenNames; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getChildren File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java Repository: xwiki/xwiki-platform The code follows secure coding practices.
[ "CWE-74" ]
CVE-2023-29523
HIGH
8.8
xwiki/xwiki-platform
getChildren
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
0d547181389f7941e53291af940966413823f61c
0
Analyze the following code function for security vulnerabilities
private long getCompressedSize(LocalFileHeader localFileHeader) throws ZipException { if (getCompressionMethod(localFileHeader).equals(CompressionMethod.STORE)) { return localFileHeader.getUncompressedSize(); } if (localFileHeader.isDataDescriptorExists() && !canSkipExtendedLocalFileHeader) { return -1; } return localFileHeader.getCompressedSize() - getEncryptionHeaderSize(localFileHeader); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getCompressedSize File: src/main/java/net/lingala/zip4j/io/inputstream/ZipInputStream.java Repository: srikanth-lingala/zip4j The code follows secure coding practices.
[ "CWE-346" ]
CVE-2023-22899
MEDIUM
5.9
srikanth-lingala/zip4j
getCompressedSize
src/main/java/net/lingala/zip4j/io/inputstream/ZipInputStream.java
ddd8fdc8ad0583eb4a6172dc86c72c881485c55b
0
Analyze the following code function for security vulnerabilities
public TypeDeserializer findPropertyTypeDeserializer(DeserializationConfig config, JavaType baseType, AnnotatedMember annotated) throws JsonMappingException { AnnotationIntrospector ai = config.getAnnotationIntrospector(); TypeResolverBuilder<?> b = ai.findPropertyTypeResolver(config, annotated, baseType); // Defaulting: if no annotations on member, check value class if (b == null) { return findTypeDeserializer(config, baseType); } // but if annotations found, may need to resolve subtypes: Collection<NamedType> subtypes = config.getSubtypeResolver().collectAndResolveSubtypesByTypeId( config, annotated, baseType); try { return b.buildTypeDeserializer(config, baseType, subtypes); } catch (IllegalArgumentException e0) { InvalidDefinitionException e = InvalidDefinitionException.from((JsonParser) null, ClassUtil.exceptionMessage(e0), baseType); e.initCause(e0); throw e; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: findPropertyTypeDeserializer File: src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java Repository: FasterXML/jackson-databind The code follows secure coding practices.
[ "CWE-502" ]
CVE-2019-16942
HIGH
7.5
FasterXML/jackson-databind
findPropertyTypeDeserializer
src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java
54aa38d87dcffa5ccc23e64922e9536c82c1b9c8
0
Analyze the following code function for security vulnerabilities
void assertPackageMatchesCallingUid(@Nullable String packageName) { final int callingUid = Binder.getCallingUid(); if (isSameApp(callingUid, packageName)) { return; } final String msg = "Permission Denial: package=" + packageName + " does not belong to uid=" + callingUid; Slog.w(TAG, msg); throw new SecurityException(msg); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: assertPackageMatchesCallingUid File: services/core/java/com/android/server/wm/ActivityTaskManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-862" ]
CVE-2023-40094
HIGH
7.8
android
assertPackageMatchesCallingUid
services/core/java/com/android/server/wm/ActivityTaskManagerService.java
1120bc7e511710b1b774adf29ba47106292365e7
0
Analyze the following code function for security vulnerabilities
private void sendMessage(String iface, int what, int arg1) { sendMessage(iface, Message.obtain(null, what, arg1, 0)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: sendMessage File: service/java/com/android/server/wifi/WifiMonitor.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21242
CRITICAL
9.8
android
sendMessage
service/java/com/android/server/wifi/WifiMonitor.java
72e903f258b5040b8f492cf18edd124b5a1ac770
0
Analyze the following code function for security vulnerabilities
@GET @Timed @Path("/paginated") @ApiOperation(value = "Get paginated list of users") @RequiresPermissions(RestPermissions.USERS_LIST) @Produces(MediaType.APPLICATION_JSON) public PaginatedResponse<UserOverviewDTO> getPage(@ApiParam(name = "page") @QueryParam("page") @DefaultValue("1") int page, @ApiParam(name = "per_page") @QueryParam("per_page") @DefaultValue("50") int perPage, @ApiParam(name = "query") @QueryParam("query") @DefaultValue("") String query, @ApiParam(name = "sort", value = "The field to sort the result on", required = true, allowableValues = "title,description") @DefaultValue(UserOverviewDTO.FIELD_FULL_NAME) @QueryParam("sort") String sort, @ApiParam(name = "order", value = "The sort direction", allowableValues = "asc, desc") @DefaultValue("asc") @QueryParam("order") String order) { SearchQuery searchQuery; final AllUserSessions sessions = AllUserSessions.create(sessionService); try { searchQuery = searchQueryParser.parse(query); } catch (IllegalArgumentException e) { throw new BadRequestException("Invalid argument in search query: " + e.getMessage()); } final PaginatedList<UserOverviewDTO> result = paginatedUserService .findPaginated(searchQuery, page, perPage, sort, order); final Set<String> allRoleIds = result.stream().flatMap(userDTO -> { if (userDTO.roles() != null) { return userDTO.roles().stream(); } return Stream.empty(); }).collect(Collectors.toSet()); Map<String, String> roleNameMap; try { roleNameMap = getRoleNameMap(allRoleIds); } catch (org.graylog2.database.NotFoundException e) { throw new NotFoundException("Couldn't find roles: " + e.getMessage()); } final UserOverviewDTO adminUser = getAdminUserDTO(sessions); List<UserOverviewDTO> users = result.stream().map(userDTO -> { UserOverviewDTO.Builder builder = userDTO.toBuilder() .fillSession(sessions.forUser(userDTO)); if (userDTO.roles() != null) { builder.roles(userDTO.roles().stream().map(roleNameMap::get).collect(Collectors.toSet())); } return builder.build(); }).collect(Collectors.toList()); final PaginatedList<UserOverviewDTO> userOverviewDTOS = new PaginatedList<>(users, result.pagination().total(), result.pagination().page(), result.pagination().perPage()); return PaginatedResponse.create("users", userOverviewDTOS, query, Collections.singletonMap("admin_user", adminUser)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getPage File: graylog2-server/src/main/java/org/graylog2/rest/resources/users/UsersResource.java Repository: Graylog2/graylog2-server The code follows secure coding practices.
[ "CWE-613" ]
CVE-2023-41041
LOW
3.1
Graylog2/graylog2-server
getPage
graylog2-server/src/main/java/org/graylog2/rest/resources/users/UsersResource.java
bb88f3d0b2b0351669ab32c60b595ab7242a3fe3
0
Analyze the following code function for security vulnerabilities
public byte[] getSessionIdentifier() { return km.sessionId; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getSessionIdentifier File: src/main/java/com/trilead/ssh2/transport/TransportManager.java Repository: connectbot/sshlib The code follows secure coding practices.
[ "CWE-354" ]
CVE-2023-48795
MEDIUM
5.9
connectbot/sshlib
getSessionIdentifier
src/main/java/com/trilead/ssh2/transport/TransportManager.java
5c8b534f6e97db7ac0e0e579331213aa25c173ab
0
Analyze the following code function for security vulnerabilities
protected MessageId internalTerminate(boolean authoritative) { if (topicName.isGlobal()) { validateGlobalNamespaceOwnership(namespaceName); } PartitionedTopicMetadata partitionMetadata = getPartitionedTopicMetadata(topicName, authoritative, false); if (partitionMetadata.partitions > 0) { throw new RestException(Status.METHOD_NOT_ALLOWED, "Termination of a partitioned topic is not allowed"); } validateTopicOwnership(topicName, authoritative); validateTopicOperation(topicName, TopicOperation.TERMINATE); Topic topic = getTopicReference(topicName); try { return ((PersistentTopic) topic).terminate().get(); } catch (Exception exception) { log.error("[{}] Failed to terminated topic {}", clientAppId(), topicName, exception); throw new RestException(exception); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: internalTerminate 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
internalTerminate
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
5b35bb81c31f1bc2ad98c9fde5b39ec68110ca52
0
Analyze the following code function for security vulnerabilities
@Override public void unregisterUidObserver(IUidObserver observer) { mUidObserverController.unregister(observer); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: unregisterUidObserver 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
unregisterUidObserver
services/core/java/com/android/server/am/ActivityManagerService.java
d10b27e539f7bc91c2360d429b9d05f05274670d
0
Analyze the following code function for security vulnerabilities
boolean systemPropertiesGetBoolean(String key, boolean def) { return SystemProperties.getBoolean(key, def); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: systemPropertiesGetBoolean 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
systemPropertiesGetBoolean
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
ed3f25b7222d4cff471f2b7d22d1150348146957
0
Analyze the following code function for security vulnerabilities
public boolean bindBackupAgent(String packageName, int backupMode, int userId) { if (DEBUG_BACKUP) Slog.v(TAG, "bindBackupAgent: app=" + packageName + " mode=" + backupMode); enforceCallingPermission("android.permission.CONFIRM_FULL_BACKUP", "bindBackupAgent"); IPackageManager pm = AppGlobals.getPackageManager(); ApplicationInfo app = null; try { app = pm.getApplicationInfo(packageName, 0, userId); } catch (RemoteException e) { // can't happen; package manager is process-local } if (app == null) { Slog.w(TAG, "Unable to bind backup agent for " + packageName); return false; } synchronized(this) { // !!! TODO: currently no check here that we're already bound BatteryStatsImpl.Uid.Pkg.Serv ss = null; BatteryStatsImpl stats = mBatteryStatsService.getActiveStatistics(); synchronized (stats) { ss = stats.getServiceStatsLocked(app.uid, app.packageName, app.name); } // Backup agent is now in use, its package can't be stopped. try { AppGlobals.getPackageManager().setPackageStoppedState( app.packageName, false, UserHandle.getUserId(app.uid)); } catch (RemoteException e) { } catch (IllegalArgumentException e) { Slog.w(TAG, "Failed trying to unstop package " + app.packageName + ": " + e); } BackupRecord r = new BackupRecord(ss, app, backupMode); ComponentName hostingName = (backupMode == IApplicationThread.BACKUP_MODE_INCREMENTAL) ? new ComponentName(app.packageName, app.backupAgentName) : new ComponentName("android", "FullBackupAgent"); // startProcessLocked() returns existing proc's record if it's already running ProcessRecord proc = startProcessLocked(app.processName, app, false, 0, "backup", hostingName, false, false, false); if (proc == null) { Slog.e(TAG, "Unable to start backup agent process " + r); return false; } r.app = proc; mBackupTarget = r; mBackupAppName = app.packageName; // Try not to kill the process during backup updateOomAdjLocked(proc); // If the process is already attached, schedule the creation of the backup agent now. // If it is not yet live, this will be done when it attaches to the framework. if (proc.thread != null) { if (DEBUG_BACKUP) Slog.v(TAG_BACKUP, "Agent proc already running: " + proc); try { proc.thread.scheduleCreateBackupAgent(app, compatibilityInfoForPackageLocked(app), backupMode); } catch (RemoteException e) { // Will time out on the backup manager side } } else { if (DEBUG_BACKUP) Slog.v(TAG_BACKUP, "Agent proc not running, waiting for attach"); } // Invariants: at this point, the target app process exists and the application // is either already running or in the process of coming up. mBackupTarget and // mBackupAppName describe the app, so that when it binds back to the AM we // know that it's scheduled for a backup-agent operation. } return true; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: bindBackupAgent File: services/core/java/com/android/server/am/ActivityManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-284" ]
CVE-2016-3838
MEDIUM
4.3
android
bindBackupAgent
services/core/java/com/android/server/am/ActivityManagerService.java
468651c86a8adb7aa56c708d2348e99022088af3
0
Analyze the following code function for security vulnerabilities
@Override public synchronized Writer setCharacterStream() throws SQLException { checkFreed(); initialize(); active = true; stringWriter = new StringWriter(); return stringWriter; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setCharacterStream File: pgjdbc/src/main/java/org/postgresql/jdbc/PgSQLXML.java Repository: pgjdbc The code follows secure coding practices.
[ "CWE-611" ]
CVE-2020-13692
MEDIUM
6.8
pgjdbc
setCharacterStream
pgjdbc/src/main/java/org/postgresql/jdbc/PgSQLXML.java
14b62aca4764d496813f55a43d050b017e01eb65
0
Analyze the following code function for security vulnerabilities
@RequiresPermission(value = MANAGE_DEVICE_POLICY_CERTIFICATES, conditional = true) public AttestedKeyPair generateKeyPair(@Nullable ComponentName admin, @NonNull String algorithm, @NonNull KeyGenParameterSpec keySpec, @AttestationIdType int idAttestationFlags) { throwIfParentInstance("generateKeyPair"); try { final ParcelableKeyGenParameterSpec parcelableSpec = new ParcelableKeyGenParameterSpec(keySpec); KeymasterCertificateChain attestationChain = new KeymasterCertificateChain(); // Translate ID attestation flags to values used by AttestationUtils final boolean success = mService.generateKeyPair( admin, mContext.getPackageName(), algorithm, parcelableSpec, idAttestationFlags, attestationChain); if (!success) { Log.e(TAG, "Error generating key via DevicePolicyManagerService."); return null; } final String alias = keySpec.getKeystoreAlias(); final KeyPair keyPair = KeyChain.getKeyPair(mContext, alias); Certificate[] outputChain = null; try { if (AttestationUtils.isChainValid(attestationChain)) { outputChain = AttestationUtils.parseCertificateChain(attestationChain); } } catch (KeyAttestationException e) { Log.e(TAG, "Error parsing attestation chain for alias " + alias, e); mService.removeKeyPair(admin, mContext.getPackageName(), alias); return null; } return new AttestedKeyPair(keyPair, outputChain); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } catch (KeyChainException e) { Log.w(TAG, "Failed to generate key", e); } catch (InterruptedException e) { Log.w(TAG, "Interrupted while generating key", e); Thread.currentThread().interrupt(); } catch (ServiceSpecificException e) { Log.w(TAG, String.format("Key Generation failure: %d", e.errorCode)); switch (e.errorCode) { case KEY_GEN_STRONGBOX_UNAVAILABLE: throw new StrongBoxUnavailableException("No StrongBox for key generation."); default: throw new RuntimeException( String.format("Unknown error while generating key: %d", e.errorCode)); } } return null; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: generateKeyPair 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
generateKeyPair
core/java/android/app/admin/DevicePolicyManager.java
e2e05f488da6abc765a62e7faf10cb74e729732e
0
Analyze the following code function for security vulnerabilities
public CreateOrUpdateArticleResponse update(AdminTokenVO adminTokenVO, UpdateArticleRequest updateArticleRequest) { return save(adminTokenVO, updateArticleRequest); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: update File: service/src/main/java/com/zrlog/service/ArticleService.java Repository: 94fzb/zrlog The code follows secure coding practices.
[ "CWE-79" ]
CVE-2019-16643
LOW
3.5
94fzb/zrlog
update
service/src/main/java/com/zrlog/service/ArticleService.java
4a91c83af669e31a22297c14f089d8911d353fa1
0
Analyze the following code function for security vulnerabilities
@Override public Enumeration<URL> findResources(String name) throws IOException { // If we have searched this path before, don't try again if (Arrays.equals(super.getURLs(), notFoundResources.get(name))) { return (new Vector<URL>(0)).elements(); } if (!name.startsWith("META-INF")) { Enumeration<URL> urls = super.findResources(name); if (!urls.hasMoreElements()) { notFoundResources.put(name, super.getURLs()); } return urls; } return (new Vector<URL>(0)).elements(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: findResources File: core/src/main/java/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Repository: AdoptOpenJDK/IcedTea-Web The code follows secure coding practices.
[ "CWE-345", "CWE-94", "CWE-22" ]
CVE-2019-10182
MEDIUM
5.8
AdoptOpenJDK/IcedTea-Web
findResources
core/src/main/java/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
e0818f521a0711aeec4b913b49b5fc6a52815662
0
Analyze the following code function for security vulnerabilities
@Override protected void onInitialize() { super.onInitialize(); String secretKey = generateSecretKey(); List<String> scratchCodes = new ArrayList<>(); for (int i=0; i<16; i++) scratchCodes.add(RandomStringUtils.randomAlphanumeric(12)); TwoFactorAuthentication authentication = new TwoFactorAuthentication(secretKey, scratchCodes); Fragment fragment = new Fragment("content", "pendingVerifyFrag", this); Form<?> form = new Form<Void>("form"); form.add(new WebMarkupContainer("enforceNotice") { @Override protected void onConfigure() { super.onConfigure(); setVisible(getPage() instanceof LoginPage); } }); form.add(new Image("QRCode", new AbstractResource() { @Override protected ResourceResponse newResourceResponse(Attributes attributes) { ResourceResponse response = new ResourceResponse(); response.setContentType(MediaType.image("png").toString()); response.disableCaching(); response.setWriteCallback(new WriteCallback() { @Override public void writeData(Attributes attributes) throws IOException { authentication.writeQRCode(getUser(), QR_CODE_SIZE, attributes.getResponse().getOutputStream()); } }); return response; } }) { @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put("width", QR_CODE_SIZE + "px"); tag.put("height", QR_CODE_SIZE + "px"); } }); TextField<String> input = new TextField<String>("passcode", Model.of("")); form.add(input); form.add(new FencedFeedbackPanel("feedback", form)); form.add(new AjaxButton("verify") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { super.onSubmit(target, form); String passcode = input.getModelObject(); if (StringUtils.isBlank(passcode)) { form.error("Please input passcode"); target.add(form); } else if (!passcode.equals(authentication.getTOTPCode())) { form.error("Passcode incorrect"); target.add(form); } else { getUser().setTwoFactorAuthentication(authentication); OneDev.getInstance(UserManager.class).save(getUser()); Fragment fragment = new Fragment("content", "verifiedFrag", TwoFactorAuthenticationSetupPanel.this); RepeatingView recoveryCodesView = new RepeatingView("recoveryCodes"); for (int i=0; i<authentication.getScratchCodes().size()/2; i++) { WebMarkupContainer container = new WebMarkupContainer(recoveryCodesView.newChildId()); container.add(new Label("left", authentication.getScratchCodes().get(i*2))); container.add(new Label("right", authentication.getScratchCodes().get(i*2+1))); recoveryCodesView.add(container); } fragment.add(recoveryCodesView); fragment.add(new ResourceLink<Void>("download", new AbstractResource() { @Override protected ResourceResponse newResourceResponse(Attributes attributes) { ResourceResponse response = new ResourceResponse(); response.setContentType(MediaType.TEXT_PLAIN.toString()); response.setFileName("onedev-recovery-codes.txt"); response.setContentDisposition(ContentDisposition.ATTACHMENT); response.disableCaching(); response.setWriteCallback(new WriteCallback() { @Override public void writeData(Attributes attributes) throws IOException { String content = StringUtils.join(authentication.getScratchCodes(), "\n"); attributes.getResponse().write(content); } }); return response; } })); fragment.add(new AjaxLink<Void>("ok") { @Override public void onClick(AjaxRequestTarget target) { onEnabled(target); } }); fragment.add(new AjaxLink<Void>("close") { @Override public void onClick(AjaxRequestTarget target) { onEnabled(target); } }); TwoFactorAuthenticationSetupPanel.this.replace(fragment); target.add(fragment); } } }); form.add(new AjaxLink<Void>("cancel") { @Override public void onClick(AjaxRequestTarget target) { onCancelled(target); } }); form.add(new AjaxLink<Void>("close") { @Override public void onClick(AjaxRequestTarget target) { onCancelled(target); } }); form.setOutputMarkupId(true); fragment.add(form); fragment.setOutputMarkupId(true); add(fragment); }
Vulnerability Classification: - CWE: CWE-338 - CVE: CVE-2023-24828 - Severity: HIGH - CVSS Score: 8.8 Description: Fix issue #1179 - OneDev should use crypto strong random string for access token and password reset Function: onInitialize File: server-core/src/main/java/io/onedev/server/web/component/user/twofactorauthentication/TwoFactorAuthenticationSetupPanel.java Repository: theonedev/onedev Fixed Code: @Override protected void onInitialize() { super.onInitialize(); String secretKey = generateSecretKey(); List<String> scratchCodes = new ArrayList<>(); for (int i=0; i<16; i++) scratchCodes.add(CryptoUtils.generateSecret()); TwoFactorAuthentication authentication = new TwoFactorAuthentication(secretKey, scratchCodes); Fragment fragment = new Fragment("content", "pendingVerifyFrag", this); Form<?> form = new Form<Void>("form"); form.add(new WebMarkupContainer("enforceNotice") { @Override protected void onConfigure() { super.onConfigure(); setVisible(getPage() instanceof LoginPage); } }); form.add(new Image("QRCode", new AbstractResource() { @Override protected ResourceResponse newResourceResponse(Attributes attributes) { ResourceResponse response = new ResourceResponse(); response.setContentType(MediaType.image("png").toString()); response.disableCaching(); response.setWriteCallback(new WriteCallback() { @Override public void writeData(Attributes attributes) throws IOException { authentication.writeQRCode(getUser(), QR_CODE_SIZE, attributes.getResponse().getOutputStream()); } }); return response; } }) { @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put("width", QR_CODE_SIZE + "px"); tag.put("height", QR_CODE_SIZE + "px"); } }); TextField<String> input = new TextField<String>("passcode", Model.of("")); form.add(input); form.add(new FencedFeedbackPanel("feedback", form)); form.add(new AjaxButton("verify") { @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { super.onSubmit(target, form); String passcode = input.getModelObject(); if (StringUtils.isBlank(passcode)) { form.error("Please input passcode"); target.add(form); } else if (!passcode.equals(authentication.getTOTPCode())) { form.error("Passcode incorrect"); target.add(form); } else { getUser().setTwoFactorAuthentication(authentication); OneDev.getInstance(UserManager.class).save(getUser()); Fragment fragment = new Fragment("content", "verifiedFrag", TwoFactorAuthenticationSetupPanel.this); RepeatingView recoveryCodesView = new RepeatingView("recoveryCodes"); for (String scratchCode: authentication.getScratchCodes()) recoveryCodesView.add(new Label(recoveryCodesView.newChildId(), scratchCode)); fragment.add(recoveryCodesView); fragment.add(new ResourceLink<Void>("download", new AbstractResource() { @Override protected ResourceResponse newResourceResponse(Attributes attributes) { ResourceResponse response = new ResourceResponse(); response.setContentType(MediaType.TEXT_PLAIN.toString()); response.setFileName("onedev-recovery-codes.txt"); response.setContentDisposition(ContentDisposition.ATTACHMENT); response.disableCaching(); response.setWriteCallback(new WriteCallback() { @Override public void writeData(Attributes attributes) throws IOException { String content = StringUtils.join(authentication.getScratchCodes(), "\n"); attributes.getResponse().write(content); } }); return response; } })); fragment.add(new AjaxLink<Void>("ok") { @Override public void onClick(AjaxRequestTarget target) { onEnabled(target); } }); fragment.add(new AjaxLink<Void>("close") { @Override public void onClick(AjaxRequestTarget target) { onEnabled(target); } }); TwoFactorAuthenticationSetupPanel.this.replace(fragment); target.add(fragment); } } }); form.add(new AjaxLink<Void>("cancel") { @Override public void onClick(AjaxRequestTarget target) { onCancelled(target); } }); form.add(new AjaxLink<Void>("close") { @Override public void onClick(AjaxRequestTarget target) { onCancelled(target); } }); form.setOutputMarkupId(true); fragment.add(form); fragment.setOutputMarkupId(true); add(fragment); }
[ "CWE-338" ]
CVE-2023-24828
HIGH
8.8
theonedev/onedev
onInitialize
server-core/src/main/java/io/onedev/server/web/component/user/twofactorauthentication/TwoFactorAuthenticationSetupPanel.java
d67dd9686897fe5e4ab881d749464aa7c06a68e5
1
Analyze the following code function for security vulnerabilities
public String dialogBlockStart(String headline) { return dialogBlock(HTML_START, headline, false); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: dialogBlockStart 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
dialogBlockStart
src/org/opencms/workplace/CmsDialog.java
72a05e3ea1cf692e2efce002687272e63f98c14a
0
Analyze the following code function for security vulnerabilities
public UnreadConversation build() { String[] messages = mMessages.toArray(new String[mMessages.size()]); String[] participants = { mParticipant }; return new UnreadConversation(messages, mRemoteInput, mReplyPendingIntent, mReadPendingIntent, participants, mLatestTimestamp); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: build File: core/java/android/app/Notification.java Repository: android The code follows secure coding practices.
[ "CWE-862" ]
CVE-2023-21288
MEDIUM
5.5
android
build
core/java/android/app/Notification.java
726247f4f53e8cc0746175265652fa415a123c0c
0
Analyze the following code function for security vulnerabilities
final int startActivities(IApplicationThread caller, int callingUid, String callingPackage, Intent[] intents, String[] resolvedTypes, IBinder resultTo, Bundle options, int userId) { if (intents == null) { throw new NullPointerException("intents is null"); } if (resolvedTypes == null) { throw new NullPointerException("resolvedTypes is null"); } if (intents.length != resolvedTypes.length) { throw new IllegalArgumentException("intents are length different than resolvedTypes"); } int callingPid; if (callingUid >= 0) { callingPid = -1; } else if (caller == null) { callingPid = Binder.getCallingPid(); callingUid = Binder.getCallingUid(); } else { callingPid = callingUid = -1; } final long origId = Binder.clearCallingIdentity(); try { synchronized (mService) { ActivityRecord[] outActivity = new ActivityRecord[1]; for (int i=0; i<intents.length; i++) { Intent intent = intents[i]; if (intent == null) { continue; } // Refuse possible leaked file descriptors if (intent != null && intent.hasFileDescriptors()) { throw new IllegalArgumentException("File descriptors passed in Intent"); } boolean componentSpecified = intent.getComponent() != null; // Don't modify the client's object! intent = new Intent(intent); // Collect information about the target of the Intent. ActivityInfo aInfo = resolveActivity(intent, resolvedTypes[i], 0, null, userId); // TODO: New, check if this is correct aInfo = mService.getActivityInfoForUser(aInfo, userId); if (aInfo != null && (aInfo.applicationInfo.privateFlags & ApplicationInfo.PRIVATE_FLAG_CANT_SAVE_STATE) != 0) { throw new IllegalArgumentException( "FLAG_CANT_SAVE_STATE not supported here"); } Bundle theseOptions; if (options != null && i == intents.length-1) { theseOptions = options; } else { theseOptions = null; } int res = startActivityLocked(caller, intent, resolvedTypes[i], aInfo, null, null, resultTo, null, -1, callingPid, callingUid, callingPackage, callingPid, callingUid, 0, theseOptions, false, componentSpecified, outActivity, null, null); if (res < 0) { return res; } resultTo = outActivity[0] != null ? outActivity[0].appToken : null; } } } finally { Binder.restoreCallingIdentity(origId); } return ActivityManager.START_SUCCESS; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: startActivities File: services/core/java/com/android/server/am/ActivityStackSupervisor.java Repository: android The code follows secure coding practices.
[ "CWE-284" ]
CVE-2016-3838
MEDIUM
4.3
android
startActivities
services/core/java/com/android/server/am/ActivityStackSupervisor.java
468651c86a8adb7aa56c708d2348e99022088af3
0
Analyze the following code function for security vulnerabilities
private Object readResolve() { if(childProjects==null) return childProjects=""; return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: readResolve File: core/src/main/java/hudson/tasks/BuildTrigger.java Repository: jenkinsci/jenkins The code follows secure coding practices.
[ "CWE-264" ]
CVE-2013-7330
MEDIUM
4
jenkinsci/jenkins
readResolve
core/src/main/java/hudson/tasks/BuildTrigger.java
36342d71e29e0620f803a7470ce96c61761648d8
0
Analyze the following code function for security vulnerabilities
private File[] newFiles(String[] names, File dir) { File[] files = new File[names.length]; for (int i = 0; i < names.length; i++) { files[i] = new File(dir, names[i]); } return files; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: newFiles File: brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkBuilder.java Repository: iBotPeaches/Apktool The code follows secure coding practices.
[ "CWE-22" ]
CVE-2024-21633
HIGH
7.8
iBotPeaches/Apktool
newFiles
brut.apktool/apktool-lib/src/main/java/brut/androlib/ApkBuilder.java
d348c43b24a9de350ff6e5bd610545a10c1fc712
0
Analyze the following code function for security vulnerabilities
public void onWakeAndUnlocking() { Trace.beginSection("KeyguardViewMediator#onWakeAndUnlocking"); mWakeAndUnlocking = true; keyguardDone(); Trace.endSection(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onWakeAndUnlocking 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
onWakeAndUnlocking
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
d18d8b350756b0e89e051736c1f28744ed31e93a
0
Analyze the following code function for security vulnerabilities
@XmlElement public String getContent() { return content; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getContent File: core-web/src/main/java/org/silverpeas/core/webapi/notification/user/InboxUserNotificationEntity.java Repository: Silverpeas/Silverpeas-Core The code follows secure coding practices.
[ "CWE-79" ]
CVE-2023-47324
MEDIUM
5.4
Silverpeas/Silverpeas-Core
getContent
core-web/src/main/java/org/silverpeas/core/webapi/notification/user/InboxUserNotificationEntity.java
9a55728729a3b431847045c674b3e883507d1e1a
0
Analyze the following code function for security vulnerabilities
ActivityStarter setResolveInfo(ResolveInfo info) { mRequest.resolveInfo = info; return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setResolveInfo File: services/core/java/com/android/server/wm/ActivityStarter.java Repository: android The code follows secure coding practices.
[ "CWE-269" ]
CVE-2023-21269
HIGH
7.8
android
setResolveInfo
services/core/java/com/android/server/wm/ActivityStarter.java
70ec64dc5a2a816d6aa324190a726a85fd749b30
0
Analyze the following code function for security vulnerabilities
public boolean get(Resolved resolved, User user, String[] actions, IndexNameExpressionResolver resolver, ClusterService cs) { for (SecurityRole sr : roles) { if (ConfigModelV7.impliesTypePerm(sr.getIpatterns(), resolved, user, actions, resolver, cs)) { return true; } } return false; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: get File: src/main/java/org/opensearch/security/securityconf/ConfigModelV7.java Repository: opensearch-project/security The code follows secure coding practices.
[ "CWE-612", "CWE-863" ]
CVE-2022-41918
MEDIUM
6.3
opensearch-project/security
get
src/main/java/org/opensearch/security/securityconf/ConfigModelV7.java
f7cc569c9d3fa5d5432c76c854eed280d45ce6f4
0
Analyze the following code function for security vulnerabilities
@Override public int getMACLength() { return keySpec != null ? 16 : 0; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getMACLength File: src/main/java/com/southernstorm/noise/protocol/AESGCMOnCtrCipherState.java Repository: rweather/noise-java The code follows secure coding practices.
[ "CWE-125", "CWE-787" ]
CVE-2020-25021
HIGH
7.5
rweather/noise-java
getMACLength
src/main/java/com/southernstorm/noise/protocol/AESGCMOnCtrCipherState.java
18e86b6f8bea7326934109aa9ffa705ebf4bde90
0
Analyze the following code function for security vulnerabilities
@Override public ParceledListSlice<PhoneAccountHandle> getCallCapablePhoneAccounts( boolean includeDisabledAccounts, String callingPackage, String callingFeatureId) { try { Log.startSession("TSI.gCCPA", Log.getPackageAbbreviation(callingPackage)); if (includeDisabledAccounts && !canReadPrivilegedPhoneState( callingPackage, "getCallCapablePhoneAccounts")) { return ParceledListSlice.emptyList(); } if (!canReadPhoneState(callingPackage, callingFeatureId, "getCallCapablePhoneAccounts")) { return ParceledListSlice.emptyList(); } synchronized (mLock) { final UserHandle callingUserHandle = Binder.getCallingUserHandle(); long token = Binder.clearCallingIdentity(); try { return new ParceledListSlice<>( mPhoneAccountRegistrar.getCallCapablePhoneAccounts(null, includeDisabledAccounts, callingUserHandle)); } catch (Exception e) { Log.e(this, e, "getCallCapablePhoneAccounts"); throw e; } finally { Binder.restoreCallingIdentity(token); } } } finally { Log.endSession(); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getCallCapablePhoneAccounts File: src/com/android/server/telecom/TelecomServiceImpl.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21394
MEDIUM
5.5
android
getCallCapablePhoneAccounts
src/com/android/server/telecom/TelecomServiceImpl.java
68dca62035c49e14ad26a54f614199cb29a3393f
0
Analyze the following code function for security vulnerabilities
@Test public void testDeserializationAsFloatEdgeCase08() throws Exception { String input = "1e10000000"; Duration value = READER.without(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS) .readValue(input); assertEquals(0, value.getSeconds()); }
Vulnerability Classification: - CWE: CWE-20 - CVE: CVE-2018-1000873 - Severity: MEDIUM - CVSS Score: 4.3 Description: Avoid latency problems converting decimal to time. Fixes https://github.com/FasterXML/jackson-databind/issues/2141 Function: testDeserializationAsFloatEdgeCase08 File: datetime/src/test/java/com/fasterxml/jackson/datatype/jsr310/TestDurationDeserialization.java Repository: FasterXML/jackson-modules-java8 Fixed Code: @Test(timeout = 100) public void testDeserializationAsFloatEdgeCase08() throws Exception { String input = "1e10000000"; Duration value = READER.without(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS) .readValue(input); assertEquals(0, value.getSeconds()); }
[ "CWE-20" ]
CVE-2018-1000873
MEDIUM
4.3
FasterXML/jackson-modules-java8
testDeserializationAsFloatEdgeCase08
datetime/src/test/java/com/fasterxml/jackson/datatype/jsr310/TestDurationDeserialization.java
ba27ce5909dfb49bcaf753ad3e04ecb980010b0b
1
Analyze the following code function for security vulnerabilities
@Override public int getLoaderId() { return m_staticLoaderId; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getLoaderId File: src/org/opencms/file/types/CmsResourceTypeImage.java Repository: alkacon/opencms-core The code follows secure coding practices.
[ "CWE-611" ]
CVE-2021-3312
MEDIUM
4
alkacon/opencms-core
getLoaderId
src/org/opencms/file/types/CmsResourceTypeImage.java
92e035423aa6967822d343e54392d4291648c0ee
0
Analyze the following code function for security vulnerabilities
@Override public void beginPostLayoutPolicyLw(int displayWidth, int displayHeight) { mTopFullscreenOpaqueWindowState = null; mAppsToBeHidden.clear(); mAppsThatDismissKeyguard.clear(); mForceStatusBar = false; mForceStatusBarFromKeyguard = false; mForcingShowNavBar = false; mForcingShowNavBarLayer = -1; mHideLockScreen = false; mAllowLockscreenWhenOn = false; mDismissKeyguard = DISMISS_KEYGUARD_NONE; mShowingLockscreen = false; mShowingDream = false; mWinShowWhenLocked = null; mKeyguardSecure = isKeyguardSecure(); mKeyguardSecureIncludingHidden = mKeyguardSecure && (mKeyguardDelegate != null && mKeyguardDelegate.isShowing()); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: beginPostLayoutPolicyLw File: policy/src/com/android/internal/policy/impl/PhoneWindowManager.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-0812
MEDIUM
6.6
android
beginPostLayoutPolicyLw
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
84669ca8de55d38073a0dcb01074233b0a417541
0
Analyze the following code function for security vulnerabilities
public String getParamPreActionDone() { return m_paramPreActionDone; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getParamPreActionDone 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
getParamPreActionDone
src/org/opencms/workplace/CmsDialog.java
72a05e3ea1cf692e2efce002687272e63f98c14a
0
Analyze the following code function for security vulnerabilities
@Override public void saveXWikiDoc(XWikiDocument doc, XWikiContext inputxcontext, boolean bTransaction) throws XWikiException { XWikiContext context = getExecutionXContext(inputxcontext, true); try { MonitorPlugin monitor = Util.getMonitorPlugin(context); try { // Start monitoring timer if (monitor != null) { monitor.startTimer(HINT); } doc.setStore(this); // Make sure the database name is stored doc.setDatabase(context.getWikiId()); // If the comment is larger than the max size supported by the Storage, then abbreviate it String comment = doc.getComment(); if (comment != null && comment.length() > 1023) { doc.setComment(StringUtils.abbreviate(comment, 1023)); } // Before starting the transaction, make sure any document metadata which might rely on configuration is // initialized doc.initialize(); if (bTransaction) { checkHibernate(context); SessionFactory sfactory = injectCustomMappingsInSessionFactory(doc, context); bTransaction = beginTransaction(sfactory, context); } try { Session session = getSession(context); session.setHibernateFlushMode(FlushMode.COMMIT); // These informations will allow to not look for attachments and objects on loading doc.setElement(XWikiDocument.HAS_ATTACHMENTS, !doc.getAttachmentList().isEmpty()); doc.setElement(XWikiDocument.HAS_OBJECTS, !doc.getXObjects().isEmpty()); // Let's update the class XML since this is the new way to store it // TODO If all the properties are removed, the old xml stays? BaseClass bclass = doc.getXClass(); if (bclass != null) { if (bclass.getFieldList().isEmpty()) { doc.setXClassXML(""); } else { // Don't format the XML to reduce the size of the stored data as much as possible doc.setXClassXML(bclass.toXMLString(false)); } bclass.setDirty(false); } // Remove attachments planned for removal if (!doc.getAttachmentsToRemove().isEmpty()) { for (XWikiAttachmentToRemove attachmentToRemove : doc.getAttachmentsToRemove()) { XWikiAttachment attachment = attachmentToRemove.getAttachment(); XWikiAttachment attachmentToAdd = doc.getAttachment(attachment.getFilename()); if (attachmentToAdd != null && attachmentToAdd.getId() == attachment.getId()) { // Hibernate does not like when the "same" database entity (from identifier point of // view) // is manipulated through two different Java objects in the same session. But it also // refuse // to delete and insert the "same" entity (still from id point of view) in the same // sessions. So when we hit such a case we only remove the attachment history and let // the // saveAttachmentList code below update the current attachment content. AttachmentVersioningStore store = getAttachmentVersioningStore(attachment); store.deleteArchive(attachment, context, bTransaction); // Keep the same content store since we need to overwrite existing data attachmentToAdd.setContentStore(attachment.getContentStore()); } else { XWikiAttachmentStoreInterface store = getXWikiAttachmentStoreInterface(attachment); store.deleteXWikiAttachment(attachment, false, context, false); } } } // Update/add new attachments if (doc.hasElement(XWikiDocument.HAS_ATTACHMENTS)) { saveAttachmentList(doc, context); } // Reset the list of attachments to remove doc.clearAttachmentsToRemove(); // Handle the latest text file if (doc.isContentDirty() || doc.isMetaDataDirty()) { Date ndate = new Date(); doc.setDate(ndate); if (doc.isContentDirty()) { doc.setContentUpdateDate(ndate); DocumentAuthors authors = doc.getAuthors(); authors.setContentAuthor(authors.getEffectiveMetadataAuthor()); } doc.incrementVersion(); if (context.getWiki().hasVersioning(context)) { context.getWiki().getVersioningStore().updateXWikiDocArchive(doc, false, context); } doc.setContentDirty(false); doc.setMetaDataDirty(false); } else { if (doc.getDocumentArchive() != null) { // A custom document archive has been provided, we assume it's right // (we also assume it's custom but that's another matter...) // Let's make sure we save the archive if we have one // This is especially needed if we load a document from XML if (context.getWiki().hasVersioning(context)) { context.getWiki().getVersioningStore().saveXWikiDocArchive(doc.getDocumentArchive(), false, context); // If the version does not exist it means it's a new version so add it to the history if (!containsVersion(doc, doc.getRCSVersion(), context)) { context.getWiki().getVersioningStore().updateXWikiDocArchive(doc, false, context); } } } else { // Make sure the getArchive call has been made once // with a valid context try { if (context.getWiki().hasVersioning(context)) { doc.getDocumentArchive(context); // If the version does not exist it means it's a new version so register it in the // history if (!containsVersion(doc, doc.getRCSVersion(), context)) { context.getWiki().getVersioningStore().updateXWikiDocArchive(doc, false, context); } } } catch (XWikiException e) { // this is a non critical error } } } // Verify if the document already exists Query query = session .createQuery("select xwikidoc.id from XWikiDocument as xwikidoc where xwikidoc.id = :id"); query.setParameter("id", doc.getId()); if (query.uniqueResult() == null) { doc.setNew(true); } // Note: we don't use session.saveOrUpdate(doc) because it used to be slower in Hibernate than // calling // session.save() and session.update() separately. if (doc.isNew()) { if (doc.isContentDirty() || doc.isMetaDataDirty()) { // Reset the creationDate to reflect the date of the first save, not the date of the object // creation doc.setCreationDate(new Date()); } session.save(doc); } else { session.update(doc); } // Remove objects planned for removal if (!doc.getXObjectsToRemove().isEmpty()) { for (BaseObject removedObject : doc.getXObjectsToRemove()) { deleteXWikiCollection(removedObject, context, false, false); } doc.setXObjectsToRemove(new ArrayList<BaseObject>()); } if (bclass != null) { bclass.setDocumentReference(doc.getDocumentReference()); // Store this XWikiClass in the context so that we can use it in case of recursive usage of // classes context.addBaseClass(bclass); } if (doc.hasElement(XWikiDocument.HAS_OBJECTS)) { // TODO: Delete all objects for which we don't have a name in the Map for (List<BaseObject> objects : doc.getXObjects().values()) { for (BaseObject obj : objects) { if (obj != null) { obj.setDocumentReference(doc.getDocumentReference()); /* If the object doesn't have a GUID, create it before saving */ if (StringUtils.isEmpty(obj.getGuid())) { obj.setGuid(null); } saveXWikiCollection(obj, context, false); } } } } // Update space table updateXWikiSpaceTable(doc, session); if (bTransaction) { endTransaction(context, true); } doc.setNew(false); // We need to ensure that the saved document becomes the original document doc.setOriginalDocument(doc.clone()); } finally { if (bTransaction) { try { endTransaction(context, false); } catch (Exception e) { } } } } catch (Exception e) { Object[] args = {this.defaultEntityReferenceSerializer.serialize(doc.getDocumentReference())}; throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_HIBERNATE_SAVING_DOC, "Exception while saving document {0}", e, args); } finally { // End monitoring timer if (monitor != null) { monitor.endTimer(HINT); } } } finally { restoreExecutionXContext(); } }
Vulnerability Classification: - CWE: CWE-459 - CVE: CVE-2023-36468 - Severity: HIGH - CVSS Score: 8.8 Description: XWIKI-20594: Mark old revisions and deleted documents as restricted * Introduce a new "restricted" attribute on XWikiDocument * Mark any document that is restored from XML as restricted * Deny script right when the secure document is restricted * Make transformations restricted when the document is restricted * Do not execute Velocity in titles when the document is restricted * Make sure saved documents aren't restricted. * Add tests * Display a warning when a document is rendered in restricted mode and the user is advanced or there is actually an error in the output. Function: saveXWikiDoc File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java Repository: xwiki/xwiki-platform Fixed Code: @Override public void saveXWikiDoc(XWikiDocument doc, XWikiContext inputxcontext, boolean bTransaction) throws XWikiException { XWikiContext context = getExecutionXContext(inputxcontext, true); try { MonitorPlugin monitor = Util.getMonitorPlugin(context); try { // Start monitoring timer if (monitor != null) { monitor.startTimer(HINT); } doc.setStore(this); // Make sure the database name is stored doc.setDatabase(context.getWikiId()); // If the comment is larger than the max size supported by the Storage, then abbreviate it String comment = doc.getComment(); if (comment != null && comment.length() > 1023) { doc.setComment(StringUtils.abbreviate(comment, 1023)); } // Before starting the transaction, make sure any document metadata which might rely on configuration is // initialized doc.initialize(); if (bTransaction) { checkHibernate(context); SessionFactory sfactory = injectCustomMappingsInSessionFactory(doc, context); bTransaction = beginTransaction(sfactory, context); } try { Session session = getSession(context); session.setHibernateFlushMode(FlushMode.COMMIT); // These informations will allow to not look for attachments and objects on loading doc.setElement(XWikiDocument.HAS_ATTACHMENTS, !doc.getAttachmentList().isEmpty()); doc.setElement(XWikiDocument.HAS_OBJECTS, !doc.getXObjects().isEmpty()); // Let's update the class XML since this is the new way to store it // TODO If all the properties are removed, the old xml stays? BaseClass bclass = doc.getXClass(); if (bclass != null) { if (bclass.getFieldList().isEmpty()) { doc.setXClassXML(""); } else { // Don't format the XML to reduce the size of the stored data as much as possible doc.setXClassXML(bclass.toXMLString(false)); } bclass.setDirty(false); } // Remove attachments planned for removal if (!doc.getAttachmentsToRemove().isEmpty()) { for (XWikiAttachmentToRemove attachmentToRemove : doc.getAttachmentsToRemove()) { XWikiAttachment attachment = attachmentToRemove.getAttachment(); XWikiAttachment attachmentToAdd = doc.getAttachment(attachment.getFilename()); if (attachmentToAdd != null && attachmentToAdd.getId() == attachment.getId()) { // Hibernate does not like when the "same" database entity (from identifier point of // view) // is manipulated through two different Java objects in the same session. But it also // refuse // to delete and insert the "same" entity (still from id point of view) in the same // sessions. So when we hit such a case we only remove the attachment history and let // the // saveAttachmentList code below update the current attachment content. AttachmentVersioningStore store = getAttachmentVersioningStore(attachment); store.deleteArchive(attachment, context, bTransaction); // Keep the same content store since we need to overwrite existing data attachmentToAdd.setContentStore(attachment.getContentStore()); } else { XWikiAttachmentStoreInterface store = getXWikiAttachmentStoreInterface(attachment); store.deleteXWikiAttachment(attachment, false, context, false); } } } // Update/add new attachments if (doc.hasElement(XWikiDocument.HAS_ATTACHMENTS)) { saveAttachmentList(doc, context); } // Reset the list of attachments to remove doc.clearAttachmentsToRemove(); // Handle the latest text file if (doc.isContentDirty() || doc.isMetaDataDirty()) { Date ndate = new Date(); doc.setDate(ndate); if (doc.isContentDirty()) { doc.setContentUpdateDate(ndate); DocumentAuthors authors = doc.getAuthors(); authors.setContentAuthor(authors.getEffectiveMetadataAuthor()); } doc.incrementVersion(); if (context.getWiki().hasVersioning(context)) { context.getWiki().getVersioningStore().updateXWikiDocArchive(doc, false, context); } doc.setContentDirty(false); doc.setMetaDataDirty(false); } else { if (doc.getDocumentArchive() != null) { // A custom document archive has been provided, we assume it's right // (we also assume it's custom but that's another matter...) // Let's make sure we save the archive if we have one // This is especially needed if we load a document from XML if (context.getWiki().hasVersioning(context)) { context.getWiki().getVersioningStore().saveXWikiDocArchive(doc.getDocumentArchive(), false, context); // If the version does not exist it means it's a new version so add it to the history if (!containsVersion(doc, doc.getRCSVersion(), context)) { context.getWiki().getVersioningStore().updateXWikiDocArchive(doc, false, context); } } } else { // Make sure the getArchive call has been made once // with a valid context try { if (context.getWiki().hasVersioning(context)) { doc.getDocumentArchive(context); // If the version does not exist it means it's a new version so register it in the // history if (!containsVersion(doc, doc.getRCSVersion(), context)) { context.getWiki().getVersioningStore().updateXWikiDocArchive(doc, false, context); } } } catch (XWikiException e) { // this is a non critical error } } } // Verify if the document already exists Query query = session .createQuery("select xwikidoc.id from XWikiDocument as xwikidoc where xwikidoc.id = :id"); query.setParameter("id", doc.getId()); if (query.uniqueResult() == null) { doc.setNew(true); } // Note: we don't use session.saveOrUpdate(doc) because it used to be slower in Hibernate than // calling // session.save() and session.update() separately. if (doc.isNew()) { if (doc.isContentDirty() || doc.isMetaDataDirty()) { // Reset the creationDate to reflect the date of the first save, not the date of the object // creation doc.setCreationDate(new Date()); } session.save(doc); } else { session.update(doc); } // Remove objects planned for removal if (!doc.getXObjectsToRemove().isEmpty()) { for (BaseObject removedObject : doc.getXObjectsToRemove()) { deleteXWikiCollection(removedObject, context, false, false); } doc.setXObjectsToRemove(new ArrayList<BaseObject>()); } if (bclass != null) { bclass.setDocumentReference(doc.getDocumentReference()); // Store this XWikiClass in the context so that we can use it in case of recursive usage of // classes context.addBaseClass(bclass); } if (doc.hasElement(XWikiDocument.HAS_OBJECTS)) { // TODO: Delete all objects for which we don't have a name in the Map for (List<BaseObject> objects : doc.getXObjects().values()) { for (BaseObject obj : objects) { if (obj != null) { obj.setDocumentReference(doc.getDocumentReference()); /* If the object doesn't have a GUID, create it before saving */ if (StringUtils.isEmpty(obj.getGuid())) { obj.setGuid(null); } saveXWikiCollection(obj, context, false); } } } } // Update space table updateXWikiSpaceTable(doc, session); if (bTransaction) { endTransaction(context, true); } doc.setNew(false); // Make sure that properly saved documents aren't restricted. doc.setRestricted(false); // We need to ensure that the saved document becomes the original document doc.setOriginalDocument(doc.clone()); } finally { if (bTransaction) { try { endTransaction(context, false); } catch (Exception e) { } } } } catch (Exception e) { Object[] args = {this.defaultEntityReferenceSerializer.serialize(doc.getDocumentReference())}; throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_HIBERNATE_SAVING_DOC, "Exception while saving document {0}", e, args); } finally { // End monitoring timer if (monitor != null) { monitor.endTimer(HINT); } } } finally { restoreExecutionXContext(); } }
[ "CWE-459" ]
CVE-2023-36468
HIGH
8.8
xwiki/xwiki-platform
saveXWikiDoc
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java
15a6f845d8206b0ae97f37aa092ca43d4f9d6e59
1
Analyze the following code function for security vulnerabilities
private void scheduleTextHandleFadeIn() { if (!isInsertionHandleShowing() && !isSelectionHandleShowing()) return; if (mDeferredHandleFadeInRunnable == null) { mDeferredHandleFadeInRunnable = new Runnable() { @Override public void run() { if (!allowTextHandleFadeIn()) { // Delay fade in until it is allowed. scheduleTextHandleFadeIn(); } else { if (isSelectionHandleShowing()) { mSelectionHandleController.beginHandleFadeIn(); } if (isInsertionHandleShowing()) { mInsertionHandleController.beginHandleFadeIn(); } } } }; } mContainerView.removeCallbacks(mDeferredHandleFadeInRunnable); mContainerView.postDelayed(mDeferredHandleFadeInRunnable, TEXT_HANDLE_FADE_IN_DELAY); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: scheduleTextHandleFadeIn 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
scheduleTextHandleFadeIn
content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
98a50b76141f0b14f292f49ce376e6554142d5e2
0
Analyze the following code function for security vulnerabilities
public boolean copyDocument(String docname, String targetdocname, String sourceWiki, String targetWiki, String wikilocale, boolean reset) throws XWikiException { return this.copyDocument(docname, targetdocname, sourceWiki, targetWiki, wikilocale, reset, false); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: copyDocument File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/XWiki.java Repository: xwiki/xwiki-platform The code follows secure coding practices.
[ "CWE-668" ]
CVE-2023-37911
MEDIUM
6.5
xwiki/xwiki-platform
copyDocument
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/XWiki.java
f471f2a392aeeb9e51d59fdfe1d76fccf532523f
0
Analyze the following code function for security vulnerabilities
public static boolean isColorDark(int color) { // as per ContrastColorUtil.shouldUseDark, this uses the color contrast midpoint. return ContrastColorUtil.calculateLuminance(color) <= 0.17912878474; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isColorDark File: core/java/android/app/Notification.java Repository: android The code follows secure coding practices.
[ "CWE-862" ]
CVE-2023-21288
MEDIUM
5.5
android
isColorDark
core/java/android/app/Notification.java
726247f4f53e8cc0746175265652fa415a123c0c
0
Analyze the following code function for security vulnerabilities
@Override protected DevicePolicyCache getDevicePolicyCache() { return mPolicyCache; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getDevicePolicyCache 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
getDevicePolicyCache
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
ed3f25b7222d4cff471f2b7d22d1150348146957
0
Analyze the following code function for security vulnerabilities
void sendCallEvent(Call call, String event, Bundle extras) { final String callId = mCallIdMapper.getCallId(call); if (callId != null && isServiceValid("sendCallEvent")) { try { logOutgoing("sendCallEvent %s %s", callId, event); mServiceInterface.sendCallEvent(callId, event, extras, Log.getExternalSession(TELECOM_ABBREVIATION)); } catch (RemoteException ignored) { } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: sendCallEvent 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
sendCallEvent
src/com/android/server/telecom/ConnectionServiceWrapper.java
9b41a963f352fdb3da1da8c633d45280badfcb24
0
Analyze the following code function for security vulnerabilities
protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException { for (String authName : authNames) { Authentication auth = authentications.get(authName); if (auth == null) { continue; } auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: updateParamsForAuth File: samples/client/petstore/java/okhttp-gson/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
updateParamsForAuth
samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java
2c576483f26f85b3979c6948a131f585c237109a
0
Analyze the following code function for security vulnerabilities
public String displayPrettyName(String fieldname) { if (this.currentObj == null) { return this.doc.displayPrettyName(fieldname, getXWikiContext()); } else { return this.doc.displayPrettyName(fieldname, this.currentObj.getBaseObject(), getXWikiContext()); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: displayPrettyName File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/Document.java Repository: xwiki/xwiki-platform The code follows secure coding practices.
[ "CWE-863" ]
CVE-2022-23615
MEDIUM
5.5
xwiki/xwiki-platform
displayPrettyName
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/Document.java
7ab0fe7b96809c7a3881454147598d46a1c9bbbe
0
Analyze the following code function for security vulnerabilities
@Override public String getFromStatement(Select select) { return "FROM"; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getFromStatement File: dashbuilder-backend/dashbuilder-dataset-sql/src/main/java/org/dashbuilder/dataprovider/sql/dialect/DefaultDialect.java Repository: dashbuilder The code follows secure coding practices.
[ "CWE-89" ]
CVE-2016-4999
HIGH
7.5
dashbuilder
getFromStatement
dashbuilder-backend/dashbuilder-dataset-sql/src/main/java/org/dashbuilder/dataprovider/sql/dialect/DefaultDialect.java
8574899e3b6455547b534f570b2330ff772e524b
0
Analyze the following code function for security vulnerabilities
private static Encounter returnEncounterCopy(Encounter source, Map<Obs, Obs> replacementObs, Map<Order, Order> replacementOrders) throws Exception { if (source != null) { Encounter encNew = (Encounter) returnCopy(source); //note: we can do this because we're not going to manipulate anything about these obs or orders, and this copy won't be persisted... Set<Obs> newObs = new HashSet<Obs>(); for (Obs o : source.getAllObs(true)) { Obs oNew = returnObsCopy(o, replacementObs); newObs.add(oNew); } encNew.setObs(newObs); Set<Order> newOrders = new HashSet<Order>(); for (Order o : source.getOrders()) { Order oNew = (Order) returnOrderCopy(o, replacementOrders); newOrders.add(oNew); } encNew.setOrders(newOrders); return encNew; } return null; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: returnEncounterCopy File: api/src/main/java/org/openmrs/module/htmlformentry/HtmlFormEntryUtil.java Repository: openmrs/openmrs-module-htmlformentry The code follows secure coding practices.
[ "CWE-611" ]
CVE-2018-16521
HIGH
7.5
openmrs/openmrs-module-htmlformentry
returnEncounterCopy
api/src/main/java/org/openmrs/module/htmlformentry/HtmlFormEntryUtil.java
9dcd304688e65c31cac5532fe501b9816ed975ae
0
Analyze the following code function for security vulnerabilities
protected XmlMappingException convertJaxbException(JAXBException ex) { if (ex instanceof ValidationException) { return new ValidationFailureException("JAXB validation exception", ex); } else if (ex instanceof MarshalException) { return new MarshallingFailureException("JAXB marshalling exception", ex); } else if (ex instanceof UnmarshalException) { return new UnmarshallingFailureException("JAXB unmarshalling exception", ex); } else { // fallback return new UncategorizedMappingException("Unknown JAXB exception", ex); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: convertJaxbException File: spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java Repository: spring-projects/spring-framework The code follows secure coding practices.
[ "CWE-264" ]
CVE-2013-4152
MEDIUM
6.8
spring-projects/spring-framework
convertJaxbException
spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java
2843b7d2ee12e3f9c458f6f816befd21b402e3b9
0
Analyze the following code function for security vulnerabilities
@Override public void acceptRingingCall() { synchronized (mLock) { enforceModifyPermission(); long token = Binder.clearCallingIdentity(); try { acceptRingingCallInternal(); } finally { Binder.restoreCallingIdentity(token); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: acceptRingingCall File: src/com/android/server/telecom/TelecomServiceImpl.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-0847
HIGH
7.2
android
acceptRingingCall
src/com/android/server/telecom/TelecomServiceImpl.java
2750faaa1ec819eed9acffea7bd3daf867fda444
0
Analyze the following code function for security vulnerabilities
@CalledByNative private void onBackgroundColorChanged(int color) { getContentViewClient().onBackgroundColorChanged(color); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onBackgroundColorChanged 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
onBackgroundColorChanged
content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
98a50b76141f0b14f292f49ce376e6554142d5e2
0
Analyze the following code function for security vulnerabilities
public Date parseDate(String str) { try { return dateFormat.parse(str); } catch (java.text.ParseException e) { throw new RuntimeException(e); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: parseDate File: samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java Repository: OpenAPITools/openapi-generator The code follows secure coding practices.
[ "CWE-668" ]
CVE-2021-21430
LOW
2.1
OpenAPITools/openapi-generator
parseDate
samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java
2c576483f26f85b3979c6948a131f585c237109a
0
Analyze the following code function for security vulnerabilities
public static File getCachedResourceFile(final URL location, final VersionString version, final UpdatePolicy policy) { final ResourceTracker rt = new ResourceTracker(); rt.addResource(location, version, null, policy); return rt.getCacheFile(location); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getCachedResourceFile File: core/src/main/java/net/sourceforge/jnlp/cache/CacheUtil.java Repository: AdoptOpenJDK/IcedTea-Web The code follows secure coding practices.
[ "CWE-345", "CWE-94", "CWE-22" ]
CVE-2019-10182
MEDIUM
5.8
AdoptOpenJDK/IcedTea-Web
getCachedResourceFile
core/src/main/java/net/sourceforge/jnlp/cache/CacheUtil.java
2ab070cdac087bd208f64fa8138bb709f8d7680c
0
Analyze the following code function for security vulnerabilities
private void doExtractFile(FileHeader hd, final OutputStream os) throws RarException, IOException { this.dataIO.init(os); this.dataIO.init(hd); this.dataIO.setUnpFileCRC(this.isOldFormat() ? 0 : 0xffFFffFF); if (this.unpack == null) { this.unpack = new Unpack(this.dataIO); } if (!hd.isSolid()) { this.unpack.init(null); } this.unpack.setDestSize(hd.getFullUnpackSize()); try { this.unpack.doUnpack(hd.getUnpVersion(), hd.isSolid()); // Verify file CRC hd = this.dataIO.getSubHeader(); final long actualCRC = hd.isSplitAfter() ? ~this.dataIO.getPackedCRC() : ~this.dataIO.getUnpFileCRC(); final int expectedCRC = hd.getFileCRC(); if (actualCRC != expectedCRC) { throw new CrcErrorException(); } // if (!hd.isSplitAfter()) { // // Verify file CRC // if(~dataIO.getUnpFileCRC() != hd.getFileCRC()){ // throw new RarException(RarExceptionType.crcError); // } // } } catch (final Exception e) { this.unpack.cleanUp(); if (e instanceof RarException) { // throw new RarException((RarException)e); throw (RarException) e; } else { throw new RarException(e); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: doExtractFile File: src/main/java/com/github/junrar/Archive.java Repository: junrar The code follows secure coding practices.
[ "CWE-835" ]
CVE-2022-23596
MEDIUM
5
junrar
doExtractFile
src/main/java/com/github/junrar/Archive.java
7b16b3d90b91445fd6af0adfed22c07413d4fab7
0
Analyze the following code function for security vulnerabilities
public void setValidityCount(Integer validityCount) { this.validityCount = validityCount; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setValidityCount File: base/common/src/main/java/com/netscape/certsrv/cert/CertSearchRequest.java Repository: dogtagpki/pki The code follows secure coding practices.
[ "CWE-611" ]
CVE-2022-2414
HIGH
7.5
dogtagpki/pki
setValidityCount
base/common/src/main/java/com/netscape/certsrv/cert/CertSearchRequest.java
16deffdf7548e305507982e246eb9fd1eac414fd
0
Analyze the following code function for security vulnerabilities
private List<DocumentReference> innerLoadBacklinks(XWikiContext inputxcontext, Function<Session, Query<String>> queryBuilder) throws XWikiException { return executeRead(inputxcontext, session -> { try { // Note: Ideally the method should return a Set but it would break the current API. // TODO: We use a Set here so that we don't get duplicates. In the future, when we can reference a page // in // another language using a syntax, we should modify this code to return one DocumentReference per // language // found. To implement this we need to be able to either serialize the reference with the language // information // or add some new column for the XWikiLink table in the database. Set<DocumentReference> backlinkReferences = new HashSet<>(); Query<String> apply = queryBuilder.apply(session); List<String> backlinkNames = apply.list(); // Convert strings into references for (String backlinkName : backlinkNames) { DocumentReference backlinkreference = this.currentMixedDocumentReferenceResolver.resolve(backlinkName); backlinkReferences.add(backlinkreference); } return new ArrayList<>(backlinkReferences); } catch (Exception e) { throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_HIBERNATE_LOADING_BACKLINKS, "Exception while loading backlinks", e); } }); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: innerLoadBacklinks File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java Repository: xwiki/xwiki-platform The code follows secure coding practices.
[ "CWE-459" ]
CVE-2023-36468
HIGH
8.8
xwiki/xwiki-platform
innerLoadBacklinks
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java
15a6f845d8206b0ae97f37aa092ca43d4f9d6e59
0
Analyze the following code function for security vulnerabilities
public ArrayList<PendingOperation> getPendingOperations() { synchronized (mAuthorities) { return new ArrayList<PendingOperation>(mPendingOperations); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getPendingOperations File: services/core/java/com/android/server/content/SyncStorageEngine.java Repository: android The code follows secure coding practices.
[ "CWE-20" ]
CVE-2016-2424
HIGH
7.1
android
getPendingOperations
services/core/java/com/android/server/content/SyncStorageEngine.java
d3383d5bfab296ba3adbc121ff8a7b542bde4afb
0
Analyze the following code function for security vulnerabilities
@Column(name = "user_id") public Long getUserId() { return this.userId; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getUserId File: publiccms-parent/publiccms-core/src/main/java/com/publiccms/entities/log/LogLogin.java Repository: sanluan/PublicCMS The code follows secure coding practices.
[ "CWE-79" ]
CVE-2020-21333
LOW
3.5
sanluan/PublicCMS
getUserId
publiccms-parent/publiccms-core/src/main/java/com/publiccms/entities/log/LogLogin.java
b4d5956e65b14347b162424abb197a180229b3db
0
Analyze the following code function for security vulnerabilities
private void setInternalId(String id) { Objects.requireNonNull(id, "Communication ID can't be null"); getState().internalId = id; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setInternalId File: server/src/main/java/com/vaadin/ui/Grid.java Repository: vaadin/framework The code follows secure coding practices.
[ "CWE-79" ]
CVE-2019-25028
MEDIUM
4.3
vaadin/framework
setInternalId
server/src/main/java/com/vaadin/ui/Grid.java
c40bed109c3723b38694ed160ea647fef5b28593
0
Analyze the following code function for security vulnerabilities
private void updateProcessErrorMsg(Throwable e) { LOGGER.error(e); sb.append("<pre style='color:red'>").append(ExceptionUtils.recordStackTraceMsg(e)).append("</pre>"); }
Vulnerability Classification: - CWE: CWE-79 - CVE: CVE-2019-16643 - Severity: LOW - CVSS Score: 3.5 Description: Upgrade jar version & fix #54 Signed-off-by: xiaochun <xchun90@163.com> Function: updateProcessErrorMsg File: web/src/main/java/com/zrlog/web/plugin/ZipUpdateVersionThread.java Repository: 94fzb/zrlog Fixed Code: private void updateProcessErrorMsg(Throwable e) { LOGGER.error("",e); sb.append("<pre style='color:red'>").append(ExceptionUtils.recordStackTraceMsg(e)).append("</pre>"); }
[ "CWE-79" ]
CVE-2019-16643
LOW
3.5
94fzb/zrlog
updateProcessErrorMsg
web/src/main/java/com/zrlog/web/plugin/ZipUpdateVersionThread.java
4a91c83af669e31a22297c14f089d8911d353fa1
1
Analyze the following code function for security vulnerabilities
public String getFullNameSQL() { return getFullNameSQL(true); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getFullNameSQL 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
getFullNameSQL
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java
f9a677408ffb06f309be46ef9d8df1915d9099a4
0
Analyze the following code function for security vulnerabilities
public IDTokenClaimsSet getIdToken() { return getSessionAttribute(PROP_SESSION_IDTOKEN); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getIdToken File: oidc-authenticator/src/main/java/org/xwiki/contrib/oidc/auth/internal/OIDCClientConfiguration.java Repository: xwiki-contrib/oidc The code follows secure coding practices.
[ "CWE-287" ]
CVE-2022-39387
HIGH
7.5
xwiki-contrib/oidc
getIdToken
oidc-authenticator/src/main/java/org/xwiki/contrib/oidc/auth/internal/OIDCClientConfiguration.java
0247af1417925b9734ab106ad7cd934ee870ac89
0
Analyze the following code function for security vulnerabilities
private static boolean isPendingIntentBalAllowedByCaller(@Nullable Bundle options) { if (options == null) { return ActivityOptions.PENDING_INTENT_BAL_ALLOWED_DEFAULT; } return options.getBoolean(ActivityOptions.KEY_PENDING_INTENT_BACKGROUND_ACTIVITY_ALLOWED, ActivityOptions.PENDING_INTENT_BAL_ALLOWED_DEFAULT); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isPendingIntentBalAllowedByCaller File: services/core/java/com/android/server/am/PendingIntentRecord.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-20918
CRITICAL
9.8
android
isPendingIntentBalAllowedByCaller
services/core/java/com/android/server/am/PendingIntentRecord.java
8418e3a017428683d173c0c82b0eb02d5b923a4e
0
Analyze the following code function for security vulnerabilities
private void handleEncryptionSelection(MenuItem item) { if (conversation == null) { return; } switch (item.getItemId()) { case R.id.encryption_choice_none: conversation.setNextEncryption(Message.ENCRYPTION_NONE); item.setChecked(true); break; case R.id.encryption_choice_pgp: if (activity.hasPgp()) { if (conversation.getAccount().getPgpSignature() != null) { conversation.setNextEncryption(Message.ENCRYPTION_PGP); item.setChecked(true); } else { activity.announcePgp(conversation.getAccount(), conversation, null, activity.onOpenPGPKeyPublished); } } else { activity.showInstallPgpDialog(); } break; case R.id.encryption_choice_axolotl: Log.d(Config.LOGTAG, AxolotlService.getLogprefix(conversation.getAccount()) + "Enabled axolotl for Contact " + conversation.getContact().getJid()); conversation.setNextEncryption(Message.ENCRYPTION_AXOLOTL); item.setChecked(true); break; default: conversation.setNextEncryption(Message.ENCRYPTION_NONE); break; } activity.xmppConnectionService.updateConversation(conversation); updateChatMsgHint(); getActivity().invalidateOptionsMenu(); activity.refreshUi(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: handleEncryptionSelection File: src/main/java/eu/siacs/conversations/ui/ConversationFragment.java Repository: iNPUTmice/Conversations The code follows secure coding practices.
[ "CWE-200" ]
CVE-2018-18467
MEDIUM
5
iNPUTmice/Conversations
handleEncryptionSelection
src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
7177c523a1b31988666b9337249a4f1d0c36f479
0
Analyze the following code function for security vulnerabilities
private int getActionLayoutResource() { return R.layout.notification_material_action; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getActionLayoutResource File: core/java/android/app/Notification.java Repository: android The code follows secure coding practices.
[ "CWE-862" ]
CVE-2023-21288
MEDIUM
5.5
android
getActionLayoutResource
core/java/android/app/Notification.java
726247f4f53e8cc0746175265652fa415a123c0c
0
Analyze the following code function for security vulnerabilities
@Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; String path = httpRequest.getServletPath(); LOG.debug("Handling request for path {}", path); if (configuration.getRealm() == null || configuration.getRealm().equals("") || !configuration.isEnabled()) { LOG.debug("No authentication needed for path {}", path); chain.doFilter(request, response); return; } HttpSession session = httpRequest.getSession(false); if (session != null) { Subject subject = (Subject) session.getAttribute("subject"); if (subject != null) { LOG.debug("Session subject {}", subject); executeAs(request, response, chain, subject); return; } } boolean doAuthenticate = path.startsWith("/auth") || path.startsWith("/jolokia") || path.startsWith("/upload"); if (doAuthenticate) { LOG.debug("Doing authentication and authorization for path {}", path); switch (Authenticator.authenticate(configuration.getRealm(), configuration.getRole(), configuration.getRolePrincipalClasses(), configuration.getConfiguration(), httpRequest, new PrivilegedCallback() { public void execute(Subject subject) throws Exception { executeAs(request, response, chain, subject); } })) { case AUTHORIZED: // request was executed using the authenticated subject, nothing more to do break; case NOT_AUTHORIZED: Helpers.doForbidden((HttpServletResponse) response); break; case NO_CREDENTIALS: //doAuthPrompt((HttpServletResponse)response); Helpers.doForbidden((HttpServletResponse) response); break; } } else { LOG.debug("No authentication needed for path {}", path); chain.doFilter(request, response); } }
Vulnerability Classification: - CWE: CWE-287 - CVE: CVE-2014-0121 - Severity: HIGH - CVSS Score: 7.5 Description: Ensure we secure hawtio-karaf-terminal's /term context Function: doFilter File: hawtio-system/src/main/java/io/hawt/web/AuthenticationFilter.java Repository: hawtio Fixed Code: @Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; String path = httpRequest.getServletPath(); LOG.debug("Handling request for path {}", path); if (configuration.getRealm() == null || configuration.getRealm().equals("") || !configuration.isEnabled()) { LOG.debug("No authentication needed for path {}", path); chain.doFilter(request, response); return; } HttpSession session = httpRequest.getSession(false); if (session != null) { Subject subject = (Subject) session.getAttribute("subject"); if (subject != null) { LOG.debug("Session subject {}", subject); executeAs(request, response, chain, subject); return; } } boolean doAuthenticate = true; if (doAuthenticate) { LOG.debug("Doing authentication and authorization for path {}", path); switch (Authenticator.authenticate(configuration.getRealm(), configuration.getRole(), configuration.getRolePrincipalClasses(), configuration.getConfiguration(), httpRequest, new PrivilegedCallback() { public void execute(Subject subject) throws Exception { executeAs(request, response, chain, subject); } })) { case AUTHORIZED: // request was executed using the authenticated subject, nothing more to do break; case NOT_AUTHORIZED: Helpers.doForbidden((HttpServletResponse) response); break; case NO_CREDENTIALS: //doAuthPrompt((HttpServletResponse)response); Helpers.doForbidden((HttpServletResponse) response); break; } } else { LOG.warn("No authentication needed for path {}", path); chain.doFilter(request, response); } }
[ "CWE-287" ]
CVE-2014-0121
HIGH
7.5
hawtio
doFilter
hawtio-system/src/main/java/io/hawt/web/AuthenticationFilter.java
5289715e4f2657562fdddcbad830a30969b96e1e
1
Analyze the following code function for security vulnerabilities
public HeightMode getHeightMode() { return getState(false).heightMode; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getHeightMode File: server/src/main/java/com/vaadin/ui/Grid.java Repository: vaadin/framework The code follows secure coding practices.
[ "CWE-79" ]
CVE-2019-25028
MEDIUM
4.3
vaadin/framework
getHeightMode
server/src/main/java/com/vaadin/ui/Grid.java
c40bed109c3723b38694ed160ea647fef5b28593
0
Analyze the following code function for security vulnerabilities
public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeIntArray(pids); data.writeString(reason); data.writeInt(secure ? 1 : 0); mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0); reply.readException(); boolean res = reply.readInt() != 0; data.recycle(); reply.recycle(); return res; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: killPids File: core/java/android/app/ActivityManagerNative.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-3832
HIGH
8.3
android
killPids
core/java/android/app/ActivityManagerNative.java
e7cf91a198de995c7440b3b64352effd2e309906
0
Analyze the following code function for security vulnerabilities
protected abstract void computeFieldPolynomial();
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: computeFieldPolynomial File: core/src/main/java/org/bouncycastle/pqc/math/linearalgebra/GF2nField.java Repository: bcgit/bc-java The code follows secure coding practices.
[ "CWE-470" ]
CVE-2018-1000613
HIGH
7.5
bcgit/bc-java
computeFieldPolynomial
core/src/main/java/org/bouncycastle/pqc/math/linearalgebra/GF2nField.java
4092ede58da51af9a21e4825fbad0d9a3ef5a223
0
Analyze the following code function for security vulnerabilities
@Override protected void onModelChanged() { super.onModelChanged(); input.setModelObject(getModelObject()); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onModelChanged File: server-core/src/main/java/io/onedev/server/web/component/markdown/MarkdownEditor.java Repository: theonedev/onedev The code follows secure coding practices.
[ "CWE-502" ]
CVE-2021-21242
HIGH
7.5
theonedev/onedev
onModelChanged
server-core/src/main/java/io/onedev/server/web/component/markdown/MarkdownEditor.java
f864053176c08f59ef2d97fea192ceca46a4d9be
0
Analyze the following code function for security vulnerabilities
protected void setOutputEncoding() throws Exception { outCipher = outSettings.getCipher(seqo); outMac = outSettings.getMac(); outCompression = outSettings.getCompression(); outSettings = null; outCipherSize = outCipher.getCipherBlockSize(); outMacSize = outMac != null ? outMac.getBlockSize() : 0; // TODO add support for configurable compression level outCompression.init(Compression.Type.Deflater, -1); maxRekeyBlocks.set(determineRekeyBlockLimit(inCipherSize, outCipherSize)); outBytesCount.set(0L); outPacketsCount.set(0L); outBlocksCount.set(0L); lastKeyTimeValue.set(Instant.now()); firstKexPacketFollows = null; if (log.isDebugEnabled()) { log.debug("setOutputEncoding({}): cipher {}; mac {}; compression {}; blocks limit {}", this, outCipher, outMac, outCompression, maxRekeyBlocks); } }
Vulnerability Classification: - CWE: CWE-354 - CVE: CVE-2023-48795 - Severity: MEDIUM - CVSS Score: 5.9 Description: GH-445: OpenSSH "strict KEX" protocol extension Implements the OpenSSH "strict KEX" protocol extension.[1] If both parties in a an SSH connection announce support for strict KEX in the initial KEX_INIT message, strict KEX is active; otherwise it isn't. With strict KEX active, there must be only KEX-related messages during the initial key exchange (no IGNORE or DEBUG messages are allowed), and the KEX_INIT message must be the first one to have been received after the initial version exchange. If these conditions are violated, the connection is terminated. Strict KEX also resets message sequence numbers to zero after each NEW_KEYS message sent or received. [1] https://github.com/openssh/openssh-portable/blob/master/PROTOCOL Function: setOutputEncoding File: sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java Repository: apache/mina-sshd Fixed Code: protected void setOutputEncoding() throws Exception { if (strictKex) { if (log.isDebugEnabled()) { log.debug("setOutputEncoding({}): strict KEX resets output message sequence number from {} to 0", this, seqo); } seqo = 0; } outCipher = outSettings.getCipher(seqo); outMac = outSettings.getMac(); outCompression = outSettings.getCompression(); outSettings = null; outCipherSize = outCipher.getCipherBlockSize(); outMacSize = outMac != null ? outMac.getBlockSize() : 0; // TODO add support for configurable compression level outCompression.init(Compression.Type.Deflater, -1); maxRekeyBlocks.set(determineRekeyBlockLimit(inCipherSize, outCipherSize)); outBytesCount.set(0L); outPacketsCount.set(0L); outBlocksCount.set(0L); lastKeyTimeValue.set(Instant.now()); firstKexPacketFollows = null; if (log.isDebugEnabled()) { log.debug("setOutputEncoding({}): cipher {}; mac {}; compression {}; blocks limit {}", this, outCipher, outMac, outCompression, maxRekeyBlocks); } }
[ "CWE-354" ]
CVE-2023-48795
MEDIUM
5.9
apache/mina-sshd
setOutputEncoding
sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
6b0fd46f64bcb75eeeee31d65f10242660aad7c1
1
Analyze the following code function for security vulnerabilities
public Collection<SemanticGraph> exhaustFromPatterns(List<SsurgeonPattern> patternList, SemanticGraph sg) throws Exception { Collection<SemanticGraph> generated = exhaustFromPatterns(patternList, sg, 1); if (generated.size() > 1) { if (log != null) log.info("Before remove dupe, size="+generated.size()); generated = SemanticGraphUtils.removeDuplicates(generated, sg); if (log != null) log.info("AFTER remove dupe, size="+generated.size()); } return generated; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: exhaustFromPatterns File: src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java Repository: stanfordnlp/CoreNLP The code follows secure coding practices.
[ "CWE-611" ]
CVE-2021-3878
HIGH
7.5
stanfordnlp/CoreNLP
exhaustFromPatterns
src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java
e5bbe135a02a74b952396751ed3015e8b8252e99
0
Analyze the following code function for security vulnerabilities
public long parseXML(Reader input) throws XMLStreamException { Map<String, String> cache = new HashMap<>(1024*32); XMLInputFactory inputFactory = XMLInputFactory.newInstance(); inputFactory.setProperty("javax.xml.stream.isCoalescing", true); inputFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, true); XMLEventReader reader = inputFactory.createXMLEventReader(input); Entity last = null; Map<String, Key> nodeKeys = new HashMap<>(); Map<String, Key> relKeys = new HashMap<>(); int count = 0; try (BatchTransaction tx = new BatchTransaction(db, batchSize * 10, reporter)) { while (reader.hasNext()) { XMLEvent event; try { event = (XMLEvent) reader.next(); } catch (Exception e) { // in case of unicode invalid chars we skip the event, or we exit in case of EOF if (e.getMessage().contains("Unexpected EOF")) { break; } continue; } if (event.isStartElement()) { StartElement element = event.asStartElement(); String name = element.getName().getLocalPart(); if (name.equals("graphml") || name.equals("graph")) continue; if (name.equals("key")) { String id = getAttribute(element, ID); Key key = new Key(getAttribute(element, NAME), getAttribute(element, TYPE), getAttribute(element, LIST), getAttribute(element, FOR)); XMLEvent next = peek(reader); if (next.isStartElement() && next.asStartElement().getName().getLocalPart().equals("default")) { reader.nextEvent().asStartElement(); key.setDefault(reader.nextEvent().asCharacters().getData()); } if (key.forNode) nodeKeys.put(id, key); else relKeys.put(id, key); continue; } if (name.equals("data")) { if (last == null) continue; String id = getAttribute(element, KEY); boolean isNode = last instanceof Node; Key key = isNode ? nodeKeys.get(id) : relKeys.get(id); if (key == null) key = Key.defaultKey(id, isNode); final Map.Entry<XMLEvent, Object> eventEntry = getDataEventEntry(reader, key); final XMLEvent next = eventEntry.getKey(); final Object value = eventEntry.getValue(); if (value != null) { if (this.labels && isNode && id.equals("labels")) { addLabels((Node)last,value.toString()); } else if (!this.labels || isNode || !id.equals("label")) { last.setProperty(key.nameOrId, value); if (reporter != null) reporter.update(0, 0, 1); } } else if (next.getEventType() == XMLStreamConstants.END_ELEMENT) { last.setProperty(key.nameOrId, StringUtils.EMPTY); reporter.update(0, 0, 1); } continue; } if (name.equals("node")) { tx.increment(); String id = getAttribute(element, ID); Node node = tx.getTransaction().createNode(); if (this.labels) { String labels = getAttribute(element, LABELS); addLabels(node, labels); } if (storeNodeIds) node.setProperty("id", id); setDefaults(nodeKeys, node); last = node; cache.put(id, node.getElementId()); if (reporter != null) reporter.update(1, 0, 0); count++; continue; } if (name.equals("edge")) { tx.increment(); String label = getAttribute(element, LABEL); Node from = getByNodeId(cache, tx.getTransaction(), element, XmlNodeExport.NodeType.SOURCE); Node to = getByNodeId(cache, tx.getTransaction(), element, XmlNodeExport.NodeType.TARGET); RelationshipType relationshipType = label == null ? getRelationshipType(reader) : RelationshipType.withName(label); Relationship relationship = from.createRelationshipTo(to, relationshipType); setDefaults(relKeys, relationship); last = relationship; if (reporter != null) reporter.update(0, 1, 0); count++; } } } } return count; }
Vulnerability Classification: - CWE: CWE-611 - CVE: CVE-2023-23926 - Severity: HIGH - CVSS Score: 8.1 Description: [AJmycukR] Fix for apoc.import.graphml Function: parseXML File: core/src/main/java/apoc/export/graphml/XmlGraphMLReader.java Repository: neo4j/apoc Fixed Code: public long parseXML(Reader input) throws XMLStreamException { Map<String, String> cache = new HashMap<>(1024*32); XMLInputFactory inputFactory = XMLInputFactory.newInstance(); inputFactory.setProperty("javax.xml.stream.isCoalescing", true); inputFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, true); inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false); inputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); XMLEventReader reader = inputFactory.createXMLEventReader(input); Entity last = null; Map<String, Key> nodeKeys = new HashMap<>(); Map<String, Key> relKeys = new HashMap<>(); int count = 0; try (BatchTransaction tx = new BatchTransaction(db, batchSize * 10, reporter)) { while (reader.hasNext()) { XMLEvent event; try { event = (XMLEvent) reader.next(); if ( event.getEventType() == XMLStreamConstants.DTD) { generateXmlDoctypeException(); } } catch (Exception e) { // in case of unicode invalid chars we skip the event, or we exit in case of EOF if (e.getMessage().contains("Unexpected EOF")) { break; } else if (e.getMessage().contains("DOCTYPE")) { throw e; } continue; } if (event.isStartElement()) { StartElement element = event.asStartElement(); String name = element.getName().getLocalPart(); if (name.equals("graphml") || name.equals("graph")) continue; if (name.equals("key")) { String id = getAttribute(element, ID); Key key = new Key(getAttribute(element, NAME), getAttribute(element, TYPE), getAttribute(element, LIST), getAttribute(element, FOR)); XMLEvent next = peek(reader); if (next.isStartElement() && next.asStartElement().getName().getLocalPart().equals("default")) { reader.nextEvent().asStartElement(); key.setDefault(reader.nextEvent().asCharacters().getData()); } if (key.forNode) nodeKeys.put(id, key); else relKeys.put(id, key); continue; } if (name.equals("data")) { if (last == null) continue; String id = getAttribute(element, KEY); boolean isNode = last instanceof Node; Key key = isNode ? nodeKeys.get(id) : relKeys.get(id); if (key == null) key = Key.defaultKey(id, isNode); final Map.Entry<XMLEvent, Object> eventEntry = getDataEventEntry(reader, key); final XMLEvent next = eventEntry.getKey(); final Object value = eventEntry.getValue(); if (value != null) { if (this.labels && isNode && id.equals("labels")) { addLabels((Node)last,value.toString()); } else if (!this.labels || isNode || !id.equals("label")) { last.setProperty(key.nameOrId, value); if (reporter != null) reporter.update(0, 0, 1); } } else if (next.getEventType() == XMLStreamConstants.END_ELEMENT) { last.setProperty(key.nameOrId, StringUtils.EMPTY); reporter.update(0, 0, 1); } continue; } if (name.equals("node")) { tx.increment(); String id = getAttribute(element, ID); Node node = tx.getTransaction().createNode(); if (this.labels) { String labels = getAttribute(element, LABELS); addLabels(node, labels); } if (storeNodeIds) node.setProperty("id", id); setDefaults(nodeKeys, node); last = node; cache.put(id, node.getElementId()); if (reporter != null) reporter.update(1, 0, 0); count++; continue; } if (name.equals("edge")) { tx.increment(); String label = getAttribute(element, LABEL); Node from = getByNodeId(cache, tx.getTransaction(), element, XmlNodeExport.NodeType.SOURCE); Node to = getByNodeId(cache, tx.getTransaction(), element, XmlNodeExport.NodeType.TARGET); RelationshipType relationshipType = label == null ? getRelationshipType(reader) : RelationshipType.withName(label); Relationship relationship = from.createRelationshipTo(to, relationshipType); setDefaults(relKeys, relationship); last = relationship; if (reporter != null) reporter.update(0, 1, 0); count++; } } } } return count; }
[ "CWE-611" ]
CVE-2023-23926
HIGH
8.1
neo4j/apoc
parseXML
core/src/main/java/apoc/export/graphml/XmlGraphMLReader.java
3202b421b21973b2f57a43b33c88f3f6901cfd2a
1
Analyze the following code function for security vulnerabilities
public void restart() throws RestartNotSupportedException { final Lifecycle lifecycle = Lifecycle.get(); lifecycle.verifyRestartable(); // verify that Hudson is restartable servletContext.setAttribute("app", new HudsonIsRestarting()); new Thread("restart thread") { final String exitUser = getAuthentication().getName(); @Override public void run() { try { ACL.impersonate(ACL.SYSTEM); // give some time for the browser to load the "reloading" page Thread.sleep(5000); LOGGER.severe(String.format("Restarting VM as requested by %s",exitUser)); for (RestartListener listener : RestartListener.all()) listener.onRestart(); lifecycle.restart(); } catch (InterruptedException e) { LOGGER.log(Level.WARNING, "Failed to restart Hudson",e); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to restart Hudson",e); } } }.start(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: restart 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
restart
core/src/main/java/jenkins/model/Jenkins.java
a0b00508eeb74d7033dc4100eb382df4e8fa72e7
0
Analyze the following code function for security vulnerabilities
@Override public void afterLast() throws SQLException { checkScrollable(); final int rows_size = rows.size(); if (rows_size > 0) { currentRow = rows_size; } onInsertRow = false; thisRow = null; rowBuffer = null; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: afterLast File: pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java Repository: pgjdbc The code follows secure coding practices.
[ "CWE-89" ]
CVE-2022-31197
HIGH
8
pgjdbc
afterLast
pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
739e599d52ad80f8dcd6efedc6157859b1a9d637
0
Analyze the following code function for security vulnerabilities
private String getMimeType(HttpServletRequest pReq) { String requestMimeType = pReq.getParameter(ConfigKey.MIME_TYPE.getKeyValue()); if (requestMimeType != null) { return requestMimeType; } return configMimeType; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getMimeType File: agent/core/src/main/java/org/jolokia/http/AgentServlet.java Repository: jolokia The code follows secure coding practices.
[ "CWE-352" ]
CVE-2014-0168
MEDIUM
6.8
jolokia
getMimeType
agent/core/src/main/java/org/jolokia/http/AgentServlet.java
2d9b168cfbbf5a6d16fa6e8a5b34503e3dc42364
0
Analyze the following code function for security vulnerabilities
private static ByteBuffer getAndroidManifestFromApk( DataSource apk, ApkUtils.ZipSections zipSections) throws IOException, ApkFormatException { List<CentralDirectoryRecord> cdRecords = V1SchemeVerifier.parseZipCentralDirectory(apk, zipSections); try { return ApkSigner.getAndroidManifestFromApk( cdRecords, apk.slice(0, zipSections.getZipCentralDirectoryOffset())); } catch (ZipFormatException e) { throw new ApkFormatException("Failed to read AndroidManifest.xml", e); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getAndroidManifestFromApk File: src/main/java/com/android/apksig/ApkVerifier.java Repository: android The code follows secure coding practices.
[ "CWE-400" ]
CVE-2023-21253
MEDIUM
5.5
android
getAndroidManifestFromApk
src/main/java/com/android/apksig/ApkVerifier.java
039f815895f62c9f8af23df66622b66246f3f61e
0
Analyze the following code function for security vulnerabilities
void enforceShellRestriction(String restriction, int userHandle) { if (Binder.getCallingUid() == Process.SHELL_UID) { if (userHandle < 0 || mUserManager.hasUserRestriction(restriction, userHandle)) { throw new SecurityException("Shell does not have permission to access user " + userHandle); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: enforceShellRestriction 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
enforceShellRestriction
services/core/java/com/android/server/am/ActivityManagerService.java
aaa0fee0d7a8da347a0c47cef5249c70efee209e
0
Analyze the following code function for security vulnerabilities
@Override public void deletePendingTopUid(int uid, long nowElapsed) { mPendingStartActivityUids.delete(uid, nowElapsed); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: deletePendingTopUid 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
deletePendingTopUid
services/core/java/com/android/server/am/ActivityManagerService.java
d10b27e539f7bc91c2360d429b9d05f05274670d
0
Analyze the following code function for security vulnerabilities
public void bindNotification( @Action int selectedAction, ShortcutManager shortcutManager, PackageManager pm, PeopleSpaceWidgetManager peopleSpaceWidgetManager, INotificationManager iNotificationManager, OnUserInteractionCallback onUserInteractionCallback, String pkg, NotificationChannel notificationChannel, NotificationEntry entry, Notification.BubbleMetadata bubbleMetadata, OnSettingsClickListener onSettingsClick, ConversationIconFactory conversationIconFactory, Context userContext, boolean isDeviceProvisioned, @Main Handler mainHandler, @Background Handler bgHandler, OnConversationSettingsClickListener onConversationSettingsClickListener, Optional<BubblesManager> bubblesManagerOptional, ShadeController shadeController) { mPressedApply = false; mSelectedAction = selectedAction; mINotificationManager = iNotificationManager; mPeopleSpaceWidgetManager = peopleSpaceWidgetManager; mOnUserInteractionCallback = onUserInteractionCallback; mPackageName = pkg; mEntry = entry; mSbn = entry.getSbn(); mPm = pm; mAppName = mPackageName; mOnSettingsClickListener = onSettingsClick; mNotificationChannel = notificationChannel; mAppUid = mSbn.getUid(); mDelegatePkg = mSbn.getOpPkg(); mIsDeviceProvisioned = isDeviceProvisioned; mOnConversationSettingsClickListener = onConversationSettingsClickListener; mIconFactory = conversationIconFactory; mUserContext = userContext; mBubbleMetadata = bubbleMetadata; mBubblesManagerOptional = bubblesManagerOptional; mShadeController = shadeController; mMainHandler = mainHandler; mBgHandler = bgHandler; mShortcutManager = shortcutManager; mShortcutInfo = entry.getRanking().getConversationShortcutInfo(); if (mShortcutInfo == null) { throw new IllegalArgumentException("Does not have required information"); } mNotificationChannel = NotificationChannelHelper.createConversationChannelIfNeeded( getContext(), mINotificationManager, entry, mNotificationChannel); try { mAppBubble = mINotificationManager.getBubblePreferenceForPackage(mPackageName, mAppUid); } catch (RemoteException e) { Log.e(TAG, "can't reach OS", e); mAppBubble = BUBBLE_PREFERENCE_SELECTED; } bindHeader(); bindActions(); View done = findViewById(R.id.done); done.setOnClickListener(mOnDone); done.setAccessibilityDelegate(mGutsContainer.getAccessibilityDelegate()); }
Vulnerability Classification: - CWE: CWE-Other - CVE: CVE-2023-40098 - Severity: MEDIUM - CVSS Score: 5.5 Description: Disable priority conversation widget for secondary users Test: NotificationConversationInfoTest.java Test: make a conversation priority on the primary user Test: make a conversation priority on a secondary user Bug: 288896269 (cherry picked from commit adf620316dcfaf19d7d4a73e2c63322b4a3a4d3a) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:7444c007743970a9d6877c1b3fd2b28143687281) Merged-In: I3f3991d2cb7fb9970cc8ada39ceae9a7ff2fcb31 Change-Id: I3f3991d2cb7fb9970cc8ada39ceae9a7ff2fcb31 Function: bindNotification File: packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java Repository: android Fixed Code: public void bindNotification( @Action int selectedAction, ShortcutManager shortcutManager, PackageManager pm, UserManager um, PeopleSpaceWidgetManager peopleSpaceWidgetManager, INotificationManager iNotificationManager, OnUserInteractionCallback onUserInteractionCallback, String pkg, NotificationChannel notificationChannel, NotificationEntry entry, Notification.BubbleMetadata bubbleMetadata, OnSettingsClickListener onSettingsClick, ConversationIconFactory conversationIconFactory, Context userContext, boolean isDeviceProvisioned, @Main Handler mainHandler, @Background Handler bgHandler, OnConversationSettingsClickListener onConversationSettingsClickListener, Optional<BubblesManager> bubblesManagerOptional, ShadeController shadeController) { mPressedApply = false; mSelectedAction = selectedAction; mINotificationManager = iNotificationManager; mPeopleSpaceWidgetManager = peopleSpaceWidgetManager; mOnUserInteractionCallback = onUserInteractionCallback; mPackageName = pkg; mEntry = entry; mSbn = entry.getSbn(); mPm = pm; mUm = um; mAppName = mPackageName; mOnSettingsClickListener = onSettingsClick; mNotificationChannel = notificationChannel; mAppUid = mSbn.getUid(); mDelegatePkg = mSbn.getOpPkg(); mIsDeviceProvisioned = isDeviceProvisioned; mOnConversationSettingsClickListener = onConversationSettingsClickListener; mIconFactory = conversationIconFactory; mUserContext = userContext; mBubbleMetadata = bubbleMetadata; mBubblesManagerOptional = bubblesManagerOptional; mShadeController = shadeController; mMainHandler = mainHandler; mBgHandler = bgHandler; mShortcutManager = shortcutManager; mShortcutInfo = entry.getRanking().getConversationShortcutInfo(); if (mShortcutInfo == null) { throw new IllegalArgumentException("Does not have required information"); } mNotificationChannel = NotificationChannelHelper.createConversationChannelIfNeeded( getContext(), mINotificationManager, entry, mNotificationChannel); try { mAppBubble = mINotificationManager.getBubblePreferenceForPackage(mPackageName, mAppUid); } catch (RemoteException e) { Log.e(TAG, "can't reach OS", e); mAppBubble = BUBBLE_PREFERENCE_SELECTED; } bindHeader(); bindActions(); View done = findViewById(R.id.done); done.setOnClickListener(mOnDone); done.setAccessibilityDelegate(mGutsContainer.getAccessibilityDelegate()); }
[ "CWE-Other" ]
CVE-2023-40098
MEDIUM
5.5
android
bindNotification
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java
d21ffbe8a2eeb2a5e6da7efbb1a0430ba6b022e0
1
Analyze the following code function for security vulnerabilities
private char getNextChar() { characterOffset_++; columnNumber_++; return buffer[offset++]; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getNextChar File: src/org/cyberneko/html/HTMLScanner.java Repository: sparklemotion/nekohtml The code follows secure coding practices.
[ "CWE-400" ]
CVE-2022-24839
MEDIUM
5
sparklemotion/nekohtml
getNextChar
src/org/cyberneko/html/HTMLScanner.java
a800fce3b079def130ed42a408ff1d09f89e773d
0
Analyze the following code function for security vulnerabilities
public void sendMessage(Collection<String> toUserIds, String toChannel, Object data) { for (String toUserId : toUserIds) { Set<Location> copy = new HashSet<>(); synchronized (_uid2Location) { Set<Location> locations = _uid2Location.get(toUserId); if (locations == null) { copy.add(new SetiLocation(toUserId, null)); } else { copy.addAll(locations); } } if (_logger.isDebugEnabled()) { _logger.debug("Sending message to locations {}", copy); } for (Location location : copy) { location.send(toUserId, toChannel, data); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: sendMessage File: cometd-java/cometd-java-oort/src/main/java/org/cometd/oort/Seti.java Repository: cometd The code follows secure coding practices.
[ "CWE-863" ]
CVE-2022-24721
MEDIUM
5.5
cometd
sendMessage
cometd-java/cometd-java-oort/src/main/java/org/cometd/oort/Seti.java
bb445a143fbf320f17c62e340455cd74acfb5929
0
Analyze the following code function for security vulnerabilities
public void notifyStartFading() { updateFullyVisibleState(true /* forceNotFullyVisible */); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: notifyStartFading File: packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2017-0822
HIGH
7.5
android
notifyStartFading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
c574568aaede7f652432deb7707f20ae54bbdf9a
0
Analyze the following code function for security vulnerabilities
void injectSendIntentSender(IntentSender intentSender, Intent extras) { if (intentSender == null) { return; } try { intentSender.sendIntent(mContext, /* code= */ 0, extras, /* onFinished=*/ null, /* handler= */ null); } catch (SendIntentException e) { Slog.w(TAG, "sendIntent failed().", e); } }
Vulnerability Classification: - CWE: CWE-Other - CVE: CVE-2023-40079 - Severity: HIGH - CVSS Score: 7.8 Description: Rescind BAL privilege when ShortcutService sends the callback PI When AppWidgetManager.requestPinAppWidget is called from a client, The passed in callback PendingIntent is called from the system server. This allows the PendingIntent to be able to bypass BAL checks. Bug: 278722815 Test: manual test. BackgroundActivityLaunchTest. Regression like RequestPinAppWidgetTest, PeopleSpaceWidgetManagerTest, etc. (cherry picked from commit eb90469587d908ac89121baf4f4dca3d1da5b817) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:0a0778e96d7da3fa8169abdf9261ed62809539fa) Merged-In: I2df9de272192c9a149a9ff519c96e6e0e8304040 Change-Id: I2df9de272192c9a149a9ff519c96e6e0e8304040 Function: injectSendIntentSender File: services/core/java/com/android/server/pm/ShortcutService.java Repository: android Fixed Code: void injectSendIntentSender(IntentSender intentSender, Intent extras) { if (intentSender == null) { return; } try { ActivityOptions options = ActivityOptions.makeBasic() .setPendingIntentBackgroundActivityStartMode( MODE_BACKGROUND_ACTIVITY_START_DENIED); intentSender.sendIntent(mContext, /* code= */ 0, extras, /* onFinished=*/ null, /* handler= */ null, null, options.toBundle()); } catch (SendIntentException e) { Slog.w(TAG, "sendIntent failed().", e); } }
[ "CWE-Other" ]
CVE-2023-40079
HIGH
7.8
android
injectSendIntentSender
services/core/java/com/android/server/pm/ShortcutService.java
96e0524c48c6e58af7d15a2caf35082186fc8de2
1
Analyze the following code function for security vulnerabilities
protected void setOnSyncRequestListener(OnSyncRequestListener listener) { if (mSyncRequestListener == null) { mSyncRequestListener = listener; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setOnSyncRequestListener File: services/core/java/com/android/server/content/SyncStorageEngine.java Repository: android The code follows secure coding practices.
[ "CWE-20" ]
CVE-2016-2424
HIGH
7.1
android
setOnSyncRequestListener
services/core/java/com/android/server/content/SyncStorageEngine.java
d3383d5bfab296ba3adbc121ff8a7b542bde4afb
0
Analyze the following code function for security vulnerabilities
@Pure public java.sql.@Nullable Date getDate(@Positive int columnIndex) throws SQLException { connection.getLogger().log(Level.FINEST, " getDate columnIndex: {0}", columnIndex); return getDate(columnIndex, null); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getDate File: pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java Repository: pgjdbc The code follows secure coding practices.
[ "CWE-89" ]
CVE-2022-31197
HIGH
8
pgjdbc
getDate
pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
739e599d52ad80f8dcd6efedc6157859b1a9d637
0
Analyze the following code function for security vulnerabilities
@Override public void hasFeatures(IAccountManagerResponse response, Account account, String[] features, String opPackageName) { int callingUid = Binder.getCallingUid(); mAppOpsManager.checkPackage(callingUid, opPackageName); if (Log.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "hasFeatures: " + account + ", response " + response + ", features " + Arrays.toString(features) + ", caller's uid " + callingUid + ", pid " + Binder.getCallingPid()); } Preconditions.checkArgument(account != null, "account cannot be null"); Preconditions.checkArgument(response != null, "response cannot be null"); Preconditions.checkArgument(features != null, "features cannot be null"); int userId = UserHandle.getCallingUserId(); checkReadAccountsPermitted(callingUid, account.type, userId, opPackageName); final long identityToken = clearCallingIdentity(); try { UserAccounts accounts = getUserAccounts(userId); new TestFeaturesSession(accounts, response, account, features).bind(); } finally { restoreCallingIdentity(identityToken); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: hasFeatures File: services/core/java/com/android/server/accounts/AccountManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-Other", "CWE-502" ]
CVE-2023-45777
HIGH
7.8
android
hasFeatures
services/core/java/com/android/server/accounts/AccountManagerService.java
f810d81839af38ee121c446105ca67cb12992fc6
0
Analyze the following code function for security vulnerabilities
private void rapidFire(Runnable... tasks) { final CyclicBarrier barrier = new CyclicBarrier(tasks.length); final CountDownLatch latch = new CountDownLatch(tasks.length); for (int i = 0; i < tasks.length; i++) { final Runnable task = tasks[i]; new Thread(new Runnable() { @Override public void run() { try { barrier.await(); task.run(); } catch (InterruptedException | BrokenBarrierException e){ Log.e(BasicCallTests.this, e, "Unexpectedly interrupted"); } finally { latch.countDown(); } } }).start(); } try { latch.await(); } catch (InterruptedException e) { Log.e(BasicCallTests.this, e, "Unexpectedly interrupted"); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: rapidFire File: tests/src/com/android/server/telecom/tests/BasicCallTests.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21283
MEDIUM
5.5
android
rapidFire
tests/src/com/android/server/telecom/tests/BasicCallTests.java
9b41a963f352fdb3da1da8c633d45280badfcb24
0
Analyze the following code function for security vulnerabilities
private static String getBaseName(String fullName) { int k = fullName.lastIndexOf('.'); if (k == -1 || k == (fullName.length() - 1)) { return fullName; } return fullName.substring(k + 1); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getBaseName 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
getBaseName
luni/src/main/java/java/io/ObjectInputStream.java
738c833d38d41f8f76eb7e77ab39add82b1ae1e2
0
Analyze the following code function for security vulnerabilities
public void onBluetoothConnectionStateChanged() { sendMessage(CMD_BLUETOOTH_CONNECTION_STATE_CHANGE); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onBluetoothConnectionStateChanged File: service/java/com/android/server/wifi/ClientModeImpl.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21242
CRITICAL
9.8
android
onBluetoothConnectionStateChanged
service/java/com/android/server/wifi/ClientModeImpl.java
72e903f258b5040b8f492cf18edd124b5a1ac770
0
Analyze the following code function for security vulnerabilities
protected Marshaller createMarshaller() { try { Marshaller marshaller = getJaxbContext().createMarshaller(); initJaxbMarshaller(marshaller); return marshaller; } catch (JAXBException ex) { throw convertJaxbException(ex); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: createMarshaller File: spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java Repository: spring-projects/spring-framework The code follows secure coding practices.
[ "CWE-264" ]
CVE-2013-4152
MEDIUM
6.8
spring-projects/spring-framework
createMarshaller
spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java
2843b7d2ee12e3f9c458f6f816befd21b402e3b9
0
Analyze the following code function for security vulnerabilities
@Override public List<IAppTask> getAppTasks(String callingPackage) { int callingUid = Binder.getCallingUid(); long ident = Binder.clearCallingIdentity(); synchronized(this) { ArrayList<IAppTask> list = new ArrayList<IAppTask>(); try { if (DEBUG_ALL) Slog.v(TAG, "getAppTasks"); final int N = mRecentTasks.size(); for (int i = 0; i < N; i++) { TaskRecord tr = mRecentTasks.get(i); // Skip tasks that do not match the caller. We don't need to verify // callingPackage, because we are also limiting to callingUid and know // that will limit to the correct security sandbox. if (tr.effectiveUid != callingUid) { continue; } Intent intent = tr.getBaseIntent(); if (intent == null || !callingPackage.equals(intent.getComponent().getPackageName())) { continue; } ActivityManager.RecentTaskInfo taskInfo = createRecentTaskInfoFromTaskRecord(tr); AppTaskImpl taskImpl = new AppTaskImpl(taskInfo.persistentId, callingUid); list.add(taskImpl); } } finally { Binder.restoreCallingIdentity(ident); } return list; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getAppTasks File: services/core/java/com/android/server/am/ActivityManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-200" ]
CVE-2016-2500
MEDIUM
4.3
android
getAppTasks
services/core/java/com/android/server/am/ActivityManagerService.java
9878bb99b77c3681f0fda116e2964bac26f349c3
0
Analyze the following code function for security vulnerabilities
protected void deleteWiki(OLATResourceable ores) { if (wikiCache!=null) { wikiCache.remove(OresHelper.createStringRepresenting(ores)); } getResourceManager().deleteOLATResourceable(ores); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: deleteWiki 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
deleteWiki
src/main/java/org/olat/modules/wiki/WikiManager.java
699490be8e931af0ef1f135c55384db1f4232637
0
Analyze the following code function for security vulnerabilities
public SFile file(String name) { return new SFile(this, name); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: file File: src/net/sourceforge/plantuml/security/SFile.java Repository: plantuml The code follows secure coding practices.
[ "CWE-284" ]
CVE-2023-3431
MEDIUM
5.3
plantuml
file
src/net/sourceforge/plantuml/security/SFile.java
fbe7fa3b25b4c887d83927cffb1009ec6cb8ab1e
0
Analyze the following code function for security vulnerabilities
@Override protected void preClose() { DefaultKeyExchangeFuture initFuture; synchronized (kexState) { initFuture = kexInitializedFuture; } if (initFuture != null) { initFuture.setValue(new SshException("Session closing while KEX in progress")); } DefaultKeyExchangeFuture kexFuture = kexFutureHolder.get(); if (kexFuture != null) { // if have any pending KEX then notify it about the closing session kexFuture.setValue(new SshException("Session closing while KEX in progress")); } kexHandler.shutdown(); // if anyone waiting for global response notify them about the closing session boolean debugEnabled = log.isDebugEnabled(); for (;;) { GlobalRequestFuture future = pendingGlobalRequests.pollLast(); if (future == null) { break; } if (debugEnabled) { log.debug("preClose({}): Session closing; failing still pending global request {}", this, future.getId()); } future.setValue(new SshException("Session is closing")); } // Fire 'close' event try { signalSessionClosed(); } finally { // clear the listeners since we are closing the session (quicker GC) this.sessionListeners.clear(); this.channelListeners.clear(); this.tunnelListeners.clear(); } super.preClose(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: preClose File: sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java Repository: apache/mina-sshd The code follows secure coding practices.
[ "CWE-354" ]
CVE-2023-48795
MEDIUM
5.9
apache/mina-sshd
preClose
sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
6b0fd46f64bcb75eeeee31d65f10242660aad7c1
0
Analyze the following code function for security vulnerabilities
@Override public void writeToParcel(Parcel dest, int flags) { dest.writeLong(mMinHomeDownlinkBandwidth); dest.writeLong(mMinHomeUplinkBandwidth); dest.writeLong(mMinRoamingDownlinkBandwidth); dest.writeLong(mMinRoamingUplinkBandwidth); dest.writeStringArray(mExcludedSsidList); writeProtoPortMap(dest, mRequiredProtoPortMap); dest.writeInt(mMaximumBssLoadValue); writeRoamingPartnerList(dest, flags, mPreferredRoamingPartnerList); dest.writeParcelable(mPolicyUpdate, flags); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: writeToParcel File: framework/java/android/net/wifi/hotspot2/pps/Policy.java Repository: android The code follows secure coding practices.
[ "CWE-400" ]
CVE-2023-21240
MEDIUM
5.5
android
writeToParcel
framework/java/android/net/wifi/hotspot2/pps/Policy.java
69119d1d3102e27b6473c785125696881bce9563
0
Analyze the following code function for security vulnerabilities
public void setStartLocation(final int startLineNumber, final int startColumnNumber) { startLineNumber_ = startLineNumber; startColumnNumber_ = startColumnNumber; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setStartLocation File: src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java Repository: HtmlUnit/htmlunit The code follows secure coding practices.
[ "CWE-787" ]
CVE-2023-2798
HIGH
7.5
HtmlUnit/htmlunit
setStartLocation
src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java
940dc7fd
0
Analyze the following code function for security vulnerabilities
@Override public XMLBuilder cdata(byte[] data) { super.cdataImpl(data); return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: cdata File: src/main/java/com/jamesmurty/utils/XMLBuilder.java Repository: jmurty/java-xmlbuilder The code follows secure coding practices.
[ "CWE-611" ]
CVE-2014-125087
MEDIUM
5.2
jmurty/java-xmlbuilder
cdata
src/main/java/com/jamesmurty/utils/XMLBuilder.java
e6fddca201790abab4f2c274341c0bb8835c3e73
0
Analyze the following code function for security vulnerabilities
private String escapeHtmlAttribute(String value) { return StringUtils.trimToEmpty(value) .replaceAll("'", "%27") .replaceAll("\"", "%22") .replaceAll("\\\\", ""); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: escapeHtmlAttribute File: src/main/java/com/erudika/scoold/utils/ScooldUtils.java Repository: Erudika/scoold The code follows secure coding practices.
[ "CWE-130" ]
CVE-2022-1543
MEDIUM
6.5
Erudika/scoold
escapeHtmlAttribute
src/main/java/com/erudika/scoold/utils/ScooldUtils.java
62a0e92e1486ddc17676a7ead2c07ff653d167ce
0
Analyze the following code function for security vulnerabilities
@Deprecated public XWikiConfig getConfig() { return new XWikiConfigDelegate(getConfiguration()); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getConfig 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
getConfig
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java
f9a677408ffb06f309be46ef9d8df1915d9099a4
0
Analyze the following code function for security vulnerabilities
public URI getUrl() { return url; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getUrl File: spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/notify/PagerdutyNotifier.java Repository: codecentric/spring-boot-admin The code follows secure coding practices.
[ "CWE-94" ]
CVE-2022-46166
CRITICAL
9.8
codecentric/spring-boot-admin
getUrl
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/notify/PagerdutyNotifier.java
c14c3ec12533f71f84de9ce3ce5ceb7991975f75
0