instruction
string
input
string
output
string
cwe_ids
list
cve_id
string
severity
string
cvss_score
float64
repo_name
string
func_name
string
file_path
string
commit_hash
string
is_vulnerable
int64
Analyze the following code function for security vulnerabilities
private static String convertHeaderValue(AsciiString name, CharSequence value) { if (!(value instanceof AsciiString)) { return value.toString(); } if (HEADER_VALUE_CACHE != null && CACHED_HEADERS.contains(name)) { final String converted = HEADER_VALUE_CACHE.get((AsciiString) value); assert converted != null; // loader does not return null. return converted; } return value.toString(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: convertHeaderValue File: core/src/main/java/com/linecorp/armeria/internal/ArmeriaHttpUtil.java Repository: line/armeria The code follows secure coding practices.
[ "CWE-74" ]
CVE-2019-16771
MEDIUM
5
line/armeria
convertHeaderValue
core/src/main/java/com/linecorp/armeria/internal/ArmeriaHttpUtil.java
b597f7a865a527a84ee3d6937075cfbb4470ed20
0
Analyze the following code function for security vulnerabilities
private static String dhcpResultsParcelableToString(DhcpResultsParcelable dhcpResults) { return new StringBuilder() .append("baseConfiguration ").append(dhcpResults.baseConfiguration) .append("leaseDuration ").append(dhcpResults.leaseDuration) .append("mtu ").append(dhcpResults.mtu) .append("serverAddress ").append(dhcpResults.serverAddress) .append("serverHostName ").append(dhcpResults.serverHostName) .append("vendorInfo ").append(dhcpResults.vendorInfo) .toString(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: dhcpResultsParcelableToString 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
dhcpResultsParcelableToString
service/java/com/android/server/wifi/ClientModeImpl.java
72e903f258b5040b8f492cf18edd124b5a1ac770
0
Analyze the following code function for security vulnerabilities
@Override public boolean releaseActivityInstance(IBinder token) { synchronized(this) { final long origId = Binder.clearCallingIdentity(); try { ActivityRecord r = ActivityRecord.isInStackLocked(token); if (r == null) { return false; } return r.getStack().safelyDestroyActivityLocked(r, "app-req"); } finally { Binder.restoreCallingIdentity(origId); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: releaseActivityInstance 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
releaseActivityInstance
services/core/java/com/android/server/am/ActivityManagerService.java
962fb40991f15be4f688d960aa00073683ebdd20
0
Analyze the following code function for security vulnerabilities
@Override public void showPromptReason(int reason) { if (mCurrentSecurityMode != SecurityMode.None) { if (reason != PROMPT_REASON_NONE) { Log.i(TAG, "Strong auth required, reason: " + reason); } getCurrentSecurityController().showPromptReason(reason); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: showPromptReason File: packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21245
HIGH
7.8
android
showPromptReason
packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java
a33159e8cb297b9eee6fa5c63c0e343d05fad622
0
Analyze the following code function for security vulnerabilities
@NonNull public Builder setErrorHandler(@Nullable DatabaseErrorHandler errorHandler) { mErrorHandler = errorHandler; return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setErrorHandler File: core/java/android/database/sqlite/SQLiteDatabase.java Repository: android The code follows secure coding practices.
[ "CWE-89" ]
CVE-2018-9493
LOW
2.1
android
setErrorHandler
core/java/android/database/sqlite/SQLiteDatabase.java
ebc250d16c747f4161167b5ff58b3aea88b37acf
0
Analyze the following code function for security vulnerabilities
protected int readPreservingBufferContent() throws IOException { if (DEBUG_BUFFER) { fCurrentEntity.debugBufferIfNeeded("(read: "); } if (fCurrentEntity.offset == fCurrentEntity.length) { if (fCurrentEntity.load(fCurrentEntity.length) < 1) { if (DEBUG_BUFFER) { System.out.println(")read: -> -1"); } return -1; } } final char c = fCurrentEntity.getNextChar(); if (DEBUG_BUFFER) { fCurrentEntity.debugBufferIfNeeded(")read: ", " -> " + c); } return c; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: readPreservingBufferContent File: src/org/cyberneko/html/HTMLScanner.java Repository: sparklemotion/nekohtml The code follows secure coding practices.
[ "CWE-400" ]
CVE-2022-24839
MEDIUM
5
sparklemotion/nekohtml
readPreservingBufferContent
src/org/cyberneko/html/HTMLScanner.java
a800fce3b079def130ed42a408ff1d09f89e773d
0
Analyze the following code function for security vulnerabilities
public boolean ensurePushAvailable() { if (atmosphereAvailable) { return true; } else { if (!pushWarningEmitted) { pushWarningEmitted = true; getLogger().warn(ATMOSPHERE_MISSING_ERROR); } return false; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: ensurePushAvailable File: flow-server/src/main/java/com/vaadin/flow/server/VaadinService.java Repository: vaadin/flow The code follows secure coding practices.
[ "CWE-203" ]
CVE-2021-31404
LOW
1.9
vaadin/flow
ensurePushAvailable
flow-server/src/main/java/com/vaadin/flow/server/VaadinService.java
621ef1b322737d963bee624b2d2e38cd739903d9
0
Analyze the following code function for security vulnerabilities
public Object getPeer() { return this.peer; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getPeer File: drools-core/src/main/java/org/drools/core/xml/ExtensibleXmlParser.java Repository: apache/incubator-kie-drools The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2014-8125
HIGH
7.5
apache/incubator-kie-drools
getPeer
drools-core/src/main/java/org/drools/core/xml/ExtensibleXmlParser.java
c48464c3b246e6ef0d4cd0dbf67e83ccd532c6d3
0
Analyze the following code function for security vulnerabilities
private void handleTimeout(ToastRecord record) { if (DBG) Slog.d(TAG, "Timeout pkg=" + record.pkg + " callback=" + record.callback); synchronized (mToastQueue) { int index = indexOfToastLocked(record.pkg, record.callback); if (index >= 0) { cancelToastLocked(index); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: handleTimeout File: services/core/java/com/android/server/notification/NotificationManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-284" ]
CVE-2016-3884
MEDIUM
4.3
android
handleTimeout
services/core/java/com/android/server/notification/NotificationManagerService.java
61e9103b5725965568e46657f4781dd8f2e5b623
0
Analyze the following code function for security vulnerabilities
@Override protected synchronized void releaseNativeResources() throws Exception { synchronized (globalRef) { if (globalRef != null) { try { globalRef.close(); } finally { globalRef = null; } } } }
Vulnerability Classification: - CWE: CWE-401 - CVE: CVE-2021-4213 - Severity: HIGH - CVSS Score: 7.5 Description: Fix memory leak on each TLS connection Each TLS connection is leaking a bunch of data that isn't in the heap and so after 25k requests Tomcat uses about 2.5GB resident memory. There are large number of relationships that point at each other and we need to break the cycle so JSSEngineReferenceImpl's finalizer can run and clear all the native resources these point at. The lowest impact place to break the cycle was at SSLAlertEvent.engine. This relationship doesn't seem to be used anywhere. Once the cycle is broken, JSSEngineReferenceImpl can be garbage collected and the finalizer can run. Signed-off-by: Chris Kelley <ckelley@redhat.com> Function: releaseNativeResources File: src/main/java/org/mozilla/jss/nss/SSLFDProxy.java Repository: dogtagpki/jss Fixed Code: @Override protected synchronized void releaseNativeResources() throws Exception { super.releaseNativeResources(); if (globalRef != null) { try { globalRef.close(); } finally { globalRef = null; } } }
[ "CWE-401" ]
CVE-2021-4213
HIGH
7.5
dogtagpki/jss
releaseNativeResources
src/main/java/org/mozilla/jss/nss/SSLFDProxy.java
5922560a78d0dee61af8a33cc9cfbf4cfa291448
1
Analyze the following code function for security vulnerabilities
public int next() throws XmlPullParserException,IOException { if (!mStarted) { mStarted = true; return START_DOCUMENT; } if (mParseState == 0) { return END_DOCUMENT; } int ev = nativeNext(mParseState); if (ev == ERROR_BAD_DOCUMENT) { throw new XmlPullParserException("Corrupt XML binary file"); } if (mDecNextDepth) { mDepth--; mDecNextDepth = false; } switch (ev) { case START_TAG: mDepth++; break; case END_TAG: mDecNextDepth = true; break; } mEventType = ev; if (ev == END_DOCUMENT) { // Automatically close the parse when we reach the end of // a document, since the standard XmlPullParser interface // doesn't have such an API so most clients will leave us // dangling. close(); } return ev; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: next File: core/java/android/content/res/XmlBlock.java Repository: android The code follows secure coding practices.
[ "CWE-415" ]
CVE-2023-40103
HIGH
7.8
android
next
core/java/android/content/res/XmlBlock.java
c3bc12c484ef3bbca4cec19234437c45af5e584d
0
Analyze the following code function for security vulnerabilities
@TestApi public void setTaskAlwaysOnTop(boolean alwaysOnTop) { mTaskAlwaysOnTop = alwaysOnTop; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setTaskAlwaysOnTop File: core/java/android/app/ActivityOptions.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-20918
CRITICAL
9.8
android
setTaskAlwaysOnTop
core/java/android/app/ActivityOptions.java
51051de4eb40bb502db448084a83fd6cbfb7d3cf
0
Analyze the following code function for security vulnerabilities
public boolean isPasswordValid(String encPass, String rawPass, Object salt) throws DataAccessException { if (encPass.startsWith(JBCRYPT_HEADER)) return JBCRYPT_ENCODER.isPasswordValid(encPass.substring(JBCRYPT_HEADER.length()),rawPass,salt); else return CLASSIC.isPasswordValid(encPass,rawPass,salt); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isPasswordValid 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
isPasswordValid
core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java
fbf96734470caba9364f04e0b77b0bae7293a1ec
0
Analyze the following code function for security vulnerabilities
@Nullable public String getDevicePolicyManagementRoleHolderPackage() { String devicePolicyManagementConfig = mContext.getString( com.android.internal.R.string.config_devicePolicyManagement); return extractPackageNameFromDeviceManagerConfig(devicePolicyManagementConfig); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getDevicePolicyManagementRoleHolderPackage 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
getDevicePolicyManagementRoleHolderPackage
core/java/android/app/admin/DevicePolicyManager.java
e2e05f488da6abc765a62e7faf10cb74e729732e
0
Analyze the following code function for security vulnerabilities
@Override public void onChange(boolean selfChange) { updateSettings(); updateRotation(false); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onChange File: policy/src/com/android/internal/policy/impl/PhoneWindowManager.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-0812
MEDIUM
6.6
android
onChange
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
84669ca8de55d38073a0dcb01074233b0a417541
0
Analyze the following code function for security vulnerabilities
public boolean isCommentNotificationAllowed() { return isNotificationsAllowed() && CONF.emailsForCommentsAllowed(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isCommentNotificationAllowed File: src/main/java/com/erudika/scoold/utils/ScooldUtils.java Repository: Erudika/scoold The code follows secure coding practices.
[ "CWE-130" ]
CVE-2022-1543
MEDIUM
6.5
Erudika/scoold
isCommentNotificationAllowed
src/main/java/com/erudika/scoold/utils/ScooldUtils.java
62a0e92e1486ddc17676a7ead2c07ff653d167ce
0
Analyze the following code function for security vulnerabilities
private void updateFontScaleIfNeeded(@UserIdInt int userId) { if (userId != getCurrentUserId()) { return; } final float scaleFactor = Settings.System.getFloatForUser(mContext.getContentResolver(), FONT_SCALE, 1.0f, userId); synchronized (mGlobalLock) { if (getGlobalConfiguration().fontScale == scaleFactor) { return; } final Configuration configuration = mWindowManager.computeNewConfiguration(DEFAULT_DISPLAY); configuration.fontScale = scaleFactor; updatePersistentConfiguration(configuration, userId); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: updateFontScaleIfNeeded 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
updateFontScaleIfNeeded
services/core/java/com/android/server/wm/ActivityTaskManagerService.java
1120bc7e511710b1b774adf29ba47106292365e7
0
Analyze the following code function for security vulnerabilities
public DocumentReference getContentAuthorReference() { return this.doc.getContentAuthorReference(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getContentAuthorReference File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/Document.java Repository: xwiki/xwiki-platform The code follows secure coding practices.
[ "CWE-863" ]
CVE-2022-23615
MEDIUM
5.5
xwiki/xwiki-platform
getContentAuthorReference
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/Document.java
7ab0fe7b96809c7a3881454147598d46a1c9bbbe
0
Analyze the following code function for security vulnerabilities
@Override public synchronized boolean isNetworkConnection() { return networkConnection; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isNetworkConnection 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
isNetworkConnection
activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnection.java
00921f2
0
Analyze the following code function for security vulnerabilities
@Deprecated @SystemApi @RequiresPermission(value = android.Manifest.permission.GRANT_PROFILE_OWNER_DEVICE_IDS_ACCESS, conditional = true) public void setProfileOwnerCanAccessDeviceIds(@NonNull ComponentName who) { ApplicationInfo ai = mContext.getApplicationInfo(); if (ai.targetSdkVersion > Build.VERSION_CODES.Q) { throw new UnsupportedOperationException( "This method is deprecated. use markProfileOwnerOnOrganizationOwnedDevice" + " instead."); } else { setProfileOwnerOnOrganizationOwnedDevice(who, true); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setProfileOwnerCanAccessDeviceIds 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
setProfileOwnerCanAccessDeviceIds
core/java/android/app/admin/DevicePolicyManager.java
e2e05f488da6abc765a62e7faf10cb74e729732e
0
Analyze the following code function for security vulnerabilities
public ApiClient setBearerToken(String bearerToken) { for (Authentication auth : authentications.values()) { if (auth instanceof HttpBearerAuth) { ((HttpBearerAuth) auth).setBearerToken(bearerToken); return this; } } throw new RuntimeException("No Bearer authentication configured!"); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setBearerToken File: samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java Repository: OpenAPITools/openapi-generator The code follows secure coding practices.
[ "CWE-668" ]
CVE-2021-21430
LOW
2.1
OpenAPITools/openapi-generator
setBearerToken
samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java
2c576483f26f85b3979c6948a131f585c237109a
0
Analyze the following code function for security vulnerabilities
@Deprecated public void markTableSyncable(String table, String foreignKey, String updateTable) { }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: markTableSyncable File: core/java/android/database/sqlite/SQLiteDatabase.java Repository: android The code follows secure coding practices.
[ "CWE-89" ]
CVE-2018-9493
LOW
2.1
android
markTableSyncable
core/java/android/database/sqlite/SQLiteDatabase.java
ebc250d16c747f4161167b5ff58b3aea88b37acf
0
Analyze the following code function for security vulnerabilities
private boolean isWallpaperVisible(WindowState wallpaperTarget) { if (DEBUG_WALLPAPER) Slog.v(TAG, "Wallpaper vis: target " + wallpaperTarget + ", obscured=" + (wallpaperTarget != null ? Boolean.toString(wallpaperTarget.mObscured) : "??") + " anim=" + ((wallpaperTarget != null && wallpaperTarget.mAppToken != null) ? wallpaperTarget.mAppToken.mAppAnimator.animation : null) + " upper=" + mUpperWallpaperTarget + " lower=" + mLowerWallpaperTarget); return (wallpaperTarget != null && (!wallpaperTarget.mObscured || (wallpaperTarget.mAppToken != null && wallpaperTarget.mAppToken.mAppAnimator.animation != null))) || mUpperWallpaperTarget != null || mLowerWallpaperTarget != null; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isWallpaperVisible 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
isWallpaperVisible
services/core/java/com/android/server/wm/WindowManagerService.java
69729fa8b13cadbf3173fe1f389fe4f3b7bd0f9c
0
Analyze the following code function for security vulnerabilities
public TMessage readMessageBegin() throws TException { byte protocolId = readByte(); if (protocolId != PROTOCOL_ID) { throw new TProtocolException( "Expected protocol id " + Integer.toHexString(PROTOCOL_ID) + " but got " + Integer.toHexString(protocolId)); } byte versionAndType = readByte(); version_ = (byte) (versionAndType & VERSION_MASK); if (!(version_ <= VERSION && version_ >= VERSION_LOW)) { throw new TProtocolException("Expected version " + VERSION + " but got " + version_); } byte type = (byte) ((versionAndType >> TYPE_SHIFT_AMOUNT) & 0x03); int seqid = readVarint32(); String messageName = readString(); return new TMessage(messageName, type, seqid); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: readMessageBegin File: thrift/lib/java/src/main/java/com/facebook/thrift/protocol/TCompactProtocol.java Repository: facebook/fbthrift The code follows secure coding practices.
[ "CWE-770" ]
CVE-2019-11938
MEDIUM
5
facebook/fbthrift
readMessageBegin
thrift/lib/java/src/main/java/com/facebook/thrift/protocol/TCompactProtocol.java
08c2d412adb214c40bb03be7587057b25d053030
0
Analyze the following code function for security vulnerabilities
@Override public T addDouble(K name, double value) { return add(name, fromDouble(name, value)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: addDouble File: codec/src/main/java/io/netty/handler/codec/DefaultHeaders.java Repository: netty The code follows secure coding practices.
[ "CWE-436", "CWE-113" ]
CVE-2022-41915
MEDIUM
6.5
netty
addDouble
codec/src/main/java/io/netty/handler/codec/DefaultHeaders.java
fe18adff1c2b333acb135ab779a3b9ba3295a1c4
0
Analyze the following code function for security vulnerabilities
@Override @Deprecated public String encodeUrl(String s) { return this.response.encodeUrl(s); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: encodeUrl File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletResponse.java Repository: xwiki/xwiki-platform The code follows secure coding practices.
[ "CWE-601" ]
CVE-2022-23618
MEDIUM
5.8
xwiki/xwiki-platform
encodeUrl
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiServletResponse.java
5251c02080466bf9fb55288f04a37671108f8096
0
Analyze the following code function for security vulnerabilities
@RequestMapping(value = STATUS_URL + "/{referenceId:\\S+}.json", method = RequestMethod.GET) public final void getStatus( @PathVariable final String referenceId, @RequestParam(value = "jsonp", defaultValue = "") final String jsonpCallback, final HttpServletRequest statusRequest, final HttpServletResponse statusResponse) { MDC.put(Processor.MDC_JOB_ID_KEY, referenceId); setNoCache(statusResponse); try { PrintJobStatus status = this.jobManager.getStatus(referenceId); setContentType(statusResponse, jsonpCallback); try (PrintWriter writer = statusResponse.getWriter()) { appendJsonpCallback(jsonpCallback, writer); JSONWriter json = new JSONWriter(writer); json.object(); { json.key(JSON_DONE).value(status.isDone()); json.key(JSON_STATUS).value(status.getStatus().toString().toLowerCase()); json.key(JSON_ELAPSED_TIME).value(status.getElapsedTime()); json.key(JSON_WAITING_TIME).value(status.getWaitingTime()); if (!StringUtils.isEmpty(status.getError())) { json.key(JSON_ERROR).value(status.getError()); } addDownloadLinkToJson(statusRequest, referenceId, json); } json.endObject(); appendJsonpCallbackEnd(jsonpCallback, writer); } } catch (JSONException | IOException e) { throw ExceptionUtils.getRuntimeException(e); } catch (NoSuchReferenceException e) { error(statusResponse, e.getMessage(), HttpStatus.NOT_FOUND); } }
Vulnerability Classification: - CWE: CWE-79 - CVE: CVE-2020-15231 - Severity: MEDIUM - CVSS Score: 4.3 Description: Remove JSONP support See: https://github.com/mapfish/mapfish-print/security/code-scanning/5?query=ref%3Arefs%2Fheads%2Fmaster Function: getStatus File: core/src/main/java/org/mapfish/print/servlet/MapPrinterServlet.java Repository: mapfish/mapfish-print Fixed Code: @RequestMapping(value = STATUS_URL + "/{referenceId:\\S+}.json", method = RequestMethod.GET) public final void getStatus( @PathVariable final String referenceId, final HttpServletRequest statusRequest, final HttpServletResponse statusResponse) { MDC.put(Processor.MDC_JOB_ID_KEY, referenceId); setNoCache(statusResponse); try { PrintJobStatus status = this.jobManager.getStatus(referenceId); setContentType(statusResponse); try (PrintWriter writer = statusResponse.getWriter()) { JSONWriter json = new JSONWriter(writer); json.object(); { json.key(JSON_DONE).value(status.isDone()); json.key(JSON_STATUS).value(status.getStatus().toString().toLowerCase()); json.key(JSON_ELAPSED_TIME).value(status.getElapsedTime()); json.key(JSON_WAITING_TIME).value(status.getWaitingTime()); if (!StringUtils.isEmpty(status.getError())) { json.key(JSON_ERROR).value(status.getError()); } addDownloadLinkToJson(statusRequest, referenceId, json); } json.endObject(); } } catch (JSONException | IOException e) { throw ExceptionUtils.getRuntimeException(e); } catch (NoSuchReferenceException e) { error(statusResponse, e.getMessage(), HttpStatus.NOT_FOUND); } }
[ "CWE-79" ]
CVE-2020-15231
MEDIUM
4.3
mapfish/mapfish-print
getStatus
core/src/main/java/org/mapfish/print/servlet/MapPrinterServlet.java
89155f2506b9cee822e15ce60ccae390a1419d5e
1
Analyze the following code function for security vulnerabilities
private void parseResources(final Element root) throws GameParseException { for (final Element element : getChildren("resource", root)) { final String name = element.getAttribute("name"); final String isDisplayedFor = element.getAttribute("isDisplayedFor"); if (isDisplayedFor.isEmpty()) { data.getResourceList().addResource(new Resource(name, data, data.getPlayerList().getPlayers())); } else if (isDisplayedFor.equalsIgnoreCase(RESOURCE_IS_DISPLAY_FOR_NONE)) { data.getResourceList().addResource(new Resource(name, data)); } else { data.getResourceList().addResource(new Resource(name, data, parsePlayersFromIsDisplayedFor(isDisplayedFor))); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: parseResources 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
parseResources
game-core/src/main/java/games/strategy/engine/data/GameParser.java
0f23875a4c6e166218859a63c884995f15c53895
0
Analyze the following code function for security vulnerabilities
private SimpleObject returnHelper(List<FormSubmissionError> validationErrors, FormEntrySession session, Encounter encounter) { if (validationErrors == null || validationErrors.size() == 0) { String afterSaveUrl = session.getAfterSaveUrlTemplate(); if (afterSaveUrl != null) { afterSaveUrl = afterSaveUrl.replaceAll("\\{\\{patient.id\\}\\}", session.getPatient().getId().toString()); afterSaveUrl = afterSaveUrl.replaceAll("\\{\\{encounter.id\\}\\}", session.getEncounter().getId().toString()); } return SimpleObject.create("success", true, "encounterId", encounter.getId(), "encounterUuid", encounter.getUuid(), "encounterTypeUuid", encounter.getEncounterType() != null ? encounter.getEncounterType().getUuid() : null, "goToUrl", afterSaveUrl); } else { Map<String, String> errors = new HashMap<String, String>(); for (FormSubmissionError err : validationErrors) { if (err.getSourceWidget() != null) errors.put(session.getContext().getErrorFieldId(err.getSourceWidget()), err.getError()); else errors.put(err.getId(), err.getError()); } return SimpleObject.create("success", false, "errors", errors); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: returnHelper File: omod/src/main/java/org/openmrs/module/htmlformentryui/fragment/controller/htmlform/EnterHtmlFormFragmentController.java Repository: openmrs/openmrs-module-htmlformentryui The code follows secure coding practices.
[ "CWE-79" ]
CVE-2021-4284
MEDIUM
6.1
openmrs/openmrs-module-htmlformentryui
returnHelper
omod/src/main/java/org/openmrs/module/htmlformentryui/fragment/controller/htmlform/EnterHtmlFormFragmentController.java
811990972ea07649ae33c4b56c61c3b520895f07
0
Analyze the following code function for security vulnerabilities
boolean isShowing() { return mDialog.isShowing(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isShowing File: services/autofill/java/com/android/server/autofill/ui/SaveUi.java Repository: android The code follows secure coding practices.
[ "CWE-Other", "CWE-610" ]
CVE-2023-40133
MEDIUM
5.5
android
isShowing
services/autofill/java/com/android/server/autofill/ui/SaveUi.java
08becc8c600f14c5529115cc1a1e0c97cd503f33
0
Analyze the following code function for security vulnerabilities
private static void printCharacter(String element, int charactersAllowed, String separator, boolean isDashElement) { int lengthOfElement = element.length(); StringBuilder print = new StringBuilder(element); int i = 0; while (i < charactersAllowed - lengthOfElement) { print.append(separator); i = i + 1; } if (isDashElement) { outStream.print(print + "-|"); } else { outStream.print(print + " |"); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: printCharacter File: cli/ballerina-cli-module/src/main/java/org/ballerinalang/cli/module/Search.java Repository: ballerina-platform/ballerina-lang The code follows secure coding practices.
[ "CWE-306" ]
CVE-2021-32700
MEDIUM
5.8
ballerina-platform/ballerina-lang
printCharacter
cli/ballerina-cli-module/src/main/java/org/ballerinalang/cli/module/Search.java
4609ffee1744ecd16aac09303b1783bf0a525816
0
Analyze the following code function for security vulnerabilities
@Override public Properties getMessages(String baseBundlename, Locale locale) throws IOException { if(locale == null){ return null; } Properties m = new Properties(); URL url = classLoader.getResource(this.messageRoot + baseBundlename + "_" + locale.toString() + ".properties"); if (url != null) { Charset encoding = PropertiesUtil.detectEncoding(url.openStream()); try (Reader reader = new InputStreamReader(url.openStream(), encoding)) { m.load(reader); } } return m; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getMessages File: services/src/main/java/org/keycloak/theme/ClassLoaderTheme.java Repository: keycloak The code follows secure coding practices.
[ "CWE-22" ]
CVE-2021-3856
MEDIUM
4.3
keycloak
getMessages
services/src/main/java/org/keycloak/theme/ClassLoaderTheme.java
73f0474008e1bebd0733e62a22aceda9e5de6743
0
Analyze the following code function for security vulnerabilities
public byte readByte() throws TException { byte b; if (trans_.getBytesRemainingInBuffer() > 0) { b = trans_.getBuffer()[trans_.getBufferPosition()]; trans_.consumeBuffer(1); } else { trans_.readAll(buffer, 0, 1); b = buffer[0]; } return b; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: readByte File: thrift/lib/java/src/main/java/com/facebook/thrift/protocol/TCompactProtocol.java Repository: facebook/fbthrift The code follows secure coding practices.
[ "CWE-770" ]
CVE-2019-11938
MEDIUM
5
facebook/fbthrift
readByte
thrift/lib/java/src/main/java/com/facebook/thrift/protocol/TCompactProtocol.java
08c2d412adb214c40bb03be7587057b25d053030
0
Analyze the following code function for security vulnerabilities
void restoreWidgetData(String packageName, byte[] widgetData) { // Apply the restored widget state and generate the ID update for the app AppWidgetBackupBridge.restoreWidgetState(packageName, widgetData, UserHandle.USER_OWNER); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: restoreWidgetData File: services/backup/java/com/android/server/backup/BackupManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-200" ]
CVE-2016-3759
MEDIUM
5
android
restoreWidgetData
services/backup/java/com/android/server/backup/BackupManagerService.java
9b8c6d2df35455ce9e67907edded1e4a2ecb9e28
0
Analyze the following code function for security vulnerabilities
public int getNumberOfImages() throws IndexUnreachableException { if (viewManager != null) { return viewManager.getImagesCount(); } return 0; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getNumberOfImages File: goobi-viewer-core/src/main/java/io/goobi/viewer/managedbeans/ActiveDocumentBean.java Repository: intranda/goobi-viewer-core The code follows secure coding practices.
[ "CWE-79" ]
CVE-2023-29014
MEDIUM
6.1
intranda/goobi-viewer-core
getNumberOfImages
goobi-viewer-core/src/main/java/io/goobi/viewer/managedbeans/ActiveDocumentBean.java
c29efe60e745a94d03debc17681c4950f3917455
0
Analyze the following code function for security vulnerabilities
public String getPackageForToken(IBinder token) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeStrongBinder(token); mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0); reply.readException(); String res = reply.readString(); data.recycle(); reply.recycle(); return res; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getPackageForToken File: core/java/android/app/ActivityManagerNative.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-3832
HIGH
8.3
android
getPackageForToken
core/java/android/app/ActivityManagerNative.java
e7cf91a198de995c7440b3b64352effd2e309906
0
Analyze the following code function for security vulnerabilities
public static void cursorStringToContentValues(Cursor cursor, String field, ContentValues values, String key) { values.put(key, cursor.getString(cursor.getColumnIndexOrThrow(field))); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: cursorStringToContentValues File: core/java/android/database/DatabaseUtils.java Repository: android The code follows secure coding practices.
[ "CWE-502" ]
CVE-2023-40121
MEDIUM
5.5
android
cursorStringToContentValues
core/java/android/database/DatabaseUtils.java
3287ac2d2565dc96bf6177967f8e3aed33954253
0
Analyze the following code function for security vulnerabilities
protected HashMap<String, String> getNullValueCVs(StudyBean study) { HashMap<String, String> nullValueCVs = new HashMap<String, String>(); int studyId = study.getId(); this.setNullValueCVsTypesExpected(); ArrayList viewRows = new ArrayList(); if (study.getParentStudyId() > 0) { viewRows = select(this.getNullValueCVsSql(studyId + "")); if (viewRows.size() <= 0) { viewRows = select(this.getNullValueCVsSql(study.getParentStudyId() + "")); } } else { viewRows = select(this.getNullValueCVsSql(studyId + "")); } Iterator iter = viewRows.iterator(); while (iter.hasNext()) { HashMap row = (HashMap) iter.next(); String sedOID = (String) row.get("definition_oid"); String cvOID = (String) row.get("crf_version_oid"); String nullValues = (String) row.get("null_values"); nullValueCVs.put(studyId + "-" + sedOID + "-" + cvOID, nullValues); } return nullValueCVs; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getNullValueCVs 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
getNullValueCVs
core/src/main/java/org/akaza/openclinica/dao/extract/OdmExtractDAO.java
b152cc63019230c9973965a98e4386ea5322c18f
0
Analyze the following code function for security vulnerabilities
private void subscribeToResponsePublisher( ChannelHandlerContext context, MediaType defaultResponseMediaType, AtomicReference<HttpRequest<?>> requestReference, Flowable<? extends MutableHttpResponse<?>> finalPublisher) { finalPublisher = finalPublisher.map((response) -> { Optional<MediaType> specifiedMediaType = response.getContentType(); MediaType responseMediaType = specifiedMediaType.orElse(defaultResponseMediaType); applyConfiguredHeaders(response.getHeaders()); Optional<?> responseBody = response.getBody(); if (responseBody.isPresent()) { Object body = responseBody.get(); Optional<NettyCustomizableResponseTypeHandler> typeHandler = customizableResponseTypeHandlerRegistry .findTypeHandler(body.getClass()); if (typeHandler.isPresent()) { NettyCustomizableResponseTypeHandler th = typeHandler.get(); setBodyContent(response, new NettyCustomizableResponseTypeHandlerInvoker(th, body)); return response; } if (specifiedMediaType.isPresent()) { Optional<MediaTypeCodec> registeredCodec = mediaTypeCodecRegistry.findCodec(responseMediaType, body.getClass()); if (registeredCodec.isPresent()) { MediaTypeCodec codec = registeredCodec.get(); return encodeBodyWithCodec(response, body, codec, responseMediaType, context, requestReference); } } Optional<MediaTypeCodec> registeredCodec = mediaTypeCodecRegistry.findCodec(defaultResponseMediaType, body.getClass()); if (registeredCodec.isPresent()) { MediaTypeCodec codec = registeredCodec.get(); return encodeBodyWithCodec(response, body, codec, responseMediaType, context, requestReference); } MediaTypeCodec defaultCodec = new TextPlainCodec(serverConfiguration.getDefaultCharset()); return encodeBodyWithCodec(response, body, defaultCodec, responseMediaType, context, requestReference); } else { return response; } }); finalPublisher.subscribe(new ContextCompletionAwareSubscriber<MutableHttpResponse<?>>(context) { @Override protected void onComplete(MutableHttpResponse<?> message) { writeFinalNettyResponse(message, requestReference, context); } @Override protected void doOnError(Throwable t) { exceptionCaughtInternal(context, t, (NettyHttpRequest) requestReference.get(), false); } }); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: subscribeToResponsePublisher File: http-server-netty/src/main/java/io/micronaut/http/server/netty/RoutingInBoundHandler.java Repository: micronaut-projects/micronaut-core The code follows secure coding practices.
[ "CWE-400" ]
CVE-2022-21700
MEDIUM
5
micronaut-projects/micronaut-core
subscribeToResponsePublisher
http-server-netty/src/main/java/io/micronaut/http/server/netty/RoutingInBoundHandler.java
b8ec32c311689667c69ae7d9f9c3b3a8abc96fe3
0
Analyze the following code function for security vulnerabilities
public void setMinHomeUplinkBandwidth(long minHomeUplinkBandwidth) { mMinHomeUplinkBandwidth = minHomeUplinkBandwidth; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setMinHomeUplinkBandwidth File: framework/java/android/net/wifi/hotspot2/pps/Policy.java Repository: android The code follows secure coding practices.
[ "CWE-400" ]
CVE-2023-21240
MEDIUM
5.5
android
setMinHomeUplinkBandwidth
framework/java/android/net/wifi/hotspot2/pps/Policy.java
69119d1d3102e27b6473c785125696881bce9563
0
Analyze the following code function for security vulnerabilities
@JsxFunction public void importStylesheet(final Node style) { style_ = style; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: importStylesheet File: src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XSLTProcessor.java Repository: HtmlUnit/htmlunit The code follows secure coding practices.
[ "CWE-94" ]
CVE-2023-26119
CRITICAL
9.8
HtmlUnit/htmlunit
importStylesheet
src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XSLTProcessor.java
641325bbc84702dc9800ec7037aec061ce21956b
0
Analyze the following code function for security vulnerabilities
public ActivityOptions setLaunchTaskDisplayArea( WindowContainerToken windowContainerToken) { mLaunchTaskDisplayArea = windowContainerToken; return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setLaunchTaskDisplayArea File: core/java/android/app/ActivityOptions.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-20918
CRITICAL
9.8
android
setLaunchTaskDisplayArea
core/java/android/app/ActivityOptions.java
51051de4eb40bb502db448084a83fd6cbfb7d3cf
0
Analyze the following code function for security vulnerabilities
private Intent getBaseIntentToSend() { Intent result = mSourceInfo != null ? mSourceInfo.getResolvedIntent() : getTargetIntent(); if (result == null) { Log.e(TAG, "ChooserTargetInfo: no base intent available to send"); } else { result = new Intent(result); if (mFillInIntent != null) { result.fillIn(mFillInIntent, mFillInFlags); } result.fillIn(mReferrerFillInIntent, 0); } return result; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getBaseIntentToSend File: core/java/com/android/internal/app/ChooserActivity.java Repository: android The code follows secure coding practices.
[ "CWE-254", "CWE-19" ]
CVE-2016-3752
HIGH
7.5
android
getBaseIntentToSend
core/java/com/android/internal/app/ChooserActivity.java
ddbf2db5b946be8fdc45c7b0327bf560b2a06988
0
Analyze the following code function for security vulnerabilities
protected abstract String getDiskFilename();
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getDiskFilename File: codec-http/src/main/java/io/netty/handler/codec/http/multipart/AbstractDiskHttpData.java Repository: netty The code follows secure coding practices.
[ "CWE-378", "CWE-379" ]
CVE-2021-21290
LOW
1.9
netty
getDiskFilename
codec-http/src/main/java/io/netty/handler/codec/http/multipart/AbstractDiskHttpData.java
c735357bf29d07856ad171c6611a2e1a0e0000ec
0
Analyze the following code function for security vulnerabilities
@Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { if (!suppressRead && !handshakeFailed) { try { int readerIndex = in.readerIndex(); int readableBytes = in.readableBytes(); int handshakeLength = -1; // Check if we have enough data to determine the record type and length. while (readableBytes >= SslUtils.SSL_RECORD_HEADER_LENGTH) { final int contentType = in.getUnsignedByte(readerIndex); switch (contentType) { case SslUtils.SSL_CONTENT_TYPE_CHANGE_CIPHER_SPEC: // fall-through case SslUtils.SSL_CONTENT_TYPE_ALERT: final int len = SslUtils.getEncryptedPacketLength(in, readerIndex); // Not an SSL/TLS packet if (len == SslUtils.NOT_ENCRYPTED) { handshakeFailed = true; NotSslRecordException e = new NotSslRecordException( "not an SSL/TLS record: " + ByteBufUtil.hexDump(in)); in.skipBytes(in.readableBytes()); ctx.fireUserEventTriggered(new SniCompletionEvent(e)); SslUtils.handleHandshakeFailure(ctx, e, true); throw e; } if (len == SslUtils.NOT_ENOUGH_DATA) { // Not enough data return; } // No ClientHello select(ctx, null); return; case SslUtils.SSL_CONTENT_TYPE_HANDSHAKE: final int majorVersion = in.getUnsignedByte(readerIndex + 1); // SSLv3 or TLS if (majorVersion == 3) { int packetLength = in.getUnsignedShort(readerIndex + 3) + SslUtils.SSL_RECORD_HEADER_LENGTH; if (readableBytes < packetLength) { // client hello incomplete; try again to decode once more data is ready. return; } else if (packetLength == SslUtils.SSL_RECORD_HEADER_LENGTH) { select(ctx, null); return; } final int endOffset = readerIndex + packetLength; // Let's check if we already parsed the handshake length or not. if (handshakeLength == -1) { if (readerIndex + 4 > endOffset) { // Need more data to read HandshakeType and handshakeLength (4 bytes) return; } final int handshakeType = in.getUnsignedByte(readerIndex + SslUtils.SSL_RECORD_HEADER_LENGTH); // Check if this is a clientHello(1) // See https://tools.ietf.org/html/rfc5246#section-7.4 if (handshakeType != 1) { select(ctx, null); return; } // Read the length of the handshake as it may arrive in fragments // See https://tools.ietf.org/html/rfc5246#section-7.4 handshakeLength = in.getUnsignedMedium(readerIndex + SslUtils.SSL_RECORD_HEADER_LENGTH + 1); // Consume handshakeType and handshakeLength (this sums up as 4 bytes) readerIndex += 4; packetLength -= 4; if (handshakeLength + 4 + SslUtils.SSL_RECORD_HEADER_LENGTH <= packetLength) { // We have everything we need in one packet. // Skip the record header readerIndex += SslUtils.SSL_RECORD_HEADER_LENGTH; select(ctx, in.retainedSlice(readerIndex, handshakeLength)); return; } else { if (handshakeBuffer == null) { handshakeBuffer = ctx.alloc().buffer(handshakeLength); } else { // Clear the buffer so we can aggregate into it again. handshakeBuffer.clear(); } } } // Combine the encapsulated data in one buffer but not include the SSL_RECORD_HEADER handshakeBuffer.writeBytes(in, readerIndex + SslUtils.SSL_RECORD_HEADER_LENGTH, packetLength - SslUtils.SSL_RECORD_HEADER_LENGTH); readerIndex += packetLength; readableBytes -= packetLength; if (handshakeLength <= handshakeBuffer.readableBytes()) { ByteBuf clientHello = handshakeBuffer.setIndex(0, handshakeLength); handshakeBuffer = null; select(ctx, clientHello); return; } break; } // fall-through default: // not tls, ssl or application data select(ctx, null); return; } } } catch (NotSslRecordException e) { // Just rethrow as in this case we also closed the channel and this is consistent with SslHandler. throw e; } catch (Exception e) { // unexpected encoding, ignore sni and use default if (logger.isDebugEnabled()) { logger.debug("Unexpected client hello packet: " + ByteBufUtil.hexDump(in), e); } select(ctx, null); } } }
Vulnerability Classification: - CWE: CWE-400 - CVE: CVE-2023-34462 - Severity: MEDIUM - CVSS Score: 6.5 Description: Merge pull request from GHSA-6mjq-h674-j845 Motivation: In theory the ClientHello can span multiple records and so reach the length of 16MB. This can result in high memory usage, we should allow the user to define a maximum length. Modifications: Add new constructor which allows to limit the maximum length of a ClientHello message. Result: Be able to guard against high memory usage when parsing ClientHello messages Function: decode File: handler/src/main/java/io/netty/handler/ssl/SslClientHelloHandler.java Repository: netty Fixed Code: @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { if (!suppressRead && !handshakeFailed) { try { int readerIndex = in.readerIndex(); int readableBytes = in.readableBytes(); int handshakeLength = -1; // Check if we have enough data to determine the record type and length. while (readableBytes >= SslUtils.SSL_RECORD_HEADER_LENGTH) { final int contentType = in.getUnsignedByte(readerIndex); switch (contentType) { case SslUtils.SSL_CONTENT_TYPE_CHANGE_CIPHER_SPEC: // fall-through case SslUtils.SSL_CONTENT_TYPE_ALERT: final int len = SslUtils.getEncryptedPacketLength(in, readerIndex); // Not an SSL/TLS packet if (len == SslUtils.NOT_ENCRYPTED) { handshakeFailed = true; NotSslRecordException e = new NotSslRecordException( "not an SSL/TLS record: " + ByteBufUtil.hexDump(in)); in.skipBytes(in.readableBytes()); ctx.fireUserEventTriggered(new SniCompletionEvent(e)); SslUtils.handleHandshakeFailure(ctx, e, true); throw e; } if (len == SslUtils.NOT_ENOUGH_DATA) { // Not enough data return; } // No ClientHello select(ctx, null); return; case SslUtils.SSL_CONTENT_TYPE_HANDSHAKE: final int majorVersion = in.getUnsignedByte(readerIndex + 1); // SSLv3 or TLS if (majorVersion == 3) { int packetLength = in.getUnsignedShort(readerIndex + 3) + SslUtils.SSL_RECORD_HEADER_LENGTH; if (readableBytes < packetLength) { // client hello incomplete; try again to decode once more data is ready. return; } else if (packetLength == SslUtils.SSL_RECORD_HEADER_LENGTH) { select(ctx, null); return; } final int endOffset = readerIndex + packetLength; // Let's check if we already parsed the handshake length or not. if (handshakeLength == -1) { if (readerIndex + 4 > endOffset) { // Need more data to read HandshakeType and handshakeLength (4 bytes) return; } final int handshakeType = in.getUnsignedByte(readerIndex + SslUtils.SSL_RECORD_HEADER_LENGTH); // Check if this is a clientHello(1) // See https://tools.ietf.org/html/rfc5246#section-7.4 if (handshakeType != 1) { select(ctx, null); return; } // Read the length of the handshake as it may arrive in fragments // See https://tools.ietf.org/html/rfc5246#section-7.4 handshakeLength = in.getUnsignedMedium(readerIndex + SslUtils.SSL_RECORD_HEADER_LENGTH + 1); if (handshakeLength > maxClientHelloLength && maxClientHelloLength != 0) { TooLongFrameException e = new TooLongFrameException( "ClientHello length exceeds " + maxClientHelloLength + ": " + handshakeLength); in.skipBytes(in.readableBytes()); ctx.fireUserEventTriggered(new SniCompletionEvent(e)); SslUtils.handleHandshakeFailure(ctx, e, true); throw e; } // Consume handshakeType and handshakeLength (this sums up as 4 bytes) readerIndex += 4; packetLength -= 4; if (handshakeLength + 4 + SslUtils.SSL_RECORD_HEADER_LENGTH <= packetLength) { // We have everything we need in one packet. // Skip the record header readerIndex += SslUtils.SSL_RECORD_HEADER_LENGTH; select(ctx, in.retainedSlice(readerIndex, handshakeLength)); return; } else { if (handshakeBuffer == null) { handshakeBuffer = ctx.alloc().buffer(handshakeLength); } else { // Clear the buffer so we can aggregate into it again. handshakeBuffer.clear(); } } } // Combine the encapsulated data in one buffer but not include the SSL_RECORD_HEADER handshakeBuffer.writeBytes(in, readerIndex + SslUtils.SSL_RECORD_HEADER_LENGTH, packetLength - SslUtils.SSL_RECORD_HEADER_LENGTH); readerIndex += packetLength; readableBytes -= packetLength; if (handshakeLength <= handshakeBuffer.readableBytes()) { ByteBuf clientHello = handshakeBuffer.setIndex(0, handshakeLength); handshakeBuffer = null; select(ctx, clientHello); return; } break; } // fall-through default: // not tls, ssl or application data select(ctx, null); return; } } } catch (NotSslRecordException e) { // Just rethrow as in this case we also closed the channel and this is consistent with SslHandler. throw e; } catch (TooLongFrameException e) { // Just rethrow as in this case we also closed the channel throw e; } catch (Exception e) { // unexpected encoding, ignore sni and use default if (logger.isDebugEnabled()) { logger.debug("Unexpected client hello packet: " + ByteBufUtil.hexDump(in), e); } select(ctx, null); } } }
[ "CWE-400" ]
CVE-2023-34462
MEDIUM
6.5
netty
decode
handler/src/main/java/io/netty/handler/ssl/SslClientHelloHandler.java
535da17e45201ae4278c0479e6162bb4127d4c32
1
Analyze the following code function for security vulnerabilities
@VisibleForTesting public MacAddress getPersistentMacAddress(WifiConfiguration config) { // mRandomizedMacAddressMapping had been the location to save randomized MAC addresses. String persistentMacString = mRandomizedMacAddressMapping.get( config.getNetworkKey()); // Use the MAC address stored in the storage if it exists and is valid. Otherwise // use the MAC address calculated from a hash function as the persistent MAC. if (persistentMacString != null) { try { return MacAddress.fromString(persistentMacString); } catch (IllegalArgumentException e) { Log.e(TAG, "Error creating randomized MAC address from stored value."); mRandomizedMacAddressMapping.remove(config.getNetworkKey()); } } MacAddress result = mMacAddressUtil.calculatePersistentMac(config.getNetworkKey(), mMacAddressUtil.obtainMacRandHashFunction(Process.WIFI_UID)); if (result == null) { result = mMacAddressUtil.calculatePersistentMac(config.getNetworkKey(), mMacAddressUtil.obtainMacRandHashFunction(Process.WIFI_UID)); } if (result == null) { Log.wtf(TAG, "Failed to generate MAC address from KeyStore even after retrying. " + "Using locally generated MAC address instead."); result = config.getRandomizedMacAddress(); if (DEFAULT_MAC_ADDRESS.equals(result)) { result = MacAddressUtils.createRandomUnicastAddress(); } } return result; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getPersistentMacAddress File: service/java/com/android/server/wifi/WifiConfigManager.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21242
CRITICAL
9.8
android
getPersistentMacAddress
service/java/com/android/server/wifi/WifiConfigManager.java
72e903f258b5040b8f492cf18edd124b5a1ac770
0
Analyze the following code function for security vulnerabilities
private void addRecipients(final Set<String> recipients, final String[] addresses) { for (final String email : addresses) { // Do not add this account, or any of its custom from addresses, to // the list of recipients. final String recipientAddress = Address.getEmailAddress(email).getAddress(); if (!recipientMatchesThisAccount(recipientAddress)) { recipients.add(email.replace("\"\"", "")); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: addRecipients File: src/com/android/mail/compose/ComposeActivity.java Repository: android The code follows secure coding practices.
[ "CWE-200" ]
CVE-2016-2425
MEDIUM
4.3
android
addRecipients
src/com/android/mail/compose/ComposeActivity.java
0d9dfd649bae9c181e3afc5d571903f1eb5dc46f
0
Analyze the following code function for security vulnerabilities
private static byte readByte(final InputStream input) { try { return (byte) input.read(); } catch (IOException e) { throw new StreamException(e); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: readByte File: src/main/java/org/cryptacular/CiphertextHeaderV2.java Repository: vt-middleware/cryptacular The code follows secure coding practices.
[ "CWE-770" ]
CVE-2020-7226
MEDIUM
5
vt-middleware/cryptacular
readByte
src/main/java/org/cryptacular/CiphertextHeaderV2.java
00395c232cdc62d4292ce27999c026fc1f076b1d
0
Analyze the following code function for security vulnerabilities
@Test public void executeListNullConnection(TestContext context) { postgresClientNullConnection().execute("SELECT 1", list1JsonArray(), context.asyncAssertFailure()); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: executeListNullConnection File: domain-models-runtime/src/test/java/org/folio/rest/persist/PostgresClientIT.java Repository: folio-org/raml-module-builder The code follows secure coding practices.
[ "CWE-89" ]
CVE-2019-15534
HIGH
7.5
folio-org/raml-module-builder
executeListNullConnection
domain-models-runtime/src/test/java/org/folio/rest/persist/PostgresClientIT.java
b7ef741133e57add40aa4cb19430a0065f378a94
0
Analyze the following code function for security vulnerabilities
@Override public List<String> getAutoRevokeExemptionGrantedPackages(int userId) { return getPackagesWithAutoRevokePolicy(AUTO_REVOKE_DISALLOWED, userId); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getAutoRevokeExemptionGrantedPackages File: services/core/java/com/android/server/pm/permission/PermissionManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-281" ]
CVE-2023-21249
MEDIUM
5.5
android
getAutoRevokeExemptionGrantedPackages
services/core/java/com/android/server/pm/permission/PermissionManagerService.java
c00b7e7dbc1fa30339adef693d02a51254755d7f
0
Analyze the following code function for security vulnerabilities
public void setStrict(boolean flag) { mStrict = flag; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setStrict File: core/java/android/database/sqlite/SQLiteQueryBuilder.java Repository: android The code follows secure coding practices.
[ "CWE-89" ]
CVE-2018-9493
LOW
2.1
android
setStrict
core/java/android/database/sqlite/SQLiteQueryBuilder.java
ebc250d16c747f4161167b5ff58b3aea88b37acf
0
Analyze the following code function for security vulnerabilities
public Builder options(Map<String, String> options) { this.options.clear(); if (options != null) { this.options.putAll(options); } return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: options File: clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseNode.java Repository: ClickHouse/clickhouse-java The code follows secure coding practices.
[ "CWE-209" ]
CVE-2024-23689
HIGH
8.8
ClickHouse/clickhouse-java
options
clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseNode.java
4f8d9303eb991b39ec7e7e34825241efa082238a
0
Analyze the following code function for security vulnerabilities
@RequiresPermission( value = android.Manifest.permission.READ_NEARBY_STREAMING_POLICY, conditional = true) public @NearbyStreamingPolicy int getNearbyAppStreamingPolicy() { return getNearbyAppStreamingPolicy(myUserId()); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getNearbyAppStreamingPolicy 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
getNearbyAppStreamingPolicy
core/java/android/app/admin/DevicePolicyManager.java
e2e05f488da6abc765a62e7faf10cb74e729732e
0
Analyze the following code function for security vulnerabilities
public Object xpathQuery(String xpath, QName type) throws XPathExpressionException { return xpathQuery(xpath, type, null); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: xpathQuery File: src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java Repository: jmurty/java-xmlbuilder The code follows secure coding practices.
[ "CWE-611" ]
CVE-2014-125087
MEDIUM
5.2
jmurty/java-xmlbuilder
xpathQuery
src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java
e6fddca201790abab4f2c274341c0bb8835c3e73
0
Analyze the following code function for security vulnerabilities
String getKeyId(WifiEnterpriseConfig current) { String eap = mFields.get(EAP_KEY); String phase2 = mFields.get(PHASE2_KEY); // If either eap or phase2 are not initialized, use current config details if (TextUtils.isEmpty((eap))) { eap = current.mFields.get(EAP_KEY); } if (TextUtils.isEmpty(phase2)) { phase2 = current.mFields.get(PHASE2_KEY); } return eap + "_" + phase2; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getKeyId File: wifi/java/android/net/wifi/WifiEnterpriseConfig.java Repository: android The code follows secure coding practices.
[ "CWE-200" ]
CVE-2016-3897
MEDIUM
4.3
android
getKeyId
wifi/java/android/net/wifi/WifiEnterpriseConfig.java
81be4e3aac55305cbb5c9d523cf5c96c66604b39
0
Analyze the following code function for security vulnerabilities
public void sendSetVideoState(String id) throws Exception { for (IConnectionServiceAdapter a : mConnectionServiceAdapters) { a.setVideoState(id, mConnectionById.get(id).videoState, null /*Session.Info*/); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: sendSetVideoState File: tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21283
MEDIUM
5.5
android
sendSetVideoState
tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java
9b41a963f352fdb3da1da8c633d45280badfcb24
0
Analyze the following code function for security vulnerabilities
@Override public boolean isRecognizedFormat(BufferedReader reader) throws IOException { Objects.requireNonNull(reader); /* The correct behaviour is to return false if it is certain that the file is not of the MsBib type, and true otherwise. Returning true is the safe choice if not certain. */ Document docin; try { DocumentBuilder dbuild = DocumentBuilderFactory.newInstance().newDocumentBuilder(); dbuild.setErrorHandler(new ErrorHandler() { @Override public void warning(SAXParseException exception) throws SAXException { // ignore warnings } @Override public void fatalError(SAXParseException exception) throws SAXException { throw exception; } @Override public void error(SAXParseException exception) throws SAXException { throw exception; } }); docin = dbuild.parse(new InputSource(reader)); } catch (Exception e) { return false; } return (docin == null) || docin.getDocumentElement().getTagName().contains("Sources"); }
Vulnerability Classification: - CWE: CWE-611 - CVE: CVE-2018-1000652 - Severity: HIGH - CVSS Score: 7.5 Description: Fix importer vulnerability (#4240) * Fix importer vulnerability Fixed issue #4229 where importer was vulnerable to XXE attacks by disabling DTDs along with adding warning to logger if features are unavailable. fixes #4229 * Fix minor code errors and logger optimization Removed author line in class comment. Reworded CHANGLOG.md. Set DTD features to individual final static constants. Optimized logger by parameterizing feature and error. * Rearrange import statments for project compatibility * Remove merge artefacts from changelog Function: isRecognizedFormat File: src/main/java/org/jabref/logic/importer/fileformat/MsBibImporter.java Repository: JabRef/jabref Fixed Code: @Override public boolean isRecognizedFormat(BufferedReader reader) throws IOException { Objects.requireNonNull(reader); /* The correct behavior is to return false if it is certain that the file is not of the MsBib type, and true otherwise. Returning true is the safe choice if not certain. */ Document docin; try { DocumentBuilder dbuild = makeSafeDocBuilderFactory(DocumentBuilderFactory.newInstance()).newDocumentBuilder(); dbuild.setErrorHandler(new ErrorHandler() { @Override public void warning(SAXParseException exception) throws SAXException { // ignore warnings } @Override public void fatalError(SAXParseException exception) throws SAXException { throw exception; } @Override public void error(SAXParseException exception) throws SAXException { throw exception; } }); docin = dbuild.parse(new InputSource(reader)); } catch (Exception e) { return false; } return (docin == null) || docin.getDocumentElement().getTagName().contains("Sources"); }
[ "CWE-611" ]
CVE-2018-1000652
HIGH
7.5
JabRef/jabref
isRecognizedFormat
src/main/java/org/jabref/logic/importer/fileformat/MsBibImporter.java
89f855d76713b4cd25ac0830c719cd61c511851e
1
Analyze the following code function for security vulnerabilities
private JsonValue readString() throws IOException { return new JsonString(readStringInternal()); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: readString File: src/main/org/hjson/JsonParser.java Repository: hjson/hjson-java The code follows secure coding practices.
[ "CWE-787" ]
CVE-2023-34620
HIGH
7.5
hjson/hjson-java
readString
src/main/org/hjson/JsonParser.java
91bef056d56bf968451887421c89a44af1d692ff
0
Analyze the following code function for security vulnerabilities
Association startAssociationLocked(int sourceUid, String sourceProcess, int sourceState, int targetUid, long targetVersionCode, ComponentName targetComponent, String targetProcess) { if (!mTrackingAssociations) { return null; } ArrayMap<ComponentName, SparseArray<ArrayMap<String, Association>>> components = mAssociations.get(targetUid); if (components == null) { components = new ArrayMap<>(); mAssociations.put(targetUid, components); } SparseArray<ArrayMap<String, Association>> sourceUids = components.get(targetComponent); if (sourceUids == null) { sourceUids = new SparseArray<>(); components.put(targetComponent, sourceUids); } ArrayMap<String, Association> sourceProcesses = sourceUids.get(sourceUid); if (sourceProcesses == null) { sourceProcesses = new ArrayMap<>(); sourceUids.put(sourceUid, sourceProcesses); } Association ass = sourceProcesses.get(sourceProcess); if (ass == null) { ass = new Association(sourceUid, sourceProcess, targetUid, targetComponent, targetProcess); sourceProcesses.put(sourceProcess, ass); } ass.mCount++; ass.mNesting++; if (ass.mNesting == 1) { ass.mStartTime = ass.mLastStateUptime = SystemClock.uptimeMillis(); ass.mLastState = sourceState; } return ass; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: startAssociationLocked 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
startAssociationLocked
services/core/java/com/android/server/am/ActivityManagerService.java
d10b27e539f7bc91c2360d429b9d05f05274670d
0
Analyze the following code function for security vulnerabilities
public ExecutorService getTopologyRecoveryExecutor() { return topologyRecoveryExecutor; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getTopologyRecoveryExecutor File: src/main/java/com/rabbitmq/client/ConnectionFactory.java Repository: rabbitmq/rabbitmq-java-client The code follows secure coding practices.
[ "CWE-400" ]
CVE-2023-46120
HIGH
7.5
rabbitmq/rabbitmq-java-client
getTopologyRecoveryExecutor
src/main/java/com/rabbitmq/client/ConnectionFactory.java
714aae602dcae6cb4b53cadf009323ebac313cc8
0
Analyze the following code function for security vulnerabilities
@GuardedBy("this") private final void startProcessLocked(ProcessRecord app, String hostingType, String hostingNameStr) { startProcessLocked(app, hostingType, hostingNameStr, null /* abiOverride */); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: startProcessLocked 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
startProcessLocked
services/core/java/com/android/server/am/ActivityManagerService.java
962fb40991f15be4f688d960aa00073683ebdd20
0
Analyze the following code function for security vulnerabilities
@Override public void endParagraph(Map<String, String> parameters) { getXHTMLWikiPrinter().printXMLEndElement("p"); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: endParagraph File: xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/XHTMLChainingRenderer.java Repository: xwiki/xwiki-rendering The code follows secure coding practices.
[ "CWE-79" ]
CVE-2023-32070
MEDIUM
6.1
xwiki/xwiki-rendering
endParagraph
xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/XHTMLChainingRenderer.java
c40e2f5f9482ec6c3e71dbf1fff5ba8a5e44cdc1
0
Analyze the following code function for security vulnerabilities
@Override public OnGoingLogicalCondition isEmpty() { return getOnGoingLogicalCondition(new IsEmptyCondition(selector)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isEmpty File: src/main/java/org/torpedoquery/jpa/internal/conditions/ConditionBuilder.java Repository: xjodoin/torpedoquery The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2019-11343
HIGH
7.5
xjodoin/torpedoquery
isEmpty
src/main/java/org/torpedoquery/jpa/internal/conditions/ConditionBuilder.java
3c20b874fba9cc2a78b9ace10208de1602b56c3f
0
Analyze the following code function for security vulnerabilities
private void startPersistentApps(int matchFlags) { if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL) return; synchronized (this) { try { final List<ApplicationInfo> apps = AppGlobals.getPackageManager() .getPersistentApplications(STOCK_PM_FLAGS | matchFlags).getList(); for (ApplicationInfo app : apps) { if (!"android".equals(app.packageName)) { addAppLocked(app, false, null /* ABI override */); } } } catch (RemoteException ex) { } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: startPersistentApps 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
startPersistentApps
services/core/java/com/android/server/am/ActivityManagerService.java
6c049120c2d749f0c0289d822ec7d0aa692f55c5
0
Analyze the following code function for security vulnerabilities
@Override public Element getDocumentElement() { return doc.getDocumentElement(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getDocumentElement File: HTML_Renderer/src/main/java/org/loboevolution/html/js/xml/XMLDocument.java Repository: LoboEvolution The code follows secure coding practices.
[ "CWE-611" ]
CVE-2018-1000540
MEDIUM
6.8
LoboEvolution
getDocumentElement
HTML_Renderer/src/main/java/org/loboevolution/html/js/xml/XMLDocument.java
9b75694cedfa4825d4a2330abf2719d470c654cd
0
Analyze the following code function for security vulnerabilities
private void dumpInner(PrintWriter pw) { dumpInner(pw, new DumpFilter()); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: dumpInner File: services/core/java/com/android/server/pm/ShortcutService.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-40079
HIGH
7.8
android
dumpInner
services/core/java/com/android/server/pm/ShortcutService.java
96e0524c48c6e58af7d15a2caf35082186fc8de2
0
Analyze the following code function for security vulnerabilities
public Set<String> fromXWiki(String xwikiGroup) { return this.xwikiMapping.get(xwikiGroup); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: fromXWiki File: oidc-authenticator/src/main/java/org/xwiki/contrib/oidc/auth/internal/OIDCClientConfiguration.java Repository: xwiki-contrib/oidc The code follows secure coding practices.
[ "CWE-287" ]
CVE-2022-39387
HIGH
7.5
xwiki-contrib/oidc
fromXWiki
oidc-authenticator/src/main/java/org/xwiki/contrib/oidc/auth/internal/OIDCClientConfiguration.java
0247af1417925b9734ab106ad7cd934ee870ac89
0
Analyze the following code function for security vulnerabilities
public static void main(String[] args) throws UnsupportedEncodingException { System.out.println(new search().createRequestString("hello", 1)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: main File: src/main/java/custom/application/search.java Repository: m0ver/bible-online The code follows secure coding practices.
[ "CWE-89" ]
CVE-2022-4454
CRITICAL
9.8
m0ver/bible-online
main
src/main/java/custom/application/search.java
6ef0aabfb2d4ccd53fcaa9707781303af357410e
0
Analyze the following code function for security vulnerabilities
public ServerBuilder tlsSelfSigned(boolean tlsSelfSigned) { virtualHostTemplate.tlsSelfSigned(tlsSelfSigned); return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: tlsSelfSigned File: core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java Repository: line/armeria The code follows secure coding practices.
[ "CWE-400" ]
CVE-2023-44487
HIGH
7.5
line/armeria
tlsSelfSigned
core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java
df7f85824a62e997b910b5d6194a3335841065fd
0
Analyze the following code function for security vulnerabilities
void setOnBackInvokedCallbackInfo( @Nullable OnBackInvokedCallbackInfo callbackInfo) { ProtoLog.d(WM_DEBUG_BACK_PREVIEW, "%s: Setting back callback %s", this, callbackInfo); mOnBackInvokedCallbackInfo = callbackInfo; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setOnBackInvokedCallbackInfo 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
setOnBackInvokedCallbackInfo
services/core/java/com/android/server/wm/WindowState.java
7428962d3b064ce1122809d87af65099d1129c9e
0
Analyze the following code function for security vulnerabilities
@Override public KexState getKexState() { return kexState.get(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getKexState File: sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java Repository: apache/mina-sshd The code follows secure coding practices.
[ "CWE-354" ]
CVE-2023-48795
MEDIUM
5.9
apache/mina-sshd
getKexState
sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
6b0fd46f64bcb75eeeee31d65f10242660aad7c1
0
Analyze the following code function for security vulnerabilities
protected void onCancelButtonSubmit(final AjaxRequestTarget target) { }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onCancelButtonSubmit File: src/main/java/org/projectforge/web/dialog/ModalDialog.java Repository: micromata/projectforge-webapp The code follows secure coding practices.
[ "CWE-352" ]
CVE-2013-7251
MEDIUM
6.8
micromata/projectforge-webapp
onCancelButtonSubmit
src/main/java/org/projectforge/web/dialog/ModalDialog.java
422de35e3c3141e418a73bfb39b430d5fd74077e
0
Analyze the following code function for security vulnerabilities
void updateCpuStatsNow() { synchronized (mProcessCpuTracker) { mProcessCpuMutexFree.set(false); final long now = SystemClock.uptimeMillis(); boolean haveNewCpuStats = false; if (MONITOR_CPU_USAGE && mLastCpuTime.get() < (now-MONITOR_CPU_MIN_TIME)) { mLastCpuTime.set(now); mProcessCpuTracker.update(); if (mProcessCpuTracker.hasGoodLastStats()) { haveNewCpuStats = true; //Slog.i(TAG, mProcessCpu.printCurrentState()); //Slog.i(TAG, "Total CPU usage: " // + mProcessCpu.getTotalCpuPercent() + "%"); // Slog the cpu usage if the property is set. if ("true".equals(SystemProperties.get("events.cpu"))) { int user = mProcessCpuTracker.getLastUserTime(); int system = mProcessCpuTracker.getLastSystemTime(); int iowait = mProcessCpuTracker.getLastIoWaitTime(); int irq = mProcessCpuTracker.getLastIrqTime(); int softIrq = mProcessCpuTracker.getLastSoftIrqTime(); int idle = mProcessCpuTracker.getLastIdleTime(); int total = user + system + iowait + irq + softIrq + idle; if (total == 0) total = 1; EventLog.writeEvent(EventLogTags.CPU, ((user+system+iowait+irq+softIrq) * 100) / total, (user * 100) / total, (system * 100) / total, (iowait * 100) / total, (irq * 100) / total, (softIrq * 100) / total); } } } final BatteryStatsImpl bstats = mBatteryStatsService.getActiveStatistics(); synchronized(bstats) { synchronized(mPidsSelfLocked) { if (haveNewCpuStats) { if (bstats.startAddingCpuLocked()) { int totalUTime = 0; int totalSTime = 0; final int N = mProcessCpuTracker.countStats(); for (int i=0; i<N; i++) { ProcessCpuTracker.Stats st = mProcessCpuTracker.getStats(i); if (!st.working) { continue; } ProcessRecord pr = mPidsSelfLocked.get(st.pid); totalUTime += st.rel_utime; totalSTime += st.rel_stime; if (pr != null) { BatteryStatsImpl.Uid.Proc ps = pr.curProcBatteryStats; if (ps == null || !ps.isActive()) { pr.curProcBatteryStats = ps = bstats.getProcessStatsLocked( pr.info.uid, pr.processName); } ps.addCpuTimeLocked(st.rel_utime, st.rel_stime); pr.curCpuTime += st.rel_utime + st.rel_stime; if (pr.lastCpuTime == 0) { pr.lastCpuTime = pr.curCpuTime; } } else { BatteryStatsImpl.Uid.Proc ps = st.batteryStats; if (ps == null || !ps.isActive()) { st.batteryStats = ps = bstats.getProcessStatsLocked( bstats.mapUid(st.uid), st.name); } ps.addCpuTimeLocked(st.rel_utime, st.rel_stime); } } final int userTime = mProcessCpuTracker.getLastUserTime(); final int systemTime = mProcessCpuTracker.getLastSystemTime(); final int iowaitTime = mProcessCpuTracker.getLastIoWaitTime(); final int irqTime = mProcessCpuTracker.getLastIrqTime(); final int softIrqTime = mProcessCpuTracker.getLastSoftIrqTime(); final int idleTime = mProcessCpuTracker.getLastIdleTime(); bstats.finishAddingCpuLocked(totalUTime, totalSTime, userTime, systemTime, iowaitTime, irqTime, softIrqTime, idleTime); } } } if (mLastWriteTime < (now-BATTERY_STATS_TIME)) { mLastWriteTime = now; mBatteryStatsService.scheduleWriteToDisk(); } } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: updateCpuStatsNow 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
updateCpuStatsNow
services/core/java/com/android/server/am/ActivityManagerService.java
962fb40991f15be4f688d960aa00073683ebdd20
0
Analyze the following code function for security vulnerabilities
@Override public Date convertToDate(Object value) { try { return value == null ? null : (Date) value; } catch (ClassCastException e) { throw new IllegalArgumentException("Not a java.util.Date: " + value + " (" + value.getClass().getName() + ")"); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: convertToDate 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
convertToDate
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
public static String getTextArea(String content, XWikiContext context) { StringBuilder result = new StringBuilder(); // Forcing a new line after the <textarea> tag, as // http://www.w3.org/TR/html4/appendix/notes.html#h-B.3.1 causes an empty line at the start // of the document content to be trimmed. result.append("<textarea name=\"content\" id=\"content\" rows=\"25\" cols=\"80\">\n"); result.append(XMLUtils.escape(content)); result.append("</textarea>"); return result.toString(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getTextArea 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
getTextArea
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java
f9a677408ffb06f309be46ef9d8df1915d9099a4
0
Analyze the following code function for security vulnerabilities
public static String[] getDefaultServerHostkeyAlgorithmList() { return HOSTKEY_ALGS.toArray(new String[0]); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getDefaultServerHostkeyAlgorithmList File: src/main/java/com/trilead/ssh2/transport/KexManager.java Repository: connectbot/sshlib The code follows secure coding practices.
[ "CWE-354" ]
CVE-2023-48795
MEDIUM
5.9
connectbot/sshlib
getDefaultServerHostkeyAlgorithmList
src/main/java/com/trilead/ssh2/transport/KexManager.java
5c8b534f6e97db7ac0e0e579331213aa25c173ab
0
Analyze the following code function for security vulnerabilities
@Override public ResponseWriter getWrapped() { if (writer == null) { writer = ctx.createPartialResponseWriter(); } return writer; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getWrapped File: impl/src/main/java/com/sun/faces/context/PartialViewContextImpl.java Repository: eclipse-ee4j/mojarra The code follows secure coding practices.
[ "CWE-79" ]
CVE-2019-17091
MEDIUM
4.3
eclipse-ee4j/mojarra
getWrapped
impl/src/main/java/com/sun/faces/context/PartialViewContextImpl.java
a3fa9573789ed5e867c43ea38374f4dbd5a8f81f
0
Analyze the following code function for security vulnerabilities
@Test public void testDeserializationFromStringWithZeroZoneOffset03() throws Exception { Instant date = Instant.now(); String json = formatWithZeroZoneOffset(date, "+00"); Instant result = MAPPER.readValue(json, Instant.class); assertEquals("The value is not correct.", date, result); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: testDeserializationFromStringWithZeroZoneOffset03 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
testDeserializationFromStringWithZeroZoneOffset03
datetime/src/test/java/com/fasterxml/jackson/datatype/jsr310/TestInstantSerialization.java
ba27ce5909dfb49bcaf753ad3e04ecb980010b0b
0
Analyze the following code function for security vulnerabilities
@Override public String batchUploadFile(HttpServletRequest request, List<MultipartFile> filedatas, SystemConfig systemConfig) { String uploadQiNiu = systemConfig.getUploadQiNiu(); String uploadLocal = systemConfig.getUploadLocal(); String uploadMinio = systemConfig.getUploadMinio(); // 判断来源 String source = request.getParameter(SysConf.SOURCE); //如果是用户上传,则包含用户uid String userUid = ""; //如果是管理员上传,则包含管理员uid String adminUid = ""; //项目名 String projectName = ""; //模块名 String sortName = ""; // 判断图片来源 if (SysConf.PICTURE.equals(source)) { // 当从vue-mogu-web网站过来的,直接从参数中获取 userUid = request.getParameter(SysConf.USER_UID); adminUid = request.getParameter(SysConf.ADMIN_UID); projectName = request.getParameter(SysConf.PROJECT_NAME); sortName = request.getParameter(SysConf.SORT_NAME); } else if (SysConf.ADMIN.equals(source)) { // 当图片从mogu-admin传递过来的时候 userUid = request.getAttribute(SysConf.USER_UID).toString(); adminUid = request.getAttribute(SysConf.ADMIN_UID).toString(); projectName = request.getAttribute(SysConf.PROJECT_NAME).toString(); sortName = request.getAttribute(SysConf.SORT_NAME).toString(); } else { userUid = request.getAttribute(SysConf.USER_UID).toString(); adminUid = request.getAttribute(SysConf.ADMIN_UID).toString(); projectName = request.getAttribute(SysConf.PROJECT_NAME).toString(); sortName = request.getAttribute(SysConf.SORT_NAME).toString(); } //projectName现在默认base if (StringUtils.isEmpty(projectName)) { projectName = "base"; } //TODO 检测用户上传,如果不是网站的用户就不能调用 if (StringUtils.isEmpty(userUid) && StringUtils.isEmpty(adminUid)) { return ResultUtil.result(SysConf.ERROR, "请先注册"); } QueryWrapper<FileSort> queryWrapper = new QueryWrapper<>(); queryWrapper.eq(SQLConf.SORT_NAME, sortName); queryWrapper.eq(SQLConf.PROJECT_NAME, projectName); queryWrapper.eq(SQLConf.STATUS, EStatus.ENABLE); List<FileSort> fileSorts = fileSortService.list(queryWrapper); FileSort fileSort = null; if (fileSorts.size() >= 1) { fileSort = fileSorts.get(0); } else { return ResultUtil.result(SysConf.ERROR, "文件不被允许上传"); } String sortUrl = fileSort.getUrl(); //判断url是否为空,如果为空,使用默认 if (StringUtils.isEmpty(sortUrl)) { sortUrl = "base/common/"; } else { sortUrl = fileSort.getUrl(); } List<File> lists = new ArrayList<>(); //文件上传 if (filedatas != null && filedatas.size() > 0) { for (MultipartFile filedata : filedatas) { String oldName = filedata.getOriginalFilename(); long size = filedata.getSize(); //获取扩展名,默认是jpg String picExpandedName = FileUtils.getPicExpandedName(oldName); //获取新文件名 String newFileName = System.currentTimeMillis() + Constants.SYMBOL_POINT + picExpandedName; String localUrl = ""; String qiNiuUrl = ""; String minioUrl = ""; try { MultipartFile tempFileData = filedata; // 上传七牛云,判断是否能够上传七牛云 if (EOpenStatus.OPEN.equals(uploadQiNiu)) { qiNiuUrl = qiniuService.uploadFile(tempFileData); } // 判断是否能够上传Minio文件服务器 if (EOpenStatus.OPEN.equals(uploadMinio)) { minioUrl = minioService.uploadFile(tempFileData); } // 判断是否能够上传至本地 if (EOpenStatus.OPEN.equals(uploadLocal)) { localUrl = localFileService.uploadFile(filedata, fileSort); } } catch (Exception e) { log.info("上传文件异常: {}", e.getMessage()); e.getStackTrace(); return ResultUtil.result(SysConf.ERROR, "文件上传失败,请检查系统配置"); } File file = new File(); file.setCreateTime(new Date(System.currentTimeMillis())); file.setFileSortUid(fileSort.getUid()); file.setFileOldName(oldName); file.setFileSize(size); file.setPicExpandedName(picExpandedName); file.setPicName(newFileName); file.setPicUrl(localUrl); file.setStatus(EStatus.ENABLE); file.setUserUid(userUid); file.setAdminUid(adminUid); file.setQiNiuUrl(qiNiuUrl); file.setMinioUrl(minioUrl); file.insert(); lists.add(file); } //保存成功返回数据 return ResultUtil.result(SysConf.SUCCESS, lists); } return ResultUtil.result(SysConf.ERROR, "请上传图片"); }
Vulnerability Classification: - CWE: CWE-434 - CVE: CVE-2022-27047 - Severity: HIGH - CVSS Score: 7.5 Description: fix:图片上传接口增加格式校验;https://github.com/moxi624/mogu_blog_v2/issues/62 Function: batchUploadFile File: mogu_picture/src/main/java/com/moxi/mogublog/picture/service/impl/FileServiceImpl.java Repository: moxi624/mogu_blog_v2 Fixed Code: @Override public String batchUploadFile(HttpServletRequest request, List<MultipartFile> filedatas, SystemConfig systemConfig) { String uploadQiNiu = systemConfig.getUploadQiNiu(); String uploadLocal = systemConfig.getUploadLocal(); String uploadMinio = systemConfig.getUploadMinio(); // 判断来源 String source = request.getParameter(SysConf.SOURCE); //如果是用户上传,则包含用户uid String userUid = ""; //如果是管理员上传,则包含管理员uid String adminUid = ""; //项目名 String projectName = ""; //模块名 String sortName = ""; // 判断图片来源 if (SysConf.PICTURE.equals(source)) { // 当从vue-mogu-web网站过来的,直接从参数中获取 userUid = request.getParameter(SysConf.USER_UID); adminUid = request.getParameter(SysConf.ADMIN_UID); projectName = request.getParameter(SysConf.PROJECT_NAME); sortName = request.getParameter(SysConf.SORT_NAME); } else if (SysConf.ADMIN.equals(source)) { // 当图片从mogu-admin传递过来的时候 userUid = request.getAttribute(SysConf.USER_UID).toString(); adminUid = request.getAttribute(SysConf.ADMIN_UID).toString(); projectName = request.getAttribute(SysConf.PROJECT_NAME).toString(); sortName = request.getAttribute(SysConf.SORT_NAME).toString(); } else { userUid = request.getAttribute(SysConf.USER_UID).toString(); adminUid = request.getAttribute(SysConf.ADMIN_UID).toString(); projectName = request.getAttribute(SysConf.PROJECT_NAME).toString(); sortName = request.getAttribute(SysConf.SORT_NAME).toString(); } //projectName现在默认base if (StringUtils.isEmpty(projectName)) { projectName = "base"; } //TODO 检测用户上传,如果不是网站的用户就不能调用 if (StringUtils.isEmpty(userUid) && StringUtils.isEmpty(adminUid)) { return ResultUtil.result(SysConf.ERROR, "请先注册"); } QueryWrapper<FileSort> queryWrapper = new QueryWrapper<>(); queryWrapper.eq(SQLConf.SORT_NAME, sortName); queryWrapper.eq(SQLConf.PROJECT_NAME, projectName); queryWrapper.eq(SQLConf.STATUS, EStatus.ENABLE); List<FileSort> fileSorts = fileSortService.list(queryWrapper); FileSort fileSort = null; if (fileSorts.size() >= 1) { fileSort = fileSorts.get(0); } else { return ResultUtil.result(SysConf.ERROR, "文件不被允许上传"); } String sortUrl = fileSort.getUrl(); //判断url是否为空,如果为空,使用默认 if (StringUtils.isEmpty(sortUrl)) { sortUrl = "base/common/"; } else { sortUrl = fileSort.getUrl(); } List<File> lists = new ArrayList<>(); //文件上传 if (filedatas != null && filedatas.size() > 0) { for (MultipartFile filedata : filedatas) { String oldName = filedata.getOriginalFilename(); long size = filedata.getSize(); //获取扩展名,默认是jpg String picExpandedName = FileUtils.getPicExpandedName(oldName); // 检查是否是安全的格式 if (!FileUtils.isPic(picExpandedName)) { throw new InsertException("请上传正确格式的文件"); } //获取新文件名 String newFileName = System.currentTimeMillis() + Constants.SYMBOL_POINT + picExpandedName; String localUrl = ""; String qiNiuUrl = ""; String minioUrl = ""; try { MultipartFile tempFileData = filedata; // 上传七牛云,判断是否能够上传七牛云 if (EOpenStatus.OPEN.equals(uploadQiNiu)) { qiNiuUrl = qiniuService.uploadFile(tempFileData); } // 判断是否能够上传Minio文件服务器 if (EOpenStatus.OPEN.equals(uploadMinio)) { minioUrl = minioService.uploadFile(tempFileData); } // 判断是否能够上传至本地 if (EOpenStatus.OPEN.equals(uploadLocal)) { localUrl = localFileService.uploadFile(filedata, fileSort); } } catch (Exception e) { log.info("上传文件异常: {}", e.getMessage()); e.getStackTrace(); return ResultUtil.result(SysConf.ERROR, "文件上传失败,请检查系统配置"); } File file = new File(); file.setCreateTime(new Date(System.currentTimeMillis())); file.setFileSortUid(fileSort.getUid()); file.setFileOldName(oldName); file.setFileSize(size); file.setPicExpandedName(picExpandedName); file.setPicName(newFileName); file.setPicUrl(localUrl); file.setStatus(EStatus.ENABLE); file.setUserUid(userUid); file.setAdminUid(adminUid); file.setQiNiuUrl(qiNiuUrl); file.setMinioUrl(minioUrl); file.insert(); lists.add(file); } //保存成功返回数据 return ResultUtil.result(SysConf.SUCCESS, lists); } return ResultUtil.result(SysConf.ERROR, "请上传图片"); }
[ "CWE-434" ]
CVE-2022-27047
HIGH
7.5
moxi624/mogu_blog_v2
batchUploadFile
mogu_picture/src/main/java/com/moxi/mogublog/picture/service/impl/FileServiceImpl.java
2d9eb941cda8fd168f9447cd6b4262f31f074d92
1
Analyze the following code function for security vulnerabilities
public Registration addColumnVisibilityChangeListener( ColumnVisibilityChangeListener listener) { return addListener(ColumnVisibilityChangeEvent.class, listener, COLUMN_VISIBILITY_METHOD); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: addColumnVisibilityChangeListener 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
addColumnVisibilityChangeListener
server/src/main/java/com/vaadin/ui/Grid.java
c40bed109c3723b38694ed160ea647fef5b28593
0
Analyze the following code function for security vulnerabilities
public int getReadTimeout() { return readTimeout; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getReadTimeout 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
getReadTimeout
samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/ApiClient.java
2c576483f26f85b3979c6948a131f585c237109a
0
Analyze the following code function for security vulnerabilities
public ApiClient setReadTimeout(int readTimeout) { this.readTimeout = readTimeout; httpClient.property(ClientProperties.READ_TIMEOUT, readTimeout); return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setReadTimeout File: samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java Repository: OpenAPITools/openapi-generator The code follows secure coding practices.
[ "CWE-668" ]
CVE-2021-21430
LOW
2.1
OpenAPITools/openapi-generator
setReadTimeout
samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/ApiClient.java
2c576483f26f85b3979c6948a131f585c237109a
0
Analyze the following code function for security vulnerabilities
protected String evaluateTitle(String title, DocumentModelBridge document, DocumentDisplayerParameters parameters) { StringWriter writer = new StringWriter(); String namespace = defaultEntityReferenceSerializer.serialize(parameters.isTransformationContextIsolated() ? document.getDocumentReference() : documentAccessBridge.getCurrentDocumentReference()); // Get the velocity engine VelocityEngine velocityEngine; try { velocityEngine = this.velocityManager.getVelocityEngine(); } catch (Exception e) { throw new RuntimeException(e); } // Execute Velocity code Map<String, Object> backupObjects = null; boolean canPop = false; EntityReference currentWikiReference = this.modelContext.getCurrentEntityReference(); try { if (parameters.isExecutionContextIsolated()) { backupObjects = new HashMap<>(); // The following method call also clones the execution context. documentAccessBridge.pushDocumentInContext(backupObjects, document); // Pop the document from the context only if the push was successful! canPop = true; // Make sure to synchronize the context wiki with the context document's wiki. modelContext.setCurrentEntityReference(document.getDocumentReference().getWikiReference()); } velocityEngine.evaluate(velocityManager.getVelocityContext(), writer, namespace, title); } catch (Exception e) { throw new RuntimeException(e); } finally { if (canPop) { documentAccessBridge.popDocumentFromContext(backupObjects); // Also restore the context wiki. this.modelContext.setCurrentEntityReference(currentWikiReference); } } return writer.toString(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: evaluateTitle File: xwiki-platform-core/xwiki-platform-display/xwiki-platform-display-api/src/main/java/org/xwiki/display/internal/AbstractDocumentTitleDisplayer.java Repository: xwiki/xwiki-platform The code follows secure coding practices.
[ "CWE-459" ]
CVE-2023-36468
HIGH
8.8
xwiki/xwiki-platform
evaluateTitle
xwiki-platform-core/xwiki-platform-display/xwiki-platform-display-api/src/main/java/org/xwiki/display/internal/AbstractDocumentTitleDisplayer.java
15a6f845d8206b0ae97f37aa092ca43d4f9d6e59
0
Analyze the following code function for security vulnerabilities
public ApiClient setApiKeyPrefix(String apiKeyPrefix) { for (Authentication auth : authentications.values()) { if (auth instanceof ApiKeyAuth) { ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); return this; } } throw new RuntimeException("No API key authentication configured!"); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setApiKeyPrefix File: samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/ApiClient.java Repository: OpenAPITools/openapi-generator The code follows secure coding practices.
[ "CWE-668" ]
CVE-2021-21430
LOW
2.1
OpenAPITools/openapi-generator
setApiKeyPrefix
samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/ApiClient.java
2c576483f26f85b3979c6948a131f585c237109a
0
Analyze the following code function for security vulnerabilities
@Override public String getMyMucNick(String jid) { MultiUserChat muc = multiUserChats.get(jid); if (muc != null && muc.getNickname() != null) return muc.getNickname(); if (mucJIDs.contains(jid)) { ChatRoomHelper.RoomInfo ri = ChatRoomHelper.getRoomInfo(mService, jid); if (ri != null) return ri.nickname; } return null; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getMyMucNick File: src/org/yaxim/androidclient/service/SmackableImp.java Repository: ge0rg/yaxim The code follows secure coding practices.
[ "CWE-20", "CWE-346" ]
CVE-2017-5589
MEDIUM
4.3
ge0rg/yaxim
getMyMucNick
src/org/yaxim/androidclient/service/SmackableImp.java
65a38dc77545d9568732189e86089390f0ceaf9f
0
Analyze the following code function for security vulnerabilities
@Deprecated public void setPhonyDocument(String docName, XWikiContext context, VelocityContext vcontext) { setPhonyDocument(getCurrentMixedDocumentReferenceResolver().resolve(docName), context, vcontext); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setPhonyDocument 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
setPhonyDocument
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java
f9a677408ffb06f309be46ef9d8df1915d9099a4
0
Analyze the following code function for security vulnerabilities
public GridStaticCellType getCellType() { return cellState.type; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getCellType 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
getCellType
server/src/main/java/com/vaadin/ui/Grid.java
b9ba10adaa06a0977c531f878c3f0046b67f9cc0
0
Analyze the following code function for security vulnerabilities
private String getLetter(String name) { String[] tokens = Iterables.toArray(Splitter.on(" ").split(name.trim()), String.class); char c = tokens[0].charAt(0); StringBuffer sb = new StringBuffer(); sb.append(c); if (tokens.length > 1) { c = tokens[1].charAt(0); sb.append(c); } return sb.toString(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getLetter File: server-core/src/main/java/io/onedev/server/web/avatar/DefaultAvatarManager.java Repository: theonedev/onedev The code follows secure coding practices.
[ "CWE-552" ]
CVE-2022-39208
HIGH
7.5
theonedev/onedev
getLetter
server-core/src/main/java/io/onedev/server/web/avatar/DefaultAvatarManager.java
8aa94e0daf8447cdf76d4f27bfda0a85a7ea5822
0
Analyze the following code function for security vulnerabilities
public @NotNull DragonflyBuilder addRepositories(@NotNull String... repositories) { this.repositories.addAll(Arrays.asList(repositories)); return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: addRepositories File: src/main/java/dev/hypera/dragonfly/DragonflyBuilder.java Repository: HyperaDev/Dragonfly The code follows secure coding practices.
[ "CWE-611" ]
CVE-2022-41967
HIGH
7.5
HyperaDev/Dragonfly
addRepositories
src/main/java/dev/hypera/dragonfly/DragonflyBuilder.java
9661375e1135127ca6cdb5712e978bec33cc06b3
0
Analyze the following code function for security vulnerabilities
@Test public void testCustomPatternWithAnnotations02() throws Exception { //Test date is pushed one year after start of the epoch just to avoid possible issues with UTC-X TZs which could //push the instant before tha start of the epoch final Instant instant = ZonedDateTime.ofInstant(Instant.ofEpochMilli(0), ZoneId.of("UTC")).plusYears(1).toInstant(); final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(CUSTOM_PATTERN); final String valueInUTC = formatter.withZone(ZoneId.of("UTC")).format(instant); final WrapperWithCustomPattern input = new WrapperWithCustomPattern(instant); String json = MAPPER.writeValueAsString(input); assertTrue("Instant in UTC timezone was not serialized as expected.", json.contains(aposToQuotes("'valueInUTC':'" + valueInUTC + "'"))); WrapperWithCustomPattern result = MAPPER.readValue(json, WrapperWithCustomPattern.class); assertEquals("Instant in UTC timezone was not deserialized as expected.", input.valueInUTC, result.valueInUTC); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: testCustomPatternWithAnnotations02 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
testCustomPatternWithAnnotations02
datetime/src/test/java/com/fasterxml/jackson/datatype/jsr310/TestInstantSerialization.java
ba27ce5909dfb49bcaf753ad3e04ecb980010b0b
0
Analyze the following code function for security vulnerabilities
@CalledByNative public int getViewportWidthPix() { return mViewportWidthPix; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getViewportWidthPix File: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java Repository: chromium The code follows secure coding practices.
[ "CWE-1021" ]
CVE-2015-1241
MEDIUM
4.3
chromium
getViewportWidthPix
content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
9d343ad2ea6ec395c377a4efa266057155bfa9c1
0
Analyze the following code function for security vulnerabilities
public void requestDestroyed(HttpServletRequest request) { if (isRequestDestroyed(request)) { return; } if (nestedInvocationGuardEnabled) { Counter counter = nestedInvocationGuard.get(); if (counter != null) { counter.value--; if (counter.value > 0) { return; // this is a nested invocation, ignore it } else { nestedInvocationGuard.remove(); // this is the outer invocation request.removeAttribute(GUARD_PARAMETER_NAME); } } else { ServletLogger.LOG.guardNotSet(); return; } } if (ignoreForwards && isForwardedRequest(request)) { return; } if (ignoreIncludes && isIncludedRequest(request)) { return; } if (!contextActivationFilter.accepts(request)) { return; } ServletLogger.LOG.requestDestroyed(request); try { conversationContextActivator.deactivateConversationContext(request); /* * if this request has been switched to async then do not invalidate the context now * as it will be invalidated at the end of the async operation. */ if (!servletApi.isAsyncSupported() || !servletApi.isAsyncStarted(request)) { getRequestContext().invalidate(); } getRequestContext().deactivate(); // fire @Destroyed(RequestScoped.class) requestDestroyedEvent.fire(request); getSessionContext().deactivate(); // fire @Destroyed(SessionScoped.class) if (!getSessionContext().isValid()) { sessionDestroyedEvent.fire((HttpSession) request.getAttribute(HTTP_SESSION)); } } finally { getRequestContext().dissociate(request); // WFLY-1533 Underlying HTTP session may be invalid try { getSessionContext().dissociate(request); } catch (Exception e) { ServletLogger.LOG.unableToDissociateContext(getSessionContext(), request); ServletLogger.LOG.catchingDebug(e); } // Catch block is inside the activator method so that we're able to log the context conversationContextActivator.disassociateConversationContext(request); SessionHolder.clear(); } }
Vulnerability Classification: - CWE: CWE-362 - CVE: CVE-2014-8122 - Severity: MEDIUM - CVSS Score: 4.3 Description: WELD-1802 An exception during context deactivation/dissociation should not abort further procesing Function: requestDestroyed File: impl/src/main/java/org/jboss/weld/servlet/HttpContextLifecycle.java Repository: weld/core Fixed Code: public void requestDestroyed(HttpServletRequest request) { if (isRequestDestroyed(request)) { return; } if (nestedInvocationGuardEnabled) { Counter counter = nestedInvocationGuard.get(); if (counter != null) { counter.value--; if (counter.value > 0) { return; // this is a nested invocation, ignore it } else { nestedInvocationGuard.remove(); // this is the outer invocation request.removeAttribute(GUARD_PARAMETER_NAME); } } else { ServletLogger.LOG.guardNotSet(); return; } } if (ignoreForwards && isForwardedRequest(request)) { return; } if (ignoreIncludes && isIncludedRequest(request)) { return; } if (!contextActivationFilter.accepts(request)) { return; } ServletLogger.LOG.requestDestroyed(request); try { conversationContextActivator.deactivateConversationContext(request); /* * if this request has been switched to async then do not invalidate the context now * as it will be invalidated at the end of the async operation. */ if (!servletApi.isAsyncSupported() || !servletApi.isAsyncStarted(request)) { getRequestContext().invalidate(); } safelyDeactivate(getRequestContext(), request); // fire @Destroyed(RequestScoped.class) requestDestroyedEvent.fire(request); safelyDeactivate(getSessionContext(), request); // fire @Destroyed(SessionScoped.class) if (!getSessionContext().isValid()) { sessionDestroyedEvent.fire((HttpSession) request.getAttribute(HTTP_SESSION)); } } finally { safelyDissociate(getRequestContext(), request); // WFLY-1533 Underlying HTTP session may be invalid safelyDissociate(getSessionContext(), request); // Catch block is inside the activator method so that we're able to log the context conversationContextActivator.disassociateConversationContext(request); SessionHolder.clear(); } }
[ "CWE-362" ]
CVE-2014-8122
MEDIUM
4.3
weld/core
requestDestroyed
impl/src/main/java/org/jboss/weld/servlet/HttpContextLifecycle.java
8e413202fa1af08c09c580f444e4fd16874f9c65
1
Analyze the following code function for security vulnerabilities
private void verboseLog(String msg) { if (VDBG) Log.v(TAG, msg); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: verboseLog File: src/com/android/bluetooth/btservice/AdapterState.java Repository: android The code follows secure coding practices.
[ "CWE-362", "CWE-20" ]
CVE-2016-3760
MEDIUM
5.4
android
verboseLog
src/com/android/bluetooth/btservice/AdapterState.java
122feb9a0b04290f55183ff2f0384c6c53756bd8
0
Analyze the following code function for security vulnerabilities
public HTTPRequest.Method getUserInfoEndPointMethod() { return getProperty(PROP_ENDPOINT_USERINFO_METHOD, HTTPRequest.Method.GET); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getUserInfoEndPointMethod File: oidc-authenticator/src/main/java/org/xwiki/contrib/oidc/auth/internal/OIDCClientConfiguration.java Repository: xwiki-contrib/oidc The code follows secure coding practices.
[ "CWE-287" ]
CVE-2022-39387
HIGH
7.5
xwiki-contrib/oidc
getUserInfoEndPointMethod
oidc-authenticator/src/main/java/org/xwiki/contrib/oidc/auth/internal/OIDCClientConfiguration.java
0247af1417925b9734ab106ad7cd934ee870ac89
0
Analyze the following code function for security vulnerabilities
private static SecurityException invalidDigest(String signatureFile, String name, String jarName) { throw new SecurityException(signatureFile + " has invalid digest for " + name + " in " + jarName); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: invalidDigest File: core/java/android/util/jar/StrictJarVerifier.java Repository: android The code follows secure coding practices.
[ "CWE-400" ]
CVE-2023-21253
MEDIUM
5.5
android
invalidDigest
core/java/android/util/jar/StrictJarVerifier.java
84df68840b6f2407146e722ebd95a7d8bc6e3529
0
Analyze the following code function for security vulnerabilities
private void deleteItems(Context c, String mapFile) throws Exception { System.out.println("Deleting items listed in mapfile: " + mapFile); // read in the mapfile Map<String, String> myhash = readMapFile(mapFile); // now delete everything that appeared in the mapFile Iterator<String> i = myhash.keySet().iterator(); while (i.hasNext()) { String itemID = myhash.get(i.next()); if (itemID.indexOf('/') != -1) { String myhandle = itemID; System.out.println("Deleting item " + myhandle); deleteItem(c, myhandle); } else { // it's an ID Item myitem = Item.find(c, Integer.parseInt(itemID)); System.out.println("Deleting item " + itemID); deleteItem(c, myitem); } c.clearCache(); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: deleteItems File: dspace-api/src/main/java/org/dspace/app/itemimport/ItemImport.java Repository: DSpace The code follows secure coding practices.
[ "CWE-22" ]
CVE-2022-31195
HIGH
7.2
DSpace
deleteItems
dspace-api/src/main/java/org/dspace/app/itemimport/ItemImport.java
56e76049185bbd87c994128a9d77735ad7af0199
0
Analyze the following code function for security vulnerabilities
@Override public void requestSystemServerHeapDump() { if (!Build.IS_DEBUGGABLE) { Slog.wtf(TAG, "requestSystemServerHeapDump called on a user build"); return; } if (Binder.getCallingUid() != SYSTEM_UID) { // This also intentionally excludes secondary profiles from calling this. throw new SecurityException( "Only the system process is allowed to request a system heap dump"); } ProcessRecord pr; synchronized (mPidsSelfLocked) { pr = mPidsSelfLocked.get(myPid()); } if (pr == null) { Slog.w(TAG, "system process not in mPidsSelfLocked: " + myPid()); return; } synchronized (mAppProfiler.mProfilerLock) { mAppProfiler.startHeapDumpLPf(pr.mProfile, true); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: requestSystemServerHeapDump 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
requestSystemServerHeapDump
services/core/java/com/android/server/am/ActivityManagerService.java
d10b27e539f7bc91c2360d429b9d05f05274670d
0
Analyze the following code function for security vulnerabilities
private ImeAdapter createImeAdapter(Context context) { return new ImeAdapter(mInputMethodManagerWrapper, new ImeAdapter.ImeAdapterDelegate() { @Override public void onImeEvent() { mPopupZoomer.hide(true); getContentViewClient().onImeEvent(); if (mFocusedNodeEditable) dismissTextHandles(); } @Override public void onDismissInput() { getContentViewClient().onImeStateChangeRequested(false); } @Override public void onKeyboardBoundsUnchanged() { assert mWebContents != null; mWebContents.scrollFocusedEditableNodeIntoView(); } @Override public View getAttachedView() { return mContainerView; } @Override public ResultReceiver getNewShowKeyboardReceiver() { return new ResultReceiver(new Handler()) { @Override public void onReceiveResult(int resultCode, Bundle resultData) { getContentViewClient().onImeStateChangeRequested( resultCode == InputMethodManager.RESULT_SHOWN || resultCode == InputMethodManager.RESULT_UNCHANGED_SHOWN); if (resultCode == InputMethodManager.RESULT_SHOWN) { // If OSK is newly shown, delay the form focus until // the onSizeChanged (in order to adjust relative to the // new size). // TODO(jdduke): We should not assume that onSizeChanged will // always be called, crbug.com/294908. getContainerView().getWindowVisibleDisplayFrame( mFocusPreOSKViewportRect); } else if (hasFocus() && resultCode == InputMethodManager.RESULT_UNCHANGED_SHOWN) { // If the OSK was already there, focus the form immediately. assert mWebContents != null; mWebContents.scrollFocusedEditableNodeIntoView(); } } }; } } ); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: createImeAdapter File: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java Repository: chromium The code follows secure coding practices.
[ "CWE-1021" ]
CVE-2015-1241
MEDIUM
4.3
chromium
createImeAdapter
content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
9d343ad2ea6ec395c377a4efa266057155bfa9c1
0
Analyze the following code function for security vulnerabilities
@Override public void setBooting(boolean booting) { mBooting = booting; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setBooting 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
setBooting
services/core/java/com/android/server/am/ActivityManagerService.java
d10b27e539f7bc91c2360d429b9d05f05274670d
0
Analyze the following code function for security vulnerabilities
@Override public void saveMetadata(ProjectMetadata metadata, long projectId) throws Exception { File projectDir = getProjectDir(projectId); ProjectMetadataUtilities.save(metadata, projectDir); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: saveMetadata File: main/src/com/google/refine/io/FileProjectManager.java Repository: OpenRefine The code follows secure coding practices.
[ "CWE-22" ]
CVE-2023-37476
HIGH
7.8
OpenRefine
saveMetadata
main/src/com/google/refine/io/FileProjectManager.java
e9c1e65d58b47aec8cd676bd5c07d97b002f205e
0