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
|
@Override
public boolean isExecuteAll() {
assertNotReleased();
String execute = PARTIAL_EXECUTE_PARAM.getValue(ctx);
return (ALL_PARTIAL_PHASE_CLIENT_IDS.equals(execute));
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isExecuteAll
File: impl/src/main/java/com/sun/faces/context/PartialViewContextImpl.java
Repository: eclipse-ee4j/mojarra
The code follows secure coding practices.
|
[
"CWE-79"
] |
CVE-2019-17091
|
MEDIUM
| 4.3
|
eclipse-ee4j/mojarra
|
isExecuteAll
|
impl/src/main/java/com/sun/faces/context/PartialViewContextImpl.java
|
a3fa9573789ed5e867c43ea38374f4dbd5a8f81f
| 0
|
Analyze the following code function for security vulnerabilities
|
@WorkerThread
public void setApplicationRestrictions(@Nullable ComponentName admin, String packageName,
Bundle settings) {
throwIfParentInstance("setApplicationRestrictions");
if (mService != null) {
try {
mService.setApplicationRestrictions(admin, mContext.getPackageName(), packageName,
settings);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setApplicationRestrictions
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
|
setApplicationRestrictions
|
core/java/android/app/admin/DevicePolicyManager.java
|
e2e05f488da6abc765a62e7faf10cb74e729732e
| 0
|
Analyze the following code function for security vulnerabilities
|
public void dismissKeyguardToLaunch(Intent intentToLaunch) {
// do nothing
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: dismissKeyguardToLaunch
File: packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2023-21267
|
MEDIUM
| 5.5
|
android
|
dismissKeyguardToLaunch
|
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
|
d18d8b350756b0e89e051736c1f28744ed31e93a
| 0
|
Analyze the following code function for security vulnerabilities
|
public long length() {
return internal.length();
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: length
File: src/net/sourceforge/plantuml/security/SFile.java
Repository: plantuml
The code follows secure coding practices.
|
[
"CWE-284"
] |
CVE-2023-3431
|
MEDIUM
| 5.3
|
plantuml
|
length
|
src/net/sourceforge/plantuml/security/SFile.java
|
fbe7fa3b25b4c887d83927cffb1009ec6cb8ab1e
| 0
|
Analyze the following code function for security vulnerabilities
|
public void initAllPoC() {
InputStream is = this.getClass().getClassLoader().getResourceAsStream("poc.list");
String allPocStr = IOUtil.readStringFromIs(is);
assert allPocStr != null;
String[] temp = allPocStr.split("\n");
Poc.addPoc(temp);
if (LANG == CHINESE) {
pocNumLabel.setText(String.format("当前共有: %s 个PoC", Poc.getPocList().size()));
} else {
pocNumLabel.setText(String.format("PoC Num: %s", Poc.getPocList().size()));
}
allPoCButton.addActionListener(e -> {
String t;
if (LANG == CHINESE) {
t = "查看所有PoC";
} else {
t = "All PoC";
}
JFrame frame = new JFrame(t);
frame.setContentPane(new AllPoCForm().searchPoC);
frame.setResizable(false);
frame.pack();
frame.setVisible(true);
});
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: initAllPoC
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
|
initAllPoC
|
src/main/java/com/chaitin/xray/form/MainForm.java
|
4d0d59663596db03f39d7edd2be251d48b52dcfc
| 0
|
Analyze the following code function for security vulnerabilities
|
@Deprecated // since 2.7
@Override
public abstract String containedTypeName(int index);
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: containedTypeName
File: src/main/java/com/fasterxml/jackson/databind/JavaType.java
Repository: FasterXML/jackson-databind
The code follows secure coding practices.
|
[
"CWE-502"
] |
CVE-2019-16942
|
HIGH
| 7.5
|
FasterXML/jackson-databind
|
containedTypeName
|
src/main/java/com/fasterxml/jackson/databind/JavaType.java
|
54aa38d87dcffa5ccc23e64922e9536c82c1b9c8
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public int getIntProperty(String name) throws JMSException {
Object o = this.getObjectProperty(name);
if (o == null)
throw new NumberFormatException("Null is not a valid int");
else if (o instanceof String) {
return Integer.parseInt((String) o);
} else if (o instanceof Byte) {
return (Byte) o;
} else if (o instanceof Short) {
return (Short) o;
} else if (o instanceof Integer) {
return (Integer) o;
} else
throw new MessageFormatException(String.format("Unable to convert from class [%s]", o.getClass().getName()));
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getIntProperty
File: src/main/java/com/rabbitmq/jms/client/RMQMessage.java
Repository: rabbitmq/rabbitmq-jms-client
The code follows secure coding practices.
|
[
"CWE-502"
] |
CVE-2020-36282
|
HIGH
| 7.5
|
rabbitmq/rabbitmq-jms-client
|
getIntProperty
|
src/main/java/com/rabbitmq/jms/client/RMQMessage.java
|
f647e5dbfe055a2ca8cbb16dd70f9d50d888b638
| 0
|
Analyze the following code function for security vulnerabilities
|
private void updateBasePath() {
if (serverIndex != null) {
setBasePath(servers.get(serverIndex).URL(serverVariables));
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: updateBasePath
File: samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java
Repository: OpenAPITools/openapi-generator
The code follows secure coding practices.
|
[
"CWE-668"
] |
CVE-2021-21430
|
LOW
| 2.1
|
OpenAPITools/openapi-generator
|
updateBasePath
|
samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java
|
2c576483f26f85b3979c6948a131f585c237109a
| 0
|
Analyze the following code function for security vulnerabilities
|
public static boolean isAcceptRange(int responseCode, FileDownloadConnection connection) {
if (responseCode == HttpURLConnection.HTTP_PARTIAL
|| responseCode == FileDownloadConnection.RESPONSE_CODE_FROM_OFFSET) return true;
final String acceptRanges = connection.getResponseHeaderField("Accept-Ranges");
return "bytes".equals(acceptRanges);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isAcceptRange
File: library/src/main/java/com/liulishuo/filedownloader/util/FileDownloadUtils.java
Repository: lingochamp/FileDownloader
The code follows secure coding practices.
|
[
"CWE-22"
] |
CVE-2018-11248
|
HIGH
| 7.5
|
lingochamp/FileDownloader
|
isAcceptRange
|
library/src/main/java/com/liulishuo/filedownloader/util/FileDownloadUtils.java
|
b023cc081bbecdd2a9f3549a3ae5c12a9647ed7f
| 0
|
Analyze the following code function for security vulnerabilities
|
@RequestMapping(value = "/updatePassword", method = RequestMethod.POST,
consumes = APPLICATION_FORM_URLENCODED_VALUE, produces = TEXT_PLAIN_VALUE)
public ResponseEntity<String> updatePassword(
@RequestParam("currentPassword") String currentPassword,
@RequestParam("password") String password)
{
Control[] controls = { getIntermediateClientRequestControl(),
new PasswordPolicyRequestControl() };
PasswordModifyExtendedRequest request = new PasswordModifyExtendedRequest(
null, currentPassword, password, controls);
try
{
PasswordModifyExtendedResult extendedResult =
(PasswordModifyExtendedResult)pool.processExtendedOperation(request);
ResultCode resultCode = extendedResult.getResultCode();
if(resultCode == ResultCode.SUCCESS)
{
return new ResponseEntity<>(HttpStatus.OK);
}
else if (resultCode == ResultCode.INVALID_CREDENTIALS)
{
String additionalInfo = "";
if (extendedResult.hasResponseControl(
PasswordPolicyResponseControl.PASSWORD_POLICY_RESPONSE_OID))
{
additionalInfo += "Reason: ";
Control[] responseControls = extendedResult.getResponseControls();
String separator = "";
for (final Control control : responseControls)
{
if (control.getOID().equals(
PasswordPolicyResponseControl.PASSWORD_POLICY_RESPONSE_OID))
{
final PasswordPolicyResponseControl responseControl =
(PasswordPolicyResponseControl) control;
additionalInfo += String.format("%s%s", separator,
getPasswordPolicyErrorTypeMessage(responseControl.getErrorType()));
separator = ", ";
}
}
}
else
{
additionalInfo = (extendedResult.getDiagnosticMessage() == null) ?
"Please verify that your old password is correct." :
extendedResult.getDiagnosticMessage();
}
// This will be returned if the "current password" is incorrect.
return new ResponseEntity<>("Your password could not be updated. " +
additionalInfo, HttpStatus.BAD_REQUEST);
}
else
{
return new ResponseEntity<>(resultCode + " - "
+ extendedResult.getDiagnosticMessage(), HttpStatus.BAD_REQUEST);
}
}
catch(LDAPException e)
{
return new ResponseEntity<>(e.getMessage(),
HttpStatus.INTERNAL_SERVER_ERROR);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: updatePassword
File: src/main/java/com/unboundid/webapp/ssam/SSAMController.java
Repository: pingidentity/ssam
The code follows secure coding practices.
|
[
"CWE-79"
] |
CVE-2018-25084
|
MEDIUM
| 4
|
pingidentity/ssam
|
updatePassword
|
src/main/java/com/unboundid/webapp/ssam/SSAMController.java
|
f64b10d63bb19ca2228b0c2d561a1a6e5a3bf251
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public void onReceivedError(WebView view,
int errorCode,
String description,
String url)
{
super.onReceivedError(view, errorCode, description, url);
nativeOnError(errorCode, description, url);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: onReceivedError
File: android/src/org/mozilla/firefox/vpn/qt/VPNWebView.java
Repository: mozilla-mobile/mozilla-vpn-client
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2021-29978
|
HIGH
| 10
|
mozilla-mobile/mozilla-vpn-client
|
onReceivedError
|
android/src/org/mozilla/firefox/vpn/qt/VPNWebView.java
|
c8440f464a2f5c4e7d4990152ee5850df8b23f42
| 0
|
Analyze the following code function for security vulnerabilities
|
public int getRequestTimeoutInMs() {
return requestTimeoutInMs;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getRequestTimeoutInMs
File: api/src/main/java/org/asynchttpclient/AsyncHttpClientConfig.java
Repository: AsyncHttpClient/async-http-client
The code follows secure coding practices.
|
[
"CWE-345"
] |
CVE-2013-7397
|
MEDIUM
| 4.3
|
AsyncHttpClient/async-http-client
|
getRequestTimeoutInMs
|
api/src/main/java/org/asynchttpclient/AsyncHttpClientConfig.java
|
df6ed70e86c8fc340ed75563e016c8baa94d7e72
| 0
|
Analyze the following code function for security vulnerabilities
|
public String getConvertingUserNameType(XWikiContext context)
{
if (StringUtils.isNotBlank(context.getWiki().getXWikiPreference("convertmail", context))) {
return context.getWiki().getXWikiPreference("convertmail", "0", context);
}
return getConfiguration().getProperty("xwiki.authentication.convertemail", "0");
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getConvertingUserNameType
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
|
getConvertingUserNameType
|
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java
|
f9a677408ffb06f309be46ef9d8df1915d9099a4
| 0
|
Analyze the following code function for security vulnerabilities
|
public static AbstractProject findNearest(String name, ItemGroup context) {
List<AbstractProject> projects = Hudson.getInstance().getAllItems(AbstractProject.class);
String[] names = new String[projects.size()];
for( int i=0; i<projects.size(); i++ )
names[i] = projects.get(i).getRelativeNameFrom(context);
String nearest = EditDistance.findNearest(name, names);
return (AbstractProject)Jenkins.getInstance().getItem(nearest,context);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: findNearest
File: core/src/main/java/hudson/model/AbstractProject.java
Repository: jenkinsci/jenkins
The code follows secure coding practices.
|
[
"CWE-264"
] |
CVE-2013-7330
|
MEDIUM
| 4
|
jenkinsci/jenkins
|
findNearest
|
core/src/main/java/hudson/model/AbstractProject.java
|
36342d71e29e0620f803a7470ce96c61761648d8
| 0
|
Analyze the following code function for security vulnerabilities
|
public OutputStream openOutputStream(Object connection) throws IOException {
if (connection instanceof String) {
String con = (String)connection;
if (con.startsWith("file://")) {
con = con.substring(7);
}
OutputStream fc = createFileOuputStream((String) con);
BufferedOutputStream o = new BufferedOutputStream(fc, (String) con);
return o;
}
return new BufferedOutputStream(((URLConnection) connection).getOutputStream(), connection.toString());
}
|
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
|
@Override
public String getConnectionUrl() {
return connectionUrl;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getConnectionUrl
File: src/main/java/uk/q3c/krail/jpa/persist/DefaultJpaInstanceConfiguration.java
Repository: KrailOrg/krail-jpa
The code follows secure coding practices.
|
[
"CWE-89"
] |
CVE-2016-15018
|
MEDIUM
| 5.2
|
KrailOrg/krail-jpa
|
getConnectionUrl
|
src/main/java/uk/q3c/krail/jpa/persist/DefaultJpaInstanceConfiguration.java
|
c1e848665492e21ef6cc9be443205e36b9a1f6be
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public int hashCode() {
if (hashCode == 0) {
hashCode = bigDecimalValue().hashCode();
}
return hashCode;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: hashCode
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
|
hashCode
|
impl/src/main/java/org/eclipse/parsson/JsonNumberImpl.java
|
84764ffbe3d0376da242b27a9a526138d0dfb8e6
| 0
|
Analyze the following code function for security vulnerabilities
|
public abstract int getLineTop(int line);
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getLineTop
File: core/java/android/text/Layout.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-20"
] |
CVE-2018-9452
|
MEDIUM
| 4.3
|
android
|
getLineTop
|
core/java/android/text/Layout.java
|
3b6f84b77c30ec0bab5147b0cffc192c86ba2634
| 0
|
Analyze the following code function for security vulnerabilities
|
public String getURLContent(String surl, XWikiContext context) throws IOException
{
return getURLContent(surl, getHttpTimeout(context), getHttpUserAgent(context));
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getURLContent
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
|
getURLContent
|
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 EntityReferenceSerializer<String> getCompactWikiEntityReferenceSerializer()
{
if (this.compactWikiEntityReferenceSerializer == null) {
this.compactWikiEntityReferenceSerializer =
Utils.getComponent(EntityReferenceSerializer.TYPE_STRING, "compactwiki");
}
return this.compactWikiEntityReferenceSerializer;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getCompactWikiEntityReferenceSerializer
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
|
getCompactWikiEntityReferenceSerializer
|
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 setIntProperty(String name, int value) throws JMSException {
this.setObjectProperty(name, value);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setIntProperty
File: src/main/java/com/rabbitmq/jms/client/RMQMessage.java
Repository: rabbitmq/rabbitmq-jms-client
The code follows secure coding practices.
|
[
"CWE-502"
] |
CVE-2020-36282
|
HIGH
| 7.5
|
rabbitmq/rabbitmq-jms-client
|
setIntProperty
|
src/main/java/com/rabbitmq/jms/client/RMQMessage.java
|
f647e5dbfe055a2ca8cbb16dd70f9d50d888b638
| 0
|
Analyze the following code function for security vulnerabilities
|
public boolean renderFileFromObjectField(String filename, XWikiDocument doc, final XWikiContext context)
throws IOException
{
LOGGER.debug("... as object property");
BaseObject object = doc.getObject("XWiki.XWikiSkins");
String content = null;
if (object != null) {
content = object.getStringValue(filename);
}
if (!StringUtils.isBlank(content)) {
XWiki xwiki = context.getWiki();
// Evaluate the file only if it's of a supported type.
String mimetype = xwiki.getEngineContext().getMimeType(filename.toLowerCase());
if (isCssMimeType(mimetype) || isJavascriptMimeType(mimetype)) {
final ObjectPropertyReference propertyReference =
new ObjectPropertyReference(filename, object.getReference());
// Evaluate the content with the rights of the document's author.
content = evaluateVelocity(content, propertyReference, doc.getAuthorReference(),
doc.getDocumentReference(), context);
}
// Prepare the response.
XWikiResponse response = context.getResponse();
// Since object fields are read as unicode strings, the result does not depend on the wiki encoding. Force
// the output to UTF-8.
response.setCharacterEncoding(ENCODING);
// Write the content to the response's output stream.
byte[] data = content.getBytes(ENCODING);
setupHeaders(response, mimetype, doc.getDate(), data.length);
response.getOutputStream().write(data);
return true;
} else {
LOGGER.debug("Object field not found or empty");
}
return false;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: renderFileFromObjectField
File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/SkinAction.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices.
|
[
"CWE-287"
] |
CVE-2022-36092
|
HIGH
| 7.5
|
xwiki/xwiki-platform
|
renderFileFromObjectField
|
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/SkinAction.java
|
71a6d0bb6f8ab718fcfaae0e9b8c16c2d69cd4bb
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
// 写入WebFilterChain对象
exchange.getAttributes().put(SaReactorHolder.CHAIN_KEY, chain);
// ---------- 全局认证处理
try {
// 写入全局上下文 (同步)
SaReactorSyncHolder.setContext(exchange);
// 执行全局过滤器
beforeAuth.run(null);
SaRouter.match(includeList).notMatch(excludeList).check(r -> {
auth.run(null);
});
} catch (StopMatchException e) {
// StopMatchException 异常代表:停止匹配,进入Controller
} catch (Throwable e) {
// 1. 获取异常处理策略结果
String result = (e instanceof BackResultException) ? e.getMessage() : String.valueOf(error.run(e));
// 2. 写入输出流
// 请注意此处默认 Content-Type 为 text/plain,如果需要返回 JSON 信息,需要在 return 前自行设置 Content-Type 为 application/json
// 例如:SaHolder.getResponse().setHeader("Content-Type", "application/json;charset=UTF-8");
if(exchange.getResponse().getHeaders().getFirst("Content-Type") == null) {
exchange.getResponse().getHeaders().set("Content-Type", "text/plain; charset=utf-8");
}
return exchange.getResponse().writeWith(Mono.just(exchange.getResponse().bufferFactory().wrap(result.getBytes())));
} finally {
// 清除上下文
SaReactorSyncHolder.clearContext();
}
// ---------- 执行
// 写入全局上下文 (同步)
SaReactorSyncHolder.setContext(exchange);
// 执行
return chain.filter(exchange).subscriberContext(ctx -> {
// 写入全局上下文 (异步)
ctx = ctx.put(SaReactorHolder.CONTEXT_KEY, exchange);
return ctx;
}).doFinally(r -> {
// 清除上下文
SaReactorSyncHolder.clearContext();
});
}
|
Vulnerability Classification:
- CWE: CWE-Other
- CVE: CVE-2023-44794
- Severity: CRITICAL
- CVSS Score: 9.8
Description: 修复路由拦截鉴权可被绕过的问题 fix #515
Function: filter
File: sa-token-starter/sa-token-reactor-spring-boot-starter/src/main/java/cn/dev33/satoken/reactor/filter/SaReactorFilter.java
Repository: dromara/Sa-Token
Fixed Code:
@Override
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
// 写入WebFilterChain对象
exchange.getAttributes().put(SaReactorHolder.CHAIN_KEY, chain);
// ---------- 全局认证处理
try {
// 写入全局上下文 (同步)
SaReactorSyncHolder.setContext(exchange);
// 执行全局过滤器
beforeAuth.run(null);
SaRouter.match(includeList).notMatch(excludeList).check(r -> {
auth.run(null);
});
} catch (StopMatchException e) {
// StopMatchException 异常代表:停止匹配,进入Controller
} catch (Throwable e) {
// 1. 获取异常处理策略结果
String result = (e instanceof BackResultException) ? e.getMessage() : String.valueOf(error.run(e));
// 2. 写入输出流
// 请注意此处默认 Content-Type 为 text/plain,如果需要返回 JSON 信息,需要在 return 前自行设置 Content-Type 为 application/json
// 例如:SaHolder.getResponse().setHeader("Content-Type", "application/json;charset=UTF-8");
if(exchange.getResponse().getHeaders().getFirst(SaTokenConsts.CONTENT_TYPE_KEY) == null) {
exchange.getResponse().getHeaders().set(SaTokenConsts.CONTENT_TYPE_KEY, SaTokenConsts.CONTENT_TYPE_TEXT_PLAIN);
}
return exchange.getResponse().writeWith(Mono.just(exchange.getResponse().bufferFactory().wrap(result.getBytes())));
} finally {
// 清除上下文
SaReactorSyncHolder.clearContext();
}
// ---------- 执行
// 写入全局上下文 (同步)
SaReactorSyncHolder.setContext(exchange);
// 执行
return chain.filter(exchange).subscriberContext(ctx -> {
// 写入全局上下文 (异步)
ctx = ctx.put(SaReactorHolder.CONTEXT_KEY, exchange);
return ctx;
}).doFinally(r -> {
// 清除上下文
SaReactorSyncHolder.clearContext();
});
}
|
[
"CWE-Other"
] |
CVE-2023-44794
|
CRITICAL
| 9.8
|
dromara/Sa-Token
|
filter
|
sa-token-starter/sa-token-reactor-spring-boot-starter/src/main/java/cn/dev33/satoken/reactor/filter/SaReactorFilter.java
|
954efeb73277f924f836da2a25322ea35ee1bfa3
| 1
|
Analyze the following code function for security vulnerabilities
|
public void saveFollows(String scenarioId, List<String> follows) {
ApiScenarioFollowExample example = new ApiScenarioFollowExample();
example.createCriteria().andScenarioIdEqualTo(scenarioId);
apiScenarioFollowMapper.deleteByExample(example);
if (!org.springframework.util.CollectionUtils.isEmpty(follows)) {
for (String follow : follows) {
ApiScenarioFollow apiScenarioFollow = new ApiScenarioFollow();
apiScenarioFollow.setScenarioId(scenarioId);
apiScenarioFollow.setFollowId(follow);
apiScenarioFollowMapper.insert(apiScenarioFollow);
}
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: saveFollows
File: backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java
Repository: metersphere
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2021-45789
|
MEDIUM
| 6.5
|
metersphere
|
saveFollows
|
backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java
|
d74e02cdff47cdf7524d305d098db6ffb7f61b47
| 0
|
Analyze the following code function for security vulnerabilities
|
public ClassEditPage editClass(DocumentReference reference)
{
gotoPage(reference, "edit", "editor=class");
return new ClassEditPage();
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: editClass
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
|
editClass
|
xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-ui/src/main/java/org/xwiki/test/ui/TestUtils.java
|
98208c5bb1e8cdf3ff1ac35d8b3d1cb3c28b3263
| 0
|
Analyze the following code function for security vulnerabilities
|
public static String getNodeContentsAsString(Node node) {
StringWriter sw = new StringWriter();
try {
Transformer t = TransformerFactory.newInstance().newTransformer();
t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
t.setOutputProperty(OutputKeys.INDENT, "yes");
t.transform(new DOMSource(node), new StreamResult(sw));
} catch (TransformerException ex) {
throw new RuntimeException("Error transforming node", ex);
}
return sw.toString();
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getNodeContentsAsString
File: api/src/main/java/org/openmrs/module/htmlformentry/HtmlFormEntryUtil.java
Repository: openmrs/openmrs-module-htmlformentry
The code follows secure coding practices.
|
[
"CWE-611"
] |
CVE-2018-16521
|
HIGH
| 7.5
|
openmrs/openmrs-module-htmlformentry
|
getNodeContentsAsString
|
api/src/main/java/org/openmrs/module/htmlformentry/HtmlFormEntryUtil.java
|
9dcd304688e65c31cac5532fe501b9816ed975ae
| 0
|
Analyze the following code function for security vulnerabilities
|
public int getExpungeBatchSize() {
return myExpungeBatchSize;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getExpungeBatchSize
File: hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java
Repository: hapifhir/hapi-fhir
The code follows secure coding practices.
|
[
"CWE-400"
] |
CVE-2021-32053
|
MEDIUM
| 5
|
hapifhir/hapi-fhir
|
getExpungeBatchSize
|
hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java
|
f2934b229c491235ab0e7782dea86b324521082a
| 0
|
Analyze the following code function for security vulnerabilities
|
private void enforceSystem() {
if (!isCallerSystem()) {
throw new SecurityException("Caller must be system");
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: enforceSystem
File: services/core/java/com/android/server/pm/ShortcutService.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2023-40079
|
HIGH
| 7.8
|
android
|
enforceSystem
|
services/core/java/com/android/server/pm/ShortcutService.java
|
96e0524c48c6e58af7d15a2caf35082186fc8de2
| 0
|
Analyze the following code function for security vulnerabilities
|
@GuardedBy("mLock")
private void rescanUpdatedPackagesLocked(@UserIdInt int userId, long lastScanTime) {
if (DEBUG_REBOOT) {
Slog.d(TAG, "rescan updated package user=" + userId + " last scanned=" + lastScanTime);
}
final ShortcutUser user = getUserShortcutsLocked(userId);
// Note after each OTA, we'll need to rescan all system apps, as their lastUpdateTime
// is not reliable.
final long now = injectCurrentTimeMillis();
final boolean afterOta =
!injectBuildFingerprint().equals(user.getLastAppScanOsFingerprint());
// Then for each installed app, publish manifest shortcuts when needed.
forUpdatedPackages(userId, lastScanTime, afterOta, ai -> {
user.attemptToRestoreIfNeededAndSave(this, ai.packageName, userId);
user.rescanPackageIfNeeded(ai.packageName, /* forceRescan= */ true);
});
// Write the time just before the scan, because there may be apps that have just
// been updated, and we want to catch them in the next time.
user.setLastAppScanTime(now);
user.setLastAppScanOsFingerprint(injectBuildFingerprint());
scheduleSaveUser(userId);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: rescanUpdatedPackagesLocked
File: services/core/java/com/android/server/pm/ShortcutService.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2023-40079
|
HIGH
| 7.8
|
android
|
rescanUpdatedPackagesLocked
|
services/core/java/com/android/server/pm/ShortcutService.java
|
96e0524c48c6e58af7d15a2caf35082186fc8de2
| 0
|
Analyze the following code function for security vulnerabilities
|
private Resource getResource(final Element element, final String attribute, final boolean mustFind)
throws GameParseException {
return getValidatedObject(element, attribute, mustFind, data.getResourceList()::getResource, "resource");
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getResource
File: game-core/src/main/java/games/strategy/engine/data/GameParser.java
Repository: triplea-game/triplea
The code follows secure coding practices.
|
[
"CWE-611"
] |
CVE-2018-1000546
|
MEDIUM
| 6.8
|
triplea-game/triplea
|
getResource
|
game-core/src/main/java/games/strategy/engine/data/GameParser.java
|
0f23875a4c6e166218859a63c884995f15c53895
| 0
|
Analyze the following code function for security vulnerabilities
|
public String toXML() throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.newDocument();
Element element = toDOM(document);
document.appendChild(element);
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
DOMSource domSource = new DOMSource(document);
StringWriter sw = new StringWriter();
StreamResult streamResult = new StreamResult(sw);
transformer.transform(domSource, streamResult);
return sw.toString();
}
|
Vulnerability Classification:
- CWE: CWE-611
- CVE: CVE-2022-2414
- Severity: HIGH
- CVSS Score: 7.5
Description: Disable access to external entities when parsing XML
This reduces the vulnerability of XML parsers to XXE (XML external
entity) injection.
The best way to prevent XXE is to stop using XML altogether, which we do
plan to do. Until that happens I consider it worthwhile to tighten the
security here though.
Function: toXML
File: base/common/src/main/java/com/netscape/certsrv/profile/ProfileInput.java
Repository: dogtagpki/pki
Fixed Code:
public String toXML() throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.newDocument();
Element element = toDOM(document);
document.appendChild(element);
TransformerFactory transformerFactory = TransformerFactory.newInstance();
transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
DOMSource domSource = new DOMSource(document);
StringWriter sw = new StringWriter();
StreamResult streamResult = new StreamResult(sw);
transformer.transform(domSource, streamResult);
return sw.toString();
}
|
[
"CWE-611"
] |
CVE-2022-2414
|
HIGH
| 7.5
|
dogtagpki/pki
|
toXML
|
base/common/src/main/java/com/netscape/certsrv/profile/ProfileInput.java
|
16deffdf7548e305507982e246eb9fd1eac414fd
| 1
|
Analyze the following code function for security vulnerabilities
|
@ProxyFromAnyToPrimaryUser
public static void notifyVisibilityChanged(Context context, SystemServicesProxy ssp,
boolean visible) {
if (ssp.isForegroundUserOwner()) {
visibilityChanged(visible);
} else {
Intent intent = createLocalBroadcastIntent(context,
ACTION_PROXY_NOTIFY_RECENTS_VISIBLITY_TO_OWNER);
intent.putExtra(EXTRA_RECENTS_VISIBILITY, visible);
context.sendBroadcastAsUser(intent, UserHandle.OWNER);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: notifyVisibilityChanged
File: packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-264"
] |
CVE-2016-0813
|
MEDIUM
| 6.6
|
android
|
notifyVisibilityChanged
|
packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
|
16a76dadcc23a13223e9c2216dad1fe5cad7d6e1
| 0
|
Analyze the following code function for security vulnerabilities
|
private void saveCdmaSubscriptionSource(int source) {
log("Storing cdma subscription source: " + source);
Settings.Global.putInt(mPhone.getContext().getContentResolver(),
Settings.Global.CDMA_SUBSCRIPTION_MODE,
source );
log("Read from settings: " + Settings.Global.getInt(mPhone.getContext().getContentResolver(),
Settings.Global.CDMA_SUBSCRIPTION_MODE, -1));
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: saveCdmaSubscriptionSource
File: src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-20"
] |
CVE-2016-3831
|
MEDIUM
| 5
|
android
|
saveCdmaSubscriptionSource
|
src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
|
f47bc301ccbc5e6d8110afab5a1e9bac1d4ef058
| 0
|
Analyze the following code function for security vulnerabilities
|
@SuppressWarnings("resource")
public Writer write(Writer writer, int indentFactor, int indent)
throws JSONException {
try {
boolean needsComma = false;
final int length = this.length();
writer.write('{');
if (length == 1) {
final Entry<String,?> entry = this.entrySet().iterator().next();
final String key = entry.getKey();
writer.write(quote(key));
writer.write(':');
if (indentFactor > 0) {
writer.write(' ');
}
try{
writeValue(writer, entry.getValue(), indentFactor, indent);
} catch (Exception e) {
throw new JSONException("Unable to write JSONObject value for key: " + key, e);
}
} else if (length != 0) {
final int newIndent = indent + indentFactor;
for (final Entry<String,?> entry : this.entrySet()) {
if (needsComma) {
writer.write(',');
}
if (indentFactor > 0) {
writer.write('\n');
}
indent(writer, newIndent);
final String key = entry.getKey();
writer.write(quote(key));
writer.write(':');
if (indentFactor > 0) {
writer.write(' ');
}
try {
writeValue(writer, entry.getValue(), indentFactor, newIndent);
} catch (Exception e) {
throw new JSONException("Unable to write JSONObject value for key: " + key, e);
}
needsComma = true;
}
if (indentFactor > 0) {
writer.write('\n');
}
indent(writer, indent);
}
writer.write('}');
return writer;
} catch (IOException exception) {
throw new JSONException(exception);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: write
File: src/main/java/org/json/JSONObject.java
Repository: stleary/JSON-java
The code follows secure coding practices.
|
[
"CWE-770"
] |
CVE-2023-5072
|
HIGH
| 7.5
|
stleary/JSON-java
|
write
|
src/main/java/org/json/JSONObject.java
|
661114c50dcfd53bb041aab66f14bb91e0a87c8a
| 0
|
Analyze the following code function for security vulnerabilities
|
public static boolean postYN(String targetIn) {
SAMLUtils.debug.message("Inside postYN()");
if ((targetIn == null) || (targetIn.length() == 0)) {
return false;
}
Set targets = (Set) SAMLServiceManager.
getAttribute(SAMLConstants.POST_TO_TARGET_URLS);
if ((targets == null) || (targets.size() == 0)) {
return false;
}
URL targetUrl = null;
try {
targetUrl = new URL(targetIn);
} catch (MalformedURLException me ) {
SAMLUtils.debug.error("SAMLUtils:postYN(): Malformed URL passed");
return false;
}
String targetInHost = targetUrl.getHost();
int targetInPort = targetUrl.getPort();
String targetInPath = targetUrl.getPath();
// making target string without protocol
String targetToCompare = new StringBuffer(targetInHost.toLowerCase())
.append(":").append(String.valueOf(targetInPort))
.append("/").append(targetInPath).toString();
if (targets.contains(targetToCompare)) {
return true;
} else {
return false;
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: postYN
File: openam-federation/openam-federation-library/src/main/java/com/sun/identity/saml/common/SAMLUtils.java
Repository: OpenIdentityPlatform/OpenAM
The code follows secure coding practices.
|
[
"CWE-287"
] |
CVE-2023-37471
|
CRITICAL
| 9.8
|
OpenIdentityPlatform/OpenAM
|
postYN
|
openam-federation/openam-federation-library/src/main/java/com/sun/identity/saml/common/SAMLUtils.java
|
7c18543d126e8a567b83bb4535631825aaa9d742
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public Route.Collection delete(final String path1, final String path2,
final Route.Handler handler) {
return new Route.Collection(
new Route.Definition[]{delete(path1, handler), delete(path2, handler)});
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: delete
File: jooby/src/main/java/org/jooby/Jooby.java
Repository: jooby-project/jooby
The code follows secure coding practices.
|
[
"CWE-22"
] |
CVE-2020-7647
|
MEDIUM
| 5
|
jooby-project/jooby
|
delete
|
jooby/src/main/java/org/jooby/Jooby.java
|
34f526028e6cd0652125baa33936ffb6a8a4a009
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public long getItemId(int position) {
return position;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getItemId
File: services/autofill/java/com/android/server/autofill/ui/DialogFillUi.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other",
"CWE-610"
] |
CVE-2023-40133
|
MEDIUM
| 5.5
|
android
|
getItemId
|
services/autofill/java/com/android/server/autofill/ui/DialogFillUi.java
|
08becc8c600f14c5529115cc1a1e0c97cd503f33
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public boolean regenerate(Region region, Extent extent, RegenOptions options) {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
try {
if (adapter != null) {
return adapter.regenerate(getWorld(), region, extent, options);
} else {
throw new UnsupportedOperationException("Missing BukkitImplAdapter for this version.");
}
} catch (FaweException e) {
throw e;
} catch (Exception e) {
LOGGER.warn("Regeneration via adapter failed.", e);
return false;
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: regenerate
File: worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java
Repository: IntellectualSites/FastAsyncWorldEdit
The code follows secure coding practices.
|
[
"CWE-400"
] |
CVE-2023-35925
|
MEDIUM
| 5.5
|
IntellectualSites/FastAsyncWorldEdit
|
regenerate
|
worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java
|
3a8dfb4f7b858a439c35f7af1d56d21f796f61f5
| 0
|
Analyze the following code function for security vulnerabilities
|
@SuppressWarnings("unchecked")
public List<CmsContent> quote(short siteId, CmsContent entity, Set<Long> contentIds, CmsContentParameters contentParameters,
CmsModel cmsModel, CmsCategory category, CmsContentAttribute attribute) {
List<CmsContent> entityList = new ArrayList<>();
for (CmsContent quote : (List<CmsContent>) getPage(new CmsContentQuery(siteId, null, null, null, null, null, null, null,
entity.getId(), null, null, null, null, null, null, null, null, null, null), null, null, null, null, null)
.getList()) {
if (null != contentIds && contentIds.contains(quote.getId())) {
quote.setUrl(entity.getUrl());
quote.setTitle(entity.getTitle());
quote.setDescription(entity.getDescription());
quote.setAuthor(entity.getAuthor());
quote.setCover(entity.getCover());
quote.setEditor(entity.getEditor());
quote.setExpiryDate(entity.getExpiryDate());
saveTagAndAttribute(siteId, entity.getId(), quote.getId(), contentParameters, cmsModel, category, attribute);
} else {
delete(quote.getId());
attributeService.delete(quote.getId());
}
}
return entityList;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: quote
File: publiccms-parent/publiccms-core/src/main/java/com/publiccms/logic/service/cms/CmsContentService.java
Repository: sanluan/PublicCMS
The code follows secure coding practices.
|
[
"CWE-79"
] |
CVE-2020-21333
|
LOW
| 3.5
|
sanluan/PublicCMS
|
quote
|
publiccms-parent/publiccms-core/src/main/java/com/publiccms/logic/service/cms/CmsContentService.java
|
b4d5956e65b14347b162424abb197a180229b3db
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public void drawRGB(Object graphics, int[] rgbData, int offset, int x,
int y, int w, int h, boolean processAlpha) {
((AndroidGraphics) graphics).drawRGB(rgbData, offset, x, y, w, h, processAlpha);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: drawRGB
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
|
drawRGB
|
Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java
|
dad49c9ef26a598619fc48d2697151a02987d478
| 0
|
Analyze the following code function for security vulnerabilities
|
private void checkDefaultBrowser() {
final int myUserId = UserHandle.myUserId();
final String packageName = getDefaultBrowserPackageName(myUserId);
if (packageName != null) {
PackageInfo info = getPackageInfo(packageName, 0, myUserId);
if (info == null) {
Slog.w(TAG, "Default browser no longer installed: " + packageName);
synchronized (mPackages) {
applyFactoryDefaultBrowserLPw(myUserId); // leaves ambiguous when > 1
}
}
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: checkDefaultBrowser
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
|
checkDefaultBrowser
|
services/core/java/com/android/server/pm/PackageManagerService.java
|
a75537b496e9df71c74c1d045ba5569631a16298
| 0
|
Analyze the following code function for security vulnerabilities
|
public Pager pagerFromParams(String pageParamName, HttpServletRequest req) {
Pager p = new Pager(CONF.maxItemsPerPage());
p.setPage(Math.min(NumberUtils.toLong(req.getParameter(pageParamName), 1), CONF.maxPages()));
p.setLimit(NumberUtils.toInt(req.getParameter("limit"), CONF.maxItemsPerPage()));
String lastKey = req.getParameter("lastKey");
String sort = req.getParameter("sortby");
String desc = req.getParameter("desc");
if (!StringUtils.isBlank(desc)) {
p.setDesc(Boolean.parseBoolean(desc));
}
if (!StringUtils.isBlank(lastKey)) {
p.setLastKey(lastKey);
}
if (!StringUtils.isBlank(sort)) {
p.setSortby(sort);
}
return p;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: pagerFromParams
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
|
pagerFromParams
|
src/main/java/com/erudika/scoold/utils/ScooldUtils.java
|
62a0e92e1486ddc17676a7ead2c07ff653d167ce
| 0
|
Analyze the following code function for security vulnerabilities
|
public static String getModuleName(){
return MODULE_NAME;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getModuleName
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
|
getModuleName
|
domain-models-runtime/src/main/java/org/folio/rest/persist/PostgresClient.java
|
b7ef741133e57add40aa4cb19430a0065f378a94
| 0
|
Analyze the following code function for security vulnerabilities
|
protected Object cleanUserPrincipal(Object principal) {
if(principal instanceof Map) {
Map cleanUser = new HashMap();
AtomicBoolean skipped = new AtomicBoolean(false);
((Map<?, ?>) principal).forEach((k, v) -> {
if (v instanceof List || v instanceof Map) {
logger.debug("Skipping {}", k);
skipped.set(true);
} else {
cleanUser.put(k, v);
}
});
if(skipped.get()) {
logger.debug("The user entity has potential self-references that make it unusable as a principal, because it must be serializable to JSON. Returning a non-persistent map with no references.");
return cleanUser;
} else {
return principal;
}
}
return principal;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: cleanUserPrincipal
File: portofino-core/src/main/java/com/manydesigns/portofino/shiro/AbstractPortofinoRealm.java
Repository: ManyDesigns/Portofino
The code follows secure coding practices.
|
[
"CWE-347"
] |
CVE-2021-29451
|
MEDIUM
| 6.4
|
ManyDesigns/Portofino
|
cleanUserPrincipal
|
portofino-core/src/main/java/com/manydesigns/portofino/shiro/AbstractPortofinoRealm.java
|
8c754a0ad234555e813dcbf9e57d637f9f23d8fb
| 0
|
Analyze the following code function for security vulnerabilities
|
public @NotNull Builder addHostKey(@NotNull String hostKey) {
hostKeys.add(hostKey);
sshdConfig.withHostKey(hostKey);
return this;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: addHostKey
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
|
addHostKey
|
src/itest/java/com/hierynomus/sshj/SshdContainer.java
|
94fcc960e0fb198ddec0f7efc53f95ac627fe083
| 0
|
Analyze the following code function for security vulnerabilities
|
public Object remove(String key) {
return this.map.remove(key);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: remove
File: src/main/java/org/json/JSONObject.java
Repository: stleary/JSON-java
The code follows secure coding practices.
|
[
"CWE-770"
] |
CVE-2023-5072
|
HIGH
| 7.5
|
stleary/JSON-java
|
remove
|
src/main/java/org/json/JSONObject.java
|
661114c50dcfd53bb041aab66f14bb91e0a87c8a
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public boolean isVrModePackageEnabled(ComponentName packageName) {
mActivityTaskManager.enforceSystemHasVrFeature();
final VrManagerInternal vrService = LocalServices.getService(VrManagerInternal.class);
return vrService.hasVrPackage(packageName, UserHandle.getCallingUserId()) ==
VrManagerInternal.NO_ERROR;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isVrModePackageEnabled
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
|
isVrModePackageEnabled
|
services/core/java/com/android/server/am/ActivityManagerService.java
|
d10b27e539f7bc91c2360d429b9d05f05274670d
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public int getTime() {
if(nativeVideo != null){
return nativeVideo.getCurrentPosition();
}
return -1;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getTime
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
|
getTime
|
Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java
|
dad49c9ef26a598619fc48d2697151a02987d478
| 0
|
Analyze the following code function for security vulnerabilities
|
protected void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams,
Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException {
for (String authName : authNames) {
Authentication auth = authentications.get(authName);
if (auth == null) {
continue;
}
auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: updateParamsForAuth
File: samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java
Repository: OpenAPITools/openapi-generator
The code follows secure coding practices.
|
[
"CWE-668"
] |
CVE-2021-21430
|
LOW
| 2.1
|
OpenAPITools/openapi-generator
|
updateParamsForAuth
|
samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java
|
2c576483f26f85b3979c6948a131f585c237109a
| 0
|
Analyze the following code function for security vulnerabilities
|
@JRubyMethod
public IRubyObject
parse_with(ThreadContext context, IRubyObject handlerRuby)
{
final Ruby runtime = context.getRuntime();
if (!invoke(context, handlerRuby, "respond_to?", runtime.newSymbol("document")).isTrue()) {
throw runtime.newArgumentError("argument must respond_to document");
}
/* TODO: how should we pass in parse options? */
ParserContext.Options options = defaultParseOptions(context);
errorHandler = new NokogiriStrictErrorHandler(runtime, options.noError, options.noWarning);
handler = new NokogiriHandler(runtime, handlerRuby, errorHandler);
preParse(runtime, handlerRuby, handler);
parser.setContentHandler(handler);
parser.setErrorHandler(handler);
parser.setEntityResolver(new NokogiriEntityResolver(runtime, errorHandler, options));
try {
parser.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
} catch (Exception ex) {
throw runtime.newRuntimeError("Problem while creating XML SAX Parser: " + ex.toString());
}
try {
try {
do_parse();
} catch (SAXParseException ex) {
// A bad document (<foo><bar></foo>) should call the
// error handler instead of raising a SAX exception.
// However, an EMPTY document should raise a RuntimeError.
// This is a bit kludgy, but AFAIK SAX doesn't distinguish
// between empty and bad whereas Nokogiri does.
String message = ex.getMessage();
if (message != null && message.contains("Premature end of file.") && stringDataSize < 1) {
throw runtime.newRuntimeError("couldn't parse document: " + message);
}
handler.error(ex);
}
} catch (SAXException ex) {
// Unexpected failure in XML subsystem
throw runtime.newRuntimeError(ex.getMessage());
} catch (IOException ex) {
throw runtime.newIOErrorFromException(ex);
}
postParse(runtime, handlerRuby, handler);
return runtime.getNil();
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: parse_with
File: ext/java/nokogiri/XmlSaxParserContext.java
Repository: sparklemotion/nokogiri
The code follows secure coding practices.
|
[
"CWE-241"
] |
CVE-2022-29181
|
MEDIUM
| 6.4
|
sparklemotion/nokogiri
|
parse_with
|
ext/java/nokogiri/XmlSaxParserContext.java
|
db05ba9a1bd4b90aa6c76742cf6102a7c7297267
| 0
|
Analyze the following code function for security vulnerabilities
|
private boolean isSeparateProfileChallengeEnabled(int userHandle) {
return mInjector.binderWithCleanCallingIdentity(() ->
mLockPatternUtils.isSeparateProfileChallengeEnabled(userHandle));
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isSeparateProfileChallengeEnabled
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
|
isSeparateProfileChallengeEnabled
|
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
|
ed3f25b7222d4cff471f2b7d22d1150348146957
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public FilePath createPath(String absolutePath) {
return new FilePath((VirtualChannel)null,absolutePath);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: createPath
File: core/src/main/java/jenkins/model/Jenkins.java
Repository: jenkinsci/jenkins
The code follows secure coding practices.
|
[
"CWE-79"
] |
CVE-2014-2065
|
MEDIUM
| 4.3
|
jenkinsci/jenkins
|
createPath
|
core/src/main/java/jenkins/model/Jenkins.java
|
a0b00508eeb74d7033dc4100eb382df4e8fa72e7
| 0
|
Analyze the following code function for security vulnerabilities
|
public String getImageUrl() throws IndexUnreachableException {
return getPageUrl(PageType.viewImage.getName(), imageToShow);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getImageUrl
File: goobi-viewer-core/src/main/java/io/goobi/viewer/managedbeans/ActiveDocumentBean.java
Repository: intranda/goobi-viewer-core
The code follows secure coding practices.
|
[
"CWE-79"
] |
CVE-2023-29014
|
MEDIUM
| 6.1
|
intranda/goobi-viewer-core
|
getImageUrl
|
goobi-viewer-core/src/main/java/io/goobi/viewer/managedbeans/ActiveDocumentBean.java
|
c29efe60e745a94d03debc17681c4950f3917455
| 0
|
Analyze the following code function for security vulnerabilities
|
private static int getEncryptedPacketLength(ChannelBuffer buffer, int offset) {
int packetLength = 0;
// SSLv3 or TLS - Check ContentType
boolean tls;
switch (buffer.getUnsignedByte(offset)) {
case 20: // change_cipher_spec
case 21: // alert
case 22: // handshake
case 23: // application_data
tls = true;
break;
default:
// SSLv2 or bad data
tls = false;
}
if (tls) {
// SSLv3 or TLS - Check ProtocolVersion
int majorVersion = buffer.getUnsignedByte(offset + 1);
if (majorVersion == 3) {
// SSLv3 or TLS
packetLength = (getShort(buffer, offset + 3) & 0xFFFF) + 5;
if (packetLength <= 5) {
// Neither SSLv3 or TLSv1 (i.e. SSLv2 or bad data)
tls = false;
}
} else {
// Neither SSLv3 or TLSv1 (i.e. SSLv2 or bad data)
tls = false;
}
}
if (!tls) {
// SSLv2 or bad data - Check the version
boolean sslv2 = true;
int headerLength = (buffer.getUnsignedByte(offset) & 0x80) != 0 ? 2 : 3;
int majorVersion = buffer.getUnsignedByte(offset + headerLength + 1);
if (majorVersion == 2 || majorVersion == 3) {
// SSLv2
if (headerLength == 2) {
packetLength = (getShort(buffer, offset) & 0x7FFF) + 2;
} else {
packetLength = (getShort(buffer, offset) & 0x3FFF) + 3;
}
if (packetLength <= headerLength) {
sslv2 = false;
}
} else {
sslv2 = false;
}
if (!sslv2) {
return -1;
}
}
return packetLength;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getEncryptedPacketLength
File: src/main/java/org/jboss/netty/handler/ssl/SslHandler.java
Repository: netty
The code follows secure coding practices.
|
[
"CWE-119"
] |
CVE-2014-3488
|
MEDIUM
| 5
|
netty
|
getEncryptedPacketLength
|
src/main/java/org/jboss/netty/handler/ssl/SslHandler.java
|
2fa9400a59d0563a66908aba55c41e7285a04994
| 0
|
Analyze the following code function for security vulnerabilities
|
private void interceptScreenshotChord() {
if (mScreenshotChordEnabled
&& mScreenshotChordVolumeDownKeyTriggered && mScreenshotChordPowerKeyTriggered
&& !mScreenshotChordVolumeUpKeyTriggered) {
final long now = SystemClock.uptimeMillis();
if (now <= mScreenshotChordVolumeDownKeyTime + SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS
&& now <= mScreenshotChordPowerKeyTime
+ SCREENSHOT_CHORD_DEBOUNCE_DELAY_MILLIS) {
mScreenshotChordVolumeDownKeyConsumed = true;
cancelPendingPowerKeyAction();
mHandler.postDelayed(mScreenshotRunnable, getScreenshotChordLongPressDelay());
}
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: interceptScreenshotChord
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
|
interceptScreenshotChord
|
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
|
84669ca8de55d38073a0dcb01074233b0a417541
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public boolean onPreferenceTreeClick(Preference preference) {
final String key = preference.getKey();
if (!isUnlockMethodSecure(key) && mLockPatternUtils.isSecure(mUserId)) {
// Show the disabling FRP warning only when the user is switching from a secure
// unlock method to an insecure one
showFactoryResetProtectionWarningDialog(key);
return true;
} else if (KEY_SKIP_FINGERPRINT.equals(key)) {
Intent chooseLockGenericIntent = new Intent(getActivity(),
ChooseLockGeneric.InternalActivity.class);
chooseLockGenericIntent.setAction(getIntent().getAction());
// Forward the target user id to ChooseLockGeneric.
chooseLockGenericIntent.putExtra(Intent.EXTRA_USER_ID, mUserId);
chooseLockGenericIntent.putExtra(CONFIRM_CREDENTIALS, !mPasswordConfirmed);
if (mUserPassword != null) {
chooseLockGenericIntent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD,
mUserPassword);
}
startActivityForResult(chooseLockGenericIntent, SKIP_FINGERPRINT_REQUEST);
return true;
} else {
return setUnlockMethod(key);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: onPreferenceTreeClick
File: src/com/android/settings/password/ChooseLockGeneric.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2018-9501
|
HIGH
| 7.2
|
android
|
onPreferenceTreeClick
|
src/com/android/settings/password/ChooseLockGeneric.java
|
5e43341b8c7eddce88f79c9a5068362927c05b54
| 0
|
Analyze the following code function for security vulnerabilities
|
public File getFile() {
return file;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getFile
File: src/main/java/org/olat/restapi/support/MultipartReader.java
Repository: OpenOLAT
The code follows secure coding practices.
|
[
"CWE-22"
] |
CVE-2021-41242
|
HIGH
| 7.9
|
OpenOLAT
|
getFile
|
src/main/java/org/olat/restapi/support/MultipartReader.java
|
c450df7d7ffe6afde39ebca6da9136f1caa16ec4
| 0
|
Analyze the following code function for security vulnerabilities
|
public String getBasePath() {
return basePath;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getBasePath
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
|
getBasePath
|
samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/ApiClient.java
|
2c576483f26f85b3979c6948a131f585c237109a
| 0
|
Analyze the following code function for security vulnerabilities
|
private boolean hasFullCrossUsersPermission(CallerIdentity caller, int userHandle) {
return (userHandle == caller.getUserId()) || isSystemUid(caller) || isRootUid(caller)
|| hasCallingOrSelfPermission(permission.INTERACT_ACROSS_USERS_FULL);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: hasFullCrossUsersPermission
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
|
hasFullCrossUsersPermission
|
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
|
ed3f25b7222d4cff471f2b7d22d1150348146957
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public boolean validateRotationAnimationLw(int exitAnimId, int enterAnimId,
boolean forceDefault) {
switch (exitAnimId) {
case R.anim.rotation_animation_xfade_exit:
case R.anim.rotation_animation_jump_exit:
// These are the only cases that matter.
if (forceDefault) {
return false;
}
int anim[] = new int[2];
selectRotationAnimationLw(anim);
return (exitAnimId == anim[0] && enterAnimId == anim[1]);
default:
return true;
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: validateRotationAnimationLw
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
|
validateRotationAnimationLw
|
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
|
84669ca8de55d38073a0dcb01074233b0a417541
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public ActivityPresentationInfo getActivityPresentationInfo(IBinder token) {
final ActivityClient ac = ActivityClient.getInstance();
return new ActivityPresentationInfo(ac.getTaskForActivity(token,
/*onlyRoot=*/ false), ac.getDisplayId(token),
mAtmInternal.getActivityName(token));
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getActivityPresentationInfo
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
|
getActivityPresentationInfo
|
services/core/java/com/android/server/am/ActivityManagerService.java
|
d10b27e539f7bc91c2360d429b9d05f05274670d
| 0
|
Analyze the following code function for security vulnerabilities
|
public static void unzipHere(String zipFilePath) throws IOException {
int index = zipFilePath.lastIndexOf("/");
if (0 > index) {
index = zipFilePath.lastIndexOf("\\");
}
unzip(zipFilePath, zipFilePath.substring(0, index), true);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: unzipHere
File: publiccms-parent/publiccms-common/src/main/java/com/publiccms/common/tools/ZipUtils.java
Repository: sanluan/PublicCMS
The code follows secure coding practices.
|
[
"CWE-434"
] |
CVE-2018-12914
|
HIGH
| 7.5
|
sanluan/PublicCMS
|
unzipHere
|
publiccms-parent/publiccms-common/src/main/java/com/publiccms/common/tools/ZipUtils.java
|
c19fe66378c75725f3e3a380a6cb9f8b8a7dcb71
| 0
|
Analyze the following code function for security vulnerabilities
|
private boolean tryToRegister(TestUtils testUtils, AbstractRegistrationPage registrationPage, boolean isModal)
{
if (isModal) {
return administrationModalUserCreation(testUtils, registrationPage);
} else {
return guestUserRegistration(testUtils, registrationPage);
}
}
|
Vulnerability Classification:
- CWE: CWE-94
- CVE: CVE-2024-21650
- Severity: CRITICAL
- CVSS Score: 9.8
Description: XWIKI-21173: Improve escaping in registration success message
* Use $xwiki.getUserName to link to the user profile.
* Add an integration test to test proper escaping.
Function: tryToRegister
File: xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-test/xwiki-platform-administration-test-docker/src/test/it/org/xwiki/administration/test/ui/RegisterIT.java
Repository: xwiki/xwiki-platform
Fixed Code:
private boolean tryToRegister(TestUtils testUtils, AbstractRegistrationPage registrationPage, boolean isModal)
{
if (isModal) {
return administrationModalUserCreation(testUtils, registrationPage);
} else {
return guestUserRegistration(registrationPage);
}
}
|
[
"CWE-94"
] |
CVE-2024-21650
|
CRITICAL
| 9.8
|
xwiki/xwiki-platform
|
tryToRegister
|
xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-test/xwiki-platform-administration-test-docker/src/test/it/org/xwiki/administration/test/ui/RegisterIT.java
|
b290bfd573c6f7db6cc15a88dd4111d9fcad0d31
| 1
|
Analyze the following code function for security vulnerabilities
|
private void updateSettingsInternalLI(AndroidPackage pkg, ReconciledPackage reconciledPkg,
int[] allUsers, PackageInstalledInfo res) {
Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "updateSettings");
final String pkgName = pkg.getPackageName();
final int[] installedForUsers = res.mOrigUsers;
final InstallArgs installArgs = reconciledPkg.mInstallArgs;
final int installReason = installArgs.mInstallReason;
InstallSource installSource = installArgs.mInstallSource;
final String installerPackageName = installSource.installerPackageName;
if (DEBUG_INSTALL) Slog.d(TAG, "New package installed in " + pkg.getPath());
synchronized (mPm.mLock) {
// For system-bundled packages, we assume that installing an upgraded version
// of the package implies that the user actually wants to run that new code,
// so we enable the package.
final PackageSetting ps = mPm.mSettings.getPackageLPr(pkgName);
final int userId = installArgs.mUser.getIdentifier();
if (ps != null) {
if (pkg.isSystem()) {
if (DEBUG_INSTALL) {
Slog.d(TAG, "Implicitly enabling system package on upgrade: " + pkgName);
}
// Enable system package for requested users
if (res.mOrigUsers != null) {
for (int origUserId : res.mOrigUsers) {
if (userId == UserHandle.USER_ALL || userId == origUserId) {
ps.setEnabled(COMPONENT_ENABLED_STATE_DEFAULT,
origUserId, installerPackageName);
}
}
}
// Also convey the prior install/uninstall state
if (allUsers != null && installedForUsers != null) {
for (int currentUserId : allUsers) {
final boolean installed = ArrayUtils.contains(
installedForUsers, currentUserId);
if (DEBUG_INSTALL) {
Slog.d(TAG, " user " + currentUserId + " => " + installed);
}
ps.setInstalled(installed, currentUserId);
}
// these install state changes will be persisted in the
// upcoming call to mSettings.writeLPr().
}
if (allUsers != null) {
for (int currentUserId : allUsers) {
ps.resetOverrideComponentLabelIcon(currentUserId);
}
}
}
// Retrieve the overlays for shared libraries of the package.
if (!ps.getPkgState().getUsesLibraryInfos().isEmpty()) {
for (SharedLibraryInfo sharedLib : ps.getPkgState().getUsesLibraryInfos()) {
for (int currentUserId : UserManagerService.getInstance().getUserIds()) {
if (!sharedLib.isDynamic()) {
// TODO(146804378): Support overlaying static shared libraries
continue;
}
final PackageSetting libPs = mPm.mSettings.getPackageLPr(
sharedLib.getPackageName());
if (libPs == null) {
continue;
}
ps.setOverlayPathsForLibrary(sharedLib.getName(),
libPs.getOverlayPaths(currentUserId), currentUserId);
}
}
}
if (userId != UserHandle.USER_ALL) {
// It's implied that when a user requests installation, they want the app to
// be installed and enabled.
ps.setInstalled(true, userId);
ps.setEnabled(COMPONENT_ENABLED_STATE_DEFAULT, userId, installerPackageName);
} else if (allUsers != null) {
// The caller explicitly specified INSTALL_ALL_USERS flag.
// Thus, updating the settings to install the app for all users.
for (int currentUserId : allUsers) {
ps.setInstalled(true, currentUserId);
ps.setEnabled(COMPONENT_ENABLED_STATE_DEFAULT, userId,
installerPackageName);
}
}
mPm.mSettings.addInstallerPackageNames(ps.getInstallSource());
// When replacing an existing package, preserve the original install reason for all
// users that had the package installed before. Similarly for uninstall reasons.
final Set<Integer> previousUserIds = new ArraySet<>();
if (res.mRemovedInfo != null && res.mRemovedInfo.mInstallReasons != null) {
final int installReasonCount = res.mRemovedInfo.mInstallReasons.size();
for (int i = 0; i < installReasonCount; i++) {
final int previousUserId = res.mRemovedInfo.mInstallReasons.keyAt(i);
final int previousInstallReason =
res.mRemovedInfo.mInstallReasons.valueAt(i);
ps.setInstallReason(previousInstallReason, previousUserId);
previousUserIds.add(previousUserId);
}
}
if (res.mRemovedInfo != null && res.mRemovedInfo.mUninstallReasons != null) {
for (int i = 0; i < res.mRemovedInfo.mUninstallReasons.size(); i++) {
final int previousUserId = res.mRemovedInfo.mUninstallReasons.keyAt(i);
final int previousReason = res.mRemovedInfo.mUninstallReasons.valueAt(i);
ps.setUninstallReason(previousReason, previousUserId);
}
}
// Set install reason for users that are having the package newly installed.
final int[] allUsersList = mPm.mUserManager.getUserIds();
if (userId == UserHandle.USER_ALL) {
for (int currentUserId : allUsersList) {
if (!previousUserIds.contains(currentUserId)
&& ps.getInstalled(currentUserId)) {
ps.setInstallReason(installReason, currentUserId);
}
}
} else if (!previousUserIds.contains(userId)) {
ps.setInstallReason(installReason, userId);
}
// TODO(b/169721400): generalize Incremental States and create a Callback object
// that can be used for all the packages.
final String codePath = ps.getPathString();
if (IncrementalManager.isIncrementalPath(codePath)
&& mIncrementalManager != null) {
mIncrementalManager.registerLoadingProgressCallback(codePath,
new IncrementalProgressListener(ps.getPackageName(), mPm));
}
// Ensure that the uninstall reason is UNKNOWN for users with the package installed.
for (int currentUserId : allUsersList) {
if (ps.getInstalled(currentUserId)) {
ps.setUninstallReason(UNINSTALL_REASON_UNKNOWN, currentUserId);
}
}
mPm.mSettings.writeKernelMappingLPr(ps);
final PermissionManagerServiceInternal.PackageInstalledParams.Builder
permissionParamsBuilder =
new PermissionManagerServiceInternal.PackageInstalledParams.Builder();
final boolean grantPermissions = (installArgs.mInstallFlags
& PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS) != 0;
if (grantPermissions) {
final List<String> grantedPermissions =
installArgs.mInstallGrantPermissions != null
? Arrays.asList(installArgs.mInstallGrantPermissions)
: pkg.getRequestedPermissions();
permissionParamsBuilder.setGrantedPermissions(grantedPermissions);
}
final boolean allowlistAllRestrictedPermissions =
(installArgs.mInstallFlags
& PackageManager.INSTALL_ALL_WHITELIST_RESTRICTED_PERMISSIONS) != 0;
final List<String> allowlistedRestrictedPermissions =
allowlistAllRestrictedPermissions ? pkg.getRequestedPermissions()
: installArgs.mAllowlistedRestrictedPermissions;
if (allowlistedRestrictedPermissions != null) {
permissionParamsBuilder.setAllowlistedRestrictedPermissions(
allowlistedRestrictedPermissions);
}
final int autoRevokePermissionsMode = installArgs.mAutoRevokePermissionsMode;
permissionParamsBuilder.setAutoRevokePermissionsMode(autoRevokePermissionsMode);
final ScanResult scanResult = reconciledPkg.mScanResult;
mPm.mPermissionManager.onPackageInstalled(pkg, scanResult.mPreviousAppId,
permissionParamsBuilder.build(), userId);
// Apply restricted settings on potentially dangerous packages.
if (installArgs.mPackageSource == PackageInstaller.PACKAGE_SOURCE_LOCAL_FILE
|| installArgs.mPackageSource
== PackageInstaller.PACKAGE_SOURCE_DOWNLOADED_FILE) {
enableRestrictedSettings(pkgName, pkg.getUid());
}
}
res.mName = pkgName;
res.mUid = pkg.getUid();
res.mPkg = pkg;
res.setReturnCode(PackageManager.INSTALL_SUCCEEDED);
//to update install status
Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "writeSettings");
mPm.writeSettingsLPrTEMP();
Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
}
Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
}
|
Vulnerability Classification:
- CWE: CWE-862
- CVE: CVE-2023-21257
- Severity: HIGH
- CVSS Score: 7.8
Description: [RESTRICT AUTOMERGE] Prevent installing apps in policy restricted work profile using ADB
If DISALLOW_DEBUGGING_FEATURES or DISALLOW_INSTALL_APPS restrictions are
set on a work profile, prevent side loading of APKs using ADB in the
work profile.
Bug: 257443065
Test: atest CtsPackageInstallTestCases:UserRestrictionInstallTest
(cherry picked from commit febe3918020a94b2af48ade98eb6a49cdd4a3bdf)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:28e133dff148cf8f43c551073000a459a1573985)
Merged-In: I169a1f72c84528ca606b6a4da165d4fbcd02b08d
Change-Id: I169a1f72c84528ca606b6a4da165d4fbcd02b08d
Function: updateSettingsInternalLI
File: services/core/java/com/android/server/pm/InstallPackageHelper.java
Repository: android
Fixed Code:
private void updateSettingsInternalLI(AndroidPackage pkg, ReconciledPackage reconciledPkg,
int[] allUsers, PackageInstalledInfo res) {
Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "updateSettings");
final String pkgName = pkg.getPackageName();
final int[] installedForUsers = res.mOrigUsers;
final InstallArgs installArgs = reconciledPkg.mInstallArgs;
final int installReason = installArgs.mInstallReason;
InstallSource installSource = installArgs.mInstallSource;
final String installerPackageName = installSource.installerPackageName;
if (DEBUG_INSTALL) Slog.d(TAG, "New package installed in " + pkg.getPath());
synchronized (mPm.mLock) {
// For system-bundled packages, we assume that installing an upgraded version
// of the package implies that the user actually wants to run that new code,
// so we enable the package.
final PackageSetting ps = mPm.mSettings.getPackageLPr(pkgName);
final int userId = installArgs.mUser.getIdentifier();
if (ps != null) {
if (pkg.isSystem()) {
if (DEBUG_INSTALL) {
Slog.d(TAG, "Implicitly enabling system package on upgrade: " + pkgName);
}
// Enable system package for requested users
if (res.mOrigUsers != null) {
for (int origUserId : res.mOrigUsers) {
if (userId == UserHandle.USER_ALL || userId == origUserId) {
ps.setEnabled(COMPONENT_ENABLED_STATE_DEFAULT,
origUserId, installerPackageName);
}
}
}
// Also convey the prior install/uninstall state
if (allUsers != null && installedForUsers != null) {
for (int currentUserId : allUsers) {
final boolean installed = ArrayUtils.contains(
installedForUsers, currentUserId);
if (DEBUG_INSTALL) {
Slog.d(TAG, " user " + currentUserId + " => " + installed);
}
ps.setInstalled(installed, currentUserId);
}
// these install state changes will be persisted in the
// upcoming call to mSettings.writeLPr().
}
if (allUsers != null) {
for (int currentUserId : allUsers) {
ps.resetOverrideComponentLabelIcon(currentUserId);
}
}
}
// Retrieve the overlays for shared libraries of the package.
if (!ps.getPkgState().getUsesLibraryInfos().isEmpty()) {
for (SharedLibraryInfo sharedLib : ps.getPkgState().getUsesLibraryInfos()) {
for (int currentUserId : UserManagerService.getInstance().getUserIds()) {
if (!sharedLib.isDynamic()) {
// TODO(146804378): Support overlaying static shared libraries
continue;
}
final PackageSetting libPs = mPm.mSettings.getPackageLPr(
sharedLib.getPackageName());
if (libPs == null) {
continue;
}
ps.setOverlayPathsForLibrary(sharedLib.getName(),
libPs.getOverlayPaths(currentUserId), currentUserId);
}
}
}
if (userId != UserHandle.USER_ALL) {
// It's implied that when a user requests installation, they want the app to
// be installed and enabled.
ps.setInstalled(true, userId);
ps.setEnabled(COMPONENT_ENABLED_STATE_DEFAULT, userId, installerPackageName);
} else if (allUsers != null) {
// The caller explicitly specified INSTALL_ALL_USERS flag.
// Thus, updating the settings to install the app for all users.
for (int currentUserId : allUsers) {
// If the app is already installed for the currentUser,
// keep it as installed as we might be updating the app at this place.
// If not currently installed, check if the currentUser is restricted by
// DISALLOW_INSTALL_APPS or DISALLOW_DEBUGGING_FEATURES device policy.
// Install / update the app if the user isn't restricted. Skip otherwise.
final boolean installedForCurrentUser = ArrayUtils.contains(
installedForUsers, currentUserId);
final boolean restrictedByPolicy =
mPm.isUserRestricted(currentUserId,
UserManager.DISALLOW_INSTALL_APPS)
|| mPm.isUserRestricted(currentUserId,
UserManager.DISALLOW_DEBUGGING_FEATURES);
if (installedForCurrentUser || !restrictedByPolicy) {
ps.setInstalled(true, currentUserId);
ps.setEnabled(COMPONENT_ENABLED_STATE_DEFAULT, currentUserId,
installerPackageName);
} else {
ps.setInstalled(false, currentUserId);
}
}
}
mPm.mSettings.addInstallerPackageNames(ps.getInstallSource());
// When replacing an existing package, preserve the original install reason for all
// users that had the package installed before. Similarly for uninstall reasons.
final Set<Integer> previousUserIds = new ArraySet<>();
if (res.mRemovedInfo != null && res.mRemovedInfo.mInstallReasons != null) {
final int installReasonCount = res.mRemovedInfo.mInstallReasons.size();
for (int i = 0; i < installReasonCount; i++) {
final int previousUserId = res.mRemovedInfo.mInstallReasons.keyAt(i);
final int previousInstallReason =
res.mRemovedInfo.mInstallReasons.valueAt(i);
ps.setInstallReason(previousInstallReason, previousUserId);
previousUserIds.add(previousUserId);
}
}
if (res.mRemovedInfo != null && res.mRemovedInfo.mUninstallReasons != null) {
for (int i = 0; i < res.mRemovedInfo.mUninstallReasons.size(); i++) {
final int previousUserId = res.mRemovedInfo.mUninstallReasons.keyAt(i);
final int previousReason = res.mRemovedInfo.mUninstallReasons.valueAt(i);
ps.setUninstallReason(previousReason, previousUserId);
}
}
// Set install reason for users that are having the package newly installed.
final int[] allUsersList = mPm.mUserManager.getUserIds();
if (userId == UserHandle.USER_ALL) {
for (int currentUserId : allUsersList) {
if (!previousUserIds.contains(currentUserId)
&& ps.getInstalled(currentUserId)) {
ps.setInstallReason(installReason, currentUserId);
}
}
} else if (!previousUserIds.contains(userId)) {
ps.setInstallReason(installReason, userId);
}
// TODO(b/169721400): generalize Incremental States and create a Callback object
// that can be used for all the packages.
final String codePath = ps.getPathString();
if (IncrementalManager.isIncrementalPath(codePath)
&& mIncrementalManager != null) {
mIncrementalManager.registerLoadingProgressCallback(codePath,
new IncrementalProgressListener(ps.getPackageName(), mPm));
}
// Ensure that the uninstall reason is UNKNOWN for users with the package installed.
for (int currentUserId : allUsersList) {
if (ps.getInstalled(currentUserId)) {
ps.setUninstallReason(UNINSTALL_REASON_UNKNOWN, currentUserId);
}
}
mPm.mSettings.writeKernelMappingLPr(ps);
final PermissionManagerServiceInternal.PackageInstalledParams.Builder
permissionParamsBuilder =
new PermissionManagerServiceInternal.PackageInstalledParams.Builder();
final boolean grantPermissions = (installArgs.mInstallFlags
& PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS) != 0;
if (grantPermissions) {
final List<String> grantedPermissions =
installArgs.mInstallGrantPermissions != null
? Arrays.asList(installArgs.mInstallGrantPermissions)
: pkg.getRequestedPermissions();
permissionParamsBuilder.setGrantedPermissions(grantedPermissions);
}
final boolean allowlistAllRestrictedPermissions =
(installArgs.mInstallFlags
& PackageManager.INSTALL_ALL_WHITELIST_RESTRICTED_PERMISSIONS) != 0;
final List<String> allowlistedRestrictedPermissions =
allowlistAllRestrictedPermissions ? pkg.getRequestedPermissions()
: installArgs.mAllowlistedRestrictedPermissions;
if (allowlistedRestrictedPermissions != null) {
permissionParamsBuilder.setAllowlistedRestrictedPermissions(
allowlistedRestrictedPermissions);
}
final int autoRevokePermissionsMode = installArgs.mAutoRevokePermissionsMode;
permissionParamsBuilder.setAutoRevokePermissionsMode(autoRevokePermissionsMode);
final ScanResult scanResult = reconciledPkg.mScanResult;
mPm.mPermissionManager.onPackageInstalled(pkg, scanResult.mPreviousAppId,
permissionParamsBuilder.build(), userId);
// Apply restricted settings on potentially dangerous packages.
if (installArgs.mPackageSource == PackageInstaller.PACKAGE_SOURCE_LOCAL_FILE
|| installArgs.mPackageSource
== PackageInstaller.PACKAGE_SOURCE_DOWNLOADED_FILE) {
enableRestrictedSettings(pkgName, pkg.getUid());
}
}
res.mName = pkgName;
res.mUid = pkg.getUid();
res.mPkg = pkg;
res.setReturnCode(PackageManager.INSTALL_SUCCEEDED);
//to update install status
Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "writeSettings");
mPm.writeSettingsLPrTEMP();
Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
}
Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
}
|
[
"CWE-862"
] |
CVE-2023-21257
|
HIGH
| 7.8
|
android
|
updateSettingsInternalLI
|
services/core/java/com/android/server/pm/InstallPackageHelper.java
|
1aec7feaf07e6d4568ca75d18158445dbeac10f6
| 1
|
Analyze the following code function for security vulnerabilities
|
public void setSchema(boolean schema) {
this.schema = schema;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setSchema
File: org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/settings/XMLValidationSettings.java
Repository: eclipse/lemminx
The code follows secure coding practices.
|
[
"CWE-611"
] |
CVE-2019-18213
|
MEDIUM
| 6.5
|
eclipse/lemminx
|
setSchema
|
org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/settings/XMLValidationSettings.java
|
c8bf3245a72cace50ee2aae5eee69538c58ce056
| 0
|
Analyze the following code function for security vulnerabilities
|
public int getAction() {
return m_action;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getAction
File: src/org/opencms/workplace/CmsDialog.java
Repository: alkacon/opencms-core
The code follows secure coding practices.
|
[
"CWE-79"
] |
CVE-2013-4600
|
MEDIUM
| 4.3
|
alkacon/opencms-core
|
getAction
|
src/org/opencms/workplace/CmsDialog.java
|
72a05e3ea1cf692e2efce002687272e63f98c14a
| 0
|
Analyze the following code function for security vulnerabilities
|
@NonNull
private AndroidFuture<AppSearchSession> fromAppSearch() {
final StrictMode.ThreadPolicy oldPolicy = StrictMode.getThreadPolicy();
final AppSearchManager.SearchContext searchContext =
new AppSearchManager.SearchContext.Builder(getPackageName()).build();
AndroidFuture<AppSearchSession> future = null;
try {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog() // TODO: change this to penaltyDeath to fix the call-site
.build());
future = mShortcutUser.getAppSearch(searchContext);
synchronized (mLock) {
if (!mIsAppSearchSchemaUpToDate) {
future = future.thenCompose(this::setupSchema);
}
mIsAppSearchSchemaUpToDate = true;
}
} catch (Exception e) {
Slog.e(TAG, "Failed to create app search session. pkg="
+ getPackageName() + " user=" + mShortcutUser.getUserId(), e);
Objects.requireNonNull(future).completeExceptionally(e);
} finally {
StrictMode.setThreadPolicy(oldPolicy);
}
return Objects.requireNonNull(future);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: fromAppSearch
File: services/core/java/com/android/server/pm/ShortcutPackage.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2023-40075
|
MEDIUM
| 5.5
|
android
|
fromAppSearch
|
services/core/java/com/android/server/pm/ShortcutPackage.java
|
ae768fbb9975fdab267f525831cb52f485ab0ecc
| 0
|
Analyze the following code function for security vulnerabilities
|
private void closeQuietly() {
try {
stream_.close();
}
catch (IOException e) {
// ignore
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: closeQuietly
File: src/org/cyberneko/html/HTMLScanner.java
Repository: sparklemotion/nekohtml
The code follows secure coding practices.
|
[
"CWE-400"
] |
CVE-2022-24839
|
MEDIUM
| 5
|
sparklemotion/nekohtml
|
closeQuietly
|
src/org/cyberneko/html/HTMLScanner.java
|
a800fce3b079def130ed42a408ff1d09f89e773d
| 0
|
Analyze the following code function for security vulnerabilities
|
private void readPermissionsFromXml(File permFile, boolean onlyFeatures) {
FileReader permReader = null;
try {
permReader = new FileReader(permFile);
} catch (FileNotFoundException e) {
Slog.w(TAG, "Couldn't find or open permissions file " + permFile);
return;
}
final boolean lowRam = ActivityManager.isLowRamDeviceStatic();
try {
XmlPullParser parser = Xml.newPullParser();
parser.setInput(permReader);
int type;
while ((type=parser.next()) != parser.START_TAG
&& type != parser.END_DOCUMENT) {
;
}
if (type != parser.START_TAG) {
throw new XmlPullParserException("No start tag found");
}
if (!parser.getName().equals("permissions") && !parser.getName().equals("config")) {
throw new XmlPullParserException("Unexpected start tag in " + permFile
+ ": found " + parser.getName() + ", expected 'permissions' or 'config'");
}
while (true) {
XmlUtils.nextElement(parser);
if (parser.getEventType() == XmlPullParser.END_DOCUMENT) {
break;
}
String name = parser.getName();
if ("group".equals(name) && !onlyFeatures) {
String gidStr = parser.getAttributeValue(null, "gid");
if (gidStr != null) {
int gid = android.os.Process.getGidForName(gidStr);
mGlobalGids = appendInt(mGlobalGids, gid);
} else {
Slog.w(TAG, "<group> without gid in " + permFile + " at "
+ parser.getPositionDescription());
}
XmlUtils.skipCurrentTag(parser);
continue;
} else if ("permission".equals(name) && !onlyFeatures) {
String perm = parser.getAttributeValue(null, "name");
if (perm == null) {
Slog.w(TAG, "<permission> without name in " + permFile + " at "
+ parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
perm = perm.intern();
readPermission(parser, perm);
} else if ("assign-permission".equals(name) && !onlyFeatures) {
String perm = parser.getAttributeValue(null, "name");
if (perm == null) {
Slog.w(TAG, "<assign-permission> without name in " + permFile + " at "
+ parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
String uidStr = parser.getAttributeValue(null, "uid");
if (uidStr == null) {
Slog.w(TAG, "<assign-permission> without uid in " + permFile + " at "
+ parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
int uid = Process.getUidForName(uidStr);
if (uid < 0) {
Slog.w(TAG, "<assign-permission> with unknown uid \""
+ uidStr + " in " + permFile + " at "
+ parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
perm = perm.intern();
ArraySet<String> perms = mSystemPermissions.get(uid);
if (perms == null) {
perms = new ArraySet<String>();
mSystemPermissions.put(uid, perms);
}
perms.add(perm);
XmlUtils.skipCurrentTag(parser);
} else if ("library".equals(name) && !onlyFeatures) {
String lname = parser.getAttributeValue(null, "name");
String lfile = parser.getAttributeValue(null, "file");
if (lname == null) {
Slog.w(TAG, "<library> without name in " + permFile + " at "
+ parser.getPositionDescription());
} else if (lfile == null) {
Slog.w(TAG, "<library> without file in " + permFile + " at "
+ parser.getPositionDescription());
} else {
//Log.i(TAG, "Got library " + lname + " in " + lfile);
mSharedLibraries.put(lname, lfile);
}
XmlUtils.skipCurrentTag(parser);
continue;
} else if ("feature".equals(name)) {
String fname = parser.getAttributeValue(null, "name");
boolean allowed;
if (!lowRam) {
allowed = true;
} else {
String notLowRam = parser.getAttributeValue(null, "notLowRam");
allowed = !"true".equals(notLowRam);
}
if (fname == null) {
Slog.w(TAG, "<feature> without name in " + permFile + " at "
+ parser.getPositionDescription());
} else if (allowed) {
//Log.i(TAG, "Got feature " + fname);
FeatureInfo fi = new FeatureInfo();
fi.name = fname;
mAvailableFeatures.put(fname, fi);
}
XmlUtils.skipCurrentTag(parser);
continue;
} else if ("unavailable-feature".equals(name)) {
String fname = parser.getAttributeValue(null, "name");
if (fname == null) {
Slog.w(TAG, "<unavailable-feature> without name in " + permFile + " at "
+ parser.getPositionDescription());
} else {
mUnavailableFeatures.add(fname);
}
XmlUtils.skipCurrentTag(parser);
continue;
} else if ("allow-in-power-save-except-idle".equals(name) && !onlyFeatures) {
String pkgname = parser.getAttributeValue(null, "package");
if (pkgname == null) {
Slog.w(TAG, "<allow-in-power-save-except-idle> without package in "
+ permFile + " at " + parser.getPositionDescription());
} else {
mAllowInPowerSaveExceptIdle.add(pkgname);
}
XmlUtils.skipCurrentTag(parser);
continue;
} else if ("allow-in-power-save".equals(name) && !onlyFeatures) {
String pkgname = parser.getAttributeValue(null, "package");
if (pkgname == null) {
Slog.w(TAG, "<allow-in-power-save> without package in " + permFile + " at "
+ parser.getPositionDescription());
} else {
mAllowInPowerSave.add(pkgname);
}
XmlUtils.skipCurrentTag(parser);
continue;
} else if ("fixed-ime-app".equals(name) && !onlyFeatures) {
String pkgname = parser.getAttributeValue(null, "package");
if (pkgname == null) {
Slog.w(TAG, "<fixed-ime-app> without package in " + permFile + " at "
+ parser.getPositionDescription());
} else {
mFixedImeApps.add(pkgname);
}
XmlUtils.skipCurrentTag(parser);
continue;
} else if ("app-link".equals(name)) {
String pkgname = parser.getAttributeValue(null, "package");
if (pkgname == null) {
Slog.w(TAG, "<app-link> without package in " + permFile + " at "
+ parser.getPositionDescription());
} else {
mLinkedApps.add(pkgname);
}
XmlUtils.skipCurrentTag(parser);
} else {
XmlUtils.skipCurrentTag(parser);
continue;
}
}
} catch (XmlPullParserException e) {
Slog.w(TAG, "Got exception parsing permissions.", e);
} catch (IOException e) {
Slog.w(TAG, "Got exception parsing permissions.", e);
} finally {
IoUtils.closeQuietly(permReader);
}
for (String fname : mUnavailableFeatures) {
if (mAvailableFeatures.remove(fname) != null) {
Slog.d(TAG, "Removed unavailable feature " + fname);
}
}
}
|
Vulnerability Classification:
- CWE: CWE-200
- CVE: CVE-2016-3759
- Severity: MEDIUM
- CVSS Score: 5.0
Description: Backport of backup transport whitelist
Sysconfig define a whitelist of permitted backup transports
Previously any apk bundled in priv-app could insert a backup transport.
Reduce risk surface by giving the OEM explicit control over who is
allowed to handle backup data.
Bug 28406080
Backport of 494df791728f4d42d67e935c327910975993ad29 from N
Change-Id: I9f90e324169a68720d608f74754d284a7e59cf87
Function: readPermissionsFromXml
File: services/core/java/com/android/server/SystemConfig.java
Repository: android
Fixed Code:
private void readPermissionsFromXml(File permFile, boolean onlyFeatures) {
FileReader permReader = null;
try {
permReader = new FileReader(permFile);
} catch (FileNotFoundException e) {
Slog.w(TAG, "Couldn't find or open permissions file " + permFile);
return;
}
final boolean lowRam = ActivityManager.isLowRamDeviceStatic();
try {
XmlPullParser parser = Xml.newPullParser();
parser.setInput(permReader);
int type;
while ((type=parser.next()) != parser.START_TAG
&& type != parser.END_DOCUMENT) {
;
}
if (type != parser.START_TAG) {
throw new XmlPullParserException("No start tag found");
}
if (!parser.getName().equals("permissions") && !parser.getName().equals("config")) {
throw new XmlPullParserException("Unexpected start tag in " + permFile
+ ": found " + parser.getName() + ", expected 'permissions' or 'config'");
}
while (true) {
XmlUtils.nextElement(parser);
if (parser.getEventType() == XmlPullParser.END_DOCUMENT) {
break;
}
String name = parser.getName();
if ("group".equals(name) && !onlyFeatures) {
String gidStr = parser.getAttributeValue(null, "gid");
if (gidStr != null) {
int gid = android.os.Process.getGidForName(gidStr);
mGlobalGids = appendInt(mGlobalGids, gid);
} else {
Slog.w(TAG, "<group> without gid in " + permFile + " at "
+ parser.getPositionDescription());
}
XmlUtils.skipCurrentTag(parser);
continue;
} else if ("permission".equals(name) && !onlyFeatures) {
String perm = parser.getAttributeValue(null, "name");
if (perm == null) {
Slog.w(TAG, "<permission> without name in " + permFile + " at "
+ parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
perm = perm.intern();
readPermission(parser, perm);
} else if ("assign-permission".equals(name) && !onlyFeatures) {
String perm = parser.getAttributeValue(null, "name");
if (perm == null) {
Slog.w(TAG, "<assign-permission> without name in " + permFile + " at "
+ parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
String uidStr = parser.getAttributeValue(null, "uid");
if (uidStr == null) {
Slog.w(TAG, "<assign-permission> without uid in " + permFile + " at "
+ parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
int uid = Process.getUidForName(uidStr);
if (uid < 0) {
Slog.w(TAG, "<assign-permission> with unknown uid \""
+ uidStr + " in " + permFile + " at "
+ parser.getPositionDescription());
XmlUtils.skipCurrentTag(parser);
continue;
}
perm = perm.intern();
ArraySet<String> perms = mSystemPermissions.get(uid);
if (perms == null) {
perms = new ArraySet<String>();
mSystemPermissions.put(uid, perms);
}
perms.add(perm);
XmlUtils.skipCurrentTag(parser);
} else if ("library".equals(name) && !onlyFeatures) {
String lname = parser.getAttributeValue(null, "name");
String lfile = parser.getAttributeValue(null, "file");
if (lname == null) {
Slog.w(TAG, "<library> without name in " + permFile + " at "
+ parser.getPositionDescription());
} else if (lfile == null) {
Slog.w(TAG, "<library> without file in " + permFile + " at "
+ parser.getPositionDescription());
} else {
//Log.i(TAG, "Got library " + lname + " in " + lfile);
mSharedLibraries.put(lname, lfile);
}
XmlUtils.skipCurrentTag(parser);
continue;
} else if ("feature".equals(name)) {
String fname = parser.getAttributeValue(null, "name");
boolean allowed;
if (!lowRam) {
allowed = true;
} else {
String notLowRam = parser.getAttributeValue(null, "notLowRam");
allowed = !"true".equals(notLowRam);
}
if (fname == null) {
Slog.w(TAG, "<feature> without name in " + permFile + " at "
+ parser.getPositionDescription());
} else if (allowed) {
//Log.i(TAG, "Got feature " + fname);
FeatureInfo fi = new FeatureInfo();
fi.name = fname;
mAvailableFeatures.put(fname, fi);
}
XmlUtils.skipCurrentTag(parser);
continue;
} else if ("unavailable-feature".equals(name)) {
String fname = parser.getAttributeValue(null, "name");
if (fname == null) {
Slog.w(TAG, "<unavailable-feature> without name in " + permFile + " at "
+ parser.getPositionDescription());
} else {
mUnavailableFeatures.add(fname);
}
XmlUtils.skipCurrentTag(parser);
continue;
} else if ("allow-in-power-save-except-idle".equals(name) && !onlyFeatures) {
String pkgname = parser.getAttributeValue(null, "package");
if (pkgname == null) {
Slog.w(TAG, "<allow-in-power-save-except-idle> without package in "
+ permFile + " at " + parser.getPositionDescription());
} else {
mAllowInPowerSaveExceptIdle.add(pkgname);
}
XmlUtils.skipCurrentTag(parser);
continue;
} else if ("allow-in-power-save".equals(name) && !onlyFeatures) {
String pkgname = parser.getAttributeValue(null, "package");
if (pkgname == null) {
Slog.w(TAG, "<allow-in-power-save> without package in " + permFile + " at "
+ parser.getPositionDescription());
} else {
mAllowInPowerSave.add(pkgname);
}
XmlUtils.skipCurrentTag(parser);
continue;
} else if ("fixed-ime-app".equals(name) && !onlyFeatures) {
String pkgname = parser.getAttributeValue(null, "package");
if (pkgname == null) {
Slog.w(TAG, "<fixed-ime-app> without package in " + permFile + " at "
+ parser.getPositionDescription());
} else {
mFixedImeApps.add(pkgname);
}
XmlUtils.skipCurrentTag(parser);
continue;
} else if ("app-link".equals(name)) {
String pkgname = parser.getAttributeValue(null, "package");
if (pkgname == null) {
Slog.w(TAG, "<app-link> without package in " + permFile + " at "
+ parser.getPositionDescription());
} else {
mLinkedApps.add(pkgname);
}
XmlUtils.skipCurrentTag(parser);
} else if ("backup-transport-whitelisted-service".equals(name)) {
String serviceName = parser.getAttributeValue(null, "service");
if (serviceName == null) {
Slog.w(TAG, "<backup-transport-whitelisted-service> without service in "
+ permFile + " at " + parser.getPositionDescription());
} else {
ComponentName cn = ComponentName.unflattenFromString(serviceName);
if (cn == null) {
Slog.w(TAG,
"<backup-transport-whitelisted-service> with invalid service name "
+ serviceName + " in "+ permFile
+ " at " + parser.getPositionDescription());
} else {
mBackupTransportWhitelist.add(cn);
}
}
XmlUtils.skipCurrentTag(parser);
} else {
XmlUtils.skipCurrentTag(parser);
continue;
}
}
} catch (XmlPullParserException e) {
Slog.w(TAG, "Got exception parsing permissions.", e);
} catch (IOException e) {
Slog.w(TAG, "Got exception parsing permissions.", e);
} finally {
IoUtils.closeQuietly(permReader);
}
for (String fname : mUnavailableFeatures) {
if (mAvailableFeatures.remove(fname) != null) {
Slog.d(TAG, "Removed unavailable feature " + fname);
}
}
}
|
[
"CWE-200"
] |
CVE-2016-3759
|
MEDIUM
| 5
|
android
|
readPermissionsFromXml
|
services/core/java/com/android/server/SystemConfig.java
|
9b8c6d2df35455ce9e67907edded1e4a2ecb9e28
| 1
|
Analyze the following code function for security vulnerabilities
|
protected abstract T build(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder,
Http2Settings initialSettings) throws Exception;
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: build
File: codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2ConnectionHandlerBuilder.java
Repository: netty
The code follows secure coding practices.
|
[
"CWE-400"
] |
CVE-2023-44487
|
HIGH
| 7.5
|
netty
|
build
|
codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2ConnectionHandlerBuilder.java
|
58f75f665aa81a8cbcf6ffa74820042a285c5e61
| 0
|
Analyze the following code function for security vulnerabilities
|
@RequiresPermissions("tag:delete")
@GetMapping("/delete")
@ResponseBody
public Result delete(Integer id) {
Tag tag = tagService.selectById(id);
if (tag.getTopicCount() > 0) return error("标签还关联着话题,要先把相关联的话题都删了,这个标签才能删除");
tagService.delete(id);
return success();
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: delete
File: src/main/java/co/yiiu/pybbs/controller/admin/TagAdminController.java
Repository: atjiu/pybbs
The code follows secure coding practices.
|
[
"CWE-79"
] |
CVE-2022-23391
|
MEDIUM
| 4.3
|
atjiu/pybbs
|
delete
|
src/main/java/co/yiiu/pybbs/controller/admin/TagAdminController.java
|
7d83b97d19f5fed9f29f72e654ef3c2818021b4d
| 0
|
Analyze the following code function for security vulnerabilities
|
private void checkEngineClosed() throws SSLException {
if (engineClosed || isDestroyed()) {
throw ENGINE_CLOSED;
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: checkEngineClosed
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
|
checkEngineClosed
|
handler/src/main/java/io/netty/handler/ssl/OpenSslEngine.java
|
bc8291c80912a39fbd2303e18476d15751af0bf1
| 0
|
Analyze the following code function for security vulnerabilities
|
public HeaderRow prependHeaderRow() {
return addHeaderRowAt(0);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: prependHeaderRow
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
|
prependHeaderRow
|
server/src/main/java/com/vaadin/ui/Grid.java
|
c40bed109c3723b38694ed160ea647fef5b28593
| 0
|
Analyze the following code function for security vulnerabilities
|
private RpkiRepository registerRepository(Tx.Write tx,
TrustAnchor trustAnchor,
Map<URI, RpkiRepository> registeredRepositories,
CertificateRepositoryObjectValidationContext context) {
if (!validationConfig.isRsyncOnly() && context.getRpkiNotifyURI() != null) {
return registeredRepositories.computeIfAbsent(
context.getRpkiNotifyURI(),
uri -> {
final Ref<TrustAnchor> trustAnchorRef = trustAnchors.makeRef(tx, trustAnchor.key());
RpkiRepository r = rpkiRepositories.register(tx, trustAnchorRef, uri.toASCIIString(), RRDP);
tx.afterCommit(() -> validationScheduler.addRrdpRpkiRepository(r));
return r;
});
}
return registeredRepositories.computeIfAbsent(
context.getRepositoryURI(),
uri -> {
final Ref<TrustAnchor> trustAnchorRef = trustAnchors.makeRef(tx, trustAnchor.key());
return rpkiRepositories.register(tx, trustAnchorRef, uri.toASCIIString(), RSYNC);
});
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: registerRepository
File: rpki-validator/src/main/java/net/ripe/rpki/validator3/domain/validation/CertificateTreeValidationService.java
Repository: RIPE-NCC/rpki-validator-3
The code follows secure coding practices.
|
[
"CWE-295"
] |
CVE-2020-16162
|
MEDIUM
| 5
|
RIPE-NCC/rpki-validator-3
|
registerRepository
|
rpki-validator/src/main/java/net/ripe/rpki/validator3/domain/validation/CertificateTreeValidationService.java
|
3cbf34fed7c0ca00574644a5b5b06f1b54a3f5dc
| 0
|
Analyze the following code function for security vulnerabilities
|
public JNLPFile getJNLPFile() {
return file;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getJNLPFile
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
|
getJNLPFile
|
core/src/main/java/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
|
e0818f521a0711aeec4b913b49b5fc6a52815662
| 0
|
Analyze the following code function for security vulnerabilities
|
private void performCorsPreflightCheck(HttpExchange pExchange) {
Headers requestHeaders = pExchange.getRequestHeaders();
Map<String,String> respHeaders =
requestHandler.handleCorsPreflightRequest(requestHeaders.getFirst("Origin"),
requestHeaders.getFirst("Access-Control-Request-Headers"));
Headers responseHeaders = pExchange.getResponseHeaders();
for (Map.Entry<String,String> entry : respHeaders.entrySet()) {
responseHeaders.set(entry.getKey(), entry.getValue());
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: performCorsPreflightCheck
File: agent/jvm/src/main/java/org/jolokia/jvmagent/handler/JolokiaHttpHandler.java
Repository: jolokia
The code follows secure coding practices.
|
[
"CWE-79"
] |
CVE-2018-1000129
|
MEDIUM
| 4.3
|
jolokia
|
performCorsPreflightCheck
|
agent/jvm/src/main/java/org/jolokia/jvmagent/handler/JolokiaHttpHandler.java
|
5895d5c137c335e6b473e9dcb9baf748851bbc5f
| 0
|
Analyze the following code function for security vulnerabilities
|
private void putNetworkOnHold() {
// Disable network selection upon receiving the server certificate
mWifiConfigManager.updateNetworkSelectionStatus(mCurrentTofuConfig.networkId,
WifiConfiguration.NetworkSelectionStatus
.DISABLED_BY_WIFI_MANAGER);
// Force disconnect and clear PMK cache to avoid supplicant reconnection
mWifiNative.disconnect(mInterfaceName);
clearNativeData();
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: putNetworkOnHold
File: service/java/com/android/server/wifi/InsecureEapNetworkHandler.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2023-21242
|
CRITICAL
| 9.8
|
android
|
putNetworkOnHold
|
service/java/com/android/server/wifi/InsecureEapNetworkHandler.java
|
72e903f258b5040b8f492cf18edd124b5a1ac770
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public final void activityResumed(IBinder token) {
final long origId = Binder.clearCallingIdentity();
synchronized(this) {
ActivityRecord.activityResumedLocked(token);
mWindowManager.notifyAppResumedFinished(token);
}
Binder.restoreCallingIdentity(origId);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: activityResumed
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
|
activityResumed
|
services/core/java/com/android/server/am/ActivityManagerService.java
|
962fb40991f15be4f688d960aa00073683ebdd20
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public void initialize( final BeanContext context )
{
this.securityService = context.getService( SecurityService.class );
this.context = context.getBinding( Context.class );
this.portalRequestSupplier = context.getBinding( PortalRequest.class );
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: initialize
File: modules/lib/lib-auth/src/main/java/com/enonic/xp/lib/auth/LoginHandler.java
Repository: enonic/xp
The code follows secure coding practices.
|
[
"CWE-384"
] |
CVE-2024-23679
|
CRITICAL
| 9.8
|
enonic/xp
|
initialize
|
modules/lib/lib-auth/src/main/java/com/enonic/xp/lib/auth/LoginHandler.java
|
0189975691e9e6407a9fee87006f730e84f734ff
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public String getPeerHost() {
return OpenSslEngine.this.getPeerHost();
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getPeerHost
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
|
getPeerHost
|
handler/src/main/java/io/netty/handler/ssl/OpenSslEngine.java
|
bc8291c80912a39fbd2303e18476d15751af0bf1
| 0
|
Analyze the following code function for security vulnerabilities
|
public static ServerXml load(String filename) throws Exception {
logger.info("ServerXml: Parsing " + filename);
ServerXml serverXml = new ServerXml();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(filename);
XPathFactory xpathFactory = XPathFactory.newInstance();
XPath xpath = xpathFactory.newXPath();
NodeList connectors = (NodeList) xpath.evaluate(
"/Server/Service[@name='Catalina']/Connector",
document,
XPathConstants.NODESET);
int length = connectors.getLength();
for (int i = 0; i < length; i++) {
Element connector = (Element) connectors.item(i);
String protocol = connector.getAttribute("protocol");
if (protocol.startsWith("AJP/")) {
continue;
}
// HTTP/1.1 connector
String scheme = connector.getAttribute("scheme");
String port = connector.getAttribute("port");
if (scheme != null && scheme.equals("https")) {
logger.info("ServerXml: Secure port: " + port);
serverXml.setSecurePort(port);
} else {
logger.info("ServerXml: Unsecure port: " + port);
serverXml.setUnsecurePort(port);
}
}
return serverXml;
}
|
Vulnerability Classification:
- CWE: CWE-611
- CVE: CVE-2022-2414
- Severity: HIGH
- CVSS Score: 7.5
Description: Disable access to external entities when parsing XML
This reduces the vulnerability of XML parsers to XXE (XML external
entity) injection.
The best way to prevent XXE is to stop using XML altogether, which we do
plan to do. Until that happens I consider it worthwhile to tighten the
security here though.
Function: load
File: base/server/src/main/java/com/netscape/cmscore/apps/ServerXml.java
Repository: dogtagpki/pki
Fixed Code:
public static ServerXml load(String filename) throws Exception {
logger.info("ServerXml: Parsing " + filename);
ServerXml serverXml = new ServerXml();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(filename);
XPathFactory xpathFactory = XPathFactory.newInstance();
XPath xpath = xpathFactory.newXPath();
NodeList connectors = (NodeList) xpath.evaluate(
"/Server/Service[@name='Catalina']/Connector",
document,
XPathConstants.NODESET);
int length = connectors.getLength();
for (int i = 0; i < length; i++) {
Element connector = (Element) connectors.item(i);
String protocol = connector.getAttribute("protocol");
if (protocol.startsWith("AJP/")) {
continue;
}
// HTTP/1.1 connector
String scheme = connector.getAttribute("scheme");
String port = connector.getAttribute("port");
if (scheme != null && scheme.equals("https")) {
logger.info("ServerXml: Secure port: " + port);
serverXml.setSecurePort(port);
} else {
logger.info("ServerXml: Unsecure port: " + port);
serverXml.setUnsecurePort(port);
}
}
return serverXml;
}
|
[
"CWE-611"
] |
CVE-2022-2414
|
HIGH
| 7.5
|
dogtagpki/pki
|
load
|
base/server/src/main/java/com/netscape/cmscore/apps/ServerXml.java
|
16deffdf7548e305507982e246eb9fd1eac414fd
| 1
|
Analyze the following code function for security vulnerabilities
|
private void migrateLegacySettingsForUserIfNeededLocked(int userId) {
// Every user has secure settings and if no file we need to migrate.
final int secureKey = makeKey(SETTINGS_TYPE_SECURE, userId);
File secureFile = getSettingsFile(secureKey);
if (secureFile.exists()) {
return;
}
DatabaseHelper dbHelper = new DatabaseHelper(getContext(), userId);
SQLiteDatabase database = dbHelper.getWritableDatabase();
migrateLegacySettingsForUserLocked(dbHelper, database, userId);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: migrateLegacySettingsForUserIfNeededLocked
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
|
migrateLegacySettingsForUserIfNeededLocked
|
packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
|
91fc934bb2e5ea59929bb2f574de6db9b5100745
| 0
|
Analyze the following code function for security vulnerabilities
|
@RequestMapping(value = "/register", method = RequestMethod.GET)
public String register(HttpServletRequest request, Model model)
{
// Get the session, creating it if necessary, to make sure that the session
// cookie gets set on the browser. If the user goes to the "register" page
// and doesn't have a session cookie, CSRF validation will fail because the
// token that is posted in the registration form cannot be correlated with
// the token in the session.
request.getSession(true);
// insert password requirements to use in the register view
model.addAttribute("passwordRequirements", getPasswordRequirements(null));
return "register";
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: register
File: src/main/java/com/unboundid/webapp/ssam/SSAMController.java
Repository: pingidentity/ssam
The code follows secure coding practices.
|
[
"CWE-79"
] |
CVE-2018-25084
|
MEDIUM
| 4
|
pingidentity/ssam
|
register
|
src/main/java/com/unboundid/webapp/ssam/SSAMController.java
|
f64b10d63bb19ca2228b0c2d561a1a6e5a3bf251
| 0
|
Analyze the following code function for security vulnerabilities
|
private GameParseException newGameParseException(final String message) {
return newGameParseException(message, null);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: newGameParseException
File: game-core/src/main/java/games/strategy/engine/data/GameParser.java
Repository: triplea-game/triplea
The code follows secure coding practices.
|
[
"CWE-611"
] |
CVE-2018-1000546
|
MEDIUM
| 6.8
|
triplea-game/triplea
|
newGameParseException
|
game-core/src/main/java/games/strategy/engine/data/GameParser.java
|
0f23875a4c6e166218859a63c884995f15c53895
| 0
|
Analyze the following code function for security vulnerabilities
|
protected static PdfDictionary duplicatePdfDictionary(PdfDictionary original, PdfDictionary copy, PdfReader newReader) {
if (copy == null)
copy = new PdfDictionary();
for (Iterator it = original.getKeys().iterator(); it.hasNext();) {
PdfName key = (PdfName)it.next();
copy.put(key, duplicatePdfObject(original.get(key), newReader));
}
return copy;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: duplicatePdfDictionary
File: java/com/gitlab/pdftk_java/com/lowagie/text/pdf/PdfReader.java
Repository: pdftk-java/pdftk
The code follows secure coding practices.
|
[
"CWE-835"
] |
CVE-2021-37819
|
HIGH
| 7.5
|
pdftk-java/pdftk
|
duplicatePdfDictionary
|
java/com/gitlab/pdftk_java/com/lowagie/text/pdf/PdfReader.java
|
9b0cbb76c8434a8505f02ada02a94263dcae9247
| 0
|
Analyze the following code function for security vulnerabilities
|
public ArrayList<String> get(int userId, String packageName) {
ArrayMap<String, ArrayList<String>> packages = getOrAllocate(userId);
return packages.get(packageName);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: get
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
|
get
|
services/core/java/com/android/server/pm/PackageManagerService.java
|
a75537b496e9df71c74c1d045ba5569631a16298
| 0
|
Analyze the following code function for security vulnerabilities
|
private void notifyFailsInFavourites() {
if (mFailedResultsCounter > 0) {
NotificationCompat.Builder notificationBuilder = createNotificationBuilder();
notificationBuilder.setTicker(i18n(R.string.sync_fail_in_favourites_ticker));
// TODO put something smart in the contentIntent below
notificationBuilder
.setContentIntent(PendingIntent.getActivity(
getContext(), (int) System.currentTimeMillis(), new Intent(), 0
))
.setContentTitle(i18n(R.string.sync_fail_in_favourites_ticker))
.setContentText(getQuantityString(
R.plurals.sync_fail_in_favourites_content,
mFailedResultsCounter,
mFailedResultsCounter + mConflictsFound, mConflictsFound
)
);
showNotification(R.string.sync_fail_in_favourites_ticker, notificationBuilder);
} else {
NotificationCompat.Builder notificationBuilder = createNotificationBuilder();
notificationBuilder.setTicker(i18n(R.string.sync_conflicts_in_favourites_ticker));
// TODO put something smart in the contentIntent below
notificationBuilder
.setContentIntent(PendingIntent.getActivity(
getContext(), (int) System.currentTimeMillis(), new Intent(), 0
))
.setContentTitle(i18n(R.string.sync_conflicts_in_favourites_ticker))
.setContentText(i18n(R.string.sync_conflicts_in_favourites_ticker, mConflictsFound));
showNotification(R.string.sync_conflicts_in_favourites_ticker, notificationBuilder);
}
}
|
Vulnerability Classification:
- CWE: CWE-732
- CVE: CVE-2022-24886
- Severity: LOW
- CVSS Score: 2.1
Description: Make PendingIntents immutable
Good practice for security
Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
Function: notifyFailsInFavourites
File: src/main/java/com/owncloud/android/syncadapter/FileSyncAdapter.java
Repository: nextcloud/android
Fixed Code:
private void notifyFailsInFavourites() {
if (mFailedResultsCounter > 0) {
NotificationCompat.Builder notificationBuilder = createNotificationBuilder();
notificationBuilder.setTicker(i18n(R.string.sync_fail_in_favourites_ticker));
// TODO put something smart in the contentIntent below
notificationBuilder
.setContentIntent(PendingIntent.getActivity(
getContext(), (int) System.currentTimeMillis(), new Intent(), PendingIntent.FLAG_IMMUTABLE
))
.setContentTitle(i18n(R.string.sync_fail_in_favourites_ticker))
.setContentText(getQuantityString(
R.plurals.sync_fail_in_favourites_content,
mFailedResultsCounter,
mFailedResultsCounter + mConflictsFound, mConflictsFound
)
);
showNotification(R.string.sync_fail_in_favourites_ticker, notificationBuilder);
} else {
NotificationCompat.Builder notificationBuilder = createNotificationBuilder();
notificationBuilder.setTicker(i18n(R.string.sync_conflicts_in_favourites_ticker));
// TODO put something smart in the contentIntent below
notificationBuilder
.setContentIntent(PendingIntent.getActivity(
getContext(), (int) System.currentTimeMillis(), new Intent(), PendingIntent.FLAG_IMMUTABLE
))
.setContentTitle(i18n(R.string.sync_conflicts_in_favourites_ticker))
.setContentText(i18n(R.string.sync_conflicts_in_favourites_ticker, mConflictsFound));
showNotification(R.string.sync_conflicts_in_favourites_ticker, notificationBuilder);
}
}
|
[
"CWE-732"
] |
CVE-2022-24886
|
LOW
| 2.1
|
nextcloud/android
|
notifyFailsInFavourites
|
src/main/java/com/owncloud/android/syncadapter/FileSyncAdapter.java
|
27559efb79d45782e000b762860658d49e9c35e9
| 1
|
Analyze the following code function for security vulnerabilities
|
@Programming
public byte[] getURLContentAsBytes(String surl, String username, String password) throws IOException
{
if (!hasProgrammingRights()) {
return null;
}
try {
return this.xwiki.getURLContentAsBytes(surl, username, password, this.context);
} catch (Exception e) {
return null;
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getURLContentAsBytes
File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/XWiki.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices.
|
[
"CWE-668"
] |
CVE-2023-37911
|
MEDIUM
| 6.5
|
xwiki/xwiki-platform
|
getURLContentAsBytes
|
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/api/XWiki.java
|
f471f2a392aeeb9e51d59fdfe1d76fccf532523f
| 0
|
Analyze the following code function for security vulnerabilities
|
boolean supportsPictureInPicture() {
return mAtmService.mSupportsPictureInPicture && isActivityTypeStandardOrUndefined()
&& info.supportsPictureInPicture();
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: supportsPictureInPicture
File: services/core/java/com/android/server/wm/ActivityRecord.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2023-21145
|
HIGH
| 7.8
|
android
|
supportsPictureInPicture
|
services/core/java/com/android/server/wm/ActivityRecord.java
|
44aeef1b82ecf21187d4903c9e3666a118bdeaf3
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public ServerBuilder decorator(
Route route, DecoratingHttpServiceFunction decoratingHttpServiceFunction) {
virtualHostTemplate.decorator(route, decoratingHttpServiceFunction);
return this;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: decorator
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
|
decorator
|
core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java
|
df7f85824a62e997b910b5d6194a3335841065fd
| 0
|
Analyze the following code function for security vulnerabilities
|
void onPendingUi(int operation, @NonNull IBinder token) {
if (!mPendingUi.matches(token)) {
Slog.w(TAG, "restore(" + operation + "): got token " + token + " instead of "
+ mPendingUi.getToken());
return;
}
final LogMaker log = newLogMaker(MetricsEvent.AUTOFILL_PENDING_SAVE_UI_OPERATION);
try {
switch (operation) {
case AutofillManager.PENDING_UI_OPERATION_RESTORE:
if (sDebug) Slog.d(TAG, "Restoring save dialog for " + token);
log.setType(MetricsEvent.TYPE_OPEN);
show();
break;
case AutofillManager.PENDING_UI_OPERATION_CANCEL:
log.setType(MetricsEvent.TYPE_DISMISS);
if (sDebug) Slog.d(TAG, "Cancelling pending save dialog for " + token);
hide();
break;
default:
log.setType(MetricsEvent.TYPE_FAILURE);
Slog.w(TAG, "restore(): invalid operation " + operation);
}
} finally {
mMetricsLogger.write(log);
}
mPendingUi.setState(PendingUi.STATE_FINISHED);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: onPendingUi
File: services/autofill/java/com/android/server/autofill/ui/SaveUi.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other",
"CWE-610"
] |
CVE-2023-40133
|
MEDIUM
| 5.5
|
android
|
onPendingUi
|
services/autofill/java/com/android/server/autofill/ui/SaveUi.java
|
08becc8c600f14c5529115cc1a1e0c97cd503f33
| 0
|
Analyze the following code function for security vulnerabilities
|
public void setContainerViewInternals(InternalAccessDelegate internalDispatcher) {
mContainerViewInternals = internalDispatcher;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setContainerViewInternals
File: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
Repository: chromium
The code follows secure coding practices.
|
[
"CWE-20"
] |
CVE-2014-3159
|
MEDIUM
| 6.4
|
chromium
|
setContainerViewInternals
|
content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
|
98a50b76141f0b14f292f49ce376e6554142d5e2
| 0
|
Analyze the following code function for security vulnerabilities
|
private final long _decode64Bits() throws IOException {
int ptr = _inputPtr;
if ((ptr + 7) >= _inputEnd) {
return _slow64();
}
final byte[] b = _inputBuffer;
int i1 = (b[ptr++] << 24) + ((b[ptr++] & 0xFF) << 16)
+ ((b[ptr++] & 0xFF) << 8) + (b[ptr++] & 0xFF);
int i2 = (b[ptr++] << 24) + ((b[ptr++] & 0xFF) << 16)
+ ((b[ptr++] & 0xFF) << 8) + (b[ptr++] & 0xFF);
_inputPtr = ptr;
return _long(i1, i2);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: _decode64Bits
File: cbor/src/main/java/com/fasterxml/jackson/dataformat/cbor/CBORParser.java
Repository: FasterXML/jackson-dataformats-binary
The code follows secure coding practices.
|
[
"CWE-770"
] |
CVE-2020-28491
|
MEDIUM
| 5
|
FasterXML/jackson-dataformats-binary
|
_decode64Bits
|
cbor/src/main/java/com/fasterxml/jackson/dataformat/cbor/CBORParser.java
|
de072d314af8f5f269c8abec6930652af67bc8e6
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public RootTaskInfo getFocusedRootTaskInfo() throws RemoteException {
enforceTaskPermission("getFocusedRootTaskInfo()");
final long ident = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
Task focusedRootTask = getTopDisplayFocusedRootTask();
if (focusedRootTask != null) {
return mRootWindowContainer.getRootTaskInfo(focusedRootTask.mTaskId);
}
return null;
}
} finally {
Binder.restoreCallingIdentity(ident);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getFocusedRootTaskInfo
File: services/core/java/com/android/server/wm/ActivityTaskManagerService.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-862"
] |
CVE-2023-40094
|
HIGH
| 7.8
|
android
|
getFocusedRootTaskInfo
|
services/core/java/com/android/server/wm/ActivityTaskManagerService.java
|
1120bc7e511710b1b774adf29ba47106292365e7
| 0
|
Analyze the following code function for security vulnerabilities
|
protected void deleteItem(Context c, String myhandle) throws Exception
{
// bit of a hack - to remove an item, you must remove it
// from all collections it's a part of, then it will be removed
Item myitem = (Item) handleService.resolveToObject(c, myhandle);
if (myitem == null)
{
System.out.println("Error - cannot locate item - already deleted?");
}
else
{
deleteItem(c, myitem);
c.uncacheEntity(myitem);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: deleteItem
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
|
deleteItem
|
dspace-api/src/main/java/org/dspace/app/itemimport/ItemImportServiceImpl.java
|
7af52a0883a9dbc475cf3001f04ed11b24c8a4c0
| 0
|
Analyze the following code function for security vulnerabilities
|
public Version getRCSVersion()
{
if (this.version == null) {
return new Version("1.1");
}
return this.version;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getRCSVersion
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
|
getRCSVersion
|
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
|
public void setMarshallingStrategy(MarshallingStrategy marshallingStrategy) {
this.marshallingStrategy = marshallingStrategy;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setMarshallingStrategy
File: xstream/src/java/com/thoughtworks/xstream/XStream.java
Repository: x-stream/xstream
The code follows secure coding practices.
|
[
"CWE-400"
] |
CVE-2021-43859
|
MEDIUM
| 5
|
x-stream/xstream
|
setMarshallingStrategy
|
xstream/src/java/com/thoughtworks/xstream/XStream.java
|
e8e88621ba1c85ac3b8620337dd672e0c0c3a846
| 0
|
Analyze the following code function for security vulnerabilities
|
public String getURL(EntityReference reference, String action, String queryString, String fragment)
{
Serializable locale = reference.getParameters().get("locale");
if (locale != null) {
queryString += "&language=" + locale;
}
return getURL(action, extractListFromReference(reference).toArray(new String[] {}), queryString, fragment);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getURL
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
|
getURL
|
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
|
private static List<ProgramWorkflowState> getStates(boolean includeRetired) {
List<ProgramWorkflowState> ret = new ArrayList<ProgramWorkflowState>();
for (Program p : Context.getProgramWorkflowService().getAllPrograms()) {
for (ProgramWorkflow w : p.getAllWorkflows()) {
for (ProgramWorkflowState s : w.getStates()) {
if (includeRetired || !s.isRetired()) {
ret.add(s);
}
}
}
}
return ret;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getStates
File: api/src/main/java/org/openmrs/module/htmlformentry/HtmlFormEntryUtil.java
Repository: openmrs/openmrs-module-htmlformentry
The code follows secure coding practices.
|
[
"CWE-611"
] |
CVE-2018-16521
|
HIGH
| 7.5
|
openmrs/openmrs-module-htmlformentry
|
getStates
|
api/src/main/java/org/openmrs/module/htmlformentry/HtmlFormEntryUtil.java
|
9dcd304688e65c31cac5532fe501b9816ed975ae
| 0
|
Analyze the following code function for security vulnerabilities
|
private void migrate22(File dataDir, Stack<Integer> versions) {
for (File file: dataDir.listFiles()) {
if (file.getName().startsWith("IssueFieldUnarys.xml")) {
File renamedFile = new File(dataDir, file.getName().replace("IssueFieldUnarys", "IssueFieldEntitys"));
try {
FileUtils.moveFile(file, renamedFile);
} catch (IOException e) {
throw new RuntimeException(e);
}
VersionedXmlDoc dom = VersionedXmlDoc.fromFile(renamedFile);
for (Element element: dom.getRootElement().elements()) {
element.setName("io.onedev.server.model.IssueFieldEntity");
}
dom.writeToFile(renamedFile, false);
}
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: migrate22
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
|
migrate22
|
server-core/src/main/java/io/onedev/server/migration/DataMigrator.java
|
d67dd9686897fe5e4ab881d749464aa7c06a68e5
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.