instruction
string
input
string
output
string
cwe_ids
list
cve_id
string
severity
string
cvss_score
float64
repo_name
string
func_name
string
file_path
string
commit_hash
string
is_vulnerable
int64
Analyze the following code function for security vulnerabilities
public void open(Method method, URL url) { this.open(method, url, true, null, null); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: open File: Testing/src/main/java/org/loboevolution/html/test/SimpleHttpRequest.java Repository: LoboEvolution The code follows secure coding practices.
[ "CWE-611" ]
CVE-2018-1000540
MEDIUM
6.8
LoboEvolution
open
Testing/src/main/java/org/loboevolution/html/test/SimpleHttpRequest.java
9b75694cedfa4825d4a2330abf2719d470c654cd
0
Analyze the following code function for security vulnerabilities
private Setting getSystemSetting(String name, int requestingUserId) { if (DEBUG) { Slog.v(LOG_TAG, "getSystemSetting(" + name + ", " + requestingUserId + ")"); } // Resolve the userId on whose behalf the call is made. final int callingUserId = resolveCallingUserIdEnforcingPermissionsLocked(requestingUserId); // Determine the owning user as some profile settings are cloned from the parent. final int owningUserId = resolveOwningUserIdForSystemSettingLocked(callingUserId, name); // Get the value. synchronized (mLock) { return mSettingsRegistry.getSettingLocked(SETTINGS_TYPE_SYSTEM, owningUserId, name); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getSystemSetting File: packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-3876
HIGH
7.2
android
getSystemSetting
packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
91fc934bb2e5ea59929bb2f574de6db9b5100745
0
Analyze the following code function for security vulnerabilities
@SuppressWarnings("unused") public static void show(Context context, Profile profile, WebContents webContents) { new WebsiteSettingsPopup(context, profile, webContents); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: show File: chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java Repository: chromium The code follows secure coding practices.
[ "CWE-20" ]
CVE-2015-1261
MEDIUM
5
chromium
show
chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java
5bf8a2dccf4777c5f065d918d1d9a2bbaa013f9f
0
Analyze the following code function for security vulnerabilities
public Map<String, String> getServerVariables() { return serverVariables; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getServerVariables File: samples/client/petstore/java/retrofit2-play26/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
getServerVariables
samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/ApiClient.java
2c576483f26f85b3979c6948a131f585c237109a
0
Analyze the following code function for security vulnerabilities
@POST @Produces(MediaType.TEXT_XML) @Path("addAttachment") @RestQuery(name = "addAttachmentURL", description = "Add an attachment to a given media package using an URL", restParameters = { @RestParameter(description = "The location of the attachment", isRequired = true, name = "url", type = RestParameter.Type.STRING), @RestParameter(description = "The kind of attachment", isRequired = true, name = "flavor", type = RestParameter.Type.STRING), @RestParameter(description = "The media package as XML", isRequired = true, name = "mediaPackage", type = RestParameter.Type.TEXT) }, reponses = { @RestResponse(description = "Returns augmented media package", responseCode = HttpServletResponse.SC_OK), @RestResponse(description = "Media package not valid", responseCode = HttpServletResponse.SC_BAD_REQUEST), @RestResponse(description = "", responseCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR) }, returnDescription = "") public Response addMediaPackageAttachment(@FormParam("url") String url, @FormParam("flavor") String flavor, @FormParam("mediaPackage") String mpx) { logger.trace("add attachment with url: {} flavor: {} mediaPackage: {}", url, flavor, mpx); try { MediaPackage mp = factory.newMediaPackageBuilder().loadFromXml(mpx); if (MediaPackageSupport.sanityCheck(mp).isSome()) return Response.serverError().status(Status.BAD_REQUEST).build(); mp = ingestService.addAttachment(new URI(url), MediaPackageElementFlavor.parseFlavor(flavor), mp); return Response.ok(mp).build(); } catch (Exception e) { logger.warn(e.getMessage(), e); return Response.serverError().status(Status.INTERNAL_SERVER_ERROR).build(); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: addMediaPackageAttachment File: modules/ingest-service-impl/src/main/java/org/opencastproject/ingest/endpoint/IngestRestService.java Repository: opencast The code follows secure coding practices.
[ "CWE-74" ]
CVE-2020-5230
MEDIUM
5
opencast
addMediaPackageAttachment
modules/ingest-service-impl/src/main/java/org/opencastproject/ingest/endpoint/IngestRestService.java
bbb473f34ab95497d6c432c81285efb0c739f317
0
Analyze the following code function for security vulnerabilities
public ConfigurationInfo getDeviceConfigurationInfo() { ConfigurationInfo config = new ConfigurationInfo(); synchronized (this) { final Configuration globalConfig = getGlobalConfiguration(); config.reqTouchScreen = globalConfig.touchscreen; config.reqKeyboardType = globalConfig.keyboard; config.reqNavigation = globalConfig.navigation; if (globalConfig.navigation == Configuration.NAVIGATION_DPAD || globalConfig.navigation == Configuration.NAVIGATION_TRACKBALL) { config.reqInputFeatures |= ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV; } if (globalConfig.keyboard != Configuration.KEYBOARD_UNDEFINED && globalConfig.keyboard != Configuration.KEYBOARD_NOKEYS) { config.reqInputFeatures |= ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD; } config.reqGlEsVersion = GL_ES_VERSION; } return config; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getDeviceConfigurationInfo 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
getDeviceConfigurationInfo
services/core/java/com/android/server/am/ActivityManagerService.java
962fb40991f15be4f688d960aa00073683ebdd20
0
Analyze the following code function for security vulnerabilities
@Override public Iterator<Component> iterator() { Set<Component> componentSet = new LinkedHashSet<>(extensionComponents); Header header = getHeader(); for (int i = 0; i < header.getRowCount(); ++i) { HeaderRow row = header.getRow(i); componentSet.addAll(row.getComponents()); } Footer footer = getFooter(); for (int i = 0; i < footer.getRowCount(); ++i) { FooterRow row = footer.getRow(i); componentSet.addAll(row.getComponents()); } return Collections.unmodifiableSet(componentSet).iterator(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: iterator 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
iterator
server/src/main/java/com/vaadin/ui/Grid.java
c40bed109c3723b38694ed160ea647fef5b28593
0
Analyze the following code function for security vulnerabilities
@Override public void setDisplayOverscan(Display display, int left, int top, int right, int bottom) { if (display.getDisplayId() == Display.DEFAULT_DISPLAY) { mOverscanLeft = left; mOverscanTop = top; mOverscanRight = right; mOverscanBottom = bottom; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setDisplayOverscan 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
setDisplayOverscan
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
84669ca8de55d38073a0dcb01074233b0a417541
0
Analyze the following code function for security vulnerabilities
@Override public Object parseMessage( CodedInputStream input, ExtensionRegistryLite extensionRegistry, Descriptors.FieldDescriptor field, Message defaultInstance) throws IOException { Message.Builder subBuilder; // When default instance is not null. The field is an extension field. if (defaultInstance != null) { subBuilder = defaultInstance.newBuilderForType(); } else { subBuilder = builder.newBuilderForField(field); } if (!field.isRepeated()) { Message originalMessage = (Message) getField(field); if (originalMessage != null) { subBuilder.mergeFrom(originalMessage); } } input.readMessage(subBuilder, extensionRegistry); return subBuilder.buildPartial(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: parseMessage File: java/core/src/main/java/com/google/protobuf/MessageReflection.java Repository: protocolbuffers/protobuf The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2022-3509
HIGH
7.5
protocolbuffers/protobuf
parseMessage
java/core/src/main/java/com/google/protobuf/MessageReflection.java
a3888f53317a8018e7a439bac4abeb8f3425d5e9
0
Analyze the following code function for security vulnerabilities
protected void setComponentsVisibility() { if (parentPage.isSelectMode() == false) { // Show cancel button only in select mode. cancelButtonPanel.setVisible(false); } searchButtonPanel.setVisible(true); resetButtonPanel.setVisible(true); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setComponentsVisibility File: src/main/java/org/projectforge/web/task/TaskTreeForm.java Repository: micromata/projectforge-webapp The code follows secure coding practices.
[ "CWE-352" ]
CVE-2013-7251
MEDIUM
6.8
micromata/projectforge-webapp
setComponentsVisibility
src/main/java/org/projectforge/web/task/TaskTreeForm.java
422de35e3c3141e418a73bfb39b430d5fd74077e
0
Analyze the following code function for security vulnerabilities
@GuardedBy("mPm.mInstallLock") private AndroidPackage installStubPackageLI(AndroidPackage stubPkg, @ParsingPackageUtils.ParseFlags int parseFlags, @PackageManagerService.ScanFlags int scanFlags) throws PackageManagerException { if (DEBUG_COMPRESSION) { Slog.i(TAG, "Uncompressing system stub; pkg: " + stubPkg.getPackageName()); } // uncompress the binary to its eventual destination on /data final File scanFile = decompressPackage(stubPkg.getPackageName(), stubPkg.getPath()); if (scanFile == null) { throw new PackageManagerException( "Unable to decompress stub at " + stubPkg.getPath()); } synchronized (mPm.mLock) { mPm.mSettings.disableSystemPackageLPw(stubPkg.getPackageName(), true /*replaced*/); } final RemovePackageHelper removePackageHelper = new RemovePackageHelper(mPm); removePackageHelper.removePackageLI(stubPkg, true /*chatty*/); try { return scanSystemPackageTracedLI(scanFile, parseFlags, scanFlags, null); } catch (PackageManagerException e) { Slog.w(TAG, "Failed to install compressed system package:" + stubPkg.getPackageName(), e); // Remove the failed install removePackageHelper.removeCodePathLI(scanFile); throw e; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: installStubPackageLI File: services/core/java/com/android/server/pm/InstallPackageHelper.java Repository: android The code follows secure coding practices.
[ "CWE-862" ]
CVE-2023-21257
HIGH
7.8
android
installStubPackageLI
services/core/java/com/android/server/pm/InstallPackageHelper.java
1aec7feaf07e6d4568ca75d18158445dbeac10f6
0
Analyze the following code function for security vulnerabilities
@GuardedBy("this") private void forceStopPackageLocked(final String packageName, int uid, String reason) { forceStopPackageLocked(packageName, UserHandle.getAppId(uid), false, false, true, false, false, UserHandle.getUserId(uid), reason); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: forceStopPackageLocked 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
forceStopPackageLocked
services/core/java/com/android/server/am/ActivityManagerService.java
962fb40991f15be4f688d960aa00073683ebdd20
0
Analyze the following code function for security vulnerabilities
private static void handleErrorResponse(HttpURLConnection conn, String url, String moduleFullName) { try (BufferedReader reader = new BufferedReader( new InputStreamReader(conn.getErrorStream(), Charset.defaultCharset()))) { StringBuilder result = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { result.append(line); } MapValue payload = (MapValue) JSONParser.parse(result.toString()); createError("error: " + payload.getStringValue("message")); } catch (IOException e) { createError("failed to pull the module '" + moduleFullName + "' from the remote repository '" + url + "'"); } }
Vulnerability Classification: - CWE: CWE-306 - CVE: CVE-2021-32700 - Severity: MEDIUM - CVSS Score: 5.8 Description: Fix central connection Function: handleErrorResponse File: cli/ballerina-cli-module/src/main/java/org/ballerinalang/cli/module/Pull.java Repository: ballerina-platform/ballerina-lang Fixed Code: private static void handleErrorResponse(HttpsURLConnection conn, String url, String moduleFullName) { try (BufferedReader reader = new BufferedReader( new InputStreamReader(conn.getErrorStream(), Charset.defaultCharset()))) { StringBuilder result = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { result.append(line); } MapValue payload = (MapValue) JSONParser.parse(result.toString()); createError("error: " + payload.getStringValue("message")); } catch (IOException e) { createError("failed to pull the module '" + moduleFullName + "' from the remote repository '" + url + "'"); } }
[ "CWE-306" ]
CVE-2021-32700
MEDIUM
5.8
ballerina-platform/ballerina-lang
handleErrorResponse
cli/ballerina-cli-module/src/main/java/org/ballerinalang/cli/module/Pull.java
4609ffee1744ecd16aac09303b1783bf0a525816
1
Analyze the following code function for security vulnerabilities
@Override public boolean action(XWikiContext context) throws XWikiException { XWiki xwiki = context.getWiki(); XWikiRequest request = context.getRequest(); XWikiResponse response = context.getResponse(); // Disallow template override with xpage parameter. if (!REGISTER.equals(Utils.getPage(context.getRequest(), REGISTER))) { throw new XWikiException(XWikiException.MODULE_XWIKI, XWikiException.ERROR_XWIKI_ACCESS_DENIED, String.format("Template may not be overriden with 'xpage' in [%s] action.", REGISTER)); } String register = request.getParameter(REGISTER); if (register != null && register.equals("1")) { // CSRF prevention if (!csrfTokenCheck(context)) { return false; } // Let's verify that the user submitted the right CAPTCHA (if required). if (!verifyCaptcha(context, xwiki)) { return false; } int useemail = xwiki.getXWikiPreferenceAsInt("use_email_verification", 0, context); int result; if (useemail == 1) { result = xwiki.createUser(true, "edit", context); } else { result = xwiki.createUser(context); } getCurrentScriptContext().setAttribute("reg", Integer.valueOf(result), ScriptContext.ENGINE_SCOPE); // Redirect if a redirection parameter is passed. String redirect = Utils.getRedirect(request, null); if (redirect == null) { return true; } else { sendRedirect(response, redirect); return false; } } return true; }
Vulnerability Classification: - CWE: CWE-287 - CVE: CVE-2022-36092 - Severity: HIGH - CVSS Score: 7.5 Description: XWIKI-19549: Disallow template override for login, register and skin * Also allow `registerinline` template for RegisterAction. Function: action File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/RegisterAction.java Repository: xwiki/xwiki-platform Fixed Code: @Override public boolean action(XWikiContext context) throws XWikiException { XWiki xwiki = context.getWiki(); XWikiRequest request = context.getRequest(); XWikiResponse response = context.getResponse(); // Limit template overrides with xpage to allowed templates. if (!ALLOWED_TEMPLATES.contains(Utils.getPage(context.getRequest(), REGISTER))) { throw new XWikiException(XWikiException.MODULE_XWIKI, XWikiException.ERROR_XWIKI_ACCESS_DENIED, String.format("Forbidden template override with 'xpage' in [%s] action.", REGISTER)); } String register = request.getParameter(REGISTER); if (register != null && register.equals("1")) { // CSRF prevention if (!csrfTokenCheck(context)) { return false; } // Let's verify that the user submitted the right CAPTCHA (if required). if (!verifyCaptcha(context, xwiki)) { return false; } int useemail = xwiki.getXWikiPreferenceAsInt("use_email_verification", 0, context); int result; if (useemail == 1) { result = xwiki.createUser(true, "edit", context); } else { result = xwiki.createUser(context); } getCurrentScriptContext().setAttribute("reg", Integer.valueOf(result), ScriptContext.ENGINE_SCOPE); // Redirect if a redirection parameter is passed. String redirect = Utils.getRedirect(request, null); if (redirect == null) { return true; } else { sendRedirect(response, redirect); return false; } } return true; }
[ "CWE-287" ]
CVE-2022-36092
HIGH
7.5
xwiki/xwiki-platform
action
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/RegisterAction.java
9b7057d57a941592d763992d4299456300918208
1
Analyze the following code function for security vulnerabilities
@Override public View addStartingWindow(IBinder appToken, String packageName, int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon, int logo, int windowFlags) { if (!SHOW_STARTING_ANIMATIONS) { return null; } if (packageName == null) { return null; } WindowManager wm = null; View view = null; try { Context context = mContext; if (DEBUG_STARTING_WINDOW) Slog.d(TAG, "addStartingWindow " + packageName + ": nonLocalizedLabel=" + nonLocalizedLabel + " theme=" + Integer.toHexString(theme)); if (theme != context.getThemeResId() || labelRes != 0) { try { context = context.createPackageContext(packageName, 0); context.setTheme(theme); } catch (PackageManager.NameNotFoundException e) { // Ignore } } Window win = PolicyManager.makeNewWindow(context); final TypedArray ta = win.getWindowStyle(); if (ta.getBoolean( com.android.internal.R.styleable.Window_windowDisablePreview, false) || ta.getBoolean( com.android.internal.R.styleable.Window_windowShowWallpaper,false)) { return null; } Resources r = context.getResources(); win.setTitle(r.getText(labelRes, nonLocalizedLabel)); win.setType( WindowManager.LayoutParams.TYPE_APPLICATION_STARTING); // Force the window flags: this is a fake window, so it is not really // touchable or focusable by the user. We also add in the ALT_FOCUSABLE_IM // flag because we do know that the next window will take input // focus, so we want to get the IME window up on top of us right away. win.setFlags( windowFlags| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE| WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, windowFlags| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE| WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); win.setDefaultIcon(icon); win.setDefaultLogo(logo); win.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); final WindowManager.LayoutParams params = win.getAttributes(); params.token = appToken; params.packageName = packageName; params.windowAnimations = win.getWindowStyle().getResourceId( com.android.internal.R.styleable.Window_windowAnimationStyle, 0); params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED; params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS; if (!compatInfo.supportsScreen()) { params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW; } params.setTitle("Starting " + packageName); wm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); view = win.getDecorView(); if (win.isFloating()) { // Whoops, there is no way to display an animation/preview // of such a thing! After all that work... let's skip it. // (Note that we must do this here because it is in // getDecorView() where the theme is evaluated... maybe // we should peek the floating attribute from the theme // earlier.) return null; } if (DEBUG_STARTING_WINDOW) Slog.d( TAG, "Adding starting window for " + packageName + " / " + appToken + ": " + (view.getParent() != null ? view : null)); wm.addView(view, params); // Only return the view if it was successfully added to the // window manager... which we can tell by it having a parent. return view.getParent() != null ? view : null; } catch (WindowManager.BadTokenException e) { // ignore Log.w(TAG, appToken + " already running, starting window not displayed. " + e.getMessage()); } catch (RuntimeException e) { // don't crash if something else bad happens, for example a // failure loading resources because we are loading from an app // on external storage that has been unmounted. Log.w(TAG, appToken + " failed creating starting window", e); } finally { if (view != null && view.getParent() == null) { Log.w(TAG, "view not successfully added to wm, removing view"); wm.removeViewImmediate(view); } } return null; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: addStartingWindow 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
addStartingWindow
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
84669ca8de55d38073a0dcb01074233b0a417541
0
Analyze the following code function for security vulnerabilities
public long addAttachments(List<Attachment> attachments) { long size = 0; AttachmentFailureException error = null; for (Attachment a : attachments) { try { size += mAttachmentsView.addAttachment(mAccount, a); } catch (AttachmentFailureException e) { error = e; } } if (error != null) { LogUtils.e(LOG_TAG, error, "Error adding attachment"); if (attachments.size() > 1) { showAttachmentTooBigToast(R.string.too_large_to_attach_multiple); } else { showAttachmentTooBigToast(error.getErrorRes()); } } return size; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: addAttachments 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
addAttachments
src/com/android/mail/compose/ComposeActivity.java
0d9dfd649bae9c181e3afc5d571903f1eb5dc46f
0
Analyze the following code function for security vulnerabilities
public @NotNull SshdContainer build() { return new SshdContainer(buildInner()); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: build File: src/itest/java/com/hierynomus/sshj/SshdContainer.java Repository: hierynomus/sshj The code follows secure coding practices.
[ "CWE-354" ]
CVE-2023-48795
MEDIUM
5.9
hierynomus/sshj
build
src/itest/java/com/hierynomus/sshj/SshdContainer.java
94fcc960e0fb198ddec0f7efc53f95ac627fe083
0
Analyze the following code function for security vulnerabilities
public void setCountries(String countries) { mCountries = countries; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setCountries 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
setCountries
framework/java/android/net/wifi/hotspot2/pps/Policy.java
69119d1d3102e27b6473c785125696881bce9563
0
Analyze the following code function for security vulnerabilities
private void parsePlotFunctions(List<Element> elements, XmlSerializer serializer) throws Exception { final Element last = XmlUtils.getLast(elements); if (last == null || last.getTextContent() == null) { return; } ExpressionProperties p = new ExpressionProperties(last); LineProperties lineProp = new LineProperties(); if (p.text.equals("sys") && p.args > 2) { // Multiple functions XmlUtils.removeLast(elements); final int argNumber = p.args - 2; serializer.attribute(FormulaList.XML_NS, PlotFunction.XML_PROP_FUNCTIONS_NUMBER, Integer.toString(argNumber)); // remove two first arguments of sys function XmlUtils.removeLast(elements); XmlUtils.removeLast(elements); // add functions for (int i = 0; i < argNumber; i++) { final String suffix = Integer.toString(argNumber - i); LineProperties newProp = new LineProperties(); parseTerm("yFunction" + suffix, elements, serializer, false, lineProp); addTextTag("xFunction" + suffix, "x", serializer); newProp.setNextDefault(lineProp); lineProp = newProp; } } else { // single function serializer.attribute(FormulaList.XML_NS, PlotFunction.XML_PROP_FUNCTIONS_NUMBER, "1"); parseTerm("yFunction", elements, serializer, false, lineProp); addTextTag("xFunction", "x", serializer); } addTextTag("yMinValue", "", serializer); addTextTag("yMaxValue", "", serializer); addTextTag("xMinValue", "", serializer); addTextTag("xMaxValue", "", serializer); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: parsePlotFunctions File: app/src/main/java/com/mkulesh/micromath/io/ImportFromSMathStudio.java Repository: mkulesh/microMathematics The code follows secure coding practices.
[ "CWE-611" ]
CVE-2018-1000821
HIGH
7.5
mkulesh/microMathematics
parsePlotFunctions
app/src/main/java/com/mkulesh/micromath/io/ImportFromSMathStudio.java
5c05ac8de16c569ff0a1816f20be235090d3dd9d
0
Analyze the following code function for security vulnerabilities
@Override public Group createSubmitters(Context context, Collection collection) throws SQLException, AuthorizeException { // Check authorisation - Must be an Admin to create Submitters Group AuthorizeUtil.authorizeManageSubmittersGroup(context, collection); Group submitters = collection.getSubmitters(); if (submitters == null) { //turn off authorization so that Collection Admins can create Collection Submitters context.turnOffAuthorisationSystem(); submitters = groupService.create(context); context.restoreAuthSystemState(); groupService.setName(submitters, "COLLECTION_" + collection.getID() + "_SUBMIT"); groupService.update(context, submitters); } // register this as the submitter group collection.setSubmitters(submitters); authorizeService.addPolicy(context, collection, Constants.ADD, submitters); return submitters; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: createSubmitters File: dspace-api/src/main/java/org/dspace/content/CollectionServiceImpl.java Repository: DSpace The code follows secure coding practices.
[ "CWE-863" ]
CVE-2021-41189
HIGH
9
DSpace
createSubmitters
dspace-api/src/main/java/org/dspace/content/CollectionServiceImpl.java
277b499a5cd3a4f5eb2370513a1b7e4ec2a6e041
0
Analyze the following code function for security vulnerabilities
@GuardedBy("this") NeededUriGrants checkGrantUriPermissionFromIntentLocked(int callingUid, String targetPkg, Intent intent, int mode, NeededUriGrants needed, int targetUserId) { if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION, "Checking URI perm to data=" + (intent != null ? intent.getData() : null) + " clip=" + (intent != null ? intent.getClipData() : null) + " from " + intent + "; flags=0x" + Integer.toHexString(intent != null ? intent.getFlags() : 0)); if (targetPkg == null) { throw new NullPointerException("targetPkg"); } if (intent == null) { return null; } Uri data = intent.getData(); ClipData clip = intent.getClipData(); if (data == null && clip == null) { return null; } // Default userId for uris in the intent (if they don't specify it themselves) int contentUserHint = intent.getContentUserHint(); if (contentUserHint == UserHandle.USER_CURRENT) { contentUserHint = UserHandle.getUserId(callingUid); } final IPackageManager pm = AppGlobals.getPackageManager(); int targetUid; if (needed != null) { targetUid = needed.targetUid; } else { try { targetUid = pm.getPackageUid(targetPkg, MATCH_DEBUG_TRIAGED_MISSING, targetUserId); } catch (RemoteException ex) { return null; } if (targetUid < 0) { if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION, "Can't grant URI permission no uid for: " + targetPkg + " on user " + targetUserId); return null; } } if (data != null) { GrantUri grantUri = GrantUri.resolve(contentUserHint, data); targetUid = checkGrantUriPermissionLocked(callingUid, targetPkg, grantUri, mode, targetUid); if (targetUid > 0) { if (needed == null) { needed = new NeededUriGrants(targetPkg, targetUid, mode); } needed.add(grantUri); } } if (clip != null) { for (int i=0; i<clip.getItemCount(); i++) { Uri uri = clip.getItemAt(i).getUri(); if (uri != null) { GrantUri grantUri = GrantUri.resolve(contentUserHint, uri); targetUid = checkGrantUriPermissionLocked(callingUid, targetPkg, grantUri, mode, targetUid); if (targetUid > 0) { if (needed == null) { needed = new NeededUriGrants(targetPkg, targetUid, mode); } needed.add(grantUri); } } else { Intent clipIntent = clip.getItemAt(i).getIntent(); if (clipIntent != null) { NeededUriGrants newNeeded = checkGrantUriPermissionFromIntentLocked( callingUid, targetPkg, clipIntent, mode, needed, targetUserId); if (newNeeded != null) { needed = newNeeded; } } } } } return needed; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: checkGrantUriPermissionFromIntentLocked 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
checkGrantUriPermissionFromIntentLocked
services/core/java/com/android/server/am/ActivityManagerService.java
962fb40991f15be4f688d960aa00073683ebdd20
0
Analyze the following code function for security vulnerabilities
@JavascriptInterface // must be added for API 17 or higher public boolean shouldNavigate(String url) { return bc.fireBrowserNavigationCallbacks(url); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: shouldNavigate File: Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java Repository: codenameone/CodenameOne The code follows secure coding practices.
[ "CWE-668" ]
CVE-2022-4903
MEDIUM
5.1
codenameone/CodenameOne
shouldNavigate
Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java
dad49c9ef26a598619fc48d2697151a02987d478
0
Analyze the following code function for security vulnerabilities
private void saveSettingsLocked(int userHandle) { if (DevicePolicyData.store(getUserData(userHandle), makeJournaledFile(userHandle))) { sendChangedNotification(userHandle); } invalidateBinderCaches(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: saveSettingsLocked File: services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-862" ]
CVE-2023-40089
HIGH
7.8
android
saveSettingsLocked
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
e2e05f488da6abc765a62e7faf10cb74e729732e
0
Analyze the following code function for security vulnerabilities
@Override public void setQuiet(boolean isQuiet) { this.isQuiet = isQuiet; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setQuiet File: dspace-api/src/main/java/org/dspace/app/itemimport/ItemImportServiceImpl.java Repository: DSpace The code follows secure coding practices.
[ "CWE-22" ]
CVE-2022-31195
HIGH
7.2
DSpace
setQuiet
dspace-api/src/main/java/org/dspace/app/itemimport/ItemImportServiceImpl.java
7af52a0883a9dbc475cf3001f04ed11b24c8a4c0
0
Analyze the following code function for security vulnerabilities
@Override public void stopAppSwitches() { if (checkCallingPermission(android.Manifest.permission.STOP_APP_SWITCHES) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("viewquires permission " + android.Manifest.permission.STOP_APP_SWITCHES); } synchronized(this) { mAppSwitchesAllowedTime = SystemClock.uptimeMillis() + APP_SWITCH_DELAY_TIME; mDidAppSwitch = false; mHandler.removeMessages(DO_PENDING_ACTIVITY_LAUNCHES_MSG); Message msg = mHandler.obtainMessage(DO_PENDING_ACTIVITY_LAUNCHES_MSG); mHandler.sendMessageDelayed(msg, APP_SWITCH_DELAY_TIME); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: stopAppSwitches 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
stopAppSwitches
services/core/java/com/android/server/am/ActivityManagerService.java
6c049120c2d749f0c0289d822ec7d0aa692f55c5
0
Analyze the following code function for security vulnerabilities
public String ParamAsRealPath(String key) { String param = getConfiguration().getProperty(key); try { return getRealPath(param); } catch (Exception e) { return param; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: ParamAsRealPath 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
ParamAsRealPath
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java
f9a677408ffb06f309be46ef9d8df1915d9099a4
0
Analyze the following code function for security vulnerabilities
private void migrate24(File dataDir, Stack<Integer> versions) { for (File file: dataDir.listFiles()) { if (file.getName().startsWith("Settings.xml")) { VersionedXmlDoc dom = VersionedXmlDoc.fromFile(file); for (Element element: dom.getRootElement().elements()) { if (element.elementTextTrim("key").equals("ISSUE")) { Element valueElement = element.element("value"); if (valueElement != null) { migrateTransitionSpecsElement24(valueElement.element("defaultTransitionSpecs")); for (Element fieldElement: valueElement.element("fieldSpecs").elements()) migrateUserMatcher24(fieldElement.element("canBeChangedBy")); } } } dom.writeToFile(file, false); } else if (file.getName().startsWith("Projects.xml")) { VersionedXmlDoc dom = VersionedXmlDoc.fromFile(file); for (Element element: dom.getRootElement().elements()) { Element issueSettingElement = element.element("issueSetting"); Element transitionsElement = issueSettingElement.element("transitionSpecs"); if (transitionsElement != null) migrateTransitionSpecsElement24(transitionsElement); for (Element branchProtectionElement: element.element("branchProtections").elements()) migrateUserMatcher24(branchProtectionElement.element("submitter")); for (Element tagProtectionElement: element.element("tagProtections").elements()) migrateUserMatcher24(tagProtectionElement.element("submitter")); } dom.writeToFile(file, false); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: migrate24 File: server-core/src/main/java/io/onedev/server/migration/DataMigrator.java Repository: theonedev/onedev The code follows secure coding practices.
[ "CWE-338" ]
CVE-2023-24828
HIGH
8.8
theonedev/onedev
migrate24
server-core/src/main/java/io/onedev/server/migration/DataMigrator.java
d67dd9686897fe5e4ab881d749464aa7c06a68e5
0
Analyze the following code function for security vulnerabilities
private boolean hasProfileOwner(int userId) { synchronized (getLockObject()) { return mOwners.hasProfileOwner(userId); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: hasProfileOwner File: services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-20" ]
CVE-2023-21284
MEDIUM
5.5
android
hasProfileOwner
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
ed3f25b7222d4cff471f2b7d22d1150348146957
0
Analyze the following code function for security vulnerabilities
void binderWithCleanCallingIdentity(@NonNull ThrowingRunnable action) { Binder.withCleanCallingIdentity(action); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: binderWithCleanCallingIdentity File: services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-20" ]
CVE-2023-21284
MEDIUM
5.5
android
binderWithCleanCallingIdentity
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
ed3f25b7222d4cff471f2b7d22d1150348146957
0
Analyze the following code function for security vulnerabilities
@Override public void onUidGone(int uid, boolean disabled) { if (uid == mUid) { PackageInactivityListener.this.updateUidState(STATE_GONE); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onUidGone File: services/core/java/com/android/server/pm/permission/OneTimePermissionUserManager.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21254
HIGH
7.8
android
onUidGone
services/core/java/com/android/server/pm/permission/OneTimePermissionUserManager.java
fa539c85503dc63bfb53c76b6f12b3549f14a709
0
Analyze the following code function for security vulnerabilities
private void execute(String jobToken, TaskLogger jobLogger, Object executionContext) { jobLogger.log("Checking cluster access..."); JobContext jobContext; if (executionContext instanceof JobContext) jobContext = (JobContext) executionContext; else jobContext = null; Commandline kubectl = newKubeCtl(); kubectl.addArgs("cluster-info"); kubectl.execute(new LineConsumer() { @Override public void consume(String line) { logger.debug(line); } }, new LineConsumer() { @Override public void consume(String line) { jobLogger.log(line); } }).checkReturnCode(); String namespace ; if (jobContext != null) { namespace = getName() + "-" + jobContext.getProjectId() + "-" + jobContext.getBuildNumber() + "-" + jobContext.getRetried(); } else { namespace = getName() + "-executor-test"; } if (getClusterRole() != null) createClusterRoleBinding(namespace, jobLogger); try { createNamespace(namespace, jobContext, jobLogger); jobLogger.log(String.format("Executing job (executor: %s, namespace: %s)...", getName(), namespace)); try { String imagePullSecretName = createImagePullSecret(namespace, jobLogger); if (jobContext != null) { for (Service jobService: jobContext.getServices()) { jobLogger.log("Starting service (name: " + jobService.getName() + ", image: " + jobService.getImage() + ")..."); startService(namespace, jobContext, jobService, imagePullSecretName, jobLogger); } } String trustCertsConfigMapName = createTrustCertsConfigMap(namespace, jobLogger); OsInfo osInfo = getBaselineOsInfo(getNodeSelector(), jobLogger); Map<String, Object> podSpec = new LinkedHashMap<>(); List<Map<Object, Object>> containerSpecs = new ArrayList<>(); String containerBuildHome; String containerCommandHome; String containerCacheHome; String containerAuthInfoHome; String trustCertsHome; String dockerSock; String containerdSock; String containerWorkspace; if (osInfo.isWindows()) { containerBuildHome = "C:\\onedev-build"; containerWorkspace = containerBuildHome + "\\workspace"; containerCacheHome = containerBuildHome + "\\cache"; containerCommandHome = containerBuildHome + "\\command"; containerAuthInfoHome = "C:\\Users\\ContainerAdministrator\\auth-info"; trustCertsHome = containerBuildHome + "\\trust-certs"; dockerSock = "\\\\.\\pipe\\docker_engine"; containerdSock = "\\\\.\\pipe\\containerd-containerd"; } else { containerBuildHome = "/onedev-build"; containerWorkspace = containerBuildHome +"/workspace"; containerCacheHome = containerBuildHome + "/cache"; containerCommandHome = containerBuildHome + "/command"; containerAuthInfoHome = "/root/auth-info"; trustCertsHome = containerBuildHome + "/trust-certs"; dockerSock = "/var/run/docker.sock"; containerdSock = "/run/containerd/containerd.sock"; } Map<String, String> buildHomeMount = CollectionUtils.newLinkedHashMap( "name", "build-home", "mountPath", containerBuildHome); Map<String, String> authInfoMount = CollectionUtils.newLinkedHashMap( "name", "auth-info-home", "mountPath", containerAuthInfoHome); // Windows nanoserver default user is ContainerUser Map<String, String> authInfoMount2 = CollectionUtils.newLinkedHashMap( "name", "auth-info-home", "mountPath", "C:\\Users\\ContainerUser\\auth-info"); Map<String, String> cacheHomeMount = CollectionUtils.newLinkedHashMap( "name", "cache-home", "mountPath", containerCacheHome); Map<String, String> trustCertsMount = CollectionUtils.newLinkedHashMap( "name", "trust-certs-home", "mountPath", trustCertsHome); Map<String, String> dockerSockMount = CollectionUtils.newLinkedHashMap( "name", "docker-sock", "mountPath", dockerSock); Map<String, String> containerdSockMount = CollectionUtils.newLinkedHashMap( "name", "containerd-sock", "mountPath", containerdSock); List<Object> commonVolumeMounts = Lists.<Object>newArrayList(buildHomeMount, authInfoMount, cacheHomeMount); if (osInfo.isWindows()) commonVolumeMounts.add(authInfoMount2); if (trustCertsConfigMapName != null) commonVolumeMounts.add(trustCertsMount); commonVolumeMounts.add(dockerSockMount); commonVolumeMounts.add(containerdSockMount); CompositeFacade entryFacade; if (jobContext != null) { entryFacade = new CompositeFacade(jobContext.getActions()); } else { List<Action> actions = new ArrayList<>(); CommandFacade facade = new CommandFacade((String) executionContext, Lists.newArrayList("this does not matter"), false); actions.add(new Action("test", facade, ExecuteCondition.ALWAYS)); entryFacade = new CompositeFacade(actions); } List<String> containerNames = Lists.newArrayList("init"); String helperImageSuffix; if (osInfo.isWindows()) { String windowsVersion = OsInfo.WINDOWS_VERSIONS.get(osInfo.getWindowsBuild()); if (windowsVersion != null) helperImageSuffix = "windows-" + windowsVersion.toLowerCase(); else throw new ExplicitException("Unsupported windows build number: " + osInfo.getWindowsBuild()); } else { helperImageSuffix = "linux"; } String helperImage = IMAGE_REPO_PREFIX + "-" + helperImageSuffix + ":" + KubernetesHelper.getVersion(); List<Map<Object, Object>> commonEnvs = new ArrayList<>(); commonEnvs.add(CollectionUtils.newLinkedHashMap( "name", ENV_SERVER_URL, "value", getServerUrl())); commonEnvs.add(CollectionUtils.newLinkedHashMap( "name", ENV_JOB_TOKEN, "value", jobToken)); commonEnvs.add(CollectionUtils.newLinkedHashMap( "name", ENV_OS_INFO, "value", Hex.encodeHexString(SerializationUtils.serialize(osInfo)) )); commonEnvs.add(CollectionUtils.newLinkedHashMap( "name", "ONEDEV_WORKSPACE", "value", containerWorkspace )); entryFacade.traverse(new LeafVisitor<Void>() { @Override public Void visit(LeafFacade facade, List<Integer> position) { String containerName = getContainerName(position); containerNames.add(containerName); Map<Object, Object> stepContainerSpec; if (facade instanceof CommandFacade) { CommandFacade commandFacade = (CommandFacade) facade; OsExecution execution = commandFacade.getExecution(osInfo); if (execution.getImage() == null) { throw new ExplicitException("This step can only be executed by server shell " + "executor or remote shell executor"); } stepContainerSpec = CollectionUtils.newHashMap( "name", containerName, "image", execution.getImage()); if (commandFacade.isUseTTY()) stepContainerSpec.put("tty", true); stepContainerSpec.put("volumeMounts", commonVolumeMounts); stepContainerSpec.put("env", commonEnvs); } else if (facade instanceof BuildImageFacade) { stepContainerSpec = CollectionUtils.newHashMap( "name", containerName, "image", helperImage); stepContainerSpec.put("volumeMounts", commonVolumeMounts); stepContainerSpec.put("env", commonEnvs); } else if (facade instanceof RunContainerFacade) { RunContainerFacade runContainerFacade = (RunContainerFacade) facade; OsContainer container = runContainerFacade.getContainer(osInfo); stepContainerSpec = CollectionUtils.newHashMap( "name", containerName, "image", container.getImage()); if (runContainerFacade.isUseTTY()) stepContainerSpec.put("tty", true); List<Object> volumeMounts = new ArrayList<>(commonVolumeMounts); for (Map.Entry<String, String> entry: container.getVolumeMounts().entrySet()) { String subPath = StringUtils.stripStart(entry.getKey(), "/\\"); if (osInfo.isWindows()) subPath = "workspace\\" + subPath; else subPath = "workspace/" + subPath; volumeMounts.add(CollectionUtils.newLinkedHashMap( "name", "build-home", "mountPath", entry.getValue(), "subPath", subPath)); } stepContainerSpec.put("volumeMounts", volumeMounts); List<Map<Object, Object>> envs = new ArrayList<>(commonEnvs); for (Map.Entry<String, String> entry: container.getEnvMap().entrySet()) { envs.add(CollectionUtils.newLinkedHashMap( "name", entry.getKey(), "value", entry.getValue())); } stepContainerSpec.put("env", envs); } else { stepContainerSpec = CollectionUtils.newHashMap( "name", containerName, "image", helperImage); stepContainerSpec.put("volumeMounts", commonVolumeMounts); stepContainerSpec.put("env", commonEnvs); } String positionStr = stringifyPosition(position); if (osInfo.isLinux()) { stepContainerSpec.put("command", Lists.newArrayList("sh")); stepContainerSpec.put("args", Lists.newArrayList(containerCommandHome + "/" + positionStr + ".sh")); } else { stepContainerSpec.put("command", Lists.newArrayList("cmd")); stepContainerSpec.put("args", Lists.newArrayList("/c", containerCommandHome + "\\" + positionStr + ".bat")); } containerSpecs.add(stepContainerSpec); return null; } }, new ArrayList<>()); String k8sHelperClassPath; if (osInfo.isLinux()) { k8sHelperClassPath = "/k8s-helper/*"; } else { k8sHelperClassPath = "C:\\k8s-helper\\*"; } List<String> sidecarArgs = Lists.newArrayList( "-classpath", k8sHelperClassPath, "io.onedev.k8shelper.SideCar"); List<String> initArgs = Lists.newArrayList( "-classpath", k8sHelperClassPath, "io.onedev.k8shelper.Init"); if (jobContext == null) { sidecarArgs.add("test"); initArgs.add("test"); } List<Map<Object, Object>> initEnvs = new ArrayList<>(commonEnvs); List<RegistryLoginFacade> registryLogins = new ArrayList<>(); for (RegistryLogin login: getRegistryLogins()) registryLogins.add(new RegistryLoginFacade(login.getRegistryUrl(), login.getUserName(), login.getPassword())); initEnvs.add(CollectionUtils.newLinkedHashMap( "name", KubernetesHelper.ENV_REGISTRY_LOGINS, "value", Hex.encodeHexString(SerializationUtils.serialize((Serializable) registryLogins)) )); Map<Object, Object> initContainerSpec = CollectionUtils.newHashMap( "name", "init", "image", helperImage, "command", Lists.newArrayList("java"), "args", initArgs, "env", initEnvs, "volumeMounts", commonVolumeMounts); Map<Object, Object> sidecarContainerSpec = CollectionUtils.newHashMap( "name", "sidecar", "image", helperImage, "command", Lists.newArrayList("java"), "args", sidecarArgs, "env", commonEnvs, "volumeMounts", commonVolumeMounts); if (jobContext != null) { sidecarContainerSpec.put("resources", CollectionUtils.newLinkedHashMap("requests", CollectionUtils.newLinkedHashMap( "cpu", jobContext.getCpuRequirement() + "m", "memory", jobContext.getMemoryRequirement() + "m"))); } containerSpecs.add(sidecarContainerSpec); containerNames.add("sidecar"); podSpec.put("containers", containerSpecs); podSpec.put("initContainers", Lists.<Object>newArrayList(initContainerSpec)); if (imagePullSecretName != null) podSpec.put("imagePullSecrets", Lists.<Object>newArrayList(CollectionUtils.newLinkedHashMap("name", imagePullSecretName))); podSpec.put("restartPolicy", "Never"); if (!getNodeSelector().isEmpty()) podSpec.put("nodeSelector", toMap(getNodeSelector())); Map<Object, Object> buildHomeVolume = CollectionUtils.newLinkedHashMap( "name", "build-home", "emptyDir", CollectionUtils.newLinkedHashMap()); Map<Object, Object> userHomeVolume = CollectionUtils.newLinkedHashMap( "name", "auth-info-home", "emptyDir", CollectionUtils.newLinkedHashMap()); Map<Object, Object> cacheHomeVolume = CollectionUtils.newLinkedHashMap( "name", "cache-home", "hostPath", CollectionUtils.newLinkedHashMap( "path", osInfo.getCacheHome(), "type", "DirectoryOrCreate")); List<Object> volumes = Lists.<Object>newArrayList(buildHomeVolume, userHomeVolume, cacheHomeVolume); if (trustCertsConfigMapName != null) { volumes.add(CollectionUtils.newLinkedHashMap( "name", "trust-certs-home", "configMap", CollectionUtils.newLinkedHashMap( "name", trustCertsConfigMapName))); } volumes.add(CollectionUtils.newLinkedHashMap( "name", "docker-sock", "hostPath", CollectionUtils.newLinkedHashMap( "path", dockerSock))); volumes.add(CollectionUtils.newLinkedHashMap( "name", "containerd-sock", "hostPath", CollectionUtils.newLinkedHashMap( "path", containerdSock))); podSpec.put("volumes", volumes); String podName = "job"; Map<Object, Object> podDef = CollectionUtils.newLinkedHashMap( "apiVersion", "v1", "kind", "Pod", "metadata", CollectionUtils.newLinkedHashMap( "name", podName, "namespace", namespace), "spec", podSpec); createResource(podDef, Sets.newHashSet(), jobLogger); String podFQN = namespace + "/" + podName; AtomicReference<String> nodeNameRef = new AtomicReference<>(null); watchPod(namespace, podName, new AbortChecker() { @Override public Abort check(String nodeName, Collection<JsonNode> containerStatusNodes) { if (nodeName != null) { nodeNameRef.set(nodeName); return new Abort(null); } else { return null; } } }, jobLogger); if (jobContext != null) jobContext.notifyJobRunning(null); String nodeName = Preconditions.checkNotNull(nodeNameRef.get()); jobLogger.log("Running job on node " + nodeName + "..."); jobLogger.log("Starting job containers..."); AtomicBoolean failed = new AtomicBoolean(false); for (String containerName: containerNames) { logger.debug("Waiting for start of container (pod: {}, container: {})...", podFQN, containerName); watchPod(namespace, podName, new AbortChecker() { @Override public Abort check(String nodeName, Collection<JsonNode> containerStatusNodes) { ContainerError error = getContainerErrors(containerStatusNodes).get(containerName); if (error != null) { /* * For non-fatal errors (command exited with non-zero code), we abort the watch * without an exception, and will continue to collect the container log which * might contain error details */ if (error.isFatal()) { String errorMessage; if (containerName.startsWith("step-")) { List<Integer> position = KubernetesHelper.parsePosition(containerName.substring("step-".length())); errorMessage = "Step \"" + entryFacade.getNamesAsString(position) + ": " + error.getMessage(); } else { errorMessage = containerName + ": " + error.getMessage(); } return new Abort(errorMessage); } else { return new Abort(null); } } else if (getStartedContainers(containerStatusNodes).contains(containerName)) { return new Abort(null); } else { return null; } } }, jobLogger); logger.debug("Collecting log of container (pod: {}, container: {})...", podFQN, containerName); collectContainerLog(namespace, podName, containerName, LOG_END_MESSAGE, jobLogger); logger.debug("Waiting for stop of container (pod: {})...", podFQN, containerName); watchPod(namespace, podName, new AbortChecker() { @Override public Abort check(String nodeName, Collection<JsonNode> containerStatusNodes) { ContainerError error = getContainerErrors(containerStatusNodes).get(containerName); if (error != null) { String errorMessage; if (containerName.startsWith("step-")) { List<Integer> position = KubernetesHelper.parsePosition(containerName.substring("step-".length())); errorMessage = "Step \"" + entryFacade.getNamesAsString(position) + " is failed: " + error.getMessage(); } else { errorMessage = containerName + ": " + error.getMessage(); } /* * We abort the watch with an exception for two reasons: * * 1. Init container error will prevent other containers to start. * 2. Step containers may not run command in case of fatal error and sidecar * container will wait indefinitely on the successful/failed mark file in * this case, causing log following last indefinitely */ if (error.isFatal() || containerName.equals("init")) { return new Abort(errorMessage); } else { jobLogger.error(errorMessage); failed.set(true); return new Abort(null); } } else if (getStoppedContainers(containerStatusNodes).contains(containerName)) { return new Abort(null); } else { return null; } } }, jobLogger); } if (failed.get()) throw new FailedException(); } finally { deleteNamespace(namespace, jobLogger); } } finally { if (getClusterRole() != null) deleteClusterRoleBinding(namespace, jobLogger); } }
Vulnerability Classification: - CWE: CWE-610 - CVE: CVE-2022-39206 - Severity: CRITICAL - CVSS Score: 9.9 Description: Fix the docker sock mount security vulnerability Function: execute File: server-plugin/server-plugin-executor-kubernetes/src/main/java/io/onedev/server/plugin/executor/kubernetes/KubernetesExecutor.java Repository: theonedev/onedev Fixed Code: private void execute(String jobToken, TaskLogger jobLogger, Object executionContext) { jobLogger.log("Checking cluster access..."); JobContext jobContext; if (executionContext instanceof JobContext) jobContext = (JobContext) executionContext; else jobContext = null; Commandline kubectl = newKubeCtl(); kubectl.addArgs("cluster-info"); kubectl.execute(new LineConsumer() { @Override public void consume(String line) { logger.debug(line); } }, new LineConsumer() { @Override public void consume(String line) { jobLogger.log(line); } }).checkReturnCode(); String namespace ; if (jobContext != null) { namespace = getName() + "-" + jobContext.getProjectId() + "-" + jobContext.getBuildNumber() + "-" + jobContext.getRetried(); } else { namespace = getName() + "-executor-test"; } if (getClusterRole() != null) createClusterRoleBinding(namespace, jobLogger); try { createNamespace(namespace, jobContext, jobLogger); jobLogger.log(String.format("Executing job (executor: %s, namespace: %s)...", getName(), namespace)); try { String imagePullSecretName = createImagePullSecret(namespace, jobLogger); if (jobContext != null) { for (Service jobService: jobContext.getServices()) { jobLogger.log("Starting service (name: " + jobService.getName() + ", image: " + jobService.getImage() + ")..."); startService(namespace, jobContext, jobService, imagePullSecretName, jobLogger); } } String trustCertsConfigMapName = createTrustCertsConfigMap(namespace, jobLogger); OsInfo osInfo = getBaselineOsInfo(getNodeSelector(), jobLogger); Map<String, Object> podSpec = new LinkedHashMap<>(); List<Map<Object, Object>> containerSpecs = new ArrayList<>(); String containerBuildHome; String containerCommandHome; String containerCacheHome; String containerAuthInfoHome; String trustCertsHome; String dockerSock; String containerdSock; String containerWorkspace; if (osInfo.isWindows()) { containerBuildHome = "C:\\onedev-build"; containerWorkspace = containerBuildHome + "\\workspace"; containerCacheHome = containerBuildHome + "\\cache"; containerCommandHome = containerBuildHome + "\\command"; containerAuthInfoHome = "C:\\Users\\ContainerAdministrator\\auth-info"; trustCertsHome = containerBuildHome + "\\trust-certs"; dockerSock = "\\\\.\\pipe\\docker_engine"; containerdSock = "\\\\.\\pipe\\containerd-containerd"; } else { containerBuildHome = "/onedev-build"; containerWorkspace = containerBuildHome +"/workspace"; containerCacheHome = containerBuildHome + "/cache"; containerCommandHome = containerBuildHome + "/command"; containerAuthInfoHome = "/root/auth-info"; trustCertsHome = containerBuildHome + "/trust-certs"; dockerSock = "/var/run/docker.sock"; containerdSock = "/run/containerd/containerd.sock"; } Map<String, String> buildHomeMount = CollectionUtils.newLinkedHashMap( "name", "build-home", "mountPath", containerBuildHome); Map<String, String> authInfoMount = CollectionUtils.newLinkedHashMap( "name", "auth-info-home", "mountPath", containerAuthInfoHome); // Windows nanoserver default user is ContainerUser Map<String, String> authInfoMount2 = CollectionUtils.newLinkedHashMap( "name", "auth-info-home", "mountPath", "C:\\Users\\ContainerUser\\auth-info"); Map<String, String> cacheHomeMount = CollectionUtils.newLinkedHashMap( "name", "cache-home", "mountPath", containerCacheHome); Map<String, String> trustCertsMount = CollectionUtils.newLinkedHashMap( "name", "trust-certs-home", "mountPath", trustCertsHome); Map<String, String> dockerSockMount = CollectionUtils.newLinkedHashMap( "name", "docker-sock", "mountPath", dockerSock); Map<String, String> containerdSockMount = CollectionUtils.newLinkedHashMap( "name", "containerd-sock", "mountPath", containerdSock); List<Object> commonVolumeMounts = Lists.<Object>newArrayList(buildHomeMount, authInfoMount, cacheHomeMount); if (osInfo.isWindows()) commonVolumeMounts.add(authInfoMount2); if (trustCertsConfigMapName != null) commonVolumeMounts.add(trustCertsMount); if (isMountContainerSock()) { commonVolumeMounts.add(dockerSockMount); commonVolumeMounts.add(containerdSockMount); } CompositeFacade entryFacade; if (jobContext != null) { entryFacade = new CompositeFacade(jobContext.getActions()); } else { List<Action> actions = new ArrayList<>(); CommandFacade facade = new CommandFacade((String) executionContext, Lists.newArrayList("this does not matter"), false); actions.add(new Action("test", facade, ExecuteCondition.ALWAYS)); entryFacade = new CompositeFacade(actions); } List<String> containerNames = Lists.newArrayList("init"); String helperImageSuffix; if (osInfo.isWindows()) { String windowsVersion = OsInfo.WINDOWS_VERSIONS.get(osInfo.getWindowsBuild()); if (windowsVersion != null) helperImageSuffix = "windows-" + windowsVersion.toLowerCase(); else throw new ExplicitException("Unsupported windows build number: " + osInfo.getWindowsBuild()); } else { helperImageSuffix = "linux"; } String helperImage = IMAGE_REPO_PREFIX + "-" + helperImageSuffix + ":" + KubernetesHelper.getVersion(); List<Map<Object, Object>> commonEnvs = new ArrayList<>(); commonEnvs.add(CollectionUtils.newLinkedHashMap( "name", ENV_SERVER_URL, "value", getServerUrl())); commonEnvs.add(CollectionUtils.newLinkedHashMap( "name", ENV_JOB_TOKEN, "value", jobToken)); commonEnvs.add(CollectionUtils.newLinkedHashMap( "name", ENV_OS_INFO, "value", Hex.encodeHexString(SerializationUtils.serialize(osInfo)) )); commonEnvs.add(CollectionUtils.newLinkedHashMap( "name", "ONEDEV_WORKSPACE", "value", containerWorkspace )); entryFacade.traverse(new LeafVisitor<Void>() { @Override public Void visit(LeafFacade facade, List<Integer> position) { String containerName = getContainerName(position); containerNames.add(containerName); Map<Object, Object> stepContainerSpec; if (facade instanceof CommandFacade) { CommandFacade commandFacade = (CommandFacade) facade; OsExecution execution = commandFacade.getExecution(osInfo); if (execution.getImage() == null) { throw new ExplicitException("This step can only be executed by server shell " + "executor or remote shell executor"); } stepContainerSpec = CollectionUtils.newHashMap( "name", containerName, "image", execution.getImage()); if (commandFacade.isUseTTY()) stepContainerSpec.put("tty", true); stepContainerSpec.put("volumeMounts", commonVolumeMounts); stepContainerSpec.put("env", commonEnvs); } else if (facade instanceof BuildImageFacade) { stepContainerSpec = CollectionUtils.newHashMap( "name", containerName, "image", helperImage); stepContainerSpec.put("volumeMounts", commonVolumeMounts); stepContainerSpec.put("env", commonEnvs); } else if (facade instanceof RunContainerFacade) { RunContainerFacade runContainerFacade = (RunContainerFacade) facade; OsContainer container = runContainerFacade.getContainer(osInfo); stepContainerSpec = CollectionUtils.newHashMap( "name", containerName, "image", container.getImage()); if (runContainerFacade.isUseTTY()) stepContainerSpec.put("tty", true); List<Object> volumeMounts = new ArrayList<>(commonVolumeMounts); for (Map.Entry<String, String> entry: container.getVolumeMounts().entrySet()) { String subPath = StringUtils.stripStart(entry.getKey(), "/\\"); if (osInfo.isWindows()) subPath = "workspace\\" + subPath; else subPath = "workspace/" + subPath; volumeMounts.add(CollectionUtils.newLinkedHashMap( "name", "build-home", "mountPath", entry.getValue(), "subPath", subPath)); } stepContainerSpec.put("volumeMounts", volumeMounts); List<Map<Object, Object>> envs = new ArrayList<>(commonEnvs); for (Map.Entry<String, String> entry: container.getEnvMap().entrySet()) { envs.add(CollectionUtils.newLinkedHashMap( "name", entry.getKey(), "value", entry.getValue())); } stepContainerSpec.put("env", envs); } else { stepContainerSpec = CollectionUtils.newHashMap( "name", containerName, "image", helperImage); stepContainerSpec.put("volumeMounts", commonVolumeMounts); stepContainerSpec.put("env", commonEnvs); } String positionStr = stringifyPosition(position); if (osInfo.isLinux()) { stepContainerSpec.put("command", Lists.newArrayList("sh")); stepContainerSpec.put("args", Lists.newArrayList(containerCommandHome + "/" + positionStr + ".sh")); } else { stepContainerSpec.put("command", Lists.newArrayList("cmd")); stepContainerSpec.put("args", Lists.newArrayList("/c", containerCommandHome + "\\" + positionStr + ".bat")); } containerSpecs.add(stepContainerSpec); return null; } }, new ArrayList<>()); String k8sHelperClassPath; if (osInfo.isLinux()) { k8sHelperClassPath = "/k8s-helper/*"; } else { k8sHelperClassPath = "C:\\k8s-helper\\*"; } List<String> sidecarArgs = Lists.newArrayList( "-classpath", k8sHelperClassPath, "io.onedev.k8shelper.SideCar"); List<String> initArgs = Lists.newArrayList( "-classpath", k8sHelperClassPath, "io.onedev.k8shelper.Init"); if (jobContext == null) { sidecarArgs.add("test"); initArgs.add("test"); } List<Map<Object, Object>> initEnvs = new ArrayList<>(commonEnvs); List<RegistryLoginFacade> registryLogins = new ArrayList<>(); for (RegistryLogin login: getRegistryLogins()) registryLogins.add(new RegistryLoginFacade(login.getRegistryUrl(), login.getUserName(), login.getPassword())); initEnvs.add(CollectionUtils.newLinkedHashMap( "name", KubernetesHelper.ENV_REGISTRY_LOGINS, "value", Hex.encodeHexString(SerializationUtils.serialize((Serializable) registryLogins)) )); Map<Object, Object> initContainerSpec = CollectionUtils.newHashMap( "name", "init", "image", helperImage, "command", Lists.newArrayList("java"), "args", initArgs, "env", initEnvs, "volumeMounts", commonVolumeMounts); Map<Object, Object> sidecarContainerSpec = CollectionUtils.newHashMap( "name", "sidecar", "image", helperImage, "command", Lists.newArrayList("java"), "args", sidecarArgs, "env", commonEnvs, "volumeMounts", commonVolumeMounts); if (jobContext != null) { sidecarContainerSpec.put("resources", CollectionUtils.newLinkedHashMap("requests", CollectionUtils.newLinkedHashMap( "cpu", jobContext.getCpuRequirement() + "m", "memory", jobContext.getMemoryRequirement() + "m"))); } containerSpecs.add(sidecarContainerSpec); containerNames.add("sidecar"); podSpec.put("containers", containerSpecs); podSpec.put("initContainers", Lists.<Object>newArrayList(initContainerSpec)); if (imagePullSecretName != null) podSpec.put("imagePullSecrets", Lists.<Object>newArrayList(CollectionUtils.newLinkedHashMap("name", imagePullSecretName))); podSpec.put("restartPolicy", "Never"); if (!getNodeSelector().isEmpty()) podSpec.put("nodeSelector", toMap(getNodeSelector())); Map<Object, Object> buildHomeVolume = CollectionUtils.newLinkedHashMap( "name", "build-home", "emptyDir", CollectionUtils.newLinkedHashMap()); Map<Object, Object> userHomeVolume = CollectionUtils.newLinkedHashMap( "name", "auth-info-home", "emptyDir", CollectionUtils.newLinkedHashMap()); Map<Object, Object> cacheHomeVolume = CollectionUtils.newLinkedHashMap( "name", "cache-home", "hostPath", CollectionUtils.newLinkedHashMap( "path", osInfo.getCacheHome(), "type", "DirectoryOrCreate")); List<Object> volumes = Lists.<Object>newArrayList(buildHomeVolume, userHomeVolume, cacheHomeVolume); if (trustCertsConfigMapName != null) { volumes.add(CollectionUtils.newLinkedHashMap( "name", "trust-certs-home", "configMap", CollectionUtils.newLinkedHashMap( "name", trustCertsConfigMapName))); } if (isMountContainerSock()) { volumes.add(CollectionUtils.newLinkedHashMap( "name", "docker-sock", "hostPath", CollectionUtils.newLinkedHashMap( "path", dockerSock))); volumes.add(CollectionUtils.newLinkedHashMap( "name", "containerd-sock", "hostPath", CollectionUtils.newLinkedHashMap( "path", containerdSock))); } podSpec.put("volumes", volumes); String podName = "job"; Map<Object, Object> podDef = CollectionUtils.newLinkedHashMap( "apiVersion", "v1", "kind", "Pod", "metadata", CollectionUtils.newLinkedHashMap( "name", podName, "namespace", namespace), "spec", podSpec); createResource(podDef, Sets.newHashSet(), jobLogger); String podFQN = namespace + "/" + podName; AtomicReference<String> nodeNameRef = new AtomicReference<>(null); watchPod(namespace, podName, new AbortChecker() { @Override public Abort check(String nodeName, Collection<JsonNode> containerStatusNodes) { if (nodeName != null) { nodeNameRef.set(nodeName); return new Abort(null); } else { return null; } } }, jobLogger); if (jobContext != null) jobContext.notifyJobRunning(null); String nodeName = Preconditions.checkNotNull(nodeNameRef.get()); jobLogger.log("Running job on node " + nodeName + "..."); jobLogger.log("Starting job containers..."); AtomicBoolean failed = new AtomicBoolean(false); for (String containerName: containerNames) { logger.debug("Waiting for start of container (pod: {}, container: {})...", podFQN, containerName); watchPod(namespace, podName, new AbortChecker() { @Override public Abort check(String nodeName, Collection<JsonNode> containerStatusNodes) { ContainerError error = getContainerErrors(containerStatusNodes).get(containerName); if (error != null) { /* * For non-fatal errors (command exited with non-zero code), we abort the watch * without an exception, and will continue to collect the container log which * might contain error details */ if (error.isFatal()) { String errorMessage; if (containerName.startsWith("step-")) { List<Integer> position = KubernetesHelper.parsePosition(containerName.substring("step-".length())); errorMessage = "Step \"" + entryFacade.getNamesAsString(position) + ": " + error.getMessage(); } else { errorMessage = containerName + ": " + error.getMessage(); } return new Abort(errorMessage); } else { return new Abort(null); } } else if (getStartedContainers(containerStatusNodes).contains(containerName)) { return new Abort(null); } else { return null; } } }, jobLogger); logger.debug("Collecting log of container (pod: {}, container: {})...", podFQN, containerName); collectContainerLog(namespace, podName, containerName, LOG_END_MESSAGE, jobLogger); logger.debug("Waiting for stop of container (pod: {})...", podFQN, containerName); watchPod(namespace, podName, new AbortChecker() { @Override public Abort check(String nodeName, Collection<JsonNode> containerStatusNodes) { ContainerError error = getContainerErrors(containerStatusNodes).get(containerName); if (error != null) { String errorMessage; if (containerName.startsWith("step-")) { List<Integer> position = KubernetesHelper.parsePosition(containerName.substring("step-".length())); errorMessage = "Step \"" + entryFacade.getNamesAsString(position) + " is failed: " + error.getMessage(); } else { errorMessage = containerName + ": " + error.getMessage(); } /* * We abort the watch with an exception for two reasons: * * 1. Init container error will prevent other containers to start. * 2. Step containers may not run command in case of fatal error and sidecar * container will wait indefinitely on the successful/failed mark file in * this case, causing log following last indefinitely */ if (error.isFatal() || containerName.equals("init")) { return new Abort(errorMessage); } else { jobLogger.error(errorMessage); failed.set(true); return new Abort(null); } } else if (getStoppedContainers(containerStatusNodes).contains(containerName)) { return new Abort(null); } else { return null; } } }, jobLogger); } if (failed.get()) throw new FailedException(); } finally { deleteNamespace(namespace, jobLogger); } } finally { if (getClusterRole() != null) deleteClusterRoleBinding(namespace, jobLogger); } }
[ "CWE-610" ]
CVE-2022-39206
CRITICAL
9.9
theonedev/onedev
execute
server-plugin/server-plugin-executor-kubernetes/src/main/java/io/onedev/server/plugin/executor/kubernetes/KubernetesExecutor.java
0052047a5b5095ac6a6b4a73a522d0272fec3a22
1
Analyze the following code function for security vulnerabilities
@Override public void uninstallPackageWithActiveAdmins(final String packageName) { Preconditions.checkArgument(!TextUtils.isEmpty(packageName)); final CallerIdentity caller = getCallerIdentity(); Preconditions.checkCallAuthorization( hasCallingOrSelfPermission(permission.MANAGE_DEVICE_ADMINS)); final int userId = caller.getUserId(); enforceUserUnlocked(userId); final ComponentName profileOwner = getProfileOwnerAsUser(userId); if (profileOwner != null && packageName.equals(profileOwner.getPackageName())) { throw new IllegalArgumentException("Cannot uninstall a package with a profile owner"); } final ComponentName deviceOwner = getDeviceOwnerComponent(/* callingUserOnly= */ false); if (getDeviceOwnerUserId() == userId && deviceOwner != null && packageName.equals(deviceOwner.getPackageName())) { throw new IllegalArgumentException("Cannot uninstall a package with a device owner"); } final Pair<String, Integer> packageUserPair = new Pair<>(packageName, userId); synchronized (getLockObject()) { mPackagesToRemove.add(packageUserPair); } // All active admins on the user. final List<ComponentName> allActiveAdmins = getActiveAdmins(userId); // Active admins in the target package. final List<ComponentName> packageActiveAdmins = new ArrayList<>(); if (allActiveAdmins != null) { for (ComponentName activeAdmin : allActiveAdmins) { if (packageName.equals(activeAdmin.getPackageName())) { packageActiveAdmins.add(activeAdmin); removeActiveAdmin(activeAdmin, userId); } } } if (packageActiveAdmins.size() == 0) { startUninstallIntent(packageName, userId); } else { mHandler.postDelayed(new Runnable() { @Override public void run() { for (ComponentName activeAdmin : packageActiveAdmins) { removeAdminArtifacts(activeAdmin, userId); } startUninstallIntent(packageName, userId); } }, DEVICE_ADMIN_DEACTIVATE_TIMEOUT); // Start uninstall after timeout anyway. } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: uninstallPackageWithActiveAdmins File: services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-20" ]
CVE-2023-21284
MEDIUM
5.5
android
uninstallPackageWithActiveAdmins
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
ed3f25b7222d4cff471f2b7d22d1150348146957
0
Analyze the following code function for security vulnerabilities
private List<PhoneAccountHandle> filterForAccountsVisibleToCaller( List<PhoneAccountHandle> phoneAccountHandles) { List<PhoneAccountHandle> profilePhoneAccountHandles = new ArrayList<>(phoneAccountHandles.size()); for (PhoneAccountHandle phoneAccountHandle : phoneAccountHandles) { if (isVisibleToCaller(phoneAccountHandle)) { profilePhoneAccountHandles.add(phoneAccountHandle); } } return profilePhoneAccountHandles; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: filterForAccountsVisibleToCaller File: src/com/android/server/telecom/TelecomServiceImpl.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-0847
HIGH
7.2
android
filterForAccountsVisibleToCaller
src/com/android/server/telecom/TelecomServiceImpl.java
2750faaa1ec819eed9acffea7bd3daf867fda444
0
Analyze the following code function for security vulnerabilities
public OutputStream openOutputStream(Object connection, int offset) throws IOException { String con = (String) connection; con = removeFilePrefix(con); RandomAccessFile rf = new RandomAccessFile(con, "rw"); rf.seek(offset); FileOutputStream fc = new FileOutputStream(rf.getFD()); BufferedOutputStream o = new BufferedOutputStream(fc, con); o.setConnection(rf); return o; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: openOutputStream File: Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java Repository: codenameone/CodenameOne The code follows secure coding practices.
[ "CWE-668" ]
CVE-2022-4903
MEDIUM
5.1
codenameone/CodenameOne
openOutputStream
Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java
dad49c9ef26a598619fc48d2697151a02987d478
0
Analyze the following code function for security vulnerabilities
public String getLaunchedFromPackage(IBinder activityToken) { return ActivityClient.getInstance().getLaunchedFromPackage(activityToken); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getLaunchedFromPackage 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
getLaunchedFromPackage
services/core/java/com/android/server/am/ActivityManagerService.java
d10b27e539f7bc91c2360d429b9d05f05274670d
0
Analyze the following code function for security vulnerabilities
private void logTimer(String description, String sql, long startNanoTime) { if (! log.isDebugEnabled()) { return; } logTimer(description, sql, startNanoTime, System.nanoTime()); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: logTimer File: domain-models-runtime/src/main/java/org/folio/rest/persist/PostgresClient.java Repository: folio-org/raml-module-builder The code follows secure coding practices.
[ "CWE-89" ]
CVE-2019-15534
HIGH
7.5
folio-org/raml-module-builder
logTimer
domain-models-runtime/src/main/java/org/folio/rest/persist/PostgresClient.java
b7ef741133e57add40aa4cb19430a0065f378a94
0
Analyze the following code function for security vulnerabilities
@Override public void addItems(Context c, List<Collection> mycollections, String sourceDir, String mapFile, boolean template) throws Exception { // create the mapfile File outFile = null; PrintWriter mapOut = null; try { Map<String, String> skipItems = new HashMap<>(); // set of items to skip if in 'resume' // mode System.out.println("Adding items from directory: " + sourceDir); System.out.println("Generating mapfile: " + mapFile); boolean directoryFileCollections = false; if (mycollections == null) { directoryFileCollections = true; } if (!isTest) { // get the directory names of items to skip (will be in keys of // hash) if (isResume) { skipItems = readMapFile(mapFile); } // sneaky isResume == true means open file in append mode outFile = new File(mapFile); mapOut = new PrintWriter(new FileWriter(outFile, isResume)); if (mapOut == null) { throw new Exception("can't open mapfile: " + mapFile); } } // open and process the source directory File d = new java.io.File(sourceDir); if (d == null || !d.isDirectory()) { throw new Exception("Error, cannot open source directory " + sourceDir); } String[] dircontents = d.list(directoryFilter); Arrays.sort(dircontents, ComparatorUtils.naturalComparator()); for (int i = 0; i < dircontents.length; i++) { if (skipItems.containsKey(dircontents[i])) { System.out.println("Skipping import of " + dircontents[i]); } else { List<Collection> clist; if (directoryFileCollections) { String path = sourceDir + File.separatorChar + dircontents[i]; try { List<Collection> cols = processCollectionFile(c, path, "collections"); if (cols == null) { System.out.println("No collections specified for item " + dircontents[i] + ". Skipping."); continue; } clist = cols; } catch (IllegalArgumentException e) { System.out.println(e.getMessage() + " Skipping." ); continue; } } else { clist = mycollections; } Item item = addItem(c, clist, sourceDir, dircontents[i], mapOut, template); c.uncacheEntity(item); System.out.println(i + " " + dircontents[i]); } } } finally { if(mapOut!=null) { mapOut.flush(); mapOut.close(); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: addItems File: dspace-api/src/main/java/org/dspace/app/itemimport/ItemImportServiceImpl.java Repository: DSpace The code follows secure coding practices.
[ "CWE-22" ]
CVE-2022-31195
HIGH
7.2
DSpace
addItems
dspace-api/src/main/java/org/dspace/app/itemimport/ItemImportServiceImpl.java
7af52a0883a9dbc475cf3001f04ed11b24c8a4c0
0
Analyze the following code function for security vulnerabilities
private boolean setTargetBssid(WifiConfiguration config, String bssid) { if (config == null || bssid == null) { return false; } if (config.BSSID != null) { bssid = config.BSSID; if (mVerboseLoggingEnabled) { Log.d(getTag(), "force BSSID to " + bssid + "due to config"); } } if (mVerboseLoggingEnabled) { Log.d(getTag(), "setTargetBssid set to " + bssid + " key=" + config.getProfileKey()); } mTargetBssid = bssid; config.getNetworkSelectionStatus().setNetworkSelectionBSSID(bssid); return true; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setTargetBssid 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
setTargetBssid
service/java/com/android/server/wifi/ClientModeImpl.java
72e903f258b5040b8f492cf18edd124b5a1ac770
0
Analyze the following code function for security vulnerabilities
public void onKeyguardViewManagerStatesUpdated() { logStateToEventlog(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: onKeyguardViewManagerStatesUpdated File: packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2017-0822
HIGH
7.5
android
onKeyguardViewManagerStatesUpdated
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
c574568aaede7f652432deb7707f20ae54bbdf9a
0
Analyze the following code function for security vulnerabilities
public static final native int setUid(int uid);
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setUid File: core/java/android/os/Process.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-3911
HIGH
9.3
android
setUid
core/java/android/os/Process.java
2c7008421cb67f5d89f16911bdbe36f6c35311ad
0
Analyze the following code function for security vulnerabilities
public String getGitHubLoginURL() { return "https://github.com/login/oauth/authorize?response_type=code&client_id=" + CONF.githubAppId() + "&scope=user%3Aemail&state=" + getParaAppId() + "&redirect_uri=" + getParaEndpoint() + "/github_auth"; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getGitHubLoginURL 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
getGitHubLoginURL
src/main/java/com/erudika/scoold/utils/ScooldUtils.java
62a0e92e1486ddc17676a7ead2c07ff653d167ce
0
Analyze the following code function for security vulnerabilities
public void attachFile(EntityReference pageReference, String name, InputStream is, boolean failIfExists, UsernamePasswordCredentials credentials) throws Exception { UsernamePasswordCredentials currentCredentials = getDefaultCredentials(); EntityReference reference = new EntityReference(name, EntityType.ATTACHMENT, pageReference); try { if (credentials != null) { setDefaultCredentials(credentials); } attachFile(reference, is, failIfExists); } finally { if (credentials != null) { setDefaultCredentials(currentCredentials); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: attachFile File: xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-ui/src/main/java/org/xwiki/test/ui/TestUtils.java Repository: xwiki/xwiki-platform The code follows secure coding practices.
[ "CWE-863" ]
CVE-2023-35166
HIGH
8.8
xwiki/xwiki-platform
attachFile
xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-ui/src/main/java/org/xwiki/test/ui/TestUtils.java
98208c5bb1e8cdf3ff1ac35d8b3d1cb3c28b3263
0
Analyze the following code function for security vulnerabilities
CacheKeyGenerator getCacheInvalidateKeyGenerator(AnnotationValue<CacheInvalidate> cacheConfig) { return cacheConfig.get(MEMBER_KEY_GENERATOR, CacheKeyGenerator.class).orElseGet(() -> getKeyGenerator(cacheConfig.get(MEMBER_KEY_GENERATOR, Class.class).orElse(null)) ); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getCacheInvalidateKeyGenerator File: runtime/src/main/java/io/micronaut/cache/interceptor/CacheInterceptor.java Repository: micronaut-projects/micronaut-core The code follows secure coding practices.
[ "CWE-400" ]
CVE-2022-21700
MEDIUM
5
micronaut-projects/micronaut-core
getCacheInvalidateKeyGenerator
runtime/src/main/java/io/micronaut/cache/interceptor/CacheInterceptor.java
b8ec32c311689667c69ae7d9f9c3b3a8abc96fe3
0
Analyze the following code function for security vulnerabilities
private DecompressedInputStream initializeDecompressorForThisEntry(CipherInputStream<?> cipherInputStream, LocalFileHeader localFileHeader) throws ZipException { CompressionMethod compressionMethod = getCompressionMethod(localFileHeader); if (compressionMethod == CompressionMethod.DEFLATE) { return new InflaterInputStream(cipherInputStream, zip4jConfig.getBufferSize()); } return new StoreInputStream(cipherInputStream); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: initializeDecompressorForThisEntry File: src/main/java/net/lingala/zip4j/io/inputstream/ZipInputStream.java Repository: srikanth-lingala/zip4j The code follows secure coding practices.
[ "CWE-346" ]
CVE-2023-22899
MEDIUM
5.9
srikanth-lingala/zip4j
initializeDecompressorForThisEntry
src/main/java/net/lingala/zip4j/io/inputstream/ZipInputStream.java
ddd8fdc8ad0583eb4a6172dc86c72c881485c55b
0
Analyze the following code function for security vulnerabilities
public final void disableSelf() { final IAccessibilityServiceConnection connection = AccessibilityInteractionClient.getInstance().getConnection(mConnectionId); if (connection != null) { try { connection.disableSelf(); } catch (RemoteException re) { throw new RuntimeException(re); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: disableSelf File: core/java/android/accessibilityservice/AccessibilityService.java Repository: android The code follows secure coding practices.
[ "CWE-284" ]
CVE-2016-3923
MEDIUM
4.3
android
disableSelf
core/java/android/accessibilityservice/AccessibilityService.java
5f256310187b4ff2f13a7abb9afed9126facd7bc
0
Analyze the following code function for security vulnerabilities
public static byte[] readByteArray(ObjectDataInput in) throws IOException { int size = in.readInt(); if (size == 0) { return null; } else { byte[] b = new byte[size]; in.readFully(b); return b; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: readByteArray File: hazelcast/src/main/java/com/hazelcast/nio/IOUtil.java Repository: hazelcast The code follows secure coding practices.
[ "CWE-502" ]
CVE-2016-10750
MEDIUM
6.8
hazelcast
readByteArray
hazelcast/src/main/java/com/hazelcast/nio/IOUtil.java
c1c31359a1df953e79a9ca9b6c54b3cdbfef11e9
0
Analyze the following code function for security vulnerabilities
public ResultSetMetaData getMetaData() throws SQLException { checkClosed(); if (rsMetaData == null) { rsMetaData = createMetaData(); } return rsMetaData; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getMetaData File: pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java Repository: pgjdbc The code follows secure coding practices.
[ "CWE-89" ]
CVE-2022-31197
HIGH
8
pgjdbc
getMetaData
pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
739e599d52ad80f8dcd6efedc6157859b1a9d637
0
Analyze the following code function for security vulnerabilities
private String getDefaultScheme() { return IntentFilter.SCHEME_HTTPS; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getDefaultScheme File: services/core/java/com/android/server/pm/PackageManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-119" ]
CVE-2016-2497
HIGH
7.5
android
getDefaultScheme
services/core/java/com/android/server/pm/PackageManagerService.java
a75537b496e9df71c74c1d045ba5569631a16298
0
Analyze the following code function for security vulnerabilities
private void writeStream(ServletOutputStream outputStream, InputStream inputStream) throws IOException { final byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; int bytes; while ((bytes = inputStream.read(buffer)) >= 0) { outputStream.write(buffer, 0, bytes); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: writeStream File: flow-server/src/main/java/com/vaadin/flow/server/DevModeHandler.java Repository: vaadin/flow The code follows secure coding practices.
[ "CWE-22" ]
CVE-2020-36321
MEDIUM
5
vaadin/flow
writeStream
flow-server/src/main/java/com/vaadin/flow/server/DevModeHandler.java
6ae6460ca4f3a9b50bd46fbf49c807fe67718307
0
Analyze the following code function for security vulnerabilities
private Map<String, byte[]> readTrustRootCerts(Parcel in) { int size = in.readInt(); if (size == NULL_VALUE) { return null; } Map<String, byte[]> trustRootCerts = new HashMap<>(size); for (int i = 0; i < size; i++) { String key = in.readString(); byte[] value = in.createByteArray(); trustRootCerts.put(key, value); } return trustRootCerts; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: readTrustRootCerts File: framework/java/android/net/wifi/hotspot2/PasspointConfiguration.java Repository: android The code follows secure coding practices.
[ "CWE-120" ]
CVE-2023-21243
MEDIUM
5.5
android
readTrustRootCerts
framework/java/android/net/wifi/hotspot2/PasspointConfiguration.java
5b49b8711efaadadf5052ba85288860c2d7ca7a6
0
Analyze the following code function for security vulnerabilities
public MediaSession.Token getSessionToken() { return mSessionToken; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getSessionToken File: services/core/java/com/android/server/media/MediaSessionRecord.java Repository: android The code follows secure coding practices.
[ "CWE-400" ]
CVE-2023-21280
MEDIUM
5.5
android
getSessionToken
services/core/java/com/android/server/media/MediaSessionRecord.java
06e772e05514af4aa427641784c5eec39a892ed3
0
Analyze the following code function for security vulnerabilities
@Override public void startAppFreezingScreen(IBinder token, int configChanges) { if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS, "setAppFreezingScreen()")) { throw new SecurityException("Requires MANAGE_APP_TOKENS permission"); } synchronized(mWindowMap) { if (configChanges == 0 && okToDisplay()) { if (DEBUG_ORIENTATION) Slog.v(TAG, "Skipping set freeze of " + token); return; } AppWindowToken wtoken = findAppWindowToken(token); if (wtoken == null || wtoken.appToken == null) { Slog.w(TAG, "Attempted to freeze screen with non-existing app token: " + wtoken); return; } final long origId = Binder.clearCallingIdentity(); startAppFreezingScreenLocked(wtoken); Binder.restoreCallingIdentity(origId); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: startAppFreezingScreen 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
startAppFreezingScreen
services/core/java/com/android/server/wm/WindowManagerService.java
69729fa8b13cadbf3173fe1f389fe4f3b7bd0f9c
0
Analyze the following code function for security vulnerabilities
public static <T> T unmarshal(final Class<T> clazz, final Reader reader, final boolean validate) { return unmarshal(clazz, new InputSource(reader), null, validate, false); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: unmarshal File: core/xml/src/main/java/org/opennms/core/xml/JaxbUtils.java Repository: OpenNMS/opennms The code follows secure coding practices.
[ "CWE-611" ]
CVE-2023-0871
MEDIUM
6.1
OpenNMS/opennms
unmarshal
core/xml/src/main/java/org/opennms/core/xml/JaxbUtils.java
3c17231714e3d55809efc580a05734ed530f9ad4
0
Analyze the following code function for security vulnerabilities
public int hashCode() { return hashCode; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: hashCode File: services/core/java/com/android/server/am/PendingIntentRecord.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-20918
CRITICAL
9.8
android
hashCode
services/core/java/com/android/server/am/PendingIntentRecord.java
8418e3a017428683d173c0c82b0eb02d5b923a4e
0
Analyze the following code function for security vulnerabilities
public String getPassword() { return currentPassword(); }
Vulnerability Classification: - CWE: CWE-668 - CVE: CVE-2022-39309 - Severity: MEDIUM - CVSS Score: 6.5 Description: SCMMaterial changes #000 * SCMMaterial unlike SCMMaterialConfig objects are used for polling, they do not need to encrypt the password. Hence removing the encryptedPassword attribute. Function: getPassword File: domain/src/main/java/com/thoughtworks/go/config/materials/ScmMaterial.java Repository: gocd Fixed Code: public String getPassword() { return password; }
[ "CWE-668" ]
CVE-2022-39309
MEDIUM
6.5
gocd
getPassword
domain/src/main/java/com/thoughtworks/go/config/materials/ScmMaterial.java
691b479f1310034992da141760e9c5d1f5b60e8a
1
Analyze the following code function for security vulnerabilities
public boolean cleanup() { mService = null; return true; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: cleanup File: src/com/android/bluetooth/btservice/AdapterService.java Repository: android The code follows secure coding practices.
[ "CWE-362", "CWE-20" ]
CVE-2016-3760
MEDIUM
5.4
android
cleanup
src/com/android/bluetooth/btservice/AdapterService.java
122feb9a0b04290f55183ff2f0384c6c53756bd8
0
Analyze the following code function for security vulnerabilities
public static boolean isOsx() { return IS_OSX; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isOsx File: common/src/main/java/io/netty/util/internal/PlatformDependent.java Repository: netty The code follows secure coding practices.
[ "CWE-668", "CWE-378", "CWE-379" ]
CVE-2022-24823
LOW
1.9
netty
isOsx
common/src/main/java/io/netty/util/internal/PlatformDependent.java
185f8b2756a36aaa4f973f1a2a025e7d981823f1
0
Analyze the following code function for security vulnerabilities
@Override public long longValueExact() { return bigDecimalValue().longValueExact(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: longValueExact File: impl/src/main/java/org/eclipse/parsson/JsonNumberImpl.java Repository: eclipse-ee4j/parsson The code follows secure coding practices.
[ "CWE-834" ]
CVE-2023-4043
HIGH
7.5
eclipse-ee4j/parsson
longValueExact
impl/src/main/java/org/eclipse/parsson/JsonNumberImpl.java
84764ffbe3d0376da242b27a9a526138d0dfb8e6
0
Analyze the following code function for security vulnerabilities
public String computeSignature(UserDetails userDetails, long expires) { StringBuilder signatureBuilder = new StringBuilder(); signatureBuilder.append(userDetails.getUsername()).append(":"); signatureBuilder.append(expires).append(":"); signatureBuilder.append(userDetails.getPassword()).append(":"); signatureBuilder.append(secretKey); MessageDigest digest; try { digest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException("No MD5 algorithm available!"); } return new String(Hex.encode(digest.digest(signatureBuilder.toString().getBytes()))); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: computeSignature File: app/templates/src/main/java/package/security/xauth/_TokenProvider.java Repository: jhipster/generator-jhipster The code follows secure coding practices.
[ "CWE-307" ]
CVE-2015-20110
HIGH
7.5
jhipster/generator-jhipster
computeSignature
app/templates/src/main/java/package/security/xauth/_TokenProvider.java
79fe5626cb1bb80f9ac86cf46980748e65d2bdbc
0
Analyze the following code function for security vulnerabilities
public boolean isLanguageRTL(String langCode) { return StringUtils.equalsAnyIgnoreCase(langCode, "ar", "he", "dv", "iw", "fa", "ps", "sd", "ug", "ur", "yi"); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isLanguageRTL 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
isLanguageRTL
src/main/java/com/erudika/scoold/utils/ScooldUtils.java
62a0e92e1486ddc17676a7ead2c07ff653d167ce
0
Analyze the following code function for security vulnerabilities
public byte[] readBinary() throws TException { int length = readVarint32(); checkReadLength(length); return readBinary(length); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: readBinary 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
readBinary
thrift/lib/java/src/main/java/com/facebook/thrift/protocol/TCompactProtocol.java
08c2d412adb214c40bb03be7587057b25d053030
0
Analyze the following code function for security vulnerabilities
@Override public boolean shouldShowRequestPermissionRationale(String permissionName, String packageName, int userId) { if (UserHandle.getCallingUserId() != userId) { mContext.enforceCallingPermission( android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, "canShowRequestPermissionRationale for user " + userId); } final int uid = getPackageUid(packageName, userId); if (UserHandle.getAppId(getCallingUid()) != UserHandle.getAppId(uid)) { return false; } if (checkPermission(permissionName, packageName, userId) == PackageManager.PERMISSION_GRANTED) { return false; } final int flags; final long identity = Binder.clearCallingIdentity(); try { flags = getPermissionFlags(permissionName, packageName, userId); } finally { Binder.restoreCallingIdentity(identity); } final int fixedFlags = PackageManager.FLAG_PERMISSION_SYSTEM_FIXED | PackageManager.FLAG_PERMISSION_POLICY_FIXED | PackageManager.FLAG_PERMISSION_USER_FIXED; if ((flags & fixedFlags) != 0) { return false; } return (flags & PackageManager.FLAG_PERMISSION_USER_SET) != 0; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: shouldShowRequestPermissionRationale File: services/core/java/com/android/server/pm/PackageManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-119" ]
CVE-2016-2497
HIGH
7.5
android
shouldShowRequestPermissionRationale
services/core/java/com/android/server/pm/PackageManagerService.java
a75537b496e9df71c74c1d045ba5569631a16298
0
Analyze the following code function for security vulnerabilities
public String getURL(String action, String querystring, XWikiContext context) { URL url = context.getURLFactory().createURL(getSpace(), getName(), action, querystring, null, getDatabase(), context); return context.getURLFactory().getURL(url, context); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getURL File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java Repository: xwiki/xwiki-platform The code follows secure coding practices.
[ "CWE-787" ]
CVE-2023-26470
HIGH
7.5
xwiki/xwiki-platform
getURL
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
db3d1c62fc5fb59fefcda3b86065d2d362f55164
0
Analyze the following code function for security vulnerabilities
private LookupResult buildLookupResult(List<ADnsAnswer> aDnsAnswers) { /* Provide both a single and multiValue addresses. * Always read the first entry and place in singleValue */ final String singleValue = aDnsAnswers.get(0).ipAddress(); LookupResult.Builder builder = LookupResult.builder() .single(singleValue) .multiValue(Collections.singletonMap(RESULTS_FIELD, aDnsAnswers)) .stringListValue(ADnsAnswer.convertToStringListValue(aDnsAnswers)); assignMinimumTTL(aDnsAnswers, builder); return builder.build(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: buildLookupResult File: graylog2-server/src/main/java/org/graylog2/lookup/adapters/DnsLookupDataAdapter.java Repository: Graylog2/graylog2-server The code follows secure coding practices.
[ "CWE-345" ]
CVE-2023-41045
MEDIUM
5.3
Graylog2/graylog2-server
buildLookupResult
graylog2-server/src/main/java/org/graylog2/lookup/adapters/DnsLookupDataAdapter.java
466af814523cffae9fbc7e77bab7472988f03c3e
0
Analyze the following code function for security vulnerabilities
ServerErrorHandler errorHandler() { return errorHandler; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: errorHandler 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
errorHandler
core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java
df7f85824a62e997b910b5d6194a3335841065fd
0
Analyze the following code function for security vulnerabilities
public boolean addBadgeOnceAndUpdate(Profile authUser, Profile.Badge b, boolean condition) { return addBadgeAndUpdate(authUser, b, condition && authUser != null && !authUser.hasBadge(b)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: addBadgeOnceAndUpdate 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
addBadgeOnceAndUpdate
src/main/java/com/erudika/scoold/utils/ScooldUtils.java
62a0e92e1486ddc17676a7ead2c07ff653d167ce
0
Analyze the following code function for security vulnerabilities
private void scheduleSendRankingUpdate() { if (!mHandler.hasMessages(MESSAGE_SEND_RANKING_UPDATE)) { Message m = Message.obtain(mHandler, MESSAGE_SEND_RANKING_UPDATE); mHandler.sendMessage(m); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: scheduleSendRankingUpdate 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
scheduleSendRankingUpdate
services/core/java/com/android/server/notification/NotificationManagerService.java
61e9103b5725965568e46657f4781dd8f2e5b623
0
Analyze the following code function for security vulnerabilities
@Override protected void execute() throws Exception { if (channel.socket.isInputShutdown() || channel.socket.isClosed()) { connectionClosed(); return; } connection.data.commandInfo = "Listening"; connection.data.commandDetail = null; try { channel.socket.setSoTimeout(socketTimeout); connection.data.lastCommandReceived = -1; char c = (char) channel.read(); if (channel.inStream.available() == 0) { connectionClosed(); return; } channel.socket.setSoTimeout(socketTimeout); connection.data.lastCommandReceived = System.currentTimeMillis(); request = new OHttpRequest(this, channel.inStream, connection.data, configuration); requestContent.setLength(0); request.isMultipart = false; if (c != '\n') // AVOID INITIAL /N requestContent.append(c); while (!channel.socket.isInputShutdown()) { c = (char) channel.read(); if (c == '\r') { final String[] words = requestContent.toString().split(" "); if (words.length < 3) { OLogManager.instance().warn(this, "->" + channel.socket.getInetAddress().getHostAddress() + ": Error on invalid content:\n" + requestContent); while (channel.inStream.available() > 0) { channel.read(); } break; } // CONSUME THE NEXT \n channel.read(); request.httpMethod = words[0].toUpperCase(); request.url = words[1].trim(); final int parametersPos = request.url.indexOf('?'); if (parametersPos > -1) { request.parameters = OHttpUtils.getParameters(request.url.substring(parametersPos)); request.url = request.url.substring(0, parametersPos); } request.httpVersion = words[2]; readAllContent(request); if (request.content != null && request.contentType != null && request.contentType.equals(OHttpUtils.CONTENT_TYPE_URLENCODED)) request.content = URLDecoder.decode(request.content, "UTF-8").trim(); if (OLogManager.instance().isDebugEnabled()) OLogManager.instance().debug(this, "[ONetworkProtocolHttpAbstract.execute] Requested: %s %s", request.httpMethod, request.url); service(); return; } requestContent.append(c); } if (OLogManager.instance().isDebugEnabled()) OLogManager.instance().debug(this, "Parsing request from client " + channel.socket.getInetAddress().getHostAddress() + ":\n" + requestContent); } catch (SocketException e) { connectionError(); } catch (SocketTimeoutException e) { timeout(); } catch (Throwable t) { if (request.httpMethod != null && request.url != null) { try { sendError(505, "Error on executing of " + request.httpMethod + " for the resource: " + request.url, null, "text/plain", t.toString(), request.keepAlive); } catch (IOException e) { } } else sendError(505, "Error on executing request", null, "text/plain", t.toString(), request.keepAlive); readAllContent(request); } finally { if (connection.data.lastCommandReceived > -1) Orient .instance() .getProfiler() .stopChrono("server.network.requests", "Total received requests", connection.data.lastCommandReceived, "server.network.requests"); request = null; response = null; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: execute File: server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/ONetworkProtocolHttpAbstract.java Repository: orientechnologies/orientdb The code follows secure coding practices.
[ "CWE-352" ]
CVE-2015-2912
MEDIUM
6.8
orientechnologies/orientdb
execute
server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/ONetworkProtocolHttpAbstract.java
d5a45e608ba8764fd817c1bdd7cf966564e828e9
0
Analyze the following code function for security vulnerabilities
public boolean isFaceUnlockRunning(int userId) { return mUserFaceUnlockRunning.get(userId); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isFaceUnlockRunning File: packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2016-3917
HIGH
7.2
android
isFaceUnlockRunning
packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
f5334952131afa835dd3f08601fb3bced7b781cd
0
Analyze the following code function for security vulnerabilities
@Deprecated public void setPasswordQuality(@NonNull ComponentName admin, int quality) { if (mService != null) { try { mService.setPasswordQuality(admin, quality, mParentInstance); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setPasswordQuality 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
setPasswordQuality
core/java/android/app/admin/DevicePolicyManager.java
e2e05f488da6abc765a62e7faf10cb74e729732e
0
Analyze the following code function for security vulnerabilities
public void startElement(final String uri, final String localName, final String qname, final Attributes attrs) throws SAXException { if ( direction == 1 ) { // going down again, so clear this.peer = null; } else { direction = 1; } final Handler handler = getHandler( uri, localName ); if ( handler == null ) { startElementBuilder( localName, attrs ); return; } validate( uri, localName, handler ); Object node = handler.start( uri, localName, attrs, this ); this.parents.add( node ); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: startElement 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
startElement
drools-core/src/main/java/org/drools/core/xml/ExtensibleXmlParser.java
c48464c3b246e6ef0d4cd0dbf67e83ccd532c6d3
0
Analyze the following code function for security vulnerabilities
public Date getCreationDate() { return this.doc.getCreationDate(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getCreationDate 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
getCreationDate
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 void goToNavigationIndex(int index) { if (mContentViewCore != null) mContentViewCore.goToNavigationIndex(index); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: goToNavigationIndex File: chrome/android/java/src/org/chromium/chrome/browser/Tab.java Repository: chromium The code follows secure coding practices.
[ "CWE-20" ]
CVE-2014-3159
MEDIUM
6.4
chromium
goToNavigationIndex
chrome/android/java/src/org/chromium/chrome/browser/Tab.java
98a50b76141f0b14f292f49ce376e6554142d5e2
0
Analyze the following code function for security vulnerabilities
@Override public List<UserInfo> getUsers(boolean excludeDying) { checkManageUsersPermission("query users"); synchronized (mPackagesLock) { ArrayList<UserInfo> users = new ArrayList<UserInfo>(mUsers.size()); for (int i = 0; i < mUsers.size(); i++) { UserInfo ui = mUsers.valueAt(i); if (ui.partial) { continue; } if (!excludeDying || !mRemovingUserIds.get(ui.id)) { users.add(ui); } } return users; } }
Vulnerability Classification: - CWE: CWE-264 - CVE: CVE-2016-3833 - Severity: HIGH - CVSS Score: 9.3 Description: Reduce shell power over user management. Remove MANAGE_USERS permission from shell and whitelist it for some specific functionality. Bug: 29189712 Change-Id: Ifb37448c091af91991964511e3efb1bb4dea1ff3 Function: getUsers File: services/core/java/com/android/server/pm/UserManagerService.java Repository: android Fixed Code: @Override public List<UserInfo> getUsers(boolean excludeDying) { checkManageOrCreateUsersPermission("query users"); synchronized (mPackagesLock) { ArrayList<UserInfo> users = new ArrayList<UserInfo>(mUsers.size()); for (int i = 0; i < mUsers.size(); i++) { UserInfo ui = mUsers.valueAt(i); if (ui.partial) { continue; } if (!excludeDying || !mRemovingUserIds.get(ui.id)) { users.add(ui); } } return users; } }
[ "CWE-264" ]
CVE-2016-3833
HIGH
9.3
android
getUsers
services/core/java/com/android/server/pm/UserManagerService.java
01875b0274e74f97edf6b0d5c92de822e0555d03
1
Analyze the following code function for security vulnerabilities
protected boolean needsBrowserProcessStarted() { return true; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: needsBrowserProcessStarted File: android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java Repository: chromium The code follows secure coding practices.
[ "CWE-254" ]
CVE-2016-5155
MEDIUM
4.3
chromium
needsBrowserProcessStarted
android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
b8dcfeb065bbfd777cdc5f5433da9a87f25e6ec6
0
Analyze the following code function for security vulnerabilities
private static JSONArray replaceLang(JSONArray items) { JSONArray clone = (JSONArray) items.clone(); for (Object o : clone) { replaceLang((JSONObject) o); } return clone; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: replaceLang File: src/main/java/com/rebuild/core/configuration/NavBuilder.java Repository: getrebuild/rebuild The code follows secure coding practices.
[ "CWE-89" ]
CVE-2023-1495
MEDIUM
6.5
getrebuild/rebuild
replaceLang
src/main/java/com/rebuild/core/configuration/NavBuilder.java
c9474f84e5f376dd2ade2078e3039961a9425da7
0
Analyze the following code function for security vulnerabilities
public void deEmphasizeUrl() { OmniboxUrlEmphasizer.deEmphasizeUrl(getText()); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: deEmphasizeUrl File: chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java Repository: chromium The code follows secure coding practices.
[ "CWE-254" ]
CVE-2016-5163
MEDIUM
4.3
chromium
deEmphasizeUrl
chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
3bd33fee094e863e5496ac24714c558bd58d28ef
0
Analyze the following code function for security vulnerabilities
public Field apply(String key, Lang lang) { return field(key, lang); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: apply File: web/play-java-forms/src/main/java/play/data/Form.java Repository: playframework The code follows secure coding practices.
[ "CWE-400" ]
CVE-2022-31018
MEDIUM
5
playframework
apply
web/play-java-forms/src/main/java/play/data/Form.java
15393b736df939e35e275af2347155f296c684f2
0
Analyze the following code function for security vulnerabilities
private void handleRilMsg(RilMessage rilMsg) { if (rilMsg == null) { return; } // dispatch messages CommandParams cmdParams = null; switch (rilMsg.mId) { case MSG_ID_EVENT_NOTIFY: if (rilMsg.mResCode == ResultCode.OK) { cmdParams = (CommandParams) rilMsg.mData; if (cmdParams != null) { handleCommand(cmdParams, false); } } break; case MSG_ID_PROACTIVE_COMMAND: try { cmdParams = (CommandParams) rilMsg.mData; } catch (ClassCastException e) { // for error handling : cast exception CatLog.d(this, "Fail to parse proactive command"); // Don't send Terminal Resp if command detail is not available if (mCurrntCmd != null) { sendTerminalResponse(mCurrntCmd.mCmdDet, ResultCode.CMD_DATA_NOT_UNDERSTOOD, false, 0x00, null); } break; } if (cmdParams != null) { if (rilMsg.mResCode == ResultCode.OK) { handleCommand(cmdParams, true); } else { // for proactive commands that couldn't be decoded // successfully respond with the code generated by the // message decoder. sendTerminalResponse(cmdParams.mCmdDet, rilMsg.mResCode, false, 0, null); } } break; case MSG_ID_REFRESH: cmdParams = (CommandParams) rilMsg.mData; if (cmdParams != null) { handleCommand(cmdParams, false); } break; case MSG_ID_SESSION_END: handleSessionEnd(); break; case MSG_ID_CALL_SETUP: // prior event notify command supplied all the information // needed for set up call processing. break; } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: handleRilMsg File: src/java/com/android/internal/telephony/cat/CatService.java Repository: android The code follows secure coding practices.
[ "CWE-264" ]
CVE-2015-3843
HIGH
9.3
android
handleRilMsg
src/java/com/android/internal/telephony/cat/CatService.java
b48581401259439dc5ef6dcf8b0f303e4cbefbe9
0
Analyze the following code function for security vulnerabilities
@Deprecated public Intent registerReceiver(IApplicationThread caller, String callerPackage, IIntentReceiver receiver, IntentFilter filter, String permission, int userId, int flags) { return registerReceiverWithFeature(caller, callerPackage, null, null, receiver, filter, permission, userId, flags); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: registerReceiver 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
registerReceiver
services/core/java/com/android/server/am/ActivityManagerService.java
d10b27e539f7bc91c2360d429b9d05f05274670d
0
Analyze the following code function for security vulnerabilities
private void initOther() { cleanAreaButton.addActionListener(e -> outputTextArea.setText(null)); xrayUrlButton.addActionListener(e -> { try { Desktop desktop = Desktop.getDesktop(); URI oURL = new URI("https://download.xray.cool/xray"); desktop.browse(oURL); } catch (Exception ex) { logger.error(ex); } }); authorLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { Desktop desktop = Desktop.getDesktop(); URI oURL = new URI("https://github.com/4ra1n"); desktop.browse(oURL); } catch (Exception ex) { logger.error(ex); } } }); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: initOther File: src/main/java/com/chaitin/xray/form/MainForm.java Repository: 4ra1n/super-xray The code follows secure coding practices.
[ "CWE-502" ]
CVE-2022-41958
HIGH
7.8
4ra1n/super-xray
initOther
src/main/java/com/chaitin/xray/form/MainForm.java
4d0d59663596db03f39d7edd2be251d48b52dcfc
0
Analyze the following code function for security vulnerabilities
@Override public void setWantClientAuth(boolean b) { setClientAuth(b ? ClientAuth.OPTIONAL : ClientAuth.NONE); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setWantClientAuth File: handler/src/main/java/io/netty/handler/ssl/OpenSslEngine.java Repository: netty The code follows secure coding practices.
[ "CWE-835" ]
CVE-2016-4970
HIGH
7.8
netty
setWantClientAuth
handler/src/main/java/io/netty/handler/ssl/OpenSslEngine.java
bc8291c80912a39fbd2303e18476d15751af0bf1
0
Analyze the following code function for security vulnerabilities
private boolean readPropertyOrFunctionToken(PathTokenAppender appender) { if (path.currentCharIs(OPEN_SQUARE_BRACKET) || path.currentCharIs(WILDCARD) || path.currentCharIs(PERIOD) || path.currentCharIs(SPACE)) { return false; } int startPosition = path.position(); int readPosition = startPosition; int endPosition = 0; boolean isFunction = false; while (path.inBounds(readPosition)) { char c = path.charAt(readPosition); if (c == SPACE) { throw new InvalidPathException("Use bracket notion ['my prop'] if your property contains blank characters. position: " + path.position()); } else if (c == PERIOD || c == OPEN_SQUARE_BRACKET) { endPosition = readPosition; break; } else if (c == OPEN_PARENTHESIS) { isFunction = true; endPosition = readPosition; break; } readPosition++; } if (endPosition == 0) { endPosition = path.length(); } List<Parameter> functionParameters = null; if (isFunction) { int parenthesis_count = 1; for(int i = readPosition + 1; i < path.length(); i++){ if (path.charAt(i) == CLOSE_PARENTHESIS) parenthesis_count--; else if (path.charAt(i) == OPEN_PARENTHESIS) parenthesis_count++; if (parenthesis_count == 0) break; } if (parenthesis_count != 0){ String functionName = path.subSequence(startPosition, endPosition).toString(); throw new InvalidPathException("Arguments to function: '" + functionName + "' are not closed properly."); } if (path.inBounds(readPosition+1)) { // read the next token to determine if we have a simple no-args function call char c = path.charAt(readPosition + 1); if (c != CLOSE_PARENTHESIS) { path.setPosition(endPosition+1); // parse the arguments of the function - arguments that are inner queries or JSON document(s) String functionName = path.subSequence(startPosition, endPosition).toString(); functionParameters = parseFunctionParameters(functionName); } else { path.setPosition(readPosition + 1); } } else { path.setPosition(readPosition); } } else { path.setPosition(endPosition); } String property = path.subSequence(startPosition, endPosition).toString(); if(isFunction){ appender.appendPathToken(PathTokenFactory.createFunctionPathToken(property, functionParameters)); } else { appender.appendPathToken(PathTokenFactory.createSinglePropertyPathToken(property, SINGLE_QUOTE)); } return path.currentIsTail() || readNextToken(appender); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: readPropertyOrFunctionToken File: json-path/src/main/java/com/jayway/jsonpath/internal/path/PathCompiler.java Repository: json-path/JsonPath The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-51074
MEDIUM
5.3
json-path/JsonPath
readPropertyOrFunctionToken
json-path/src/main/java/com/jayway/jsonpath/internal/path/PathCompiler.java
f49ff25e3bad8c8a0c853058181f2c00b5beb305
0
Analyze the following code function for security vulnerabilities
@Override public Map<Object, String> vars() { return vars; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: vars File: jooby/src/main/java/org/jooby/internal/RouteImpl.java Repository: jooby-project/jooby The code follows secure coding practices.
[ "CWE-79" ]
CVE-2019-15477
MEDIUM
4.3
jooby-project/jooby
vars
jooby/src/main/java/org/jooby/internal/RouteImpl.java
34856a738829d8fedca4ed27bd6ff413af87186f
0
Analyze the following code function for security vulnerabilities
@Override public boolean isBackgroundVisibleBehind(IBinder token) { final long origId = Binder.clearCallingIdentity(); try { synchronized (this) { final ActivityStack stack = ActivityRecord.getStackLocked(token); final boolean visible = stack == null ? false : stack.hasVisibleBehindActivity(); if (ActivityStackSupervisor.DEBUG_VISIBLE_BEHIND) Slog.d(TAG, "isBackgroundVisibleBehind: stack=" + stack + " visible=" + visible); return visible; } } finally { Binder.restoreCallingIdentity(origId); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: isBackgroundVisibleBehind File: services/core/java/com/android/server/am/ActivityManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-284" ]
CVE-2015-3833
MEDIUM
4.3
android
isBackgroundVisibleBehind
services/core/java/com/android/server/am/ActivityManagerService.java
aaa0fee0d7a8da347a0c47cef5249c70efee209e
0
Analyze the following code function for security vulnerabilities
@Pure public @Nullable BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { return getBigDecimal(findColumn(columnName), scale); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getBigDecimal File: pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java Repository: pgjdbc The code follows secure coding practices.
[ "CWE-89" ]
CVE-2022-31197
HIGH
8
pgjdbc
getBigDecimal
pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
739e599d52ad80f8dcd6efedc6157859b1a9d637
0
Analyze the following code function for security vulnerabilities
void enableVerboseLogging(boolean verbose) { mVerboseLoggingEnabled = verbose; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: enableVerboseLogging File: service/java/com/android/server/wifi/WifiMonitor.java Repository: android The code follows secure coding practices.
[ "CWE-Other" ]
CVE-2023-21242
CRITICAL
9.8
android
enableVerboseLogging
service/java/com/android/server/wifi/WifiMonitor.java
72e903f258b5040b8f492cf18edd124b5a1ac770
0
Analyze the following code function for security vulnerabilities
@Override public AppendableCharSequence parse(ByteBuf buffer) { // Suppress a warning because HeaderParser.reset() is supposed to be called reset(); // lgtm[java/subtle-inherited-call] return super.parse(buffer); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: parse File: codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java Repository: netty The code follows secure coding practices.
[ "CWE-444" ]
CVE-2021-43797
MEDIUM
4.3
netty
parse
codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java
07aa6b5938a8b6ed7a6586e066400e2643897323
0
Analyze the following code function for security vulnerabilities
private static int endOfQuotedString(String s, int start) { char quote = s.charAt(start); for (int i = start; (i = s.indexOf(quote, i + 1)) >= 0;) { // If there are an even number of preceding backslashes then this is // the end of the string. int slashRunStart = i; while (slashRunStart > start && s.charAt(slashRunStart - 1) == '\\') { --slashRunStart; } if (((i - slashRunStart) & 1) == 0) { return i + 1; } } return s.length(); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: endOfQuotedString File: src/main/java/com/google/json/JsonSanitizer.java Repository: OWASP/json-sanitizer The code follows secure coding practices.
[ "CWE-79" ]
CVE-2020-13973
MEDIUM
4.3
OWASP/json-sanitizer
endOfQuotedString
src/main/java/com/google/json/JsonSanitizer.java
53ceaac3e0a10e86d512ce96a0056578f2d1978f
0
Analyze the following code function for security vulnerabilities
private void processAttach (Context context, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException { // Token String token = request.getParameter("token"); //buttom boolean submit_next = (request.getParameter("submit_next") != null); if (submit_next) { TableRow requestItem = RequestItemManager.getRequestbyToken( context, token); // validate if (requestItem != null) { // Token String subject = request.getParameter("subject"); String message = request.getParameter("message"); boolean accept = UIUtil.getBoolParameter(request, "accept_request"); try { Item item = Item.find(context, requestItem.getIntColumn("item_id")); Email email = new Email(); email.setSubject(subject); email.setContent("{0}"); email.addRecipient(requestItem.getStringColumn("request_email")); email.addArgument(message); // add attach if (accept) { if (requestItem.getBooleanColumn("allfiles")) { Bundle[] bundles = item.getBundles("ORIGINAL"); for (int i = 0; i < bundles.length; i++) { Bitstream[] bitstreams = bundles[i] .getBitstreams(); for (int k = 0; k < bitstreams.length; k++) { if (!bitstreams[k].getFormat().isInternal() && RequestItemManager.isRestricted( context, bitstreams[k])) { email.addAttachment( BitstreamStorageManager .retrieve( context, bitstreams[k] .getID()), bitstreams[k].getName(), bitstreams[k].getFormat() .getMIMEType()); } } } } else { Bitstream bit = Bitstream.find(context, requestItem.getIntColumn("bitstream_id")); email.addAttachment(BitstreamStorageManager .retrieve(context, requestItem .getIntColumn("bitstream_id")), bit .getName(), bit.getFormat().getMIMEType()); } } email.send(); requestItem.setColumn("accept_request",accept); requestItem.setColumn("decision_date",new Date()); DatabaseManager.update(context, requestItem); log.info(LogManager.getHeader(context, "sent_attach_requestItem", "token=" + token)); JSPManager.showJSP(request, response, "/requestItem/request-free-access.jsp"); } catch (MessagingException me) { log.warn(LogManager.getHeader(context, "error_mailing_requestItem", ""), me); JSPManager.showInternalError(request, response); } } else JSPManager.showInvalidIDError(request, response, null, -1); } else { processToken(context, request, response); } }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: processAttach File: dspace-jspui/src/main/java/org/dspace/app/webui/servlet/RequestItemServlet.java Repository: DSpace The code follows secure coding practices.
[ "CWE-601", "CWE-79" ]
CVE-2022-31192
MEDIUM
6.1
DSpace
processAttach
dspace-jspui/src/main/java/org/dspace/app/webui/servlet/RequestItemServlet.java
28eb8158210d41168a62ed5f9e044f754513bc37
0
Analyze the following code function for security vulnerabilities
public String getDefaultTheme() { return loadResource("themes/default.css"); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getDefaultTheme 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
getDefaultTheme
src/main/java/com/erudika/scoold/utils/ScooldUtils.java
62a0e92e1486ddc17676a7ead2c07ff653d167ce
0
Analyze the following code function for security vulnerabilities
public XmlGenerator nodeIfContents(String name, Object contents, Object... attributes) { if (contents != null) { appendNode(xml, name, contents, attributes); } return this; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: nodeIfContents File: hazelcast/src/main/java/com/hazelcast/config/ConfigXmlGenerator.java Repository: hazelcast The code follows secure coding practices.
[ "CWE-522" ]
CVE-2023-33264
MEDIUM
4.3
hazelcast
nodeIfContents
hazelcast/src/main/java/com/hazelcast/config/ConfigXmlGenerator.java
80a502d53cc48bf895711ab55f95e3a51e344ac1
0
Analyze the following code function for security vulnerabilities
public void setApplication(ApplicationInstance app) { if (this.app != null) { LOG.error(IcedTeaWebConstants.DEFAULT_ERROR_MESSAGE, new IllegalStateException("Application can only be set once")); return; } this.app = app; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setApplication File: core/src/main/java/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Repository: AdoptOpenJDK/IcedTea-Web The code follows secure coding practices.
[ "CWE-345", "CWE-94", "CWE-22" ]
CVE-2019-10182
MEDIUM
5.8
AdoptOpenJDK/IcedTea-Web
setApplication
core/src/main/java/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
e0818f521a0711aeec4b913b49b5fc6a52815662
0
Analyze the following code function for security vulnerabilities
public String getTempFolderPath() { return tempFolderPath; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getTempFolderPath 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
getTempFolderPath
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
@Override public NodeList getElementsByTagName(String tagname) { return doc.getElementsByTagName(tagname); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getElementsByTagName 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
getElementsByTagName
HTML_Renderer/src/main/java/org/loboevolution/html/js/xml/XMLDocument.java
9b75694cedfa4825d4a2330abf2719d470c654cd
0
Analyze the following code function for security vulnerabilities
public java.math.@Nullable BigDecimal getBigDecimal(String columnName) throws SQLException { return getBigDecimal(findColumn(columnName)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getBigDecimal File: pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java Repository: pgjdbc The code follows secure coding practices.
[ "CWE-89" ]
CVE-2022-31197
HIGH
8
pgjdbc
getBigDecimal
pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
739e599d52ad80f8dcd6efedc6157859b1a9d637
0
Analyze the following code function for security vulnerabilities
protected char getPrevious() { return this.previous;}
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getPrevious File: src/main/java/org/json/JSONTokener.java Repository: stleary/JSON-java The code follows secure coding practices.
[ "CWE-770" ]
CVE-2023-5072
HIGH
7.5
stleary/JSON-java
getPrevious
src/main/java/org/json/JSONTokener.java
661114c50dcfd53bb041aab66f14bb91e0a87c8a
0
Analyze the following code function for security vulnerabilities
private void showNewUserDisclaimerIfNecessary(@UserIdInt int userId) { boolean mustShow; synchronized (getLockObject()) { DevicePolicyData policyData = getUserData(userId); if (VERBOSE_LOG) { Slogf.v(LOG_TAG, "showNewUserDisclaimerIfNecessary(" + userId + "): " + policyData.mNewUserDisclaimer + ")"); } mustShow = DevicePolicyData.NEW_USER_DISCLAIMER_NEEDED .equals(policyData.mNewUserDisclaimer); } if (!mustShow) return; Intent intent = new Intent(DevicePolicyManager.ACTION_SHOW_NEW_USER_DISCLAIMER); // TODO(b/172691310): add CTS tests to make sure disclaimer is shown Slogf.i(LOG_TAG, "Dispatching ACTION_SHOW_NEW_USER_DISCLAIMER intent"); mContext.sendBroadcastAsUser(intent, UserHandle.of(userId)); }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: showNewUserDisclaimerIfNecessary File: services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java Repository: android The code follows secure coding practices.
[ "CWE-20" ]
CVE-2023-21284
MEDIUM
5.5
android
showNewUserDisclaimerIfNecessary
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
ed3f25b7222d4cff471f2b7d22d1150348146957
0
Analyze the following code function for security vulnerabilities
public void setSort(int sort) { this.sort = sort; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: setSort File: publiccms-parent/publiccms-core/src/main/java/com/publiccms/entities/sys/SysModule.java Repository: sanluan/PublicCMS The code follows secure coding practices.
[ "CWE-79" ]
CVE-2018-18927
LOW
3.5
sanluan/PublicCMS
setSort
publiccms-parent/publiccms-core/src/main/java/com/publiccms/entities/sys/SysModule.java
2b411dc2821c69539138aaf7632b938b659a58fa
0
Analyze the following code function for security vulnerabilities
public final float getSpacingAdd() { return mSpacingAdd; }
No Vulnerability Detected: This code is secure and does not contain known vulnerabilities. Function: getSpacingAdd File: core/java/android/text/Layout.java Repository: android The code follows secure coding practices.
[ "CWE-20" ]
CVE-2018-9452
MEDIUM
4.3
android
getSpacingAdd
core/java/android/text/Layout.java
3b6f84b77c30ec0bab5147b0cffc192c86ba2634
0