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
@VisibleForTesting public boolean isAnimating() { return false; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isAnimating File: packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-40098
MEDIUM
5.5
android
isAnimating
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java
d21ffbe8a2eeb2a5e6da7efbb1a0430ba6b022e0
0
Analyze the following code function for security vulnerabilities
@Override public void onPlayFromMediaId(String mediaId, Bundle extras) { super.onPlayFromMediaId(mediaId, extras); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onPlayFromMediaId File: Ports/Android/src/com/codename1/media/BackgroundAudioService.java Repository: codenameone/CodenameOne The code follows secure coding practices.
[ "CWE-668" ]
CVE-2022-4903
MEDIUM
5.1
codenameone/CodenameOne
onPlayFromMediaId
Ports/Android/src/com/codename1/media/BackgroundAudioService.java
dad49c9ef26a598619fc48d2697151a02987d478
0
Analyze the following code function for security vulnerabilities
@Override public ChannelListener.Setter<? extends ConnectedChannel> getCloseSetter() { return null; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getCloseSetter 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
getCloseSetter
servlet/src/main/java/io/undertow/servlet/handlers/ServletInitialHandler.java
d2715e3afa13f50deaa19643676816ce391551e9
0
Analyze the following code function for security vulnerabilities
@Override public boolean startUserInBackground(final int userId) { return startUser(userId, /* foreground */ false); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: startUserInBackground 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
startUserInBackground
services/core/java/com/android/server/am/ActivityManagerService.java
aaa0fee0d7a8da347a0c47cef5249c70efee209e
0
Analyze the following code function for security vulnerabilities
void registerRemoteAnimations(RemoteAnimationDefinition definition) { mRemoteAnimationDefinition = definition; if (definition != null) { definition.linkToDeath(this::unregisterRemoteAnimations); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: registerRemoteAnimations File: services/core/java/com/android/server/wm/ActivityRecord.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21145
HIGH
7.8
android
registerRemoteAnimations
services/core/java/com/android/server/wm/ActivityRecord.java
44aeef1b82ecf21187d4903c9e3666a118bdeaf3
0
Analyze the following code function for security vulnerabilities
public int engineGetKeySize(Key key) { if (key instanceof DHKey) { return ((DHKey)key).getParams().getP().bitLength(); } else { throw new IllegalArgumentException("not a DH key"); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: engineGetKeySize File: prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/ec/IESCipher.java Repository: bcgit/bc-java The code follows secure coding practices.
[ "CWE-361" ]
CVE-2016-1000345
MEDIUM
4.3
bcgit/bc-java
engineGetKeySize
prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/ec/IESCipher.java
21dcb3d9744c83dcf2ff8fcee06dbca7bfa4ef35
0
Analyze the following code function for security vulnerabilities
@Override public boolean isIntegral() { return bigDecimalValue().scale() == 0; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isIntegral File: impl/src/main/java/org/eclipse/parsson/JsonNumberImpl.java Repository: eclipse-ee4j/parsson The code follows secure coding practices.
[ "CWE-834" ]
CVE-2023-4043
HIGH
7.5
eclipse-ee4j/parsson
isIntegral
impl/src/main/java/org/eclipse/parsson/JsonNumberImpl.java
84764ffbe3d0376da242b27a9a526138d0dfb8e6
0
Analyze the following code function for security vulnerabilities
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof IdleStateEvent) { ConnectionClosureReason.setIdle(ctx.channel()); ctx.close(); } if (evt instanceof SslHandshakeCompletionEvent && ((SslHandshakeCompletionEvent) evt).isSuccess()) { SSLEngine engine = ctx.pipeline().get(SslHandler.class).engine(); if (engine.getWantClientAuth() || engine.getNeedClientAuth()) { try { X509Certificate clientCert = engine.getSession().getPeerCertificateChain()[0]; ctx.channel().attr(CLIENT_CERT_KEY).set(clientCert); } catch (SSLPeerUnverifiedException ignore) { // ignore - there is no way to avoid this exception that I can determine } } } super.userEventTriggered(ctx, evt); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: userEventTriggered File: ratpack-core/src/main/java/ratpack/server/internal/NettyHandlerAdapter.java Repository: ratpack The code follows secure coding practices.
[ "CWE-74" ]
CVE-2019-17513
MEDIUM
5
ratpack
userEventTriggered
ratpack-core/src/main/java/ratpack/server/internal/NettyHandlerAdapter.java
efb910d38a96494256f36675ef0e5061097dd77d
0
Analyze the following code function for security vulnerabilities
static Map<String,Long> parseRevisionFile(AbstractBuild<?,?> build, boolean findClosest, boolean prunePinnedExternals) throws IOException { Map<String,Long> revisions = new HashMap<String,Long>(); // module -> revision if (findClosest) { for (AbstractBuild<?,?> b=build; b!=null; b=b.getPreviousBuild()) { if(getRevisionFile(b).exists()) { build = b; break; } } } {// read the revision file of the build File file = getRevisionFile(build); if(!file.exists()) // nothing to compare against return revisions; BufferedReader br = new BufferedReader(new FileReader(file)); try { String line; while((line=br.readLine())!=null) { boolean isPinned = false; int indexLast = line.length(); if (line.lastIndexOf("::p") == indexLast-3) { isPinned = true; indexLast -= 3; } int index = line.lastIndexOf('/'); if(index<0) { continue; // invalid line? } try { String url = line.substring(0, index); long revision = Long.parseLong(line.substring(index+1,indexLast)); Long oldRevision = revisions.get(url); if (isPinned) { if (!prunePinnedExternals) { if (oldRevision == null) // If we're writing pinned, only write if there are no unpinned revisions.put(url, revision); } } else { // unpinned if (oldRevision == null || oldRevision > revision) // For unpinned, take minimum revisions.put(url, revision); } } catch (NumberFormatException e) { // perhaps a corrupted line. LOGGER.log(WARNING, "Error parsing line " + line, e); } } } finally { br.close(); } } return revisions; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: parseRevisionFile File: src/main/java/hudson/scm/SubversionSCM.java Repository: jenkinsci/subversion-plugin The code follows secure coding practices.
[ "CWE-255" ]
CVE-2013-6372
LOW
2.1
jenkinsci/subversion-plugin
parseRevisionFile
src/main/java/hudson/scm/SubversionSCM.java
7d4562d6f7e40de04bbe29577b51c79f07d05ba6
0
Analyze the following code function for security vulnerabilities
protected CompletableFuture<Integer> internalGetMaxProducers(boolean applied) { return getTopicPoliciesAsyncWithRetry(topicName) .thenApply(op -> op.map(TopicPolicies::getMaxProducerPerTopic) .orElseGet(() -> { if (applied) { Integer maxProducer = getNamespacePolicies(namespaceName).max_producers_per_topic; return maxProducer == null ? config().getMaxProducersPerTopic() : maxProducer; } return null; })); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: internalGetMaxProducers 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
internalGetMaxProducers
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
5b35bb81c31f1bc2ad98c9fde5b39ec68110ca52
0
Analyze the following code function for security vulnerabilities
private List<Uri> extractUris(Bundle extras) { final List<Uri> uris = extras.getParcelableArrayList(Intent.EXTRA_STREAM); if (uris != null) { return uris; } final Uri uri = extras.getParcelable(Intent.EXTRA_STREAM); if (uri != null) { return Collections.singletonList(uri); } else { return null; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: extractUris 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
extractUris
src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
7177c523a1b31988666b9337249a4f1d0c36f479
0
Analyze the following code function for security vulnerabilities
@Override public Object intercept(MethodInvocationContext<Object, Object> context) { if (context.hasStereotype(CacheConfig.class)) { ReturnType returnTypeObject = context.getReturnType(); Class returnType = returnTypeObject.getType(); if (CompletionStage.class.isAssignableFrom(returnType)) { return interceptCompletableFuture(context, returnTypeObject, returnType); } else if (Publishers.isConvertibleToPublisher(returnType)) { return interceptPublisher(context, returnTypeObject, returnType); } else { return interceptSync(context, returnTypeObject, returnType); } } else { return context.proceed(); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: intercept File: runtime/src/main/java/io/micronaut/cache/interceptor/CacheInterceptor.java Repository: micronaut-projects/micronaut-core The code follows secure coding practices.
[ "CWE-400" ]
CVE-2022-21700
MEDIUM
5
micronaut-projects/micronaut-core
intercept
runtime/src/main/java/io/micronaut/cache/interceptor/CacheInterceptor.java
b8ec32c311689667c69ae7d9f9c3b3a8abc96fe3
0
Analyze the following code function for security vulnerabilities
@Override public boolean supportsThingType(ThingTypeUID thingTypeUID) { return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: supportsThingType File: bundles/org.openhab.binding.exec/src/main/java/org/openhab/binding/exec/internal/ExecHandlerFactory.java Repository: openhab/openhab-addons The code follows secure coding practices.
[ "CWE-863" ]
CVE-2020-5242
HIGH
9.3
openhab/openhab-addons
supportsThingType
bundles/org.openhab.binding.exec/src/main/java/org/openhab/binding/exec/internal/ExecHandlerFactory.java
4c4cb664f2e2c3866aadf117d22fb54aa8dd0031
0
Analyze the following code function for security vulnerabilities
public List<String> getWidgetParticipants(int userId) { if (DEBUG) { Slog.i(TAG, "Getting widget participants for user: " + userId); } HashSet<String> packages = new HashSet<>(); synchronized (mLock) { final int N = mWidgets.size(); for (int i = 0; i < N; i++) { Widget widget = mWidgets.get(i); // Skip cross-user widgets. if (!isProviderAndHostInUser(widget, userId)) { continue; } packages.add(widget.host.id.packageName); Provider provider = widget.provider; if (provider != null) { packages.add(provider.id.componentName.getPackageName()); } } } return new ArrayList<>(packages); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getWidgetParticipants File: services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java Repository: android The code follows secure coding practices.
[ "CWE-284" ]
CVE-2015-1541
MEDIUM
4.3
android
getWidgetParticipants
services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
0b98d304c467184602b4c6bce76fda0b0274bc07
0
Analyze the following code function for security vulnerabilities
public @PolyNull BigDecimal toBigDecimal(@PolyNull String s, int scale) throws SQLException { if (s == null) { return null; } BigDecimal val = toBigDecimal(s); return scaleBigDecimal(val, scale); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: toBigDecimal 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
toBigDecimal
pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
739e599d52ad80f8dcd6efedc6157859b1a9d637
0
Analyze the following code function for security vulnerabilities
public int getHttpTimeout(XWikiContext context) { return getConfiguration().getProperty("xwiki.http.timeout", 60000); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getHttpTimeout 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
getHttpTimeout
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java
f9a677408ffb06f309be46ef9d8df1915d9099a4
0
Analyze the following code function for security vulnerabilities
@Override public final int startActivityFromRecents(int taskId, Bundle bOptions) { return mActivityTaskManager.startActivityFromRecents(taskId, bOptions); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: startActivityFromRecents 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
startActivityFromRecents
services/core/java/com/android/server/am/ActivityManagerService.java
d10b27e539f7bc91c2360d429b9d05f05274670d
0
Analyze the following code function for security vulnerabilities
static RMQMessage convertJmsMessage(RMQSession session, GetResponse response, ReceivingContextConsumer receivingContextConsumer) throws JMSException { // Deserialize the message payload from the byte[] body RMQMessage message = fromMessage(response.getBody(), session.getTrustedPackages()); message.setSession(session); // Insert session in received message for Message.acknowledge message.setJMSRedelivered(response.getEnvelope().isRedeliver()); // Set the redelivered flag message.setRabbitDeliveryTag(response.getEnvelope().getDeliveryTag()); // Insert delivery tag in received message for Message.acknowledge // message.setJMSDestination(dest); // DO NOT set the destination bug#57214768 // JMSProperties already set message.setReadonly(true); // Set readOnly - mandatory for received messages maybeSetupDirectReplyTo(message, response.getProps().getReplyTo()); receivingContextConsumer.accept(new ReceivingContext(message)); return message; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: convertJmsMessage File: src/main/java/com/rabbitmq/jms/client/RMQMessage.java Repository: rabbitmq/rabbitmq-jms-client The code follows secure coding practices.
[ "CWE-502" ]
CVE-2020-36282
HIGH
7.5
rabbitmq/rabbitmq-jms-client
convertJmsMessage
src/main/java/com/rabbitmq/jms/client/RMQMessage.java
f647e5dbfe055a2ca8cbb16dd70f9d50d888b638
0
Analyze the following code function for security vulnerabilities
public static SslUtils getInstance() { return SingletonHolder.instance; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getInstance File: api/src/main/java/org/asynchttpclient/util/SslUtils.java Repository: AsyncHttpClient/async-http-client The code follows secure coding practices.
[ "CWE-345" ]
CVE-2013-7397
MEDIUM
4.3
AsyncHttpClient/async-http-client
getInstance
api/src/main/java/org/asynchttpclient/util/SslUtils.java
df6ed70e86c8fc340ed75563e016c8baa94d7e72
0
Analyze the following code function for security vulnerabilities
public void setUserSearchBase(String userSearchBase) { this.userSearchBase = userSearchBase; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setUserSearchBase File: server-plugin/server-plugin-authenticator-ldap/src/main/java/io/onedev/server/plugin/authenticator/ldap/LdapAuthenticator.java Repository: theonedev/onedev The code follows secure coding practices.
[ "CWE-90" ]
CVE-2021-32651
MEDIUM
4.3
theonedev/onedev
setUserSearchBase
server-plugin/server-plugin-authenticator-ldap/src/main/java/io/onedev/server/plugin/authenticator/ldap/LdapAuthenticator.java
4440f0c57e440488d7e653417b2547eaae8ad19c
0
Analyze the following code function for security vulnerabilities
@Override public boolean isPresent(int nativeHandle) throws RemoteException { TagEndpoint tag = null; // Check if NFC is enabled if (!isNfcEnabled()) { return false; } /* find the tag in the hmap */ tag = (TagEndpoint) findObject(nativeHandle); if (tag == null) { return false; } return tag.isPresent(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isPresent File: src/com/android/nfc/NfcService.java Repository: android The code follows secure coding practices.
[ "CWE-200" ]
CVE-2016-3761
LOW
2.1
android
isPresent
src/com/android/nfc/NfcService.java
9ea802b5456a36f1115549b645b65c791eff3c2c
0
Analyze the following code function for security vulnerabilities
public void doIconSize( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { String qs = req.getQueryString(); if(qs==null || !ICON_SIZE.matcher(qs).matches()) throw new ServletException(); Cookie cookie = new Cookie("iconSize", qs); cookie.setMaxAge(/* ~4 mo. */9999999); // #762 rsp.addCookie(cookie); String ref = req.getHeader("Referer"); if(ref==null) ref="."; rsp.sendRedirect2(ref); }
Vulnerability Classification: - CWE: CWE-79 - CVE: CVE-2014-2065 - Severity: MEDIUM - CVSS Score: 4.3 Description: [FIXED SECURITY-77] XSS in iconSize cookie. Function: doIconSize File: core/src/main/java/jenkins/model/Jenkins.java Repository: jenkinsci/jenkins Fixed Code: public void doIconSize( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { String qs = req.getQueryString(); if(qs==null) throw new ServletException(); Cookie cookie = new Cookie("iconSize", Functions.validateIconSize(qs)); cookie.setMaxAge(/* ~4 mo. */9999999); // #762 rsp.addCookie(cookie); String ref = req.getHeader("Referer"); if(ref==null) ref="."; rsp.sendRedirect2(ref); }
[ "CWE-79" ]
CVE-2014-2065
MEDIUM
4.3
jenkinsci/jenkins
doIconSize
core/src/main/java/jenkins/model/Jenkins.java
a0b00508eeb74d7033dc4100eb382df4e8fa72e7
1
Analyze the following code function for security vulnerabilities
public static void init(@NonNull ObservablePreferenceFragment host) { host.getLifecycle().addObserver(new SearchMenuController(host)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: init File: src/com/android/settings/search/actionbar/SearchMenuController.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2018-9501
HIGH
7.2
android
init
src/com/android/settings/search/actionbar/SearchMenuController.java
5e43341b8c7eddce88f79c9a5068362927c05b54
0
Analyze the following code function for security vulnerabilities
@GetMapping(value = "export/{modelId}/{type}") @ApiOperation("导出模型") @Authorize(action = "export") public void export(@PathVariable("modelId") @ApiParam("模型ID") String modelId, @PathVariable("type") @ApiParam(value = "类型", allowableValues = "bpmn,json", example = "json") String type, @ApiParam(hidden = true) HttpServletResponse response) { try { Model modelData = repositoryService.getModel(modelId); BpmnJsonConverter jsonConverter = new BpmnJsonConverter(); byte[] modelEditorSource = repositoryService.getModelEditorSource(modelData.getId()); JsonNode editorNode = new ObjectMapper().readTree(modelEditorSource); BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode); // 处理异常 if (bpmnModel.getMainProcess() == null) { response.setStatus(HttpStatus.UNPROCESSABLE_ENTITY.value()); response.getOutputStream().println("no main process, can't export for dimension: " + type); response.flushBuffer(); return; } String filename = ""; byte[] exportBytes = null; String mainProcessId = bpmnModel.getMainProcess().getId(); if ("bpmn".equals(type)) { BpmnXMLConverter xmlConverter = new BpmnXMLConverter(); exportBytes = xmlConverter.convertToXML(bpmnModel); filename = mainProcessId + ".bpmn20.xml"; } else if ("json".equals(type)) { exportBytes = modelEditorSource; filename = mainProcessId + ".json"; } else { throw new UnsupportedOperationException("不支持的格式:" + type); } response.setCharacterEncoding("UTF-8"); response.setContentType("application/octet-stream"); response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(filename, "UTF-8")); /*创建输入流*/ try (ByteArrayInputStream in = new ByteArrayInputStream(exportBytes)) { IOUtils.copy(in, response.getOutputStream()); response.flushBuffer(); in.close(); } } catch (Exception e) { log.error("导出model的xml文件失败:modelId={}, type={}", modelId, type, e); } }
Vulnerability Classification: - CWE: CWE-79 - CVE: CVE-2018-20594 - Severity: MEDIUM - CVSS Score: 4.3 Description: fix #107 修复反射型xss Function: export File: hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/src/main/java/org/hswebframework/web/workflow/web/FlowableModelManagerController.java Repository: hs-web/hsweb-framework Fixed Code: @GetMapping(value = "export/{modelId}/{type}") @ApiOperation("导出模型") @Authorize(action = "export") @SneakyThrows public void export(@PathVariable("modelId") @ApiParam("模型ID") String modelId, @PathVariable("type") @ApiParam(value = "类型", allowableValues = "bpmn,json", example = "json") ModelType type, @ApiParam(hidden = true) HttpServletResponse response) { Model modelData = repositoryService.getModel(modelId); if (modelData == null) { throw new NotFoundException("模型不存在"); } BpmnJsonConverter jsonConverter = new BpmnJsonConverter(); byte[] modelEditorSource = repositoryService.getModelEditorSource(modelData.getId()); JsonNode editorNode = new ObjectMapper().readTree(modelEditorSource); BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode); // 处理异常 if (bpmnModel.getMainProcess() == null) { throw new UnsupportedOperationException("无法导出模型文件:" + type); } String filename = ""; byte[] exportBytes = null; String mainProcessId = bpmnModel.getMainProcess().getId(); if (type == ModelType.bpmn) { BpmnXMLConverter xmlConverter = new BpmnXMLConverter(); exportBytes = xmlConverter.convertToXML(bpmnModel); filename = mainProcessId + ".bpmn20.xml"; } else if (type == ModelType.json) { exportBytes = modelEditorSource; filename = mainProcessId + ".json"; } else { throw new UnsupportedOperationException("不支持的格式:" + type); } response.setCharacterEncoding("UTF-8"); response.setContentType("application/octet-stream"); response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(filename, "UTF-8")); /*创建输入流*/ try (ByteArrayInputStream in = new ByteArrayInputStream(exportBytes)) { IOUtils.copy(in, response.getOutputStream()); response.flushBuffer(); } }
[ "CWE-79" ]
CVE-2018-20594
MEDIUM
4.3
hs-web/hsweb-framework
export
hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/src/main/java/org/hswebframework/web/workflow/web/FlowableModelManagerController.java
b72a2275ed21240296c6539bae1049c56abb542f
1
Analyze the following code function for security vulnerabilities
void dumpWindowsLocked() { final int numDisplays = mDisplayContents.size(); for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) { final DisplayContent displayContent = mDisplayContents.valueAt(displayNdx); Slog.v(TAG, " Display #" + displayContent.getDisplayId()); final WindowList windows = displayContent.getWindowList(); for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) { Slog.v(TAG, " #" + winNdx + ": " + windows.get(winNdx)); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: dumpWindowsLocked File: services/core/java/com/android/server/wm/WindowManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-3875
HIGH
7.2
android
dumpWindowsLocked
services/core/java/com/android/server/wm/WindowManagerService.java
69729fa8b13cadbf3173fe1f389fe4f3b7bd0f9c
0
Analyze the following code function for security vulnerabilities
private LdapName toLdapName(String userDomain) throws RepositoryLoginException{ String[] domainComponents = (Strings.isNullOrEmpty(userDomain)) ? new String[0] : userDomain.toLowerCase().split("\\."); ArrayList<Rdn> domainRdns = new ArrayList<Rdn>(domainComponents.length); try { for (String dc : domainComponents) { domainRdns.add(new Rdn("dc", dc)); } } catch (InvalidNameException e) { throw new RepositoryLoginException("Invalid domain " + userDomain, e); } Collections.reverse(domainRdns); // RDN lists are in reverse order. return new LdapName(domainRdns); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: toLdapName File: projects/dctm-core/source/java/com/google/enterprise/connector/dctm/DctmAuthenticationManager.java Repository: AnantLabs/google-enterprise-connector-dctm The code follows secure coding practices.
[ "CWE-89" ]
CVE-2014-125083
MEDIUM
5.2
AnantLabs/google-enterprise-connector-dctm
toLdapName
projects/dctm-core/source/java/com/google/enterprise/connector/dctm/DctmAuthenticationManager.java
6fba04f18ab7764002a1da308e7cd9712b501cb7
0
Analyze the following code function for security vulnerabilities
private void copyJarEntryTrimmingBasePath(JarFile jarFile, ZipEntry jarEntry, String basePath, File outputDirectory) { String fullPath = jarEntry.getName(); String relativePath = fullPath .substring(fullPath.toLowerCase(Locale.ENGLISH) .indexOf(basePath.toLowerCase(Locale.ENGLISH)) + basePath.length()); File target = new File(outputDirectory, relativePath); try { if (target.exists()) { if (!hasSameContent(jarFile.getInputStream(jarEntry), target)) { FileUtils.copyInputStreamToFile( jarFile.getInputStream(jarEntry), target); } } else { FileUtils.copyInputStreamToFile( jarFile.getInputStream(jarEntry), target); } } catch (IOException e) { throw new UncheckedIOException(String.format( "Failed to extract jar entry '%s' from jarFile '%s'", jarEntry, outputDirectory), e); } }
Vulnerability Classification: - CWE: CWE-379 - CVE: CVE-2021-31411 - Severity: MEDIUM - CVSS Score: 4.6 Description: Simplify if else, clean exception. Function: copyJarEntryTrimmingBasePath File: flow-server/src/main/java/com/vaadin/flow/server/frontend/JarContentsManager.java Repository: vaadin/flow Fixed Code: private void copyJarEntryTrimmingBasePath(JarFile jarFile, ZipEntry jarEntry, String basePath, File outputDirectory) { String fullPath = jarEntry.getName(); String relativePath = fullPath .substring(fullPath.toLowerCase(Locale.ENGLISH) .indexOf(basePath.toLowerCase(Locale.ENGLISH)) + basePath.length()); File target = new File(outputDirectory, relativePath); try { if (!target.exists() || !hasSameContent(jarFile.getInputStream(jarEntry), target)) { FileUtils.copyInputStreamToFile( jarFile.getInputStream(jarEntry), target); } } catch (IOException e) { throw new UncheckedIOException(String.format( "Failed to extract jar entry '%s' from jarFile", jarEntry), e); } }
[ "CWE-379" ]
CVE-2021-31411
MEDIUM
4.6
vaadin/flow
copyJarEntryTrimmingBasePath
flow-server/src/main/java/com/vaadin/flow/server/frontend/JarContentsManager.java
82cea56045b8430f7a26f037c01486b1feffa51d
1
Analyze the following code function for security vulnerabilities
public JSONArray getJSONArray(String key) throws JSONException { Object object = this.get(key); if (object instanceof JSONArray) { return (JSONArray) object; } throw wrongValueFormatException(key, "JSONArray", object, null); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getJSONArray File: src/main/java/org/json/JSONObject.java Repository: stleary/JSON-java The code follows secure coding practices.
[ "CWE-770" ]
CVE-2023-5072
HIGH
7.5
stleary/JSON-java
getJSONArray
src/main/java/org/json/JSONObject.java
661114c50dcfd53bb041aab66f14bb91e0a87c8a
0
Analyze the following code function for security vulnerabilities
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; if(req.getRequestURI().equals(req.getContextPath()+"/")) { if (needsToCreateFirstUser()) { ((HttpServletResponse)response).sendRedirect("securityRealm/firstUser"); } else {// the first user already created. the role of this filter is over. PluginServletFilter.removeFilter(this); chain.doFilter(request,response); } } else chain.doFilter(request,response); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: doFilter File: core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java Repository: jenkinsci/jenkins The code follows secure coding practices.
[ "CWE-200" ]
CVE-2014-2064
MEDIUM
5
jenkinsci/jenkins
doFilter
core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java
fbf96734470caba9364f04e0b77b0bae7293a1ec
0
Analyze the following code function for security vulnerabilities
private static String getNodeTextContents(Node n) { if (n.getNodeType() == Node.TEXT_NODE || n.getNodeType() == Node.CDATA_SECTION_NODE) { Text txtNode = (Text) n; String content = txtNode.getWholeText(); //This concatenates any adjacent text/cdata/entity nodes if (content == null) return ""; else return content; } else { if (n.hasChildNodes()) { NodeList children = n.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { //Skip any non-text nodes, like comments or entities Node child = children.item(i); if (child.getNodeType() == Node.TEXT_NODE || child.getNodeType() == Node.CDATA_SECTION_NODE) { Text txtNode = (Text) child; String content = txtNode.getWholeText(); //This concatenates any adjacent text/cdata/entity nodes if (content == null) return ""; else return content; } } return ""; } else { return ""; } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getNodeTextContents File: src/main/java/com/dd/plist/XMLPropertyListParser.java Repository: 3breadt/dd-plist The code follows secure coding practices.
[ "CWE-611" ]
CVE-2016-15026
MEDIUM
4.3
3breadt/dd-plist
getNodeTextContents
src/main/java/com/dd/plist/XMLPropertyListParser.java
8c954e8d9f6f6863729e50105a8abf3f87fff74c
0
Analyze the following code function for security vulnerabilities
private void applyCachedPacketFilter() { // If packet filter is supported on both connections, ignore since we would have already // applied the filter. if (mContext.getResources().getBoolean(R.bool.config_wifiEnableApfOnNonPrimarySta)) return; if (mCachedPacketFilter == null) { Log.w(TAG, "No cached packet filter to apply"); return; } Log.i(TAG, "Applying cached packet filter"); mWifiNative.installPacketFilter(mInterfaceName, mCachedPacketFilter); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: applyCachedPacketFilter 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
applyCachedPacketFilter
service/java/com/android/server/wifi/ClientModeImpl.java
72e903f258b5040b8f492cf18edd124b5a1ac770
0
Analyze the following code function for security vulnerabilities
public boolean isBouncerShowing() { return mBouncerShowing; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isBouncerShowing File: packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2017-0822
HIGH
7.5
android
isBouncerShowing
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
c574568aaede7f652432deb7707f20ae54bbdf9a
0
Analyze the following code function for security vulnerabilities
static boolean isFilenameValid(Context context, File file) { final File[] whitelist; try { file = file.getCanonicalFile(); whitelist = new File[] { context.getFilesDir().getCanonicalFile(), context.getCacheDir().getCanonicalFile(), Environment.getDownloadCacheDirectory().getCanonicalFile(), Environment.getExternalStorageDirectory().getCanonicalFile(), }; } catch (IOException e) { Log.w(TAG, "Failed to resolve canonical path: " + e); return false; } for (File testDir : whitelist) { if (FileUtils.contains(testDir, file)) { return true; } } return false; }
Vulnerability Classification: - CWE: CWE-362 - CVE: CVE-2016-0848 - Severity: HIGH - CVSS Score: 7.2 Description: Use resolved path for both checking and opening. This avoids a race condition where someone can change a symlink target after the security checks have passed. Bug: 26211054 Change-Id: I5842aaecc7b7d417a3b1902957b59b8a1f3c1ccb Function: isFilenameValid File: src/com/android/providers/downloads/Helpers.java Repository: android Fixed Code: static boolean isFilenameValid(Context context, File file) { final File[] whitelist; try { whitelist = new File[] { context.getFilesDir().getCanonicalFile(), context.getCacheDir().getCanonicalFile(), Environment.getDownloadCacheDirectory().getCanonicalFile(), Environment.getExternalStorageDirectory().getCanonicalFile(), }; } catch (IOException e) { Log.w(TAG, "Failed to resolve canonical path: " + e); return false; } for (File testDir : whitelist) { if (FileUtils.contains(testDir, file)) { return true; } } return false; }
[ "CWE-362" ]
CVE-2016-0848
HIGH
7.2
android
isFilenameValid
src/com/android/providers/downloads/Helpers.java
bdc831357e7a116bc561d51bf2ddc85ff11c01a9
1
Analyze the following code function for security vulnerabilities
@Override public boolean select(final Collection<?> itemIds) throws IllegalArgumentException { return select(itemIds, true); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: select 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
select
server/src/main/java/com/vaadin/ui/Grid.java
b9ba10adaa06a0977c531f878c3f0046b67f9cc0
0
Analyze the following code function for security vulnerabilities
@Override public boolean isSlow() { return slow; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isSlow File: activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java Repository: apache/activemq The code follows secure coding practices.
[ "CWE-264" ]
CVE-2014-3576
MEDIUM
5
apache/activemq
isSlow
activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java
00921f2
0
Analyze the following code function for security vulnerabilities
private void resetState() { resetSeenObjects(); hasPushbackTC = false; pushbackTC = 0; // nestedLevels = 0; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: resetState 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
resetState
luni/src/main/java/java/io/ObjectInputStream.java
738c833d38d41f8f76eb7e77ab39add82b1ae1e2
0
Analyze the following code function for security vulnerabilities
@Nullable @Override public final String get(CharSequence name) { requireNonNull(name, "name"); final int h = AsciiString.hashCode(name); final int i = index(h); HeaderEntry e = entries[i]; String value = null; // loop until the first header was found while (e != null) { if (e.hash == h && keyEquals(e.key, name)) { value = e.value; } e = e.next; } return value; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: get File: core/src/main/java/com/linecorp/armeria/common/HttpHeadersBase.java Repository: line/armeria The code follows secure coding practices.
[ "CWE-74" ]
CVE-2019-16771
MEDIUM
5
line/armeria
get
core/src/main/java/com/linecorp/armeria/common/HttpHeadersBase.java
b597f7a865a527a84ee3d6937075cfbb4470ed20
0
Analyze the following code function for security vulnerabilities
private void deleteProviderLocked(Provider provider) { int N = provider.widgets.size(); for (int i = N - 1; i >= 0; i--) { Widget widget = provider.widgets.remove(i); // Call back with empty RemoteViews updateAppWidgetInstanceLocked(widget, null, false); // clear out references to this appWidgetId widget.host.widgets.remove(widget); mWidgets.remove(widget); widget.provider = null; pruneHostLocked(widget.host); widget.host = null; } mProviders.remove(provider); // no need to send the DISABLE broadcast, since the receiver is gone anyway cancelBroadcasts(provider); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: deleteProviderLocked File: services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java Repository: android The code follows secure coding practices.
[ "CWE-284" ]
CVE-2015-1541
MEDIUM
4.3
android
deleteProviderLocked
services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
0b98d304c467184602b4c6bce76fda0b0274bc07
0
Analyze the following code function for security vulnerabilities
@Override public void updateBatteryStats(ComponentName activity, int uid, int userId, boolean resumed) { ActivityManagerService.this.updateBatteryStats(activity, uid, userId, resumed); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: updateBatteryStats 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
updateBatteryStats
services/core/java/com/android/server/am/ActivityManagerService.java
d10b27e539f7bc91c2360d429b9d05f05274670d
0
Analyze the following code function for security vulnerabilities
@GuardedBy("mPm.mLock") private void commitPackagesLocked(final CommitRequest request) { // TODO: remove any expected failures from this method; this should only be able to fail due // to unavoidable errors (I/O, etc.) for (ReconciledPackage reconciledPkg : request.mReconciledPackages.values()) { final ScanResult scanResult = reconciledPkg.mScanResult; final ScanRequest scanRequest = scanResult.mRequest; final ParsedPackage parsedPackage = scanRequest.mParsedPackage; final String packageName = parsedPackage.getPackageName(); final PackageInstalledInfo res = reconciledPkg.mInstallResult; final RemovePackageHelper removePackageHelper = new RemovePackageHelper(mPm); final DeletePackageHelper deletePackageHelper = new DeletePackageHelper(mPm); if (reconciledPkg.mPrepareResult.mReplace) { AndroidPackage oldPackage = mPm.mPackages.get(packageName); // Set the update and install times PackageStateInternal deletedPkgSetting = mPm.snapshotComputer() .getPackageStateInternal(oldPackage.getPackageName()); reconciledPkg.mPkgSetting .setFirstInstallTimeFromReplaced(deletedPkgSetting, request.mAllUsers) .setLastUpdateTime(System.currentTimeMillis()); res.mRemovedInfo.mBroadcastAllowList = mPm.mAppsFilter.getVisibilityAllowList( mPm.snapshotComputer(), reconciledPkg.mPkgSetting, request.mAllUsers, mPm.mSettings.getPackagesLocked()); if (reconciledPkg.mPrepareResult.mSystem) { // Remove existing system package removePackageHelper.removePackageLI(oldPackage, true); if (!disableSystemPackageLPw(oldPackage)) { // We didn't need to disable the .apk as a current system package, // which means we are replacing another update that is already // installed. We need to make sure to delete the older one's .apk. res.mRemovedInfo.mArgs = new FileInstallArgs( oldPackage.getPath(), getAppDexInstructionSets( AndroidPackageUtils.getPrimaryCpuAbi(oldPackage, deletedPkgSetting), AndroidPackageUtils.getSecondaryCpuAbi(oldPackage, deletedPkgSetting)), mPm); } else { res.mRemovedInfo.mArgs = null; } } else { try { // Settings will be written during the call to updateSettingsLI(). deletePackageHelper.executeDeletePackageLIF( reconciledPkg.mDeletePackageAction, packageName, true, request.mAllUsers, false); } catch (SystemDeleteException e) { if (mPm.mIsEngBuild) { throw new RuntimeException("Unexpected failure", e); // ignore; not possible for non-system app } } // Successfully deleted the old package; proceed with replace. // Update the in-memory copy of the previous code paths. PackageSetting ps1 = mPm.mSettings.getPackageLPr( reconciledPkg.mPrepareResult.mExistingPackage.getPackageName()); if ((reconciledPkg.mInstallArgs.mInstallFlags & PackageManager.DONT_KILL_APP) == 0) { Set<String> oldCodePaths = ps1.getOldCodePaths(); if (oldCodePaths == null) { oldCodePaths = new ArraySet<>(); } Collections.addAll(oldCodePaths, oldPackage.getBaseApkPath()); Collections.addAll(oldCodePaths, oldPackage.getSplitCodePaths()); ps1.setOldCodePaths(oldCodePaths); } else { ps1.setOldCodePaths(null); } if (reconciledPkg.mInstallResult.mReturnCode == PackageManager.INSTALL_SUCCEEDED) { PackageSetting ps2 = mPm.mSettings.getPackageLPr( parsedPackage.getPackageName()); if (ps2 != null) { res.mRemovedInfo.mRemovedForAllUsers = mPm.mPackages.get(ps2.getPackageName()) == null; } } } } AndroidPackage pkg = commitReconciledScanResultLocked( reconciledPkg, request.mAllUsers); updateSettingsLI(pkg, reconciledPkg, request.mAllUsers, res); final PackageSetting ps = mPm.mSettings.getPackageLPr(packageName); if (ps != null) { res.mNewUsers = ps.queryInstalledUsers(mPm.mUserManager.getUserIds(), true); ps.setUpdateAvailable(false /*updateAvailable*/); } if (res.mReturnCode == PackageManager.INSTALL_SUCCEEDED) { mPm.updateSequenceNumberLP(ps, res.mNewUsers); mPm.updateInstantAppInstallerLocked(packageName); } } ApplicationPackageManager.invalidateGetPackagesForUidCache(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: commitPackagesLocked File: services/core/java/com/android/server/pm/InstallPackageHelper.java Repository: android The code follows secure coding practices.
[ "CWE-862" ]
CVE-2023-21257
HIGH
7.8
android
commitPackagesLocked
services/core/java/com/android/server/pm/InstallPackageHelper.java
1aec7feaf07e6d4568ca75d18158445dbeac10f6
0
Analyze the following code function for security vulnerabilities
@Override public PackageConfigurationUpdater createPackageConfigurationUpdater( String packageName , int userId) { return new PackageConfigurationUpdaterImpl(packageName, userId, ActivityTaskManagerService.this); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: createPackageConfigurationUpdater 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
createPackageConfigurationUpdater
services/core/java/com/android/server/wm/ActivityTaskManagerService.java
1120bc7e511710b1b774adf29ba47106292365e7
0
Analyze the following code function for security vulnerabilities
private void ensureMinimumQuality( int userId, ActiveAdmin admin, int minimumQuality, String operation) { mInjector.binderWithCleanCallingIdentity(() -> { // This check will also take care of the case where the password requirements // are specified as complexity rather than quality: When a password complexity // is set, the quality is reset to "unspecified" which will be below any value // of minimumQuality. if (admin.mPasswordPolicy.quality < minimumQuality && passwordQualityInvocationOrderCheckEnabled(admin.info.getPackageName(), userId)) { throw new IllegalStateException(String.format( "password quality should be at least %d for %s", minimumQuality, operation)); } }); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: ensureMinimumQuality 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
ensureMinimumQuality
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
ed3f25b7222d4cff471f2b7d22d1150348146957
0
Analyze the following code function for security vulnerabilities
public void badRequest(final String explain) { badRequest(new BadRequestException(explain)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: badRequest File: src/tsd/HttpQuery.java Repository: OpenTSDB/opentsdb The code follows secure coding practices.
[ "CWE-79" ]
CVE-2023-25827
MEDIUM
6.1
OpenTSDB/opentsdb
badRequest
src/tsd/HttpQuery.java
ff02c1e95e60528275f69b31bcbf7b2ac625cea8
0
Analyze the following code function for security vulnerabilities
@Override public KBTemplate findByUuid_C_Last(String uuid, long companyId, OrderByComparator<KBTemplate> orderByComparator) throws NoSuchTemplateException { KBTemplate kbTemplate = fetchByUuid_C_Last(uuid, companyId, orderByComparator); if (kbTemplate != null) { return kbTemplate; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", companyId="); msg.append(companyId); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchTemplateException(msg.toString()); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: findByUuid_C_Last File: modules/apps/knowledge-base/knowledge-base-service/src/main/java/com/liferay/knowledge/base/service/persistence/impl/KBTemplatePersistenceImpl.java Repository: brianchandotcom/liferay-portal The code follows secure coding practices.
[ "CWE-79" ]
CVE-2017-12647
MEDIUM
4.3
brianchandotcom/liferay-portal
findByUuid_C_Last
modules/apps/knowledge-base/knowledge-base-service/src/main/java/com/liferay/knowledge/base/service/persistence/impl/KBTemplatePersistenceImpl.java
ef93d984be9d4d478a5c4b1ca9a86f4e80174774
0
Analyze the following code function for security vulnerabilities
@Deprecated public void setCrossProfileCalendarPackages(@NonNull ComponentName admin, @Nullable Set<String> packageNames) { throwIfParentInstance("setCrossProfileCalendarPackages"); if (mService != null) { try { mService.setCrossProfileCalendarPackages(admin, packageNames == null ? null : new ArrayList<>(packageNames)); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setCrossProfileCalendarPackages 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
setCrossProfileCalendarPackages
core/java/android/app/admin/DevicePolicyManager.java
e2e05f488da6abc765a62e7faf10cb74e729732e
0
Analyze the following code function for security vulnerabilities
public JSONObject putOnce(String key, Object value) throws JSONException { if (key != null && value != null) { if (this.opt(key) != null) { throw new JSONException("Duplicate key \"" + key + "\""); } return this.put(key, value); } return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: putOnce File: src/main/java/org/json/JSONObject.java Repository: stleary/JSON-java The code follows secure coding practices.
[ "CWE-770" ]
CVE-2023-5072
HIGH
7.5
stleary/JSON-java
putOnce
src/main/java/org/json/JSONObject.java
661114c50dcfd53bb041aab66f14bb91e0a87c8a
0
Analyze the following code function for security vulnerabilities
public Entity<?> serialize(Object obj, Map<String, Object> formParams, String contentType, boolean isBodyNullable) throws ApiException { Entity<?> entity; if (contentType.startsWith("multipart/form-data")) { MultiPart multiPart = new MultiPart(); for (Entry<String, Object> param: formParams.entrySet()) { if (param.getValue() instanceof File) { File file = (File) param.getValue(); FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()) .fileName(file.getName()).size(file.length()).build(); multiPart.bodyPart(new FormDataBodyPart(contentDisp, file, MediaType.APPLICATION_OCTET_STREAM_TYPE)); } else { FormDataContentDisposition contentDisp = FormDataContentDisposition.name(param.getKey()).build(); multiPart.bodyPart(new FormDataBodyPart(contentDisp, parameterToString(param.getValue()))); } } entity = Entity.entity(multiPart, MediaType.MULTIPART_FORM_DATA_TYPE); } else if (contentType.startsWith("application/x-www-form-urlencoded")) { Form form = new Form(); for (Entry<String, Object> param: formParams.entrySet()) { form.param(param.getKey(), parameterToString(param.getValue())); } entity = Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE); } else { // We let jersey handle the serialization if (isBodyNullable) { // payload is nullable if (obj instanceof String) { entity = Entity.entity(obj == null ? "null" : "\"" + ((String)obj).replaceAll("\"", Matcher.quoteReplacement("\\\"")) + "\"", contentType); } else { entity = Entity.entity(obj == null ? "null" : obj, contentType); } } else { if (obj instanceof String) { entity = Entity.entity(obj == null ? "" : "\"" + ((String)obj).replaceAll("\"", Matcher.quoteReplacement("\\\"")) + "\"", contentType); } else { entity = Entity.entity(obj == null ? "" : obj, contentType); } } } return entity; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: serialize 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
serialize
samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java
2c576483f26f85b3979c6948a131f585c237109a
0
Analyze the following code function for security vulnerabilities
private void clearProfilerLocked() { if (mProfilerInfo !=null && mProfilerInfo.profileFd != null) { try { mProfilerInfo.profileFd.close(); } catch (IOException e) { } } mProfileApp = null; mProfileProc = null; mProfilerInfo = null; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: clearProfilerLocked File: services/core/java/com/android/server/am/ActivityManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-863" ]
CVE-2018-9492
HIGH
7.2
android
clearProfilerLocked
services/core/java/com/android/server/am/ActivityManagerService.java
962fb40991f15be4f688d960aa00073683ebdd20
0
Analyze the following code function for security vulnerabilities
public int getServerSyncId() { return serverSyncId; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getServerSyncId File: flow-server/src/main/java/com/vaadin/flow/component/internal/UIInternals.java Repository: vaadin/flow The code follows secure coding practices.
[ "CWE-200" ]
CVE-2023-25499
MEDIUM
6.5
vaadin/flow
getServerSyncId
flow-server/src/main/java/com/vaadin/flow/component/internal/UIInternals.java
428cc97eaa9c89b1124e39f0089bbb741b6b21cc
0
Analyze the following code function for security vulnerabilities
public float countInterfaceCoverage(List<ApiScenarioWithBLOBs> allScenarioInfoList, List<ApiDefinition> allEffectiveApiList) { if (allEffectiveApiList == null || allEffectiveApiList.isEmpty()) { return 100; } Map<ApiMethodUrlDTO, List<String>> urlMap = new HashMap<>(); for (ApiDefinition model : allEffectiveApiList) { String url = model.getPath(); String method = model.getMethod(); String id = model.getId(); ApiMethodUrlDTO dto = new ApiMethodUrlDTO(url, method); if (urlMap.containsKey(dto)) { urlMap.get(dto).add(id); } else { List<String> list = new ArrayList<>(); list.add(id); urlMap.put(dto, list); } } if (urlMap.isEmpty()) { return 100; } List<ApiMethodUrlDTO> urlList = new ArrayList<>(); for (ApiScenarioWithBLOBs model : allScenarioInfoList) { List<ApiMethodUrlDTO> useUrl = this.getScenarioUseUrl(model); if (CollectionUtils.isNotEmpty(useUrl)) { for (ApiMethodUrlDTO dto : useUrl) { if (!urlList.contains(dto)) { urlList.add(dto); } } } } List<String> containsApiIdList = new ArrayList<>(); for (ApiMethodUrlDTO urlDTO : urlList) { List<String> apiIdList = urlMap.get(urlDTO); if (apiIdList != null) { for (String api : apiIdList) { if (!containsApiIdList.contains(api)) { containsApiIdList.add(api); } } } } int allApiIdCount = 0; for (List<String> allApiIdList : urlMap.values()) { if (CollectionUtils.isNotEmpty(allApiIdList)) { allApiIdCount += allApiIdList.size(); } } float coverageRageNumber = (float) containsApiIdList.size() * 100 / allApiIdCount; return coverageRageNumber; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: countInterfaceCoverage File: backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java Repository: metersphere The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2021-45789
MEDIUM
6.5
metersphere
countInterfaceCoverage
backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java
d74e02cdff47cdf7524d305d098db6ffb7f61b47
0
Analyze the following code function for security vulnerabilities
public void setInstaller(Installer installer) { mInstaller = installer; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setInstaller File: services/core/java/com/android/server/am/ActivityManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-863" ]
CVE-2018-9492
HIGH
7.2
android
setInstaller
services/core/java/com/android/server/am/ActivityManagerService.java
962fb40991f15be4f688d960aa00073683ebdd20
0
Analyze the following code function for security vulnerabilities
@VisibleForTesting public ImeAdapter getImeAdapterForTest() { return mImeAdapter; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getImeAdapterForTest 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
getImeAdapterForTest
content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
98a50b76141f0b14f292f49ce376e6554142d5e2
0
Analyze the following code function for security vulnerabilities
public void setWorkingDirectory( String path ) { if ( path != null ) { this.workingDir = path; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setWorkingDirectory File: src/main/java/org/apache/maven/shared/utils/cli/shell/Shell.java Repository: apache/maven-shared-utils The code follows secure coding practices.
[ "CWE-116" ]
CVE-2022-29599
HIGH
7.5
apache/maven-shared-utils
setWorkingDirectory
src/main/java/org/apache/maven/shared/utils/cli/shell/Shell.java
2735facbbbc2e13546328cb02dbb401b3776eea3
0
Analyze the following code function for security vulnerabilities
@Override public ArrayList<QueryReturnValue> runMultipleQueries( ArrayList<QueryType> queryTypeList, ArrayList<QueryParametersBase> queryParamsList) { int size = queryTypeList == null ? 0 : queryTypeList.size(); log.debug("Server: RunMultipleQuery invoked! [amount of queries: {}]", size); //$NON-NLS-1$ ArrayList<QueryReturnValue> ret = new ArrayList<>(); if (queryTypeList != null && queryParamsList != null && queryTypeList.size() == queryParamsList.size()) { String correlationId = CorrelationIdTracker.getCorrelationId(); for (int i = 0; i < queryTypeList.size(); i++) { if (queryParamsList.get(i).getCorrelationId() == null) { queryParamsList.get(i).setCorrelationId(correlationId); } debugQuery(queryTypeList.get(i), queryParamsList.get(i)); ret.add(runQuery(queryTypeList.get(i), queryParamsList.get(i))); } } else { log.error( "Wrong multi query usage: the query types and parameters must not be null " //$NON-NLS-1$ + "or be equally long. Types length '{}' vs params length '{}'", //$NON-NLS-1$ queryTypeList == null ? 0 : queryTypeList.size(), queryParamsList == null ? 0 : queryParamsList.size() ); } for (QueryReturnValue vqrv : ret) { log.debug("QueryReturnValue '{}'", vqrv); //$NON-NLS-1$ } log.debug("Server: RunMultipleQuery result [amount of queries: {}]", ret.size()); //$NON-NLS-1$ return ret; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: runMultipleQueries File: frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/server/gwt/GenericApiGWTServiceImpl.java Repository: oVirt/ovirt-engine The code follows secure coding practices.
[ "CWE-287" ]
CVE-2024-0822
HIGH
7.5
oVirt/ovirt-engine
runMultipleQueries
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/server/gwt/GenericApiGWTServiceImpl.java
036f617316f6d7077cd213eb613eb4816e33d1fc
0
Analyze the following code function for security vulnerabilities
@Override public void setEmergencyCallsOnly(boolean show) { boolean changed = show != mShowEmergencyCallsOnly; if (changed) { mShowEmergencyCallsOnly = show; if (mExpanded) { updateEverything(); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setEmergencyCallsOnly File: packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-3886
HIGH
7.2
android
setEmergencyCallsOnly
packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java
6ca6cd5a50311d58a1b7bf8fbef3f9aa29eadcd5
0
Analyze the following code function for security vulnerabilities
public WinstoneOutputStream getWinstoneOutputStream() { return this.outputStream; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getWinstoneOutputStream File: src/java/winstone/WinstoneResponse.java Repository: jenkinsci/winstone The code follows secure coding practices.
[ "CWE-79" ]
CVE-2011-4344
LOW
2.6
jenkinsci/winstone
getWinstoneOutputStream
src/java/winstone/WinstoneResponse.java
410ed3001d51c689cf59085b7417466caa2ded7b
0
Analyze the following code function for security vulnerabilities
private void readForcedDisplayPropertiesLocked(final DisplayContent displayContent) { // Display size. String sizeStr = Settings.Global.getString(mContext.getContentResolver(), Settings.Global.DISPLAY_SIZE_FORCED); if (sizeStr == null || sizeStr.length() == 0) { sizeStr = SystemProperties.get(SIZE_OVERRIDE, null); } if (sizeStr != null && sizeStr.length() > 0) { final int pos = sizeStr.indexOf(','); if (pos > 0 && sizeStr.lastIndexOf(',') == pos) { int width, height; try { width = Integer.parseInt(sizeStr.substring(0, pos)); height = Integer.parseInt(sizeStr.substring(pos+1)); synchronized(displayContent.mDisplaySizeLock) { if (displayContent.mBaseDisplayWidth != width || displayContent.mBaseDisplayHeight != height) { Slog.i(TAG, "FORCED DISPLAY SIZE: " + width + "x" + height); displayContent.mBaseDisplayWidth = width; displayContent.mBaseDisplayHeight = height; } } } catch (NumberFormatException ex) { } } } // Display density. String densityStr = Settings.Global.getString(mContext.getContentResolver(), Settings.Global.DISPLAY_DENSITY_FORCED); if (densityStr == null || densityStr.length() == 0) { densityStr = SystemProperties.get(DENSITY_OVERRIDE, null); } if (densityStr != null && densityStr.length() > 0) { int density; try { density = Integer.parseInt(densityStr); synchronized(displayContent.mDisplaySizeLock) { if (displayContent.mBaseDisplayDensity != density) { Slog.i(TAG, "FORCED DISPLAY DENSITY: " + density); displayContent.mBaseDisplayDensity = density; } } } catch (NumberFormatException ex) { } } // Display scaling mode. int mode = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.DISPLAY_SCALING_FORCE, 0); if (mode != 0) { synchronized(displayContent.mDisplaySizeLock) { Slog.i(TAG, "FORCED DISPLAY SCALING DISABLED"); displayContent.mDisplayScalingDisabled = true; } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: readForcedDisplayPropertiesLocked File: services/core/java/com/android/server/wm/WindowManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-3875
HIGH
7.2
android
readForcedDisplayPropertiesLocked
services/core/java/com/android/server/wm/WindowManagerService.java
69729fa8b13cadbf3173fe1f389fe4f3b7bd0f9c
0
Analyze the following code function for security vulnerabilities
IBackupAgent bindToAgentSynchronous(ApplicationInfo app, int mode) { IBackupAgent agent = null; synchronized(mAgentConnectLock) { mConnecting = true; mConnectedAgent = null; try { if (mActivityManager.bindBackupAgent(app, mode)) { Slog.d(TAG, "awaiting agent for " + app); // success; wait for the agent to arrive // only wait 10 seconds for the bind to happen long timeoutMark = System.currentTimeMillis() + TIMEOUT_INTERVAL; while (mConnecting && mConnectedAgent == null && (System.currentTimeMillis() < timeoutMark)) { try { mAgentConnectLock.wait(5000); } catch (InterruptedException e) { // just bail Slog.w(TAG, "Interrupted: " + e); mActivityManager.clearPendingBackup(); return null; } } // if we timed out with no connect, abort and move on if (mConnecting == true) { Slog.w(TAG, "Timeout waiting for agent " + app); mActivityManager.clearPendingBackup(); return null; } if (DEBUG) Slog.i(TAG, "got agent " + mConnectedAgent); agent = mConnectedAgent; } } catch (RemoteException e) { // can't happen - ActivityManager is local } } return agent; }
Vulnerability Classification: - CWE: CWE-264 - CVE: CVE-2016-3832 - Severity: HIGH - CVSS Score: 8.3 Description: Don't trust callers to supply app info to bindBackupAgent() Get the canonical identity and metadata about the package from the Package Manager at time of usage rather than rely on the caller to have gotten things right, even when the caller has the system uid. Bug 28795098 Change-Id: I215786bc894dedf7ca28e9c80cefabd0e40ca877 Merge conflict resolution for ag/1133474 (referencing ag/1148862) - directly to mnc-mr2-release Function: bindToAgentSynchronous File: services/backup/java/com/android/server/backup/BackupManagerService.java Repository: android Fixed Code: IBackupAgent bindToAgentSynchronous(ApplicationInfo app, int mode) { IBackupAgent agent = null; synchronized(mAgentConnectLock) { mConnecting = true; mConnectedAgent = null; try { if (mActivityManager.bindBackupAgent(app.packageName, mode, UserHandle.USER_OWNER)) { Slog.d(TAG, "awaiting agent for " + app); // success; wait for the agent to arrive // only wait 10 seconds for the bind to happen long timeoutMark = System.currentTimeMillis() + TIMEOUT_INTERVAL; while (mConnecting && mConnectedAgent == null && (System.currentTimeMillis() < timeoutMark)) { try { mAgentConnectLock.wait(5000); } catch (InterruptedException e) { // just bail Slog.w(TAG, "Interrupted: " + e); mActivityManager.clearPendingBackup(); return null; } } // if we timed out with no connect, abort and move on if (mConnecting == true) { Slog.w(TAG, "Timeout waiting for agent " + app); mActivityManager.clearPendingBackup(); return null; } if (DEBUG) Slog.i(TAG, "got agent " + mConnectedAgent); agent = mConnectedAgent; } } catch (RemoteException e) { // can't happen - ActivityManager is local } } return agent; }
[ "CWE-264" ]
CVE-2016-3832
HIGH
8.3
android
bindToAgentSynchronous
services/backup/java/com/android/server/backup/BackupManagerService.java
e7cf91a198de995c7440b3b64352effd2e309906
1
Analyze the following code function for security vulnerabilities
public static @Nullable String sanitizeDisplayName(@Nullable String name, boolean rewriteHiddenFileName) { if (name == null) { return null; } else if (rewriteHiddenFileName && name.startsWith(".")) { // The resulting file must not be hidden. return "_" + name; } else { return buildValidFatFilename(name); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: sanitizeDisplayName File: src/com/android/providers/media/util/FileUtils.java Repository: android The code follows secure coding practices.
[ "CWE-22" ]
CVE-2023-35670
HIGH
7.8
android
sanitizeDisplayName
src/com/android/providers/media/util/FileUtils.java
db3c69afcb0a45c8aa2f333fcde36217889899fe
0
Analyze the following code function for security vulnerabilities
@Override protected boolean isToolbarEnabled() { return false; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isToolbarEnabled File: src/com/android/settings/password/ChooseLockPattern.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-40117
HIGH
7.8
android
isToolbarEnabled
src/com/android/settings/password/ChooseLockPattern.java
11815817de2f2d70fe842b108356a1bc75d44ffb
0
Analyze the following code function for security vulnerabilities
private void setNewTask(Task taskToAffiliate) { final boolean toTop = !mLaunchTaskBehind && !mAvoidMoveToFront; final Task task = mTargetRootTask.reuseOrCreateTask( mNewTaskInfo != null ? mNewTaskInfo : mStartActivity.info, mNewTaskIntent != null ? mNewTaskIntent : mIntent, mVoiceSession, mVoiceInteractor, toTop, mStartActivity, mSourceRecord, mOptions); task.mTransitionController.collectExistenceChange(task); addOrReparentStartingActivity(task, "setTaskFromReuseOrCreateNewTask"); ProtoLog.v(WM_DEBUG_TASKS, "Starting new activity %s in new task %s", mStartActivity, mStartActivity.getTask()); if (taskToAffiliate != null) { mStartActivity.setTaskToAffiliateWith(taskToAffiliate); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setNewTask 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
setNewTask
services/core/java/com/android/server/wm/ActivityStarter.java
70ec64dc5a2a816d6aa324190a726a85fd749b30
0
Analyze the following code function for security vulnerabilities
public JSONObject rename() { String oldFile = this.get.get("old"); String newFile = this.get.get("new"); String oldExtension = getFileExtension(oldFile); if (!newFile.endsWith(oldExtension)) { this.error("rename file error,[" + oldFile + " to " + newFile + "]"); return null; } oldFile = getFilePath(oldFile); if (oldFile.endsWith("/")) { this.get.put("old", oldFile.substring(0, oldFile.length() - 1)); } boolean error = false; JSONObject array = null; String tmp[] = oldFile.split("/"); String filename = tmp[tmp.length - 1]; int pos = oldFile.lastIndexOf("/"); String path = oldFile.substring(0, pos + 1); File fileFrom = null; File fileTo = null; try { fileFrom = new File(this.fileRoot + oldFile); fileTo = new File(this.fileRoot + path + newFile); if (fileTo.exists()) { if (fileTo.isDirectory()) { this.error(sprintf(lang("DIRECTORY_ALREADY_EXISTS"), newFile)); error = true; } else { // fileTo.isFile this.error(sprintf(lang("FILE_ALREADY_EXISTS"), newFile)); error = true; } } else if (!fileFrom.renameTo(fileTo)) { this.error(sprintf(lang("ERROR_RENAMING_DIRECTORY"), filename + "#" + newFile)); error = true; } } catch (Exception e) { if (fileFrom.isDirectory()) { this.error(sprintf(lang("ERROR_RENAMING_DIRECTORY"), filename + "#" + newFile)); } else { this.error(sprintf(lang("ERROR_RENAMING_FILE"), filename + "#" + newFile)); } error = true; } if (!error) { array = new JSONObject(); try { array.put("Error", ""); array.put("Code", 0); array.put("Old Path", this.get.get("old")); array.put("Old Name", filename); array.put("New Path", path + this.get.get("new")); array.put("New Name", this.get.get("new")); } catch (JSONException e) { this.error("JSONObject error"); } } return array; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: rename File: src/main/java/com/jflyfox/modules/filemanager/FileManager.java Repository: jflyfox/jfinal_cms The code follows secure coding practices.
[ "CWE-74" ]
CVE-2021-37262
MEDIUM
5
jflyfox/jfinal_cms
rename
src/main/java/com/jflyfox/modules/filemanager/FileManager.java
e7fd0fe9362464c4d2bd308318eecc89a847b116
0
Analyze the following code function for security vulnerabilities
@Override public String getDatePartFunctionSQL(String part, Column column) { String columnSQL = getColumnSQL(column); return "EXTRACT(" + part + " FROM " + columnSQL + ")"; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getDatePartFunctionSQL 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
getDatePartFunctionSQL
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 void dispatchUidsChanged() { int N; synchronized (this) { N = mPendingUidChanges.size(); if (mActiveUidChanges.length < N) { mActiveUidChanges = new UidRecord.ChangeItem[N]; } for (int i=0; i<N; i++) { final UidRecord.ChangeItem change = mPendingUidChanges.get(i); mActiveUidChanges[i] = change; change.uidRecord.pendingChange = null; change.uidRecord = null; } mPendingUidChanges.clear(); if (DEBUG_UID_OBSERVERS) Slog.i(TAG_UID_OBSERVERS, "*** Delivering " + N + " uid changes"); } if (mLocalPowerManager != null) { for (int j=0; j<N; j++) { UidRecord.ChangeItem item = mActiveUidChanges[j]; if (item.gone) { mLocalPowerManager.uidGone(item.uid); } else { mLocalPowerManager.updateUidProcState(item.uid, item.processState); } } } int i = mUidObservers.beginBroadcast(); while (i > 0) { i--; final IUidObserver observer = mUidObservers.getBroadcastItem(i); if (observer != null) { try { for (int j=0; j<N; j++) { UidRecord.ChangeItem item = mActiveUidChanges[j]; if (item.gone) { if (DEBUG_UID_OBSERVERS) Slog.i(TAG_UID_OBSERVERS, "UID gone uid=" + item.uid); observer.onUidGone(item.uid); } else { if (DEBUG_UID_OBSERVERS) Slog.i(TAG_UID_OBSERVERS, "UID CHANGED uid=" + item.uid + ": " + item.processState); observer.onUidStateChanged(item.uid, item.processState); } } } catch (RemoteException e) { } } } mUidObservers.finishBroadcast(); synchronized (this) { for (int j=0; j<N; j++) { mAvailUidChanges.add(mActiveUidChanges[j]); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: dispatchUidsChanged 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
dispatchUidsChanged
services/core/java/com/android/server/am/ActivityManagerService.java
9878bb99b77c3681f0fda116e2964bac26f349c3
0
Analyze the following code function for security vulnerabilities
@TestApi public void setLaunchActivityType(int activityType) { mLaunchActivityType = activityType; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setLaunchActivityType File: core/java/android/app/ActivityOptions.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-20918
CRITICAL
9.8
android
setLaunchActivityType
core/java/android/app/ActivityOptions.java
51051de4eb40bb502db448084a83fd6cbfb7d3cf
0
Analyze the following code function for security vulnerabilities
public void onHostEmulationActivated() { Log.d(TAG, "notifyHostEmulationActivated"); synchronized (mLock) { // Regardless of what happens, if we're having a tap again // activity up, close it Intent intent = new Intent(TapAgainDialog.ACTION_CLOSE); intent.setPackage("com.android.nfc"); mContext.sendBroadcastAsUser(intent, UserHandle.ALL); if (mState != STATE_IDLE) { Log.e(TAG, "Got activation event in non-idle state"); } mState = STATE_W4_SELECT; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onHostEmulationActivated File: src/com/android/nfc/cardemulation/HostEmulationManager.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-35671
MEDIUM
5.5
android
onHostEmulationActivated
src/com/android/nfc/cardemulation/HostEmulationManager.java
745632835f3d97513a9c2a96e56e1dc06c4e4176
0
Analyze the following code function for security vulnerabilities
public static CountingReader readerFor(Object input, Map<String, Object> headers, String payload, String compressionAlgo) throws IOException { return inputStreamFor(input, headers, payload, compressionAlgo).asReader(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: readerFor File: core/src/main/java/apoc/util/FileUtils.java Repository: neo4j-contrib/neo4j-apoc-procedures The code follows secure coding practices.
[ "CWE-22" ]
CVE-2022-23532
MEDIUM
6.5
neo4j-contrib/neo4j-apoc-procedures
readerFor
core/src/main/java/apoc/util/FileUtils.java
01e63ed2d187cd2a8aa1d78bf831ef0fdd69b522
0
Analyze the following code function for security vulnerabilities
@Override public void setVolumeTo(String packageName, String opPackageName, int value, int flags) { int pid = Binder.getCallingPid(); int uid = Binder.getCallingUid(); final long token = Binder.clearCallingIdentity(); try { MediaSessionRecord.this.setVolumeTo(packageName, opPackageName, pid, uid, value, flags); } finally { Binder.restoreCallingIdentity(token); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setVolumeTo File: services/core/java/com/android/server/media/MediaSessionRecord.java Repository: android The code follows secure coding practices.
[ "CWE-400" ]
CVE-2023-21280
MEDIUM
5.5
android
setVolumeTo
services/core/java/com/android/server/media/MediaSessionRecord.java
06e772e05514af4aa427641784c5eec39a892ed3
0
Analyze the following code function for security vulnerabilities
protected void onAddedToDocumentFragment() { if (firstChild_ != null) { for (final DomNode child : getChildren()) { child.onAddedToDocumentFragment(); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onAddedToDocumentFragment 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
onAddedToDocumentFragment
src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java
940dc7fd
0
Analyze the following code function for security vulnerabilities
protected void setLockScreenAllowRemoteInput(boolean allowLockscreenRemoteInput) { mAllowLockscreenRemoteInput = allowLockscreenRemoteInput; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setLockScreenAllowRemoteInput File: packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2017-0822
HIGH
7.5
android
setLockScreenAllowRemoteInput
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
c574568aaede7f652432deb7707f20ae54bbdf9a
0
Analyze the following code function for security vulnerabilities
public List<Cliente> montaListaClientes(ResultSet rs) throws SQLException{ List<Cliente> listaClientes = new ArrayList(); while (rs.next()) { Cliente cliente = new Cliente(); cliente.setIdCliente(rs.getInt("idcliente")); cliente.setNome(rs.getString("nome")); cliente.setSexo(rs.getString("sexo")); cliente.setCpf(rs.getString("cpf")); Date nascimento = rs.getDate("nascimento"); cliente.setNascimento(nascimento); cliente.setTelefone(rs.getString("telefone")); cliente.setEmail(rs.getString("email")); cliente.setSenha(rs.getString("senha")); cliente.setCep(rs.getString("cep")); cliente.setEndereco(rs.getString("endereco")); cliente.setEndNumero(rs.getString("endnumero")); cliente.setEndComplemento(rs.getString("endcomplemento")); cliente.setBairro(rs.getString("bairro")); cliente.setCidade(rs.getString("cidade")); cliente.setEstado(rs.getString("estado")); cliente.setPerfil(rs.getInt("perfil")); listaClientes.add(cliente); } return listaClientes; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: montaListaClientes File: src/java/br/com/magazine/dao/ClienteDAO.java Repository: evandro-machado/Trabalho-Web2 The code follows secure coding practices.
[ "CWE-89" ]
CVE-2015-10061
MEDIUM
5.2
evandro-machado/Trabalho-Web2
montaListaClientes
src/java/br/com/magazine/dao/ClienteDAO.java
f59ac954625d0a4f6d34f069a2e26686a7a20aeb
0
Analyze the following code function for security vulnerabilities
private void clearThumbnail() { if (mThumbnail == null) { return; } mThumbnail.destroy(); mThumbnail = null; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: clearThumbnail File: services/core/java/com/android/server/wm/ActivityRecord.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21145
HIGH
7.8
android
clearThumbnail
services/core/java/com/android/server/wm/ActivityRecord.java
44aeef1b82ecf21187d4903c9e3666a118bdeaf3
0
Analyze the following code function for security vulnerabilities
@DeprecatedAt("2022-08-31") @Deprecated public Document parseDocument(String input, String sourceName) throws InvalidSyntaxException { MultiSourceReader multiSourceReader = MultiSourceReader.newMultiSourceReader() .string(input, sourceName) .trackData(true) .build(); return parseDocument(multiSourceReader); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: parseDocument File: src/main/java/graphql/parser/Parser.java Repository: graphql-java The code follows secure coding practices.
[ "CWE-770" ]
CVE-2023-28867
HIGH
7.5
graphql-java
parseDocument
src/main/java/graphql/parser/Parser.java
8a1c884c81c0b656db201cfd95881feb0f430a55
0
Analyze the following code function for security vulnerabilities
public static void startWebServer(Connection conn) throws SQLException { startWebServer(conn, false); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: startWebServer File: h2/src/main/org/h2/tools/Server.java Repository: h2database The code follows secure coding practices.
[ "CWE-312" ]
CVE-2022-45868
HIGH
7.8
h2database
startWebServer
h2/src/main/org/h2/tools/Server.java
23ee3d0b973923c135fa01356c8eaed40b895393
0
Analyze the following code function for security vulnerabilities
boolean inSizeCompatMode() { if (mInSizeCompatModeForBounds) { return true; } if (mCompatDisplayInsets == null || !shouldCreateCompatDisplayInsets() // The orientation is different from parent when transforming. || isFixedRotationTransforming()) { return false; } final Rect appBounds = getConfiguration().windowConfiguration.getAppBounds(); if (appBounds == null) { // The app bounds hasn't been computed yet. return false; } final WindowContainer parent = getParent(); if (parent == null) { // The parent of detached Activity can be null. return false; } final Configuration parentConfig = parent.getConfiguration(); // Although colorMode, screenLayout, smallestScreenWidthDp are also fixed, generally these // fields should be changed with density and bounds, so here only compares the most // significant field. return parentConfig.densityDpi != getConfiguration().densityDpi; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: inSizeCompatMode File: services/core/java/com/android/server/wm/ActivityRecord.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21145
HIGH
7.8
android
inSizeCompatMode
services/core/java/com/android/server/wm/ActivityRecord.java
44aeef1b82ecf21187d4903c9e3666a118bdeaf3
0
Analyze the following code function for security vulnerabilities
private static void consultCertificateSecurityException(LaunchException ex) throws LaunchException { if (isCertUnderestimated()) { LOG.error("{} and {} are declared. Ignoring certificate issue", CommandLineOptions.NOSEC.getOption(), ConfigurationConstants.KEY_SECURITY_ITW_IGNORECERTISSUES); } else { throw ex; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: consultCertificateSecurityException 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
consultCertificateSecurityException
core/src/main/java/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
e0818f521a0711aeec4b913b49b5fc6a52815662
0
Analyze the following code function for security vulnerabilities
void enforceCrossUserPermission(int callingUid, int userId, boolean requireFullPermission, boolean checkShell, String message) { if (userId < 0) { throw new IllegalArgumentException("Invalid userId " + userId); } if (checkShell) { enforceShellRestriction(UserManager.DISALLOW_DEBUGGING_FEATURES, callingUid, userId); } if (userId == UserHandle.getUserId(callingUid)) return; if (callingUid != Process.SYSTEM_UID && callingUid != 0) { if (requireFullPermission) { mContext.enforceCallingOrSelfPermission( android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, message); } else { try { mContext.enforceCallingOrSelfPermission( android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, message); } catch (SecurityException se) { mContext.enforceCallingOrSelfPermission( android.Manifest.permission.INTERACT_ACROSS_USERS, message); } } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: enforceCrossUserPermission File: services/core/java/com/android/server/pm/PackageManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-119" ]
CVE-2016-2497
HIGH
7.5
android
enforceCrossUserPermission
services/core/java/com/android/server/pm/PackageManagerService.java
a75537b496e9df71c74c1d045ba5569631a16298
0
Analyze the following code function for security vulnerabilities
boolean isGoneForLayout() { final ActivityRecord atoken = mActivityRecord; return mViewVisibility == View.GONE || !mRelayoutCalled // We can't check isVisible here because it will also check the client visibility // for WindowTokens. Even if the client is not visible, we still need to perform // a layout since they can request relayout when client visibility is false. // TODO (b/157682066) investigate if we can clean up isVisible || (atoken == null && !(wouldBeVisibleIfPolicyIgnored() && isVisibleByPolicy())) || (atoken != null && !atoken.mVisibleRequested) || isParentWindowGoneForLayout() || (mAnimatingExit && !isAnimatingLw()) || mDestroying; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isGoneForLayout File: services/core/java/com/android/server/wm/WindowState.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-35674
HIGH
7.8
android
isGoneForLayout
services/core/java/com/android/server/wm/WindowState.java
7428962d3b064ce1122809d87af65099d1129c9e
0
Analyze the following code function for security vulnerabilities
private void migrateMergeStrategy16(Element mergeStrategyElement) { if (mergeStrategyElement != null) { mergeStrategyElement.setName("mergeStrategy"); switch (mergeStrategyElement.getText()) { case "ALWAYS_MERGE": mergeStrategyElement.setText("CREATE_MERGE_COMMIT"); break; case "MERGE_IF_NECESSARY": mergeStrategyElement.setText("CREATE_MERGE_COMMIT_IF_NECESSARY"); break; case "SQUASH_MERGE": mergeStrategyElement.setText("SQUASH_SOURCE_BRANCH_COMMITS"); break; case "REBASE_MERGE": mergeStrategyElement.setText("REBASE_SOURCE_BRANCH_COMMITS"); break; } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: migrateMergeStrategy16 File: server-core/src/main/java/io/onedev/server/migration/DataMigrator.java Repository: theonedev/onedev The code follows secure coding practices.
[ "CWE-338" ]
CVE-2023-24828
HIGH
8.8
theonedev/onedev
migrateMergeStrategy16
server-core/src/main/java/io/onedev/server/migration/DataMigrator.java
d67dd9686897fe5e4ab881d749464aa7c06a68e5
0
Analyze the following code function for security vulnerabilities
@VisibleForTesting public void errorSavingKeys() { keyResult = KEY_FAILED; requireDialog().setTitle(R.string.common_error); textView.setText(R.string.end_to_end_encryption_unsuccessful); positiveButton.setText(R.string.end_to_end_encryption_dialog_close); positiveButton.setVisibility(View.VISIBLE); positiveButton.setTextColor(ThemeColorUtils.primaryAccentColor(getContext())); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: errorSavingKeys File: src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.java Repository: nextcloud/android The code follows secure coding practices.
[ "CWE-212" ]
CVE-2021-32658
LOW
2.1
nextcloud/android
errorSavingKeys
src/main/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragment.java
355f3c745b464b741b20a3b96597303490c26333
0
Analyze the following code function for security vulnerabilities
public void setWindowManager(WindowManagerService wm) { mWindowManager = wm; mStackSupervisor.setWindowManager(wm); mActivityStarter.setWindowManager(wm); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setWindowManager File: services/core/java/com/android/server/am/ActivityManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-3912
HIGH
9.3
android
setWindowManager
services/core/java/com/android/server/am/ActivityManagerService.java
6c049120c2d749f0c0289d822ec7d0aa692f55c5
0
Analyze the following code function for security vulnerabilities
public int getFrontActivityScreenCompatMode() throws RemoteException;
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getFrontActivityScreenCompatMode File: core/java/android/app/IActivityManager.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-3832
HIGH
8.3
android
getFrontActivityScreenCompatMode
core/java/android/app/IActivityManager.java
e7cf91a198de995c7440b3b64352effd2e309906
0
Analyze the following code function for security vulnerabilities
private native void nativePinchEnd(long nativeContentViewCoreImpl, long timeMs);
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: nativePinchEnd 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
nativePinchEnd
content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
98a50b76141f0b14f292f49ce376e6554142d5e2
0
Analyze the following code function for security vulnerabilities
@Override public SerializationServiceBuilder setUseNativeByteOrder(boolean useNativeByteOrder) { this.useNativeByteOrder = useNativeByteOrder; return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setUseNativeByteOrder File: hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/DefaultSerializationServiceBuilder.java Repository: hazelcast The code follows secure coding practices.
[ "CWE-502" ]
CVE-2016-10750
MEDIUM
6.8
hazelcast
setUseNativeByteOrder
hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/DefaultSerializationServiceBuilder.java
c1c31359a1df953e79a9ca9b6c54b3cdbfef11e9
0
Analyze the following code function for security vulnerabilities
private void execute() throws IOException { final int nplotted = runGnuplot(query, basepath, plot); if (query.hasQueryStringParam("json")) { final HashMap<String, Object> results = new HashMap<String, Object>(); results.put("plotted", nplotted); results.put("points", npoints); // 1.0 returned an empty inner array if the 1st hashset was null, to do // the same we need to fudge it with an empty set if (aggregated_tags != null && aggregated_tags.length > 0 && aggregated_tags[0] == null) { aggregated_tags[0] = new HashSet<String>(); } results.put("etags", aggregated_tags); results.put("timing", query.processingTimeMillis()); query.sendReply(JSON.serializeToBytes(results)); writeFile(query, basepath + ".json", JSON.serializeToBytes(results)); } else if (query.hasQueryStringParam("png")) { query.sendFile(basepath + ".png", max_age); } else { query.internalError(new Exception("Should never be here!")); } // TODO(tsuna): Expire old files from the on-disk cache. graphlatency.add(query.processingTimeMillis()); graphs_generated.incrementAndGet(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: execute File: src/tsd/GraphHandler.java Repository: OpenTSDB/opentsdb The code follows secure coding practices.
[ "CWE-78" ]
CVE-2023-25826
CRITICAL
9.8
OpenTSDB/opentsdb
execute
src/tsd/GraphHandler.java
26be40a5e5b6ce8b0b1e4686c4b0d7911e5d8a25
0
Analyze the following code function for security vulnerabilities
protected String getNullValueCVsSql(String studyId) { return "select sed.oc_oid as definition_oid, cv.oc_oid as crf_version_oid, edc.null_values from study_event_definition sed, event_definition_crf edc, crf_version cv" + " where edc.study_id = " + studyId + " and length(edc.null_values) > 0" + " and sed.study_event_definition_id = edc.study_event_definition_id" + " and edc.crf_id = cv.crf_id"; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getNullValueCVsSql File: core/src/main/java/org/akaza/openclinica/dao/extract/OdmExtractDAO.java Repository: OpenClinica The code follows secure coding practices.
[ "CWE-89" ]
CVE-2022-24831
HIGH
7.5
OpenClinica
getNullValueCVsSql
core/src/main/java/org/akaza/openclinica/dao/extract/OdmExtractDAO.java
b152cc63019230c9973965a98e4386ea5322c18f
0
Analyze the following code function for security vulnerabilities
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { if (DBG) log("onActivityResult request:" + requestCode + " result:" + resultCode); switch (requestCode) { case PIN2_REQUEST_CODE: Bundle extras = (intent != null) ? intent.getExtras() : null; if (extras != null) { mPin2 = extras.getString("pin2"); processPin2(mPin2); } else if (resultCode != RESULT_OK) { // if they cancelled, then we just cancel too. if (DBG) log("onActivityResult: cancelled."); finish(); } break; // look for the data associated with this number, and update // the display with it. case CONTACTS_PICKER_CODE: if (resultCode != RESULT_OK) { if (DBG) log("onActivityResult: cancelled."); return; } Cursor cursor = null; try { cursor = getContentResolver().query(intent.getData(), NUM_PROJECTION, null, null, null); if ((cursor == null) || (!cursor.moveToFirst())) { Log.w(LOG_TAG,"onActivityResult: bad contact data, no results found."); return; } mNameField.setText(cursor.getString(0)); mNumberField.setText(cursor.getString(1)); } finally { if (cursor != null) { cursor.close(); } } break; } }
Vulnerability Classification: - CWE: CWE-Other, CWE-862 - CVE: CVE-2023-35665 - Severity: HIGH - CVSS Score: 7.8 Description: Fixed leak of cross user data in multiple settings. - Any app is allowed to receive GET_CONTENT intent. Using this, an user puts back in the intent an uri with data of another user. - Telephony service has INTERACT_ACROSS_USER permission. Using this, it reads and shows the deta to the evil user. Fix: When telephony service gets the intent result, it checks if the uri is from the current user or not. Bug: b/256591023 , b/256819787 Test: The malicious behaviour was not being reproduced. Unable to import contact from other users data. Test2: Able to import contact from the primary user or uri with no user id (These settings are not available for secondary users) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:ab593467e900d4a6d25a34024a06195ae863f6dc) Merged-In: I1e3a643f17948153aecc1d0df9ffd9619ad678c1 Change-Id: I1e3a643f17948153aecc1d0df9ffd9619ad678c1 Function: onActivityResult File: src/com/android/phone/settings/fdn/EditFdnContactScreen.java Repository: android Fixed Code: @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { if (DBG) log("onActivityResult request:" + requestCode + " result:" + resultCode); switch (requestCode) { case PIN2_REQUEST_CODE: Bundle extras = (intent != null) ? intent.getExtras() : null; if (extras != null) { mPin2 = extras.getString("pin2"); processPin2(mPin2); } else if (resultCode != RESULT_OK) { // if they cancelled, then we just cancel too. if (DBG) log("onActivityResult: cancelled."); finish(); } break; // look for the data associated with this number, and update // the display with it. case CONTACTS_PICKER_CODE: if (resultCode != RESULT_OK) { if (DBG) log("onActivityResult: cancelled."); return; } Cursor cursor = null; try { // check if the URI returned by the user belongs to the user final int currentUser = UserHandle.getUserId(Process.myUid()); if (currentUser != ContentProvider.getUserIdFromUri(intent.getData(), currentUser)) { Log.w(LOG_TAG, "onActivityResult: Contact data of different user, " + "cannot access"); return; } cursor = getContentResolver().query(intent.getData(), NUM_PROJECTION, null, null, null); if ((cursor == null) || (!cursor.moveToFirst())) { Log.w(LOG_TAG,"onActivityResult: bad contact data, no results found."); return; } mNameField.setText(cursor.getString(0)); mNumberField.setText(cursor.getString(1)); } finally { if (cursor != null) { cursor.close(); } } break; } }
[ "CWE-Other", "CWE-862" ]
CVE-2023-35665
HIGH
7.8
android
onActivityResult
src/com/android/phone/settings/fdn/EditFdnContactScreen.java
674039e70e1c5bf29b808899ac80c709acc82290
1
Analyze the following code function for security vulnerabilities
void setCheckedForSetup(boolean checked) { mCheckedForSetup = checked; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setCheckedForSetup File: services/core/java/com/android/server/am/ActivityManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-863" ]
CVE-2018-9492
HIGH
7.2
android
setCheckedForSetup
services/core/java/com/android/server/am/ActivityManagerService.java
962fb40991f15be4f688d960aa00073683ebdd20
0
Analyze the following code function for security vulnerabilities
public Material byFolder(String folder) { for (Material material : this) { if ((material instanceof ScmMaterial || material instanceof PluggableSCMMaterial) && Objects.equals(folder, material.getFolder())) { return material; } } return null; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: byFolder File: domain/src/main/java/com/thoughtworks/go/config/materials/Materials.java Repository: gocd The code follows secure coding practices.
[ "CWE-668" ]
CVE-2022-39309
MEDIUM
6.5
gocd
byFolder
domain/src/main/java/com/thoughtworks/go/config/materials/Materials.java
691b479f1310034992da141760e9c5d1f5b60e8a
0
Analyze the following code function for security vulnerabilities
@Override public void initialize() throws InitializationException { ListenerChain chain = new ListenerChain(); setListenerChain(chain); // Construct the listener chain in the right order. Listeners early in the chain are called before listeners // placed later in the chain. chain.addListener(this); chain.addListener(new BlockStateChainingListener(chain)); chain.addListener(new EmptyBlockChainingListener(chain)); chain.addListener(new MetaDataStateChainingListener(chain)); chain.addListener(new XHTMLChainingRenderer(this.linkRenderer, this.imageRenderer, chain)); }
Vulnerability Classification: - CWE: CWE-79 - CVE: CVE-2023-32070 - Severity: MEDIUM - CVSS Score: 6.1 Description: XRENDERING-663: Restrict allowed attributes in HTML rendering * Change HTML renderers to only print allowed attributes and elements. * Add prefix to forbidden attributes to preserve them in XWiki syntax. * Adapt tests to expect that invalid attributes get a prefix. Function: initialize File: xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/XHTMLRenderer.java Repository: xwiki/xwiki-rendering Fixed Code: @Override public void initialize() throws InitializationException { ListenerChain chain = new ListenerChain(); setListenerChain(chain); // Construct the listener chain in the right order. Listeners early in the chain are called before listeners // placed later in the chain. chain.addListener(this); chain.addListener(new BlockStateChainingListener(chain)); chain.addListener(new EmptyBlockChainingListener(chain)); chain.addListener(new MetaDataStateChainingListener(chain)); chain.addListener(new XHTMLChainingRenderer(this.linkRenderer, this.imageRenderer, this.htmlElementSanitizer, chain)); }
[ "CWE-79" ]
CVE-2023-32070
MEDIUM
6.1
xwiki/xwiki-rendering
initialize
xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/XHTMLRenderer.java
c40e2f5f9482ec6c3e71dbf1fff5ba8a5e44cdc1
1
Analyze the following code function for security vulnerabilities
@Override public Iterable<File> children(File file) { return fileTreeChildren(file); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: children File: android/guava/src/com/google/common/io/Files.java Repository: google/guava The code follows secure coding practices.
[ "CWE-732" ]
CVE-2020-8908
LOW
2.1
google/guava
children
android/guava/src/com/google/common/io/Files.java
fec0dbc4634006a6162cfd4d0d09c962073ddf40
0
Analyze the following code function for security vulnerabilities
private void migrate52(File dataDir, Stack<Integer> versions) { for (File file: dataDir.listFiles()) { if (file.getName().startsWith("PullRequests.xml")) { VersionedXmlDoc dom = VersionedXmlDoc.fromFile(file); for (Element element: dom.getRootElement().elements()) element.addElement("revision").setText("0"); dom.writeToFile(file, false); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: migrate52 File: server-core/src/main/java/io/onedev/server/migration/DataMigrator.java Repository: theonedev/onedev The code follows secure coding practices.
[ "CWE-338" ]
CVE-2023-24828
HIGH
8.8
theonedev/onedev
migrate52
server-core/src/main/java/io/onedev/server/migration/DataMigrator.java
d67dd9686897fe5e4ab881d749464aa7c06a68e5
0
Analyze the following code function for security vulnerabilities
@Override protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws IOException { final HttpSession session = request.getSession(); final Cookie csrfCookie = CookieUtils.getCookie(request, "csrf"); if (csrfCookie == null || !csrfCookie.getValue().equals(request.getParameter("csrf"))) { session.setAttribute("errorMessage", LocaleUtils.getLocalizedString("global.csrf.failed")); } else { final WebManager webManager = new WebManager(); webManager.init(request, response, session, session.getServletContext()); final String action = ParamUtils.getStringParameter(request, "action", ""); switch (action) { case "delete": deleteProperty(request, response, session); break; case "cancel": session.setAttribute("warningMessage", LocaleUtils.getLocalizedString("system.cache-details.cancelled")); break; default: session.setAttribute("warningMessage", LocaleUtils.getLocalizedString("global.request-error-no-such-action", Collections.singletonList(action))); break; } } response.sendRedirect(request.getRequestURI() + ListPager.getQueryString(request, '?', SEARCH_FIELDS)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: doPost File: xmppserver/src/main/java/org/jivesoftware/admin/servlet/SystemCacheDetailsServlet.java Repository: igniterealtime/Openfire The code follows secure coding practices.
[ "CWE-79" ]
CVE-2019-20363
MEDIUM
4.3
igniterealtime/Openfire
doPost
xmppserver/src/main/java/org/jivesoftware/admin/servlet/SystemCacheDetailsServlet.java
b6f758241f3fdd57b48c527a695512f33e26eb74
0
Analyze the following code function for security vulnerabilities
private Restrictor createRestrictor(Configuration pConfig) { String location = pConfig.get(ConfigKey.POLICY_LOCATION); try { Restrictor ret = RestrictorFactory.lookupPolicyRestrictor(location); if (ret != null) { logHandler.info("Using access restrictor " + location); return ret; } else { logHandler.info("No access restrictor found, access to all MBean is allowed"); return new AllowAllRestrictor(); } } catch (IOException e) { logHandler.error("Error while accessing access restrictor at " + location + ". Denying all access to MBeans for security reasons. Exception: " + e, e); return new DenyAllRestrictor(); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: createRestrictor File: agent/jvm/src/main/java/org/jolokia/jvmagent/JolokiaHttpHandler.java Repository: jolokia The code follows secure coding practices.
[ "CWE-352" ]
CVE-2014-0168
MEDIUM
6.8
jolokia
createRestrictor
agent/jvm/src/main/java/org/jolokia/jvmagent/JolokiaHttpHandler.java
2d9b168cfbbf5a6d16fa6e8a5b34503e3dc42364
0
Analyze the following code function for security vulnerabilities
@Override public String toString() { String result = Integer.toString(sourceUserId) + " @ " + uri.toString(); if (prefix) result += " [prefix]"; return result; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: toString 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
toString
services/core/java/com/android/server/am/ActivityManagerService.java
aaa0fee0d7a8da347a0c47cef5249c70efee209e
0
Analyze the following code function for security vulnerabilities
public static File createTempFile() throws IOException { final File file = File.createTempFile("rep", "tmp"); // Make sure the file is deleted when JVM is shutdown at last. file.deleteOnExit(); return file; }
Vulnerability Classification: - CWE: CWE-668 - CVE: CVE-2021-28168 - Severity: LOW - CVSS Score: 2.1 Description: switching to NIO tmp file creation approach Signed-off-by: Maxim Nesen <maxim.nesen@oracle.com> Function: createTempFile File: core-common/src/main/java/org/glassfish/jersey/message/internal/Utils.java Repository: eclipse-ee4j/jersey Fixed Code: public static File createTempFile() throws IOException { final File file = Files.createTempFile("rep", "tmp").toFile(); // Make sure the file is deleted when JVM is shutdown at last. file.deleteOnExit(); return file; }
[ "CWE-668" ]
CVE-2021-28168
LOW
2.1
eclipse-ee4j/jersey
createTempFile
core-common/src/main/java/org/glassfish/jersey/message/internal/Utils.java
8850535786a93772849eba622ef064d6aca30472
1
Analyze the following code function for security vulnerabilities
@Test public void testCustomPatternWithAnnotations01() throws Exception { final Wrapper input = new Wrapper(Instant.ofEpochMilli(0)); String json = MAPPER.writeValueAsString(input); assertEquals(aposToQuotes("{'value':'1970-01-01T00:00:00Z'}"), json); Wrapper result = MAPPER.readValue(json, Wrapper.class); assertEquals(input.value, result.value); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: testCustomPatternWithAnnotations01 File: datetime/src/test/java/com/fasterxml/jackson/datatype/jsr310/TestInstantSerialization.java Repository: FasterXML/jackson-modules-java8 The code follows secure coding practices.
[ "CWE-20" ]
CVE-2018-1000873
MEDIUM
4.3
FasterXML/jackson-modules-java8
testCustomPatternWithAnnotations01
datetime/src/test/java/com/fasterxml/jackson/datatype/jsr310/TestInstantSerialization.java
ba27ce5909dfb49bcaf753ad3e04ecb980010b0b
0
Analyze the following code function for security vulnerabilities
PackageInfo generatePackageInfo(PackageParser.Package p, int flags, int userId) { if (!sUserManager.exists(userId)) return null; final PackageSetting ps = (PackageSetting) p.mExtras; if (ps == null) { return null; } final PermissionsState permissionsState = ps.getPermissionsState(); final int[] gids = permissionsState.computeGids(userId); final Set<String> permissions = permissionsState.getPermissions(userId); final PackageUserState state = ps.readUserState(userId); return PackageParser.generatePackageInfo(p, gids, flags, ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: generatePackageInfo File: services/core/java/com/android/server/pm/PackageManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-119" ]
CVE-2016-2497
HIGH
7.5
android
generatePackageInfo
services/core/java/com/android/server/pm/PackageManagerService.java
a75537b496e9df71c74c1d045ba5569631a16298
0
Analyze the following code function for security vulnerabilities
private TechAdvance getTechnology(final String name) { final TechnologyFrontier frontier = data.getTechnologyFrontier(); TechAdvance type = frontier.getAdvanceByName(name); if (type == null) { type = frontier.getAdvanceByProperty(name); } return type; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getTechnology File: game-core/src/main/java/games/strategy/engine/data/GameParser.java Repository: triplea-game/triplea The code follows secure coding practices.
[ "CWE-611" ]
CVE-2018-1000546
MEDIUM
6.8
triplea-game/triplea
getTechnology
game-core/src/main/java/games/strategy/engine/data/GameParser.java
0f23875a4c6e166218859a63c884995f15c53895
0
Analyze the following code function for security vulnerabilities
private void login(TaskLogger jobLogger) { for (RegistryLogin login: getRegistryLogins()) DockerExecutorUtils.login(newDocker(), login.getRegistryUrl(), login.getUserName(), login.getPassword(), jobLogger); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: login File: server-plugin/server-plugin-executor-serverdocker/src/main/java/io/onedev/server/plugin/executor/serverdocker/ServerDockerExecutor.java Repository: theonedev/onedev The code follows secure coding practices.
[ "CWE-610" ]
CVE-2022-39206
CRITICAL
9.9
theonedev/onedev
login
server-plugin/server-plugin-executor-serverdocker/src/main/java/io/onedev/server/plugin/executor/serverdocker/ServerDockerExecutor.java
0052047a5b5095ac6a6b4a73a522d0272fec3a22
0