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 Bundle getAssistContextExtras(int requestType) {
PendingAssistExtras pae = enqueueAssistContext(requestType, null, null, null,
null, null, true /* focused */, true /* newSessionId */,
UserHandle.getCallingUserId(), null, PENDING_ASSIST_EXTRAS_TIMEOUT, 0);
if (pae == null) {
return null;
}
synchronized (pae) {
while (!pae.haveResult) {
try {
pae.wait();
} catch (InterruptedException e) {
}
}
}
synchronized (this) {
buildAssistBundleLocked(pae, pae.result);
mPendingAssistExtras.remove(pae);
mUiHandler.removeCallbacks(pae);
}
return pae.extras;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getAssistContextExtras
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
|
getAssistContextExtras
|
services/core/java/com/android/server/am/ActivityManagerService.java
|
962fb40991f15be4f688d960aa00073683ebdd20
| 0
|
Analyze the following code function for security vulnerabilities
|
protected Logger getLogger() {
return LoggerFactory.getLogger(this.getClass());
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getLogger
File: weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/BaseWxPayResult.java
Repository: Wechat-Group/WxJava
The code follows secure coding practices.
|
[
"CWE-611"
] |
CVE-2018-20318
|
HIGH
| 7.5
|
Wechat-Group/WxJava
|
getLogger
|
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/BaseWxPayResult.java
|
6272639f02e397fed40828a2d0da66c30264bc0e
| 0
|
Analyze the following code function for security vulnerabilities
|
public void validateDestinationDirectoryName(String otherSCMMaterialFolder) {
if (folder != null && folder.equalsIgnoreCase(otherSCMMaterialFolder)) {
addError(FOLDER, "The destination directory must be unique across materials.");
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: validateDestinationDirectoryName
File: config/config-api/src/main/java/com/thoughtworks/go/config/materials/ScmMaterialConfig.java
Repository: gocd
The code follows secure coding practices.
|
[
"CWE-77"
] |
CVE-2021-43286
|
MEDIUM
| 6.5
|
gocd
|
validateDestinationDirectoryName
|
config/config-api/src/main/java/com/thoughtworks/go/config/materials/ScmMaterialConfig.java
|
6fa9fb7a7c91e760f1adc2593acdd50f2d78676b
| 0
|
Analyze the following code function for security vulnerabilities
|
@RequestMapping("/shop/category/{friendlyUrl}.html")
public String displayCategoryNoReference(@PathVariable final String friendlyUrl, Model model, HttpServletRequest request, HttpServletResponse response, Locale locale) throws Exception {
return this.displayCategory(friendlyUrl,null,model,request,response,locale);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: displayCategoryNoReference
File: sm-shop/src/main/java/com/salesmanager/shop/store/controller/category/ShoppingCategoryController.java
Repository: shopizer-ecommerce/shopizer
The code follows secure coding practices.
|
[
"CWE-79"
] |
CVE-2021-33561
|
LOW
| 3.5
|
shopizer-ecommerce/shopizer
|
displayCategoryNoReference
|
sm-shop/src/main/java/com/salesmanager/shop/store/controller/category/ShoppingCategoryController.java
|
197f8c78c8f673b957e41ca2c823afc654c19271
| 0
|
Analyze the following code function for security vulnerabilities
|
public static Object getProviderRole(String id) {
Object providerRole = null;
if (StringUtils.isNotBlank(id)) {
// see if this is parseable int; if so, try looking up by id
Integer providerRoleId = null;
try {
providerRoleId = Integer.parseInt(id);
providerRole = getProviderRoleById(providerRoleId);
if (providerRole != null) {
return providerRole;
}
}
catch (Exception e) {
// ignore this, move to try by uuid
}
// if no match by id, look up by uuid
providerRole = getProviderRoleBUuid(id);
}
return providerRole;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getProviderRole
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
|
getProviderRole
|
api/src/main/java/org/openmrs/module/htmlformentry/HtmlFormEntryUtil.java
|
9dcd304688e65c31cac5532fe501b9816ed975ae
| 0
|
Analyze the following code function for security vulnerabilities
|
public final Iterable<DomNode> getDescendants() {
return () -> new DescendantElementsIterator<>(DomNode.class);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getDescendants
File: src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java
Repository: HtmlUnit/htmlunit
The code follows secure coding practices.
|
[
"CWE-787"
] |
CVE-2023-2798
|
HIGH
| 7.5
|
HtmlUnit/htmlunit
|
getDescendants
|
src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java
|
940dc7fd
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public ClassAccessor getSelfRegisteredUserClassAccessor() {
return JavaClassAccessor.getClassAccessor(User.class);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getSelfRegisteredUserClassAccessor
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
|
getSelfRegisteredUserClassAccessor
|
portofino-core/src/main/java/com/manydesigns/portofino/shiro/AbstractPortofinoRealm.java
|
8c754a0ad234555e813dcbf9e57d637f9f23d8fb
| 0
|
Analyze the following code function for security vulnerabilities
|
public void setWaitingForPermissionResult(boolean waitingForPermissionResult) {
this.waitingForPermissionResult = waitingForPermissionResult;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setWaitingForPermissionResult
File: Ports/Android/src/com/codename1/impl/android/CodenameOneActivity.java
Repository: codenameone/CodenameOne
The code follows secure coding practices.
|
[
"CWE-668"
] |
CVE-2022-4903
|
MEDIUM
| 5.1
|
codenameone/CodenameOne
|
setWaitingForPermissionResult
|
Ports/Android/src/com/codename1/impl/android/CodenameOneActivity.java
|
dad49c9ef26a598619fc48d2697151a02987d478
| 0
|
Analyze the following code function for security vulnerabilities
|
public JWT decode(String encodedJWT, Map<String, Verifier> verifiers, Function<Header, String> keyFunction) {
Objects.requireNonNull(encodedJWT);
Objects.requireNonNull(verifiers);
String[] parts = getParts(encodedJWT);
Header header = Mapper.deserialize(base64Decode(parts[0].getBytes(StandardCharsets.UTF_8)), Header.class);
// Be particular about decoding an unsecured JWT. If the JWT is signed or any verifiers were provided don't do it.
if (header.algorithm == Algorithm.none && parts.length == 2 && verifiers.isEmpty()) {
return Mapper.deserialize(base64Decode(parts[1].getBytes(StandardCharsets.UTF_8)), JWT.class);
}
// If verifiers were provided, ensure it is able to verify this JWT.
String key = keyFunction.apply(header);
Verifier verifier = verifiers.get(key);
if (verifier != null) {
if (!verifier.canVerify(header.algorithm)) {
verifier = null;
}
}
return decode(encodedJWT, header, parts, verifier);
}
|
Vulnerability Classification:
- CWE: CWE-20
- CVE: CVE-2018-1000125
- Severity: HIGH
- CVSS Score: 7.5
Description: Fixes Issue #2, bug exists that allows a JWT to be decoded even when no signature is provided.
Function: decode
File: src/main/java/org/primeframework/jwt/JWTDecoder.java
Repository: FusionAuth/fusionauth-jwt
Fixed Code:
public JWT decode(String encodedJWT, Map<String, Verifier> verifiers, Function<Header, String> keyFunction) {
Objects.requireNonNull(encodedJWT);
Objects.requireNonNull(verifiers);
String[] parts = getParts(encodedJWT);
Header header = Mapper.deserialize(base64Decode(parts[0].getBytes(StandardCharsets.UTF_8)), Header.class);
// If parts.length == 2 we have no signature, if no verifiers were provided, decode if header says 'none', else throw an exception
if (parts.length == 2 && verifiers.isEmpty()) {
if (header.algorithm == Algorithm.none) {
return Mapper.deserialize(base64Decode(parts[1].getBytes(StandardCharsets.UTF_8)), JWT.class);
} else {
throw new InvalidJWTSignatureException();
}
}
// If verifiers were provided, ensure it is able to verify this JWT.
String key = keyFunction.apply(header);
Verifier verifier = verifiers.get(key);
if (verifier != null) {
if (!verifier.canVerify(header.algorithm)) {
verifier = null;
}
}
return decode(encodedJWT, header, parts, verifier);
}
|
[
"CWE-20"
] |
CVE-2018-1000125
|
HIGH
| 7.5
|
FusionAuth/fusionauth-jwt
|
decode
|
src/main/java/org/primeframework/jwt/JWTDecoder.java
|
0d94dcef0133d699f21d217e922564adbb83a227
| 1
|
Analyze the following code function for security vulnerabilities
|
public String getSchemeId() {
return schemeId;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getSchemeId
File: src/com/dotmarketing/portlets/workflows/model/WorkflowSearcher.java
Repository: dotCMS/core
The code follows secure coding practices.
|
[
"CWE-89"
] |
CVE-2016-4040
|
MEDIUM
| 6.5
|
dotCMS/core
|
getSchemeId
|
src/com/dotmarketing/portlets/workflows/model/WorkflowSearcher.java
|
bc4db5d71dc67015572f8e4c6fdf87e29b854d02
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public void endDefinitionDescription()
{
getXHTMLWikiPrinter().printXMLEndElement("dd");
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: endDefinitionDescription
File: xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/XHTMLChainingRenderer.java
Repository: xwiki/xwiki-rendering
The code follows secure coding practices.
|
[
"CWE-79"
] |
CVE-2023-32070
|
MEDIUM
| 6.1
|
xwiki/xwiki-rendering
|
endDefinitionDescription
|
xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/XHTMLChainingRenderer.java
|
c40e2f5f9482ec6c3e71dbf1fff5ba8a5e44cdc1
| 0
|
Analyze the following code function for security vulnerabilities
|
private void initialDatasetLayout(View decor, String filterText) {
final AdapterView.OnItemClickListener onItemClickListener =
(adapter, view, position, id) -> {
final ViewItem vi = mAdapter.getItem(position);
mCallback.onDatasetPicked(vi.dataset);
};
mListView.setAdapter(mAdapter);
mListView.setVisibility(View.VISIBLE);
mListView.setOnItemClickListener(onItemClickListener);
if (mAdapter.getCount() == 1) {
// just single item, set up continue button
setContinueButton(decor, (v) ->
onItemClickListener.onItemClick(null, null, 0, 0));
}
if (filterText == null) {
mFilterText = null;
} else {
mFilterText = filterText.toLowerCase();
}
final int oldCount = mAdapter.getCount();
mAdapter.getFilter().filter(mFilterText, (count) -> {
if (mDestroyed) {
return;
}
if (count <= 0) {
if (sDebug) {
final int size = mFilterText == null ? 0 : mFilterText.length();
Slog.d(TAG, "No dataset matches filter with " + size + " chars");
}
mCallback.onCanceled();
} else {
if (mAdapter.getCount() > mVisibleDatasetsMaxCount) {
mListView.setVerticalScrollBarEnabled(true);
mListView.onVisibilityAggregated(true);
} else {
mListView.setVerticalScrollBarEnabled(false);
}
if (mAdapter.getCount() != oldCount) {
mListView.requestLayout();
}
}
});
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: initialDatasetLayout
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
|
initialDatasetLayout
|
services/autofill/java/com/android/server/autofill/ui/DialogFillUi.java
|
08becc8c600f14c5529115cc1a1e0c97cd503f33
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public void unregisterAnrController(AnrController controller) {
mActivityTaskManager.unregisterAnrController(controller);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: unregisterAnrController
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
|
unregisterAnrController
|
services/core/java/com/android/server/am/ActivityManagerService.java
|
d10b27e539f7bc91c2360d429b9d05f05274670d
| 0
|
Analyze the following code function for security vulnerabilities
|
private void extractParams(CipherParameters params)
{
if (params instanceof ParametersWithIV)
{
this.IV = ((ParametersWithIV)params).getIV();
this.param = (IESParameters)((ParametersWithIV)params).getParameters();
}
else
{
this.IV = null;
this.param = (IESParameters)params;
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: extractParams
File: core/src/main/java/org/bouncycastle/crypto/engines/IESEngine.java
Repository: bcgit/bc-java
The code follows secure coding practices.
|
[
"CWE-361"
] |
CVE-2016-1000345
|
MEDIUM
| 4.3
|
bcgit/bc-java
|
extractParams
|
core/src/main/java/org/bouncycastle/crypto/engines/IESEngine.java
|
21dcb3d9744c83dcf2ff8fcee06dbca7bfa4ef35
| 0
|
Analyze the following code function for security vulnerabilities
|
@GET
@ApiOperation(value = "List all configuration classes")
@Timed
@RequiresPermissions(RestPermissions.CLUSTER_CONFIG_ENTRY_READ)
public ClusterConfigList list() {
final Set<Class<?>> classes = clusterConfigService.list();
return ClusterConfigList.createFromClass(classes);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: list
File: graylog2-server/src/main/java/org/graylog2/rest/resources/system/ClusterConfigResource.java
Repository: Graylog2/graylog2-server
The code follows secure coding practices.
|
[
"CWE-863"
] |
CVE-2024-24824
|
HIGH
| 8.8
|
Graylog2/graylog2-server
|
list
|
graylog2-server/src/main/java/org/graylog2/rest/resources/system/ClusterConfigResource.java
|
75ef2b8d60e7d67f859b79fe712c8ae7b2e861d8
| 0
|
Analyze the following code function for security vulnerabilities
|
public void writeMessageEnd() throws TException {}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: writeMessageEnd
File: thrift/lib/java/src/main/java/com/facebook/thrift/protocol/TCompactProtocol.java
Repository: facebook/fbthrift
The code follows secure coding practices.
|
[
"CWE-770"
] |
CVE-2019-11938
|
MEDIUM
| 5
|
facebook/fbthrift
|
writeMessageEnd
|
thrift/lib/java/src/main/java/com/facebook/thrift/protocol/TCompactProtocol.java
|
08c2d412adb214c40bb03be7587057b25d053030
| 0
|
Analyze the following code function for security vulnerabilities
|
@Pure
@Override
public @Nullable Array getArray(int i) throws SQLException {
byte[] value = getRawValue(i);
if (value == null) {
return null;
}
int oid = fields[i - 1].getOID();
if (isBinary(i)) {
return makeArray(oid, value);
}
return makeArray(oid, castNonNull(getFixedString(i)));
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getArray
File: pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
Repository: pgjdbc
The code follows secure coding practices.
|
[
"CWE-89"
] |
CVE-2022-31197
|
HIGH
| 8
|
pgjdbc
|
getArray
|
pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
|
739e599d52ad80f8dcd6efedc6157859b1a9d637
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public int getActualHeight() {
// Because we're animating the bounds, getHeight will return the small height at the
// beginning of the animation. Instead we'd want it to already return the end value
return mActualHeight;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getActualHeight
File: packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2023-40098
|
MEDIUM
| 5.5
|
android
|
getActualHeight
|
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java
|
d21ffbe8a2eeb2a5e6da7efbb1a0430ba6b022e0
| 0
|
Analyze the following code function for security vulnerabilities
|
public void setDocumentArchive(XWikiDocumentArchive arch)
{
// We are using a SoftReference which will allow the archive to be
// discarded by the Garbage collector as long as the context is closed (usually during the
// request)
if (arch != null) {
this.archive = new SoftReference<XWikiDocumentArchive>(arch);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setDocumentArchive
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
|
setDocumentArchive
|
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
|
KeyChainConnection keyChainBind() throws InterruptedException {
return KeyChain.bind(mContext);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: keyChainBind
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
|
keyChainBind
|
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
|
ed3f25b7222d4cff471f2b7d22d1150348146957
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
@Deprecated(since = "14.8RC1")
public void saveLinks(XWikiDocument doc, XWikiContext inputxcontext, boolean bTransaction) throws XWikiException
{
XWikiContext context = getExecutionXContext(inputxcontext, true);
// Extract the links
Set<XWikiLink> links = extractLinks(doc, context);
// Save the links
executeWrite(context, session -> {
// We delete the existing links before saving the newly analyzed ones. Unless non exists yet.
if (countLinks(doc.getId(), context, false) > 0) {
deleteLinks(doc.getId(), context, false);
}
// necessary to blank links from doc
context.remove("links");
if (!links.isEmpty()) {
// Get link size limit
int linkMaxSize = getLimitSize(context, XWikiLink.class, "link");
// Save the links.
for (XWikiLink wikiLink : links) {
// Verify that the link reference isn't larger than the maximum size of the field since otherwise
// that would lead to a DB error that would result in a fatal error, and the user would have a hard
// time understanding why his page failed to be saved.
if (wikiLink.getLink().length() <= linkMaxSize) {
session.save(wikiLink);
} else {
this.logger.warn("Could not store backlink [{}] because the link reference [{}] is too big",
wikiLink, wikiLink.getLink());
}
}
}
return null;
});
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: saveLinks
File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices.
|
[
"CWE-459"
] |
CVE-2023-36468
|
HIGH
| 8.8
|
xwiki/xwiki-platform
|
saveLinks
|
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/store/XWikiHibernateStore.java
|
15a6f845d8206b0ae97f37aa092ca43d4f9d6e59
| 0
|
Analyze the following code function for security vulnerabilities
|
public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
boolean abortBroadcast, int flags) throws RemoteException;
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: finishReceiver
File: core/java/android/app/IActivityManager.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-264"
] |
CVE-2016-3832
|
HIGH
| 8.3
|
android
|
finishReceiver
|
core/java/android/app/IActivityManager.java
|
e7cf91a198de995c7440b3b64352effd2e309906
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public Point getAppTaskThumbnailSize() {
synchronized (this) {
return new Point(mThumbnailWidth, mThumbnailHeight);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getAppTaskThumbnailSize
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
|
getAppTaskThumbnailSize
|
services/core/java/com/android/server/am/ActivityManagerService.java
|
962fb40991f15be4f688d960aa00073683ebdd20
| 0
|
Analyze the following code function for security vulnerabilities
|
private String disableNotificationEffects(NotificationRecord record) {
if (mDisableNotificationEffects) {
return "booleanState";
}
if ((mListenerHints & HINT_HOST_DISABLE_EFFECTS) != 0) {
return "listenerHints";
}
if (mCallState != TelephonyManager.CALL_STATE_IDLE && !mZenModeHelper.isCall(record)) {
return "callState";
}
return null;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: disableNotificationEffects
File: services/core/java/com/android/server/notification/NotificationManagerService.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-284"
] |
CVE-2016-3884
|
MEDIUM
| 4.3
|
android
|
disableNotificationEffects
|
services/core/java/com/android/server/notification/NotificationManagerService.java
|
61e9103b5725965568e46657f4781dd8f2e5b623
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public void setBounds(int left, int top, int right, int bottom) {
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setBounds
File: packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2017-0822
|
HIGH
| 7.5
|
android
|
setBounds
|
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
|
c574568aaede7f652432deb7707f20ae54bbdf9a
| 0
|
Analyze the following code function for security vulnerabilities
|
public DynamicForm fill(Map<String, Object> value) {
Form<Dynamic> form = super.fill(new Dynamic(value));
return new DynamicForm(
form.rawData(),
form.files(),
form.errors(),
form.value(),
messagesApi,
formatters,
validatorFactory,
config,
lang().orElse(null));
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: fill
File: web/play-java-forms/src/main/java/play/data/DynamicForm.java
Repository: playframework
The code follows secure coding practices.
|
[
"CWE-400"
] |
CVE-2022-31018
|
MEDIUM
| 5
|
playframework
|
fill
|
web/play-java-forms/src/main/java/play/data/DynamicForm.java
|
15393b736df939e35e275af2347155f296c684f2
| 0
|
Analyze the following code function for security vulnerabilities
|
public void enableTemporaryDisabledNetworks() {
mWifiBlocklistMonitor.clearBssidBlocklist();
for (WifiConfiguration config : getInternalConfiguredNetworks()) {
if (config.getNetworkSelectionStatus().isNetworkTemporaryDisabled()) {
updateNetworkSelectionStatus(config,
NetworkSelectionStatus.DISABLED_NONE);
}
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: enableTemporaryDisabledNetworks
File: service/java/com/android/server/wifi/WifiConfigManager.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2023-21242
|
CRITICAL
| 9.8
|
android
|
enableTemporaryDisabledNetworks
|
service/java/com/android/server/wifi/WifiConfigManager.java
|
72e903f258b5040b8f492cf18edd124b5a1ac770
| 0
|
Analyze the following code function for security vulnerabilities
|
public static boolean isKeyStrokeEvent(@Nullable final KeyStroke keyStroke, final int keyEventType, @Nullable final KeyEvent event) {
boolean result = false;
if (keyStroke != null && event != null) {
if (keyEventType == keyStroke.getKeyEventType()) {
result = ((keyStroke.getModifiers() & event.getModifiers()) == keyStroke.getModifiers()) && (keyStroke.getKeyCode() == event.getKeyCode());
}
}
return result;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isKeyStrokeEvent
File: mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/utils/Utils.java
Repository: raydac/netbeans-mmd-plugin
The code follows secure coding practices.
|
[
"CWE-611"
] |
CVE-2018-1000542
|
MEDIUM
| 6.8
|
raydac/netbeans-mmd-plugin
|
isKeyStrokeEvent
|
mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/utils/Utils.java
|
9fba652bf06e649186b8f9e612d60e9cc15097e9
| 0
|
Analyze the following code function for security vulnerabilities
|
public static float getDesiredWidth(CharSequence source,
TextPaint paint) {
return getDesiredWidth(source, 0, source.length(), paint);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getDesiredWidth
File: core/java/android/text/Layout.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-20"
] |
CVE-2018-9452
|
MEDIUM
| 4.3
|
android
|
getDesiredWidth
|
core/java/android/text/Layout.java
|
3b6f84b77c30ec0bab5147b0cffc192c86ba2634
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public boolean isInteractive() {
return service.mPowerManager.isInteractive();
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isInteractive
File: services/core/java/com/android/server/wm/WindowState.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2023-35674
|
HIGH
| 7.8
|
android
|
isInteractive
|
services/core/java/com/android/server/wm/WindowState.java
|
7428962d3b064ce1122809d87af65099d1129c9e
| 0
|
Analyze the following code function for security vulnerabilities
|
@GuardedBy("mInnerLock")
private void setAlarmLocked() {
if (mIsAlarmSet) {
return;
}
if (DEBUG) {
Log.d(LOG_TAG, "Scheduling alarm for " + mPackageName + " (" + mUid + ").");
}
long revokeTime = mTimerStart + mTimeout;
if (revokeTime > System.currentTimeMillis()) {
mAlarmManager.setExact(AlarmManager.RTC_WAKEUP, revokeTime, LOG_TAG, this,
mHandler);
mIsAlarmSet = true;
} else {
mIsAlarmSet = true;
onAlarm();
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setAlarmLocked
File: services/core/java/com/android/server/pm/permission/OneTimePermissionUserManager.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-281"
] |
CVE-2023-21249
|
MEDIUM
| 5.5
|
android
|
setAlarmLocked
|
services/core/java/com/android/server/pm/permission/OneTimePermissionUserManager.java
|
c00b7e7dbc1fa30339adef693d02a51254755d7f
| 0
|
Analyze the following code function for security vulnerabilities
|
public void validateSql(@NonNull String sql, @Nullable CancellationSignal cancellationSignal) {
getThreadSession().prepare(sql,
getThreadDefaultConnectionFlags(/* readOnly =*/ true), cancellationSignal, null);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: validateSql
File: core/java/android/database/sqlite/SQLiteDatabase.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-89"
] |
CVE-2018-9493
|
LOW
| 2.1
|
android
|
validateSql
|
core/java/android/database/sqlite/SQLiteDatabase.java
|
ebc250d16c747f4161167b5ff58b3aea88b37acf
| 0
|
Analyze the following code function for security vulnerabilities
|
private File processUploadedFile(FileItem item, String dirToSaveUploadedFileIn) {
dirToSaveUploadedFileIn = dirToSaveUploadedFileIn == null ? System.getProperty("java.io.tmpdir") : dirToSaveUploadedFileIn;
String fileName = item.getName();
// Some browsers IE 6,7 getName returns the whole path
int startIndex = fileName.lastIndexOf('\\');
if (startIndex != -1) {
fileName = fileName.substring(startIndex + 1, fileName.length());
}
File uploadedFile = new File(dirToSaveUploadedFileIn + File.separator + fileName);
try {
uploadedFile = new UploadFileServlet().new OCFileRename().rename(uploadedFile, item.getInputStream());
} catch (IOException e) {
throw new OpenClinicaSystemException(e.getMessage());
}
try {
item.write(uploadedFile);
} catch (Exception e) {
throw new OpenClinicaSystemException(e.getMessage());
}
return uploadedFile;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: processUploadedFile
File: web/src/main/java/org/akaza/openclinica/controller/openrosa/OpenRosaSubmissionController.java
Repository: OpenClinica
The code follows secure coding practices.
|
[
"CWE-22"
] |
CVE-2022-24830
|
HIGH
| 7.5
|
OpenClinica
|
processUploadedFile
|
web/src/main/java/org/akaza/openclinica/controller/openrosa/OpenRosaSubmissionController.java
|
6f864e86543f903bd20d6f9fc7056115106441f3
| 0
|
Analyze the following code function for security vulnerabilities
|
private static final void enforceSystemOrRoot(String message) {
final int uid = Binder.getCallingUid();
if (uid != Process.SYSTEM_UID && uid != 0) {
throw new SecurityException(message);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: enforceSystemOrRoot
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
|
enforceSystemOrRoot
|
services/core/java/com/android/server/pm/PackageManagerService.java
|
a75537b496e9df71c74c1d045ba5569631a16298
| 0
|
Analyze the following code function for security vulnerabilities
|
private List<PluginPackageResourceFiles> processPluginUiPackageFile(File localFilePath, PackageType xmlPackage,
PluginPackages pluginPackageEntity) throws IOException {
File pluginUiPackageFile = new File(localFilePath, pluginProperties.getUiFile());
log.info("pluginUiPackageFile: {}", pluginUiPackageFile.getAbsolutePath());
String uiPackageUrl = "";
List<PluginPackageResourceFiles> pluginPackageResourceFilesEntities = new ArrayList<>();
if (pluginUiPackageFile.exists()) {
String keyName = xmlPackage.getName() + "/" + xmlPackage.getVersion() + "/" + pluginUiPackageFile.getName();
log.info("keyName : {}", keyName);
pluginPackageResourceFilesEntities = parseAllPluginPackageResourceFile(pluginPackageEntity,
pluginUiPackageFile.getAbsolutePath(), pluginUiPackageFile.getName());
uiPackageUrl = s3Client.uploadFile(pluginProperties.getPluginPackageBucketName(), keyName,
pluginUiPackageFile);
pluginPackageEntity.setUiPackageIncluded(true);
log.info("UI static package file has uploaded to MinIO {}", uiPackageUrl.split("\\?")[0]);
} else {
pluginPackageEntity.setUiPackageIncluded(false);
}
for (PluginPackageResourceFiles fileEntity : pluginPackageResourceFilesEntities) {
pluginPackageResourceFilesMapper.insert(fileEntity);
}
log.info("total {} resource files saved for {}", pluginPackageResourceFilesEntities.size(),
xmlPackage.getName());
return pluginPackageResourceFilesEntities;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: processPluginUiPackageFile
File: platform-core/src/main/java/com/webank/wecube/platform/core/service/plugin/PluginArtifactsMgmtService.java
Repository: WeBankPartners/wecube-platform
The code follows secure coding practices.
|
[
"CWE-22"
] |
CVE-2021-45746
|
MEDIUM
| 5
|
WeBankPartners/wecube-platform
|
processPluginUiPackageFile
|
platform-core/src/main/java/com/webank/wecube/platform/core/service/plugin/PluginArtifactsMgmtService.java
|
1164dae43c505f8a0233cc049b2689d6ca6d0c37
| 0
|
Analyze the following code function for security vulnerabilities
|
public JSONException syntaxError(String message, Throwable causedBy) {
return new JSONException(message + this.toString(), causedBy);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: syntaxError
File: src/main/java/org/json/JSONTokener.java
Repository: stleary/JSON-java
The code follows secure coding practices.
|
[
"CWE-787"
] |
CVE-2022-45690
|
HIGH
| 7.5
|
stleary/JSON-java
|
syntaxError
|
src/main/java/org/json/JSONTokener.java
|
7a124d857dc8da1165c87fa788e53359a317d0f7
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public List<String> getParamNames(){
Enumeration<String> parameterNames = request.getParameterNames();
List<String> list = new ArrayList<>();
while (parameterNames.hasMoreElements()) {
list.add(parameterNames.nextElement());
}
return list;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getParamNames
File: sa-token-starter/sa-token-servlet/src/main/java/cn/dev33/satoken/servlet/model/SaRequestForServlet.java
Repository: dromara/Sa-Token
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2023-44794
|
CRITICAL
| 9.8
|
dromara/Sa-Token
|
getParamNames
|
sa-token-starter/sa-token-servlet/src/main/java/cn/dev33/satoken/servlet/model/SaRequestForServlet.java
|
954efeb73277f924f836da2a25322ea35ee1bfa3
| 0
|
Analyze the following code function for security vulnerabilities
|
private SettingsState getSecureSettingsLocked(int userId) {
return getSettingsLocked(SETTINGS_TYPE_SECURE, userId);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getSecureSettingsLocked
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
|
getSecureSettingsLocked
|
packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
|
91fc934bb2e5ea59929bb2f574de6db9b5100745
| 0
|
Analyze the following code function for security vulnerabilities
|
private boolean shouldDrawBlurBehind() {
return (mAttrs.flags & FLAG_BLUR_BEHIND) != 0
&& mWmService.mBlurController.getBlurEnabled();
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: shouldDrawBlurBehind
File: services/core/java/com/android/server/wm/WindowState.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2023-35674
|
HIGH
| 7.8
|
android
|
shouldDrawBlurBehind
|
services/core/java/com/android/server/wm/WindowState.java
|
7428962d3b064ce1122809d87af65099d1129c9e
| 0
|
Analyze the following code function for security vulnerabilities
|
public List<Object[]> getTraceLogs() {
return traceLogs;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getTraceLogs
File: src/main/java/com/rebuild/core/service/dataimport/DataImporter.java
Repository: getrebuild/rebuild
The code follows secure coding practices.
|
[
"CWE-79"
] |
CVE-2023-1613
|
MEDIUM
| 4
|
getrebuild/rebuild
|
getTraceLogs
|
src/main/java/com/rebuild/core/service/dataimport/DataImporter.java
|
d0de4cc35303168f44ca57712c824b5cb9525e54
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public String getId() {
return id;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getId
File: services/src/main/java/org/keycloak/theme/ClasspathThemeResourceProviderFactory.java
Repository: keycloak
The code follows secure coding practices.
|
[
"CWE-22"
] |
CVE-2021-3856
|
MEDIUM
| 4.3
|
keycloak
|
getId
|
services/src/main/java/org/keycloak/theme/ClasspathThemeResourceProviderFactory.java
|
73f0474008e1bebd0733e62a22aceda9e5de6743
| 0
|
Analyze the following code function for security vulnerabilities
|
public void fillHelperObject(HelperObject helperObject) {
helperObject.setUrlBase(CoreResources.getField("sysURL").split("/MainMenu")[0]);
helperObject.setOpenClinicaMailSender(openClinicaMailSender);
helperObject.setDataSource(dataSource);
helperObject.setResterms(resterms);
helperObject.setEventCrfDao(eventCrfDao);
helperObject.setStudyEventDao(studyEventDao);
helperObject.setStudySubjectDao(studySubjectDao);
helperObject.setCrfVersionDao(crfVersionDao);
helperObject.setSessionFactory(sessionFactory);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: fillHelperObject
File: web/src/main/java/org/akaza/openclinica/controller/BatchCRFMigrationController.java
Repository: OpenClinica
The code follows secure coding practices.
|
[
"CWE-22"
] |
CVE-2022-24830
|
HIGH
| 7.5
|
OpenClinica
|
fillHelperObject
|
web/src/main/java/org/akaza/openclinica/controller/BatchCRFMigrationController.java
|
6f864e86543f903bd20d6f9fc7056115106441f3
| 0
|
Analyze the following code function for security vulnerabilities
|
public void removeLock(XWikiContext context) throws XWikiException
{
XWikiLock lock = getStore(context).loadLock(getId(), context, true);
if (lock != null) {
getStore(context).deleteLock(lock, context, true);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: removeLock
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
|
removeLock
|
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 static void resetDeployPath() {
DEPLOYED_BASE_PATH = Suppliers.memoize(() -> getDeployedBasePath());
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: resetDeployPath
File: org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/utils/FilesUtils.java
Repository: eclipse/lemminx
The code follows secure coding practices.
|
[
"CWE-22"
] |
CVE-2019-18212
|
MEDIUM
| 4
|
eclipse/lemminx
|
resetDeployPath
|
org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/utils/FilesUtils.java
|
e37c399aa266be1b7a43061d4afc43dc230410d2
| 0
|
Analyze the following code function for security vulnerabilities
|
public void notifyActivityDrawnForKeyguard() {
if (DEBUG_KEYGUARD) Slog.d(TAG, "notifyActivityDrawnForKeyguard: waiting="
+ mKeyguardWaitingForActivityDrawn + " Callers=" + Debug.getCallers(5));
synchronized (mWindowMap) {
if (mKeyguardWaitingForActivityDrawn) {
mPolicy.notifyActivityDrawnForKeyguardLw();
mKeyguardWaitingForActivityDrawn = false;
}
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: notifyActivityDrawnForKeyguard
File: services/core/java/com/android/server/wm/WindowManagerService.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-264"
] |
CVE-2016-3875
|
HIGH
| 7.2
|
android
|
notifyActivityDrawnForKeyguard
|
services/core/java/com/android/server/wm/WindowManagerService.java
|
69729fa8b13cadbf3173fe1f389fe4f3b7bd0f9c
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException, FormException {
super.doConfigSubmit(req,rsp);
updateTransientActions();
Set<AbstractProject> upstream = Collections.emptySet();
if(req.getParameter("pseudoUpstreamTrigger")!=null) {
upstream = new HashSet<AbstractProject>(Items.fromNameList(getParent(),req.getParameter("upstreamProjects"),AbstractProject.class));
}
// dependency setting might have been changed by the user, so rebuild.
Jenkins.getInstance().rebuildDependencyGraph();
convertUpstreamBuildTrigger(upstream);
// notify the queue as the project might be now tied to different node
Jenkins.getInstance().getQueue().scheduleMaintenance();
// this is to reflect the upstream build adjustments done above
Jenkins.getInstance().rebuildDependencyGraph();
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: doConfigSubmit
File: core/src/main/java/hudson/model/AbstractProject.java
Repository: jenkinsci/jenkins
The code follows secure coding practices.
|
[
"CWE-264"
] |
CVE-2014-2058
|
MEDIUM
| 6.5
|
jenkinsci/jenkins
|
doConfigSubmit
|
core/src/main/java/hudson/model/AbstractProject.java
|
b6b2a367a7976be80a799c6a49fa6c58d778b50e
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public void endFormat(WikiFormat format)
{
WikiParameters wikiParameters = new WikiParameters(format.getParams());
if (isMetaDataElement(wikiParameters)) {
getListener().endMetaData(createMetaData(wikiParameters));
WikiParameters cleanParameters = cleanParametersFromMetadata(wikiParameters);
if (cleanParameters.getSize() > 0 || !format.getStyles().isEmpty()) {
WikiFormat newFormat = format;
if (wikiParameters.getSize() != cleanParameters.getSize()) {
newFormat = format.setParameters(cleanParameters.toList());
}
super.endFormat(newFormat);
}
} else {
super.endFormat(format);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: endFormat
File: xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/parser/xhtml/wikimodel/XHTMLXWikiGeneratorListener.java
Repository: xwiki/xwiki-rendering
The code follows secure coding practices.
|
[
"CWE-79"
] |
CVE-2023-32070
|
MEDIUM
| 6.1
|
xwiki/xwiki-rendering
|
endFormat
|
xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/parser/xhtml/wikimodel/XHTMLXWikiGeneratorListener.java
|
c40e2f5f9482ec6c3e71dbf1fff5ba8a5e44cdc1
| 0
|
Analyze the following code function for security vulnerabilities
|
private void writeHiddenFields(Map<String, String> hiddenFields) throws JspException {
if (hiddenFields != null) {
this.tagWriter.appendValue("<div>\n");
for (String name : hiddenFields.keySet()) {
this.tagWriter.appendValue("<input type=\"hidden\" ");
this.tagWriter.appendValue("name=\"" + name + "\" value=\"" + hiddenFields.get(name) + "\" ");
this.tagWriter.appendValue("/>\n");
}
this.tagWriter.appendValue("</div>");
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: writeHiddenFields
File: spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/FormTag.java
Repository: spring-projects/spring-framework
The code follows secure coding practices.
|
[
"CWE-79"
] |
CVE-2014-1904
|
MEDIUM
| 4.3
|
spring-projects/spring-framework
|
writeHiddenFields
|
spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/FormTag.java
|
741b4b229ae032bd17175b46f98673ce0bd2d485
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public void delete() {
if (fileChannel != null) {
try {
fileChannel.force(false);
} catch (IOException e) {
logger.warn("Failed to force.", e);
} finally {
try {
fileChannel.close();
} catch (IOException e) {
logger.warn("Failed to close a file.", e);
}
}
fileChannel = null;
}
if (!isRenamed) {
String filePath = null;
if (file != null && file.exists()) {
filePath = file.getPath();
if (!file.delete()) {
filePath = null;
logger.warn("Failed to delete: {}", file);
}
}
// If you turn on deleteOnExit make sure it is executed.
if (deleteOnExit() && filePath != null) {
DeleteFileOnExitHook.remove(filePath);
}
file = null;
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: delete
File: codec-http/src/main/java/io/netty/handler/codec/http/multipart/AbstractDiskHttpData.java
Repository: netty
The code follows secure coding practices.
|
[
"CWE-378",
"CWE-379"
] |
CVE-2021-21290
|
LOW
| 1.9
|
netty
|
delete
|
codec-http/src/main/java/io/netty/handler/codec/http/multipart/AbstractDiskHttpData.java
|
c735357bf29d07856ad171c6611a2e1a0e0000ec
| 0
|
Analyze the following code function for security vulnerabilities
|
@GuardedBy("this")
final ProcessRecord addAppLocked(ApplicationInfo info, String customProcess, boolean isolated,
String abiOverride, int zygotePolicyFlags) {
return addAppLocked(info, customProcess, isolated, false /* disableHiddenApiChecks */,
abiOverride, zygotePolicyFlags);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: addAppLocked
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
|
addAppLocked
|
services/core/java/com/android/server/am/ActivityManagerService.java
|
d10b27e539f7bc91c2360d429b9d05f05274670d
| 0
|
Analyze the following code function for security vulnerabilities
|
public void setRequestedFrameMax(int requestedFrameMax) {
this.requestedFrameMax = requestedFrameMax;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setRequestedFrameMax
File: src/main/java/com/rabbitmq/client/ConnectionFactory.java
Repository: rabbitmq/rabbitmq-java-client
The code follows secure coding practices.
|
[
"CWE-400"
] |
CVE-2023-46120
|
HIGH
| 7.5
|
rabbitmq/rabbitmq-java-client
|
setRequestedFrameMax
|
src/main/java/com/rabbitmq/client/ConnectionFactory.java
|
714aae602dcae6cb4b53cadf009323ebac313cc8
| 0
|
Analyze the following code function for security vulnerabilities
|
public static SQLiteDatabase openDatabase(@NonNull File path,
@NonNull OpenParams openParams) {
return openDatabase(path.getPath(), openParams);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: openDatabase
File: core/java/android/database/sqlite/SQLiteDatabase.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-89"
] |
CVE-2018-9493
|
LOW
| 2.1
|
android
|
openDatabase
|
core/java/android/database/sqlite/SQLiteDatabase.java
|
ebc250d16c747f4161167b5ff58b3aea88b37acf
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public void write(final ObjectDataOutput out, final Externalizable obj) throws IOException {
out.writeUTF(obj.getClass().getName());
if (gzipEnabled) {
writeGzipped(((OutputStream) out), obj);
} else {
write((OutputStream) out, obj);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: write
File: hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/JavaDefaultSerializers.java
Repository: hazelcast
The code follows secure coding practices.
|
[
"CWE-502"
] |
CVE-2016-10750
|
MEDIUM
| 6.8
|
hazelcast
|
write
|
hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/JavaDefaultSerializers.java
|
c1c31359a1df953e79a9ca9b6c54b3cdbfef11e9
| 0
|
Analyze the following code function for security vulnerabilities
|
protected boolean isEntityReferenceNameValid(EntityReference entityReference)
{
if (this.getEntityNameValidationManager().getEntityReferenceNameStrategy() != null
&& this.getEntityNameValidationConfiguration().useValidation()) {
if (!this.getEntityNameValidationManager().getEntityReferenceNameStrategy().isValid(entityReference)) {
Object[] args = {getLocalSerializer().serialize(entityReference)};
XWikiException invalidNameException = new XWikiException(XWikiException.MODULE_XWIKI_STORE,
XWikiException.ERROR_XWIKI_APP_DOCUMENT_NAME_INVALID,
"Cannot create document {0} because its name does not respect the name strategy of the wiki.", null,
args);
ScriptContext scontext = getCurrentScriptContext();
scontext.setAttribute("invalidNameReference", entityReference, ScriptContext.ENGINE_SCOPE);
scontext.setAttribute("createException", invalidNameException, ScriptContext.ENGINE_SCOPE);
return false;
}
}
return true;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isEntityReferenceNameValid
File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiAction.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices.
|
[
"CWE-668"
] |
CVE-2023-29208
|
HIGH
| 7.5
|
xwiki/xwiki-platform
|
isEntityReferenceNameValid
|
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiAction.java
|
d9e947559077e947315bf700c5703dfc7dd8a8d7
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public Object getSource() {
return request;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getSource
File: sa-token-starter/sa-token-jakarta-servlet/src/main/java/cn/dev33/satoken/servlet/model/SaRequestForServlet.java
Repository: dromara/Sa-Token
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2023-44794
|
CRITICAL
| 9.8
|
dromara/Sa-Token
|
getSource
|
sa-token-starter/sa-token-jakarta-servlet/src/main/java/cn/dev33/satoken/servlet/model/SaRequestForServlet.java
|
954efeb73277f924f836da2a25322ea35ee1bfa3
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public void setGlobalSetting(ComponentName who, String setting, String value) {
Objects.requireNonNull(who, "ComponentName is null");
final CallerIdentity caller = getCallerIdentity(who);
Preconditions.checkCallAuthorization(isDefaultDeviceOwner(caller));
DevicePolicyEventLogger
.createEvent(DevicePolicyEnums.SET_GLOBAL_SETTING)
.setAdmin(who)
.setStrings(setting, value)
.write();
synchronized (getLockObject()) {
// Some settings are no supported any more. However we do not want to throw a
// SecurityException to avoid breaking apps.
if (GLOBAL_SETTINGS_DEPRECATED.contains(setting)) {
Slogf.i(LOG_TAG, "Global setting no longer supported: %s", setting);
return;
}
if (!GLOBAL_SETTINGS_ALLOWLIST.contains(setting)
&& !UserManager.isDeviceInDemoMode(mContext)) {
throw new SecurityException(String.format(
"Permission denial: device owners cannot update %1$s", setting));
}
if (Settings.Global.STAY_ON_WHILE_PLUGGED_IN.equals(setting)) {
// ignore if it contradicts an existing policy
long timeMs = getMaximumTimeToLock(
who, mInjector.userHandleGetCallingUserId(), /* parent */ false);
if (timeMs > 0 && timeMs < Long.MAX_VALUE) {
return;
}
}
mInjector.binderWithCleanCallingIdentity(
() -> mInjector.settingsGlobalPutString(setting, value));
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setGlobalSetting
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
|
setGlobalSetting
|
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
|
ed3f25b7222d4cff471f2b7d22d1150348146957
| 0
|
Analyze the following code function for security vulnerabilities
|
private void updateInterfaceCapabilities() {
DeviceWiphyCapabilities cap = getDeviceWiphyCapabilities();
if (cap != null) {
// Some devices don't have support of 11ax/be indicated by the chip,
// so an override config value is used
if (mContext.getResources().getBoolean(R.bool.config_wifi11beSupportOverride)) {
cap.setWifiStandardSupport(ScanResult.WIFI_STANDARD_11BE, true);
}
if (mContext.getResources().getBoolean(R.bool.config_wifi11axSupportOverride)) {
cap.setWifiStandardSupport(ScanResult.WIFI_STANDARD_11AX, true);
}
mWifiNative.setDeviceWiphyCapabilities(mInterfaceName, cap);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: updateInterfaceCapabilities
File: service/java/com/android/server/wifi/ClientModeImpl.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2023-21242
|
CRITICAL
| 9.8
|
android
|
updateInterfaceCapabilities
|
service/java/com/android/server/wifi/ClientModeImpl.java
|
72e903f258b5040b8f492cf18edd124b5a1ac770
| 0
|
Analyze the following code function for security vulnerabilities
|
private void recordBootAttempt(File home) {
FileOutputStream o=null;
try {
o = new FileOutputStream(BootFailure.getBootFailureFile(home), true);
o.write((new Date().toString() + System.getProperty("line.separator", "\n")).toString().getBytes());
} catch (IOException e) {
LOGGER.log(WARNING, "Failed to record boot attempts",e);
} finally {
IOUtils.closeQuietly(o);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: recordBootAttempt
File: core/src/main/java/hudson/WebAppMain.java
Repository: jenkinsci/jenkins
The code follows secure coding practices.
|
[
"CWE-254"
] |
CVE-2014-9634
|
MEDIUM
| 5
|
jenkinsci/jenkins
|
recordBootAttempt
|
core/src/main/java/hudson/WebAppMain.java
|
582128b9ac179a788d43c1478be8a5224dc19710
| 0
|
Analyze the following code function for security vulnerabilities
|
@Nullable
public URL getVenueUrl(@NonNull ScanResult scanResult) {
long bssid;
try {
bssid = Utils.parseMac(scanResult.BSSID);
} catch (IllegalArgumentException e) {
Log.e(TAG, "Invalid BSSID provided in the scan result: " + scanResult.BSSID);
return null;
}
InformationElementUtil.Vsa vsa = InformationElementUtil.getHS2VendorSpecificIE(
scanResult.informationElements);
ANQPNetworkKey anqpKey = ANQPNetworkKey.buildKey(scanResult.SSID, bssid, scanResult.hessid,
vsa.anqpDomainID);
ANQPData anqpEntry = mAnqpCache.getEntry(anqpKey);
if (anqpEntry == null) {
return null;
}
VenueUrlElement venueUrlElement = (VenueUrlElement)
anqpEntry.getElements().get(Constants.ANQPElementType.ANQPVenueUrl);
if (venueUrlElement == null || venueUrlElement.getVenueUrls().isEmpty()) {
return null; // No Venue URL
}
VenueNameElement venueNameElement = (VenueNameElement)
anqpEntry.getElements().get(Constants.ANQPElementType.ANQPVenueName);
if (venueNameElement == null
|| venueUrlElement.getVenueUrls().size() != venueNameElement.getNames().size()) {
Log.w(TAG, "Venue name list size mismatches the Venue URL list size");
return null; // No match between Venue names Venue URLs
}
// Find the Venue URL that matches the system language. Venue URLs are ordered by venue
// names.
Locale locale = Locale.getDefault();
URL venueUrl = null;
int index = 1;
for (I18Name venueName : venueNameElement.getNames()) {
if (venueName.getLanguage().equals(locale.getISO3Language())) {
venueUrl = venueUrlElement.getVenueUrls().get(index);
break;
}
index++;
}
// If no venue URL for the system language is available, use entry number one
if (venueUrl == null) {
venueUrl = venueUrlElement.getVenueUrls().get(1);
}
if (mVerboseLoggingEnabled) {
Log.d(TAG, "Venue URL to display (language = " + locale.getDisplayLanguage()
+ "): " + (venueUrl != null ? venueUrl : "None"));
}
return venueUrl;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getVenueUrl
File: service/java/com/android/server/wifi/hotspot2/PasspointManager.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-120"
] |
CVE-2023-21243
|
MEDIUM
| 5.5
|
android
|
getVenueUrl
|
service/java/com/android/server/wifi/hotspot2/PasspointManager.java
|
5b49b8711efaadadf5052ba85288860c2d7ca7a6
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
protected HttpEntity getRequestEntity() throws IOException, MessageInvalidException {
try {
final XmlSerializer s = Xml.newSerializer();
final ByteArrayOutputStream os = new ByteArrayOutputStream(1024);
s.setOutput(os, "UTF-8");
s.startDocument("UTF-8", false);
s.startTag(null, "Autodiscover");
s.attribute(null, "xmlns", AUTO_DISCOVER_SCHEMA_PREFIX + "requestschema/2006");
s.startTag(null, "Request");
s.startTag(null, "EMailAddress").text(mUsername).endTag(null, "EMailAddress");
s.startTag(null, "AcceptableResponseSchema");
s.text(AUTO_DISCOVER_SCHEMA_PREFIX + "responseschema/2006");
s.endTag(null, "AcceptableResponseSchema");
s.endTag(null, "Request");
s.endTag(null, "Autodiscover");
s.endDocument();
return new StringEntity(os.toString());
} catch (final IOException e) {
// For all exception types, we can simply punt on autodiscover.
} catch (final IllegalArgumentException e) {
} catch (final IllegalStateException e) {
}
return null;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getRequestEntity
File: src/com/android/exchange/eas/EasAutoDiscover.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-200"
] |
CVE-2016-2415
|
HIGH
| 7.1
|
android
|
getRequestEntity
|
src/com/android/exchange/eas/EasAutoDiscover.java
|
0d1a38b1755efe7ed4e8d7302a24186616bba9b2
| 0
|
Analyze the following code function for security vulnerabilities
|
private String followRedirect(String meetingId, String redirectUrl,
int redirectCount, String origUrl) {
if (redirectCount > MAX_REDIRECTS) {
log.error("Max redirect reached for meeting=[{}] with url=[{}]",
meetingId, origUrl);
return null;
}
if(!isValidRedirectUrl(redirectUrl)) return null;
URL presUrl;
try {
presUrl = new URL(redirectUrl);
} catch (MalformedURLException e) {
log.error("Malformed url=[{}] for meeting=[{}]", redirectUrl, meetingId, e);
return null;
}
HttpURLConnection conn;
try {
conn = (HttpURLConnection) presUrl.openConnection();
conn.setReadTimeout(60000);
conn.addRequestProperty("Accept-Language", "en-US,en;q=0.8");
conn.addRequestProperty("User-Agent", "Mozilla");
// normally, 3xx is redirect
int status = conn.getResponseCode();
if (status != HttpURLConnection.HTTP_OK) {
if (status == HttpURLConnection.HTTP_MOVED_TEMP
|| status == HttpURLConnection.HTTP_MOVED_PERM
|| status == HttpURLConnection.HTTP_SEE_OTHER) {
String newUrl = conn.getHeaderField("Location");
return followRedirect(meetingId, newUrl, redirectCount + 1,
origUrl);
} else {
log.error(
"Invalid HTTP response=[{}] for url=[{}] with meeting[{}]",
status, redirectUrl, meetingId);
return null;
}
} else {
return redirectUrl;
}
} catch (IOException e) {
log.error("IOException for url=[{}] with meeting[{}]", redirectUrl, meetingId, e);
return null;
}
}
|
Vulnerability Classification:
- CWE: CWE-918
- CVE: CVE-2023-43798
- Severity: MEDIUM
- CVSS Score: 5.4
Description: Fix: Getting final Url (from redirect) on presentation upload
Function: followRedirect
File: bbb-common-web/src/main/java/org/bigbluebutton/presentation/PresentationUrlDownloadService.java
Repository: bigbluebutton
Fixed Code:
private String followRedirect(String meetingId, String redirectUrl,
int redirectCount, String origUrl) {
if (redirectCount > MAX_REDIRECTS) {
log.error("Max redirect reached for meeting=[{}] with url=[{}]",
meetingId, origUrl);
return null;
}
if(!isValidRedirectUrl(redirectUrl)) return null;
URL presUrl;
try {
presUrl = new URL(redirectUrl);
} catch (MalformedURLException e) {
log.error("Malformed url=[{}] for meeting=[{}]", redirectUrl, meetingId, e);
return null;
}
HttpURLConnection conn;
try {
conn = (HttpURLConnection) presUrl.openConnection();
conn.setReadTimeout(60000);
conn.addRequestProperty("Accept-Language", "en-US,en;q=0.8");
conn.addRequestProperty("User-Agent", "Mozilla");
conn.setInstanceFollowRedirects(false);
// normally, 3xx is redirect
int status = conn.getResponseCode();
if (status != HttpURLConnection.HTTP_OK) {
if (status == HttpURLConnection.HTTP_MOVED_TEMP
|| status == HttpURLConnection.HTTP_MOVED_PERM
|| status == HttpURLConnection.HTTP_SEE_OTHER) {
String newUrl = conn.getHeaderField("Location");
return followRedirect(meetingId, newUrl, redirectCount + 1,
origUrl);
} else {
log.error(
"Invalid HTTP response=[{}] for url=[{}] with meeting[{}]",
status, redirectUrl, meetingId);
return null;
}
} else {
return redirectUrl;
}
} catch (IOException e) {
log.error("IOException for url=[{}] with meeting[{}]", redirectUrl, meetingId, e);
return null;
}
}
|
[
"CWE-918"
] |
CVE-2023-43798
|
MEDIUM
| 5.4
|
bigbluebutton
|
followRedirect
|
bbb-common-web/src/main/java/org/bigbluebutton/presentation/PresentationUrlDownloadService.java
|
02ba4c6ff8e78a0f4384ad1b7c7367c5a90376e8
| 1
|
Analyze the following code function for security vulnerabilities
|
private void setVisibilityOfLowerDialogArea(boolean isVisible) {
mHorizontalSeparator.setVisibility(isVisible ? View.VISIBLE : View.GONE);
mLowerDialogArea.setVisibility(isVisible ? View.VISIBLE : View.GONE);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setVisibilityOfLowerDialogArea
File: chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java
Repository: chromium
The code follows secure coding practices.
|
[
"CWE-20"
] |
CVE-2015-1261
|
MEDIUM
| 5
|
chromium
|
setVisibilityOfLowerDialogArea
|
chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java
|
5bf8a2dccf4777c5f065d918d1d9a2bbaa013f9f
| 0
|
Analyze the following code function for security vulnerabilities
|
protected static TomlMapper newTomlMapper(TomlFactory tomlFactory) {
return new TomlMapper(tomlFactory);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: newTomlMapper
File: toml/src/test/java/com/fasterxml/jackson/dataformat/toml/TomlMapperTestBase.java
Repository: FasterXML/jackson-dataformats-text
The code follows secure coding practices.
|
[
"CWE-787"
] |
CVE-2023-3894
|
HIGH
| 7.5
|
FasterXML/jackson-dataformats-text
|
newTomlMapper
|
toml/src/test/java/com/fasterxml/jackson/dataformat/toml/TomlMapperTestBase.java
|
20a209387931dba31e1a027b74976911c3df39fe
| 0
|
Analyze the following code function for security vulnerabilities
|
private List<File> getAllDirectories(String state) {
List<File> allDirectories = new ArrayList<>();
String dir = getDestinationBaseDirectoryName(state);
if ( dir != null ) {
String[] formats = getPlaybackFormats(dir);
for (String format : formats) {
allDirectories.addAll(getDirectories(dir + File.separatorChar + format));
}
}
return allDirectories;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getAllDirectories
File: bbb-common-web/src/main/java/org/bigbluebutton/api/RecordingService.java
Repository: bigbluebutton
The code follows secure coding practices.
|
[
"CWE-22"
] |
CVE-2020-12443
|
HIGH
| 7.5
|
bigbluebutton
|
getAllDirectories
|
bbb-common-web/src/main/java/org/bigbluebutton/api/RecordingService.java
|
b21ca8355a57286a1e6df96984b3a4c57679a463
| 0
|
Analyze the following code function for security vulnerabilities
|
public void skipPast(String to) {
this.myIndex = this.mySource.indexOf(to, this.myIndex);
if (this.myIndex < 0) {
this.myIndex = this.mySource.length();
} else {
this.myIndex += to.length();
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: skipPast
File: src/main/java/org/codehaus/jettison/json/JSONTokener.java
Repository: jettison-json/jettison
The code follows secure coding practices.
|
[
"CWE-674",
"CWE-787"
] |
CVE-2022-45693
|
HIGH
| 7.5
|
jettison-json/jettison
|
skipPast
|
src/main/java/org/codehaus/jettison/json/JSONTokener.java
|
cf6a4a1f85416b49b16a5b0c5c0bb81a4833dbc8
| 0
|
Analyze the following code function for security vulnerabilities
|
public PropertyClass getPropertyClassFromName(String propPath, XWikiContext context)
{
int i1 = propPath.indexOf('_');
if (i1 == -1) {
return null;
} else {
String className = propPath.substring(0, i1);
String propName = propPath.substring(i1 + 1);
try {
return (PropertyClass) getDocument(className, context).getXClass().get(propName);
} catch (XWikiException e) {
return null;
}
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getPropertyClassFromName
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
|
getPropertyClassFromName
|
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 int getInputMethodWindowVisibleHeight() {
synchronized (mWindowMap) {
return mPolicy.getInputMethodWindowVisibleHeightLw();
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getInputMethodWindowVisibleHeight
File: services/core/java/com/android/server/wm/WindowManagerService.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-264"
] |
CVE-2016-3875
|
HIGH
| 7.2
|
android
|
getInputMethodWindowVisibleHeight
|
services/core/java/com/android/server/wm/WindowManagerService.java
|
69729fa8b13cadbf3173fe1f389fe4f3b7bd0f9c
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
// ------------------------------------------------------------------------------
// Handle WebSocket frames
// ------------------------------------------------------------------------------
if (msg instanceof WebSocketFrame) {
handleWebsocketFrame(ctx, (WebSocketFrame) msg);
return;
}
// ------------------------------------------------------------------------------
// Decode HTTP headers
// ------------------------------------------------------------------------------
boolean requestComplete = false;
try {
if (msg instanceof HttpRequest) {
HttpRequest httpReq = (HttpRequest) msg;
// System.out.println("REQUEST: " + httpReq.getUri());
// Start a new request
request = new Request(httpReq);
// Handle expect-100-continue
boolean expect100Continue = false;
List<CharSequence> allExpectHeaders = httpReq.headers().getAll(EXPECT);
for (int i = 0; i < allExpectHeaders.size(); i++) {
String h = allExpectHeaders.get(i).toString();
if (h.equalsIgnoreCase("100-continue")) {
expect100Continue = true;
break;
}
}
if (expect100Continue) {
ctx.writeAndFlush(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE,
Unpooled.EMPTY_BUFFER));
requestComplete = true;
return;
}
closeAfterWrite = !HttpHeaderUtil.isKeepAlive(httpReq);
addKeepAliveHeader = !closeAfterWrite && httpReq.protocolVersion().equals(HttpVersion.HTTP_1_0);
if (httpReq.method() == HttpMethod.POST) {
// Start decoding HttpContent chunks
destroyDecoder();
decoder = new HttpPostRequestDecoder(factory, httpReq);
} else {
// Non-POST (probably GET) -- start handling the request
requestComplete = true;
}
// TODO: will this return failure before all POST chunks have been received?
if (!httpReq.decoderResult().isSuccess()) {
sendHttpErrorResponse(ctx, httpReq, new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
HttpResponseStatus.BAD_REQUEST));
requestComplete = true;
return;
}
}
// ------------------------------------------------------------------------------
// Decode HTTP POST body
// ------------------------------------------------------------------------------
if (msg instanceof HttpContent && decoder != null) {
HttpContent chunk = (HttpContent) msg;
// Offer chunk to decoder (this decreases refcount of chunk, so it doesn't have to
// be separately released). Decoder is released after message has been handled.
decoder.offer(chunk);
try {
while (decoder.hasNext()) {
InterfaceHttpData data = decoder.next();
if (data != null) {
HttpDataType httpDataType = data.getHttpDataType();
if (httpDataType == HttpDataType.Attribute) {
try {
Attribute attribute = (Attribute) data;
request.setPostParam(attribute.getName(), attribute.getString(attribute
.getCharset() == null ? Charset.forName("UTF-8") : attribute.getCharset()));
} finally {
// Decrease refcount, freeing data
data.release();
}
} else if (httpDataType == HttpDataType.FileUpload) {
FileUpload fileUpload = (FileUpload) data;
// TODO consider imposing size limit and returning 413 (Request Entity Too
// Large) once the amount of data that has been sent hits the limit
if (fileUpload.isCompleted()) {
// Save the FileUpload object (which wraps a DiskFileUpload in /tmp).
// Need to release this resource later.
request.setPostFileUploadParam(fileUpload.getName(), fileUpload);
}
} else {
Log.warning("Got unknown data chunk type: " + httpDataType);
}
}
}
} catch (EndOfDataDecoderException e) {
// Apparently decoder.hasNext() doesn't actually work
}
if (chunk instanceof LastHttpContent) {
requestComplete = true;
}
}
if (!requestComplete) {
// Wait for more chunks.
// (Since requestComplete is false, calling return here will not call destroyDecoder()
// in the finally block, so it will still exist when the next chunk is received.)
return;
}
// ------------------------------------------------------------------------------
// Figure out how to handle HTTP request
// ------------------------------------------------------------------------------
// All POST chunks have been received (or there are no chunks); ready to start handling the request
String origReqURI = request.getURI();
// If this is a hash URI, look up original URI whose served resource was hashed to give this hash URI.
// We only need to serve the resource at a hash URI once per resource per client, since resources served
// from hash URIs are indefinitely cached in the browser.
String hashKey = CacheExtension.getHashKey(origReqURI);
boolean isHashURI = hashKey != null;
String reqURI = isHashURI ? CacheExtension.getOrigURI(origReqURI) : origReqURI;
InetSocketAddress requestor = (InetSocketAddress) ctx.channel().remoteAddress();
if (requestor != null) {
InetAddress address = requestor.getAddress();
if (address != null) {
request.setRequestor(address.getHostAddress());
}
}
boolean isHEAD = request.getMethod() == HttpMethod.HEAD;
// Run the GET method if HEAD is requested, just don't return a body.
HttpMethod origReqMethod = request.getMethod();
if (isHEAD) {
request.setMethod(HttpMethod.GET);
}
// ------------------------------------------------------------------------------
// Authenticate user
// ------------------------------------------------------------------------------
// The response object generated by a RestHandler
Response response = null;
// Call route handlers until one is able to handle the route,
// or until we run out of handlers
User user = null;
RouteInfo authorizedRoute = null;
ArrayList<RouteInfo> allRoutes = GribbitServer.siteResources.getAllRoutes();
for (int i = 0, n = allRoutes.size(); i < n; i++) {
RouteInfo route = allRoutes.get(i);
// If the request URI matches this route path
if (route.matches(reqURI)) {
Class<? extends RouteHandler> handler = route.getHandler();
if (!(request.getMethod() == HttpMethod.GET || request.getMethod() == HttpMethod.POST)) {
// We only support GET and POST at this point
Log.error("Unsupported HTTP method " + request.getMethod().name() + " for path " + reqURI);
response = new ErrorResponse(HttpResponseStatus.METHOD_NOT_ALLOWED, "HTTP method not allowed");
} else if ((request.getMethod() == HttpMethod.GET && !route.hasGetMethod())
|| (request.getMethod() == HttpMethod.POST && !route.hasPostMethod())) {
// Tried to call an HTTP method that is not defined for this route
Log.error("HTTP method " + request.getMethod().name() + " not implemented in handler "
+ handler.getName());
response = new ErrorResponse(HttpResponseStatus.METHOD_NOT_ALLOWED, "HTTP method not allowed");
} else if (RouteHandlerAuthRequired.class.isAssignableFrom(handler)) {
// This handler requires authentication -- check if user is logged in
user = User.getLoggedInUser(request);
if (user == null) {
// User is not logged in: handle request with OnUnauthorized handler instead
response =
getResponseForErrorHandlerRoute(GribbitServer.siteResources.getUnauthorizedRoute(),
request, user)
// Redirect the user back to the page they were trying to get to once they
// do manage to log in successfully
.setCookie(
new Cookie(Cookie.REDIRECT_AFTER_LOGIN_COOKIE_NAME, "/", reqURI,
300));
} else if (RouteHandlerAuthAndValidatedEmailRequired.class.isAssignableFrom(handler)
&& !user.emailIsValidated()) {
// User is logged in, but their email address has not been validated:
// handle request with EmailNotValidated handler instead
response =
getResponseForErrorHandlerRoute(
GribbitServer.siteResources.getEmailNotValidatedRoute(), request, user);
} else {
// Authorization required and user logged in: OK to handle request
// with this route
authorizedRoute = route;
}
} else {
// Authorization not required -- OK to handle request with this route
authorizedRoute = route;
}
// URI matches, so don't need to search further URIs
break;
}
}
// ------------------------------------------------------------------------------
// Complete websocket handshake if requested
// ------------------------------------------------------------------------------
if (response == null && authorizedRoute == null && msg instanceof HttpRequest
// TODO: Read WS routes from class annotations
&& reqURI.endsWith("/websocket")) {
HttpRequest httpReq = (HttpRequest) msg;
// Record which user was authenticated (if any) when websocket upgrade request was made.
// TODO: Reject WS upgrade request for websockets that require authentication.
// TODO: Also provide a means for revoking WS login.
wsAuthenticatedUser = User.getLoggedInUser(request);
WebSocketServerHandshakerFactory wsFactory =
new WebSocketServerHandshakerFactory(GribbitServer.wsUri.toString(), null, true);
handshaker = wsFactory.newHandshaker(httpReq);
if (handshaker == null) {
WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(ctx.channel());
} else {
// Attempt websocket handshake, and if it succeeds, upgrade connection to websocket
// TODO: filed bug report, handshaker.handshake should take HttpRequest, not FullHttpRequest
DefaultFullHttpRequest fullReq =
new DefaultFullHttpRequest(httpReq.protocolVersion(), httpReq.method(), httpReq.uri());
fullReq.headers().add(httpReq.headers());
handshaker.handshake(ctx.channel(), (FullHttpRequest) fullReq);
}
return;
}
// ------------------------------------------------------------------------------
// Handle static file requests
// ------------------------------------------------------------------------------
// If no error has occurred so far, and no route handler matched the request URI, and this is a
// GET request, then see if the URI points to a static file resource, and if so, serve the file.
if (response == null && authorizedRoute == null) {
// Static file requests can only use GET method
if (request.getMethod() != HttpMethod.GET) {
sendHttpErrorResponse(ctx, null, new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
HttpResponseStatus.FORBIDDEN));
return;
}
File staticResourceFile = GribbitServer.siteResources.getStaticResource(reqURI);
if (staticResourceFile == null) {
// Neither a route handler nor a static resource matched the request URI.
// Return 404 Not Found.
response =
getResponseForErrorHandlerRoute(GribbitServer.siteResources.getNotFoundRoute(), request,
user);
} else {
// A static resource matched the request URI, check last-modified timestamp
// against the If-Modified-Since header timestamp in the request.
long lastModifiedEpochSeconds = staticResourceFile.lastModified() / 1000;
if (!request.cachedVersionIsOlderThan(lastModifiedEpochSeconds)) {
// File has not been modified since it was last cached -- return Not Modified
response = new NotModifiedResponse(lastModifiedEpochSeconds);
} else {
// If file is newer than what is in the browser cache, or is not in cache, serve the file
serveStaticFile(reqURI, hashKey, staticResourceFile, lastModifiedEpochSeconds, ctx);
Log.fine(request.getRequestor() + "\t" + origReqMethod + "\t" + reqURI + "\tfile://"
+ staticResourceFile.getPath() + "\t" + HttpResponseStatus.OK + "\t"
+ (System.currentTimeMillis() - request.getReqReceivedTimeEpochMillis()) + " msec");
// Finished request
return;
}
}
}
// ------------------------------------------------------------------------------
// Handle GET or POST requests
// ------------------------------------------------------------------------------
ZonedDateTime timeNow = null;
// If an error response hasn't yet been generated and this is a (non-static-file) GET or POST request,
// then call the get() or post() method for the route handler bound to the request URI to obtain the
// response object.
boolean hashTheResponse = false;
long hashKeyRemainingAgeSeconds = 0;
if (response == null && authorizedRoute != null) {
// ----------------------------------
// See if response should be hashed
// ----------------------------------
// For hashed *non-file* URIs, the actual last modified timestamp of dynamically-served
// content can't be read directly, so read the last modified timestamp stored for the
// previously hashed version in the CacheExtension class, as long as the max age of the
// cached version hasn't been exceeded, and see if the last modified timestamp is more
// recent than the version cached in the browser.
//
// The important ramification of this is that when the resource identified by the non-file
// URI changes, the CacheExtension class must be notified of that change (including in cases
// where the database is modified by another database client) if the modified version should
// start being served at a new hash URI immediately, otherwise the web client connected to
// this web server will continue to serve old resources until the max age of the cached
// content is exceeded.
if (isHashURI) {
HashInfo hashInfo = CacheExtension.getHashInfo(reqURI);
if (hashInfo != null) {
long lastModifiedEpochSeconds = hashInfo.getLastModifiedEpochSeconds();
timeNow = ZonedDateTime.now();
long timeNowEpochSeconds = timeNow.toEpochSecond();
long maxAgeSeconds = authorizedRoute.getMaxAgeSeconds();
hashKeyRemainingAgeSeconds = lastModifiedEpochSeconds + maxAgeSeconds - timeNowEpochSeconds;
if (maxAgeSeconds == 0) {
// Content is not hash-cached
hashKeyRemainingAgeSeconds = 0;
}
if (maxAgeSeconds > 0 && hashKeyRemainingAgeSeconds <= 0) {
// Resource has expired -- call the route handler to generate a new response rather
// than serving a Not Modified response, and schedule the response to be hashed or
// re-hashed once the response has been generated.
hashTheResponse = true;
// Reset the expiry time at the requested number of seconds in the future
hashKeyRemainingAgeSeconds = maxAgeSeconds;
} else if (!request.cachedVersionIsOlderThan(lastModifiedEpochSeconds)) {
// Resource has not expired in cache, but client has requested it anyway.
// However, resource has not been modified since it was last hashed --
// return Not Modified.
response = new NotModifiedResponse(lastModifiedEpochSeconds);
} else {
// Resource has not expired in cache, but client has requested it anyway.
// Resource *has* been modified since it was last hashed -- serve it the
// normal way using the route handler, but don't hash the response, since
// it has not expired yet.
}
} else {
// There is no original URI matching this hash URI, so the hash key was stale
// (i.e. a URI whose hashcode has been spoofed, or a very old hashcode from
// the previous time the server was run), but we still got a valid request URI
// by stripping away the hash code, so that is served below in the normal way.
}
}
// If the response wasn't just set to "Not Modified" above, serve the request
if (response == null) {
// -----------------------------------------------------------------
// Call the route handler for this request, generating the response
// -----------------------------------------------------------------
response = getResponseForRoute(authorizedRoute, request, user);
if (response == null) {
// Should not happen
throw new RuntimeException("Didn't generate a response");
}
}
}
if (response == null) {
// Should not happen
throw new RuntimeException("Didn't generate a response");
}
// ------------------------------------------------------------------------------------
// Serve an HTTP result (except in the case of static files, they were served already)
// ------------------------------------------------------------------------------------
// Turn the Response object into an HttpResponse object and serve it to the user over Netty.
if (timeNow == null) {
timeNow = ZonedDateTime.now();
}
// Serve the response to the client
serveHttpResponse(reqURI, response, isHEAD, request.acceptEncodingGzip(),//
timeNow, hashTheResponse, hashKeyRemainingAgeSeconds, hashKey, ctx);
// Log the request and response
HttpResponseStatus status = response.getStatus();
String logMsg =
request.getRequestor() + "\t" + origReqMethod + "\t" + reqURI
+ (request.getMethod() == origReqMethod ? "" : "\t" + request.getMethod()) + "\t" + status
+ "\t" + (System.currentTimeMillis() - request.getReqReceivedTimeEpochMillis()) + " msec";
if (status == HttpResponseStatus.OK //
|| status == HttpResponseStatus.NOT_MODIFIED //
|| status == HttpResponseStatus.FOUND //
|| (status == HttpResponseStatus.NOT_FOUND //
&& (reqURI.equals("favicon.ico") || reqURI.endsWith("/favicon.ico")))) {
// Log at level "fine" for non-errors, or 404 for favicon
Log.fine(logMsg);
} else {
// Log at level "warning" for errors, or 404 for non-favicon
Log.warningWithoutCallerRef(logMsg);
}
} finally {
if (requestComplete) {
// Finished request -- destroy the multipart decoder and remove temporary files
destroyDecoder();
}
}
}
|
Vulnerability Classification:
- CWE: CWE-346
- CVE: CVE-2014-125071
- Severity: MEDIUM
- CVSS Score: 5.2
Description: Protect against CSWSH: (Cross-Site WebSocket Hijacking)
Function: messageReceived
File: src/gribbit/request/HttpRequestHandler.java
Repository: lukehutch/gribbit
Fixed Code:
@Override
public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
// ------------------------------------------------------------------------------
// Handle WebSocket frames
// ------------------------------------------------------------------------------
if (msg instanceof WebSocketFrame) {
handleWebsocketFrame(ctx, (WebSocketFrame) msg);
return;
}
// ------------------------------------------------------------------------------
// Decode HTTP headers
// ------------------------------------------------------------------------------
boolean requestComplete = false;
try {
if (msg instanceof HttpRequest) {
HttpRequest httpReq = (HttpRequest) msg;
// System.out.println("REQUEST: " + httpReq.getUri());
// Start a new request
request = new Request(httpReq);
// Handle expect-100-continue
boolean expect100Continue = false;
List<CharSequence> allExpectHeaders = httpReq.headers().getAll(EXPECT);
for (int i = 0; i < allExpectHeaders.size(); i++) {
String h = allExpectHeaders.get(i).toString();
if (h.equalsIgnoreCase("100-continue")) {
expect100Continue = true;
break;
}
}
if (expect100Continue) {
ctx.writeAndFlush(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE,
Unpooled.EMPTY_BUFFER));
requestComplete = true;
return;
}
closeAfterWrite = !HttpHeaderUtil.isKeepAlive(httpReq);
addKeepAliveHeader = !closeAfterWrite && httpReq.protocolVersion().equals(HttpVersion.HTTP_1_0);
if (httpReq.method() == HttpMethod.POST) {
// Start decoding HttpContent chunks
destroyDecoder();
decoder = new HttpPostRequestDecoder(factory, httpReq);
} else {
// Non-POST (probably GET) -- start handling the request
requestComplete = true;
}
// TODO: will this return failure before all POST chunks have been received?
if (!httpReq.decoderResult().isSuccess()) {
sendHttpErrorResponse(ctx, httpReq, new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
HttpResponseStatus.BAD_REQUEST));
requestComplete = true;
return;
}
}
// ------------------------------------------------------------------------------
// Decode HTTP POST body
// ------------------------------------------------------------------------------
if (msg instanceof HttpContent && decoder != null) {
HttpContent chunk = (HttpContent) msg;
// Offer chunk to decoder (this decreases refcount of chunk, so it doesn't have to
// be separately released). Decoder is released after message has been handled.
decoder.offer(chunk);
try {
while (decoder.hasNext()) {
InterfaceHttpData data = decoder.next();
if (data != null) {
HttpDataType httpDataType = data.getHttpDataType();
if (httpDataType == HttpDataType.Attribute) {
try {
Attribute attribute = (Attribute) data;
request.setPostParam(attribute.getName(), attribute.getString(attribute
.getCharset() == null ? Charset.forName("UTF-8") : attribute.getCharset()));
} finally {
// Decrease refcount, freeing data
data.release();
}
} else if (httpDataType == HttpDataType.FileUpload) {
FileUpload fileUpload = (FileUpload) data;
// TODO consider imposing size limit and returning 413 (Request Entity Too
// Large) once the amount of data that has been sent hits the limit
if (fileUpload.isCompleted()) {
// Save the FileUpload object (which wraps a DiskFileUpload in /tmp).
// Need to release this resource later.
request.setPostFileUploadParam(fileUpload.getName(), fileUpload);
}
} else {
Log.warning("Got unknown data chunk type: " + httpDataType);
}
}
}
} catch (EndOfDataDecoderException e) {
// Apparently decoder.hasNext() doesn't actually work
}
if (chunk instanceof LastHttpContent) {
requestComplete = true;
}
}
if (!requestComplete) {
// Wait for more chunks.
// (Since requestComplete is false, calling return here will not call destroyDecoder()
// in the finally block, so it will still exist when the next chunk is received.)
return;
}
// ------------------------------------------------------------------------------
// Figure out how to handle HTTP request
// ------------------------------------------------------------------------------
// All POST chunks have been received (or there are no chunks); ready to start handling the request
String origReqURI = request.getURI();
// If this is a hash URI, look up original URI whose served resource was hashed to give this hash URI.
// We only need to serve the resource at a hash URI once per resource per client, since resources served
// from hash URIs are indefinitely cached in the browser.
String hashKey = CacheExtension.getHashKey(origReqURI);
boolean isHashURI = hashKey != null;
String reqURI = isHashURI ? CacheExtension.getOrigURI(origReqURI) : origReqURI;
InetSocketAddress requestor = (InetSocketAddress) ctx.channel().remoteAddress();
if (requestor != null) {
InetAddress address = requestor.getAddress();
if (address != null) {
request.setRequestor(address.getHostAddress());
}
}
boolean isHEAD = request.getMethod() == HttpMethod.HEAD;
// Run the GET method if HEAD is requested, just don't return a body.
HttpMethod origReqMethod = request.getMethod();
if (isHEAD) {
request.setMethod(HttpMethod.GET);
}
// ------------------------------------------------------------------------------
// Authenticate user
// ------------------------------------------------------------------------------
// The response object generated by a RestHandler
Response response = null;
// Call route handlers until one is able to handle the route,
// or until we run out of handlers
User user = null;
RouteInfo authorizedRoute = null;
ArrayList<RouteInfo> allRoutes = GribbitServer.siteResources.getAllRoutes();
for (int i = 0, n = allRoutes.size(); i < n; i++) {
RouteInfo route = allRoutes.get(i);
// If the request URI matches this route path
if (route.matches(reqURI)) {
Class<? extends RouteHandler> handler = route.getHandler();
if (!(request.getMethod() == HttpMethod.GET || request.getMethod() == HttpMethod.POST)) {
// We only support GET and POST at this point
Log.error("Unsupported HTTP method " + request.getMethod().name() + " for path " + reqURI);
response = new ErrorResponse(HttpResponseStatus.METHOD_NOT_ALLOWED, "HTTP method not allowed");
} else if ((request.getMethod() == HttpMethod.GET && !route.hasGetMethod())
|| (request.getMethod() == HttpMethod.POST && !route.hasPostMethod())) {
// Tried to call an HTTP method that is not defined for this route
Log.error("HTTP method " + request.getMethod().name() + " not implemented in handler "
+ handler.getName());
response = new ErrorResponse(HttpResponseStatus.METHOD_NOT_ALLOWED, "HTTP method not allowed");
} else if (RouteHandlerAuthRequired.class.isAssignableFrom(handler)) {
// This handler requires authentication -- check if user is logged in
user = User.getLoggedInUser(request);
if (user == null) {
// User is not logged in: handle request with OnUnauthorized handler instead
response =
getResponseForErrorHandlerRoute(GribbitServer.siteResources.getUnauthorizedRoute(),
request, user)
// Redirect the user back to the page they were trying to get to once they
// do manage to log in successfully
.setCookie(
new Cookie(Cookie.REDIRECT_AFTER_LOGIN_COOKIE_NAME, "/", reqURI,
300));
} else if (RouteHandlerAuthAndValidatedEmailRequired.class.isAssignableFrom(handler)
&& !user.emailIsValidated()) {
// User is logged in, but their email address has not been validated:
// handle request with EmailNotValidated handler instead
response =
getResponseForErrorHandlerRoute(
GribbitServer.siteResources.getEmailNotValidatedRoute(), request, user);
} else {
// Authorization required and user logged in: OK to handle request
// with this route
authorizedRoute = route;
}
} else {
// Authorization not required -- OK to handle request with this route
authorizedRoute = route;
}
// URI matches, so don't need to search further URIs
break;
}
}
// ------------------------------------------------------------------------------
// Complete websocket handshake if requested
// ------------------------------------------------------------------------------
// FIXME: Make these into class annotations
String websocketPath = "/websocket";
boolean isAuthenticatedWebsocket = true;
if (response == null && authorizedRoute == null && msg instanceof HttpRequest
// TODO: Read WS routes from class annotations, rather than using hardcoded "/websocket"
&& reqURI.endsWith(websocketPath)) {
HttpRequest httpReq = (HttpRequest) msg;
// Protect against CSWSH: (Cross-Site WebSocket Hijacking)
// http://www.christian-schneider.net/CrossSiteWebSocketHijacking.html
// http://tools.ietf.org/html/rfc6455#page-7
CharSequence origin = request.getOrigin();
URI originUri = null;
if (origin != null && origin.length() > 0) {
try {
// Try parsing origin URI
originUri = new URI(origin.toString());
} catch (Exception e) {
}
}
// If port number is set but it is the default for the URI scheme, revert the port number
// back to -1 (which means unspecified), so that it matches the server port number,
// which is unspecified when serving http on port 80 and https on port 443
int originPort = originUri == null ? -1 //
: originUri.getPort() == 80 && "http".equals(originUri.getScheme()) ? -1 //
: originUri.getPort() == 443 && "https".equals(originUri.getScheme()) ? -1 //
: originUri.getPort();
// Scheme, host and port all must match to forbid cross-origin requests
if (originUri == null //
|| !GribbitServer.uri.getScheme().equals(originUri.getScheme()) //
|| !GribbitServer.uri.getHost().equals(originUri.getHost()) //
|| GribbitServer.uri.getPort() != originPort) { //
// Reject scripted requests to open this websocket from a different domain
sendHttpErrorResponse(ctx, null, new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
HttpResponseStatus.FORBIDDEN));
return;
}
// Log.info("Origin: " + origin.toString());
if (isAuthenticatedWebsocket) {
// For authenticated websockets, check if the user is logged in
User loggedInUser = User.getLoggedInUser(request);
if (loggedInUser == null) {
// Not logged in, so can't connect to this websocket
sendHttpErrorResponse(ctx, null, new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
HttpResponseStatus.FORBIDDEN));
return;
}
// To further mitigate CSWSH attacks: check for the CSRF token in the URL parameter "_csrf";
// the passed token must match the user's CSRF token. This means the websocket URL has to
// be dynamically generated and inserted into the webpage that opened the websocket.
// TODO: generate this URL an insert into the page somehow
String csrfTok = loggedInUser.csrfTok;
if (csrfTok == null || csrfTok.isEmpty() || csrfTok.equals(CSRF.CSRF_TOKEN_UNKNOWN)
|| csrfTok.equals(CSRF.CSRF_TOKEN_PLACEHOLDER)) {
// No valid CSRF token in User object
sendHttpErrorResponse(ctx, null, new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
HttpResponseStatus.FORBIDDEN));
return;
}
String csrfParam = request.getQueryParam("_csrf");
if (csrfParam == null || csrfParam.isEmpty() || !csrfParam.equals(csrfTok)) {
// The CSRF URL query parameter is missing, or doesn't match the user's token
sendHttpErrorResponse(ctx, null, new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
HttpResponseStatus.FORBIDDEN));
return;
}
// Record which user was authenticated when the websocket upgrade request was made.
// TODO: Also provide a means for revoking user's session while WS is still open,
// e.g. poll the user table every few seconds to see if user's session token has
// changed in the database? (Although this would mean that logging in on a new
// device would log you out of all other sessions...)
wsAuthenticatedUser = loggedInUser;
}
WebSocketServerHandshakerFactory wsFactory =
new WebSocketServerHandshakerFactory(GribbitServer.wsUri.toString(), null, true);
handshaker = wsFactory.newHandshaker(httpReq);
if (handshaker == null) {
WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(ctx.channel());
} else {
// Attempt websocket handshake, and if it succeeds, upgrade connection to websocket
// TODO: filed bug report, handshaker.handshake should take HttpRequest, not FullHttpRequest
DefaultFullHttpRequest fullReq =
new DefaultFullHttpRequest(httpReq.protocolVersion(), httpReq.method(), httpReq.uri());
fullReq.headers().add(httpReq.headers());
handshaker.handshake(ctx.channel(), (FullHttpRequest) fullReq);
}
return;
}
// ------------------------------------------------------------------------------
// Handle static file requests
// ------------------------------------------------------------------------------
// If no error has occurred so far, and no route handler matched the request URI, and this is a
// GET request, then see if the URI points to a static file resource, and if so, serve the file.
if (response == null && authorizedRoute == null) {
// Static file requests can only use GET method
if (request.getMethod() != HttpMethod.GET) {
sendHttpErrorResponse(ctx, null, new DefaultFullHttpResponse(HttpVersion.HTTP_1_1,
HttpResponseStatus.FORBIDDEN));
return;
}
File staticResourceFile = GribbitServer.siteResources.getStaticResource(reqURI);
if (staticResourceFile == null) {
// Neither a route handler nor a static resource matched the request URI.
// Return 404 Not Found.
response =
getResponseForErrorHandlerRoute(GribbitServer.siteResources.getNotFoundRoute(), request,
user);
} else {
// A static resource matched the request URI, check last-modified timestamp
// against the If-Modified-Since header timestamp in the request.
long lastModifiedEpochSeconds = staticResourceFile.lastModified() / 1000;
if (!request.cachedVersionIsOlderThan(lastModifiedEpochSeconds)) {
// File has not been modified since it was last cached -- return Not Modified
response = new NotModifiedResponse(lastModifiedEpochSeconds);
} else {
// If file is newer than what is in the browser cache, or is not in cache, serve the file
serveStaticFile(reqURI, hashKey, staticResourceFile, lastModifiedEpochSeconds, ctx);
Log.fine(request.getRequestor() + "\t" + origReqMethod + "\t" + reqURI + "\tfile://"
+ staticResourceFile.getPath() + "\t" + HttpResponseStatus.OK + "\t"
+ (System.currentTimeMillis() - request.getReqReceivedTimeEpochMillis()) + " msec");
// Finished request
return;
}
}
}
// ------------------------------------------------------------------------------
// Handle GET or POST requests
// ------------------------------------------------------------------------------
ZonedDateTime timeNow = null;
// If an error response hasn't yet been generated and this is a (non-static-file) GET or POST request,
// then call the get() or post() method for the route handler bound to the request URI to obtain the
// response object.
boolean hashTheResponse = false;
long hashKeyRemainingAgeSeconds = 0;
if (response == null && authorizedRoute != null) {
// ----------------------------------
// See if response should be hashed
// ----------------------------------
// For hashed *non-file* URIs, the actual last modified timestamp of dynamically-served
// content can't be read directly, so read the last modified timestamp stored for the
// previously hashed version in the CacheExtension class, as long as the max age of the
// cached version hasn't been exceeded, and see if the last modified timestamp is more
// recent than the version cached in the browser.
//
// The important ramification of this is that when the resource identified by the non-file
// URI changes, the CacheExtension class must be notified of that change (including in cases
// where the database is modified by another database client) if the modified version should
// start being served at a new hash URI immediately, otherwise the web client connected to
// this web server will continue to serve old resources until the max age of the cached
// content is exceeded.
if (isHashURI) {
HashInfo hashInfo = CacheExtension.getHashInfo(reqURI);
if (hashInfo != null) {
long lastModifiedEpochSeconds = hashInfo.getLastModifiedEpochSeconds();
timeNow = ZonedDateTime.now();
long timeNowEpochSeconds = timeNow.toEpochSecond();
long maxAgeSeconds = authorizedRoute.getMaxAgeSeconds();
hashKeyRemainingAgeSeconds = lastModifiedEpochSeconds + maxAgeSeconds - timeNowEpochSeconds;
if (maxAgeSeconds == 0) {
// Content is not hash-cached
hashKeyRemainingAgeSeconds = 0;
}
if (maxAgeSeconds > 0 && hashKeyRemainingAgeSeconds <= 0) {
// Resource has expired -- call the route handler to generate a new response rather
// than serving a Not Modified response, and schedule the response to be hashed or
// re-hashed once the response has been generated.
hashTheResponse = true;
// Reset the expiry time at the requested number of seconds in the future
hashKeyRemainingAgeSeconds = maxAgeSeconds;
} else if (!request.cachedVersionIsOlderThan(lastModifiedEpochSeconds)) {
// Resource has not expired in cache, but client has requested it anyway.
// However, resource has not been modified since it was last hashed --
// return Not Modified.
response = new NotModifiedResponse(lastModifiedEpochSeconds);
} else {
// Resource has not expired in cache, but client has requested it anyway.
// Resource *has* been modified since it was last hashed -- serve it the
// normal way using the route handler, but don't hash the response, since
// it has not expired yet.
}
} else {
// There is no original URI matching this hash URI, so the hash key was stale
// (i.e. a URI whose hashcode has been spoofed, or a very old hashcode from
// the previous time the server was run), but we still got a valid request URI
// by stripping away the hash code, so that is served below in the normal way.
}
}
// If the response wasn't just set to "Not Modified" above, serve the request
if (response == null) {
// -----------------------------------------------------------------
// Call the route handler for this request, generating the response
// -----------------------------------------------------------------
response = getResponseForRoute(authorizedRoute, request, user);
if (response == null) {
// Should not happen
throw new RuntimeException("Didn't generate a response");
}
}
}
if (response == null) {
// Should not happen
throw new RuntimeException("Didn't generate a response");
}
// ------------------------------------------------------------------------------------
// Serve an HTTP result (except in the case of static files, they were served already)
// ------------------------------------------------------------------------------------
// Turn the Response object into an HttpResponse object and serve it to the user over Netty.
if (timeNow == null) {
timeNow = ZonedDateTime.now();
}
// Serve the response to the client
serveHttpResponse(reqURI, response, isHEAD, request.acceptEncodingGzip(),//
timeNow, hashTheResponse, hashKeyRemainingAgeSeconds, hashKey, ctx);
// Log the request and response
HttpResponseStatus status = response.getStatus();
String logMsg =
request.getRequestor() + "\t" + origReqMethod + "\t" + reqURI
+ (request.getMethod() == origReqMethod ? "" : "\t" + request.getMethod()) + "\t" + status
+ "\t" + (System.currentTimeMillis() - request.getReqReceivedTimeEpochMillis()) + " msec";
if (status == HttpResponseStatus.OK //
|| status == HttpResponseStatus.NOT_MODIFIED //
|| status == HttpResponseStatus.FOUND //
|| (status == HttpResponseStatus.NOT_FOUND //
&& (reqURI.equals("favicon.ico") || reqURI.endsWith("/favicon.ico")))) {
// Log at level "fine" for non-errors, or 404 for favicon
Log.fine(logMsg);
} else {
// Log at level "warning" for errors, or 404 for non-favicon
Log.warningWithoutCallerRef(logMsg);
}
} finally {
if (requestComplete) {
// Finished request -- destroy the multipart decoder and remove temporary files
destroyDecoder();
}
}
}
|
[
"CWE-346"
] |
CVE-2014-125071
|
MEDIUM
| 5.2
|
lukehutch/gribbit
|
messageReceived
|
src/gribbit/request/HttpRequestHandler.java
|
620418df247aebda3dd4be1dda10fe229ea505dd
| 1
|
Analyze the following code function for security vulnerabilities
|
@Override
public InternalSerializationService build() {
initVersions();
if (config != null) {
addConfigDataSerializableFactories(dataSerializableFactories, config, classLoader);
addConfigPortableFactories(portableFactories, config, classLoader);
classDefinitions.addAll(config.getClassDefinitions());
}
InputOutputFactory inputOutputFactory = createInputOutputFactory();
InternalSerializationService ss = createSerializationService(inputOutputFactory, notActiveExceptionSupplier);
registerSerializerHooks(ss);
if (config != null) {
if (config.getGlobalSerializerConfig() != null) {
GlobalSerializerConfig globalSerializerConfig = config.getGlobalSerializerConfig();
Serializer serializer = globalSerializerConfig.getImplementation();
if (serializer == null) {
try {
serializer = ClassLoaderUtil.newInstance(classLoader, globalSerializerConfig.getClassName());
} catch (Exception e) {
throw new HazelcastSerializationException(e);
}
}
if (serializer instanceof HazelcastInstanceAware) {
((HazelcastInstanceAware) serializer).setHazelcastInstance(hazelcastInstance);
}
((AbstractSerializationService) ss)
.registerGlobal(serializer, globalSerializerConfig.isOverrideJavaSerialization());
}
}
return ss;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: build
File: hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/DefaultSerializationServiceBuilder.java
Repository: hazelcast
The code follows secure coding practices.
|
[
"CWE-502"
] |
CVE-2016-10750
|
MEDIUM
| 6.8
|
hazelcast
|
build
|
hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/DefaultSerializationServiceBuilder.java
|
c1c31359a1df953e79a9ca9b6c54b3cdbfef11e9
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public ProviderInfo getProviderInfo(ComponentName component, int flags, int userId) {
if (!sUserManager.exists(userId)) return null;
enforceCrossUserPermission(Binder.getCallingUid(), userId, false, false, "get provider info");
synchronized (mPackages) {
PackageParser.Provider p = mProviders.mProviders.get(component);
if (DEBUG_PACKAGE_INFO) Log.v(
TAG, "getProviderInfo " + component + ": " + p);
if (p != null && mSettings.isEnabledLPr(p.info, flags, userId)) {
PackageSetting ps = mSettings.mPackages.get(component.getPackageName());
if (ps == null) return null;
return PackageParser.generateProviderInfo(p, flags, ps.readUserState(userId),
userId);
}
}
return null;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getProviderInfo
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
|
getProviderInfo
|
services/core/java/com/android/server/pm/PackageManagerService.java
|
a75537b496e9df71c74c1d045ba5569631a16298
| 0
|
Analyze the following code function for security vulnerabilities
|
private boolean handleRedirect(XWikiContext context) throws XWikiException
{
// If no redirection are expected, this step is skipped.
if (this.supportRedirections()) {
try {
for (RedirectionFilter filter : this.componentManager.<RedirectionFilter>getInstanceList(
RedirectionFilter.class)) {
if (filter.redirect(context)) {
return true;
}
}
} catch (ComponentLookupException e) {
throw new XWikiException("Failed to resolve the redirection filters list", e);
}
}
return false;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: handleRedirect
File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiAction.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices.
|
[
"CWE-668"
] |
CVE-2023-29208
|
HIGH
| 7.5
|
xwiki/xwiki-platform
|
handleRedirect
|
xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiAction.java
|
d9e947559077e947315bf700c5703dfc7dd8a8d7
| 0
|
Analyze the following code function for security vulnerabilities
|
public String[] getExcludedCommitMessagesNormalized() {
String s = fixEmptyAndTrim(excludedCommitMessages);
return s == null ? new String[0] : s.split("[\\r\\n]+");
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getExcludedCommitMessagesNormalized
File: src/main/java/hudson/scm/SubversionSCM.java
Repository: jenkinsci/subversion-plugin
The code follows secure coding practices.
|
[
"CWE-255"
] |
CVE-2013-6372
|
LOW
| 2.1
|
jenkinsci/subversion-plugin
|
getExcludedCommitMessagesNormalized
|
src/main/java/hudson/scm/SubversionSCM.java
|
7d4562d6f7e40de04bbe29577b51c79f07d05ba6
| 0
|
Analyze the following code function for security vulnerabilities
|
private static boolean isExternal(PackageParser.Package pkg) {
return (pkg.applicationInfo.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isExternal
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
|
isExternal
|
services/core/java/com/android/server/pm/PackageManagerService.java
|
a75537b496e9df71c74c1d045ba5569631a16298
| 0
|
Analyze the following code function for security vulnerabilities
|
final void doLowMemReportIfNeededLocked(ProcessRecord dyingProc) {
// If there are no longer any background processes running,
// and the app that died was not running instrumentation,
// then tell everyone we are now low on memory.
boolean haveBg = false;
for (int i=mLruProcesses.size()-1; i>=0; i--) {
ProcessRecord rec = mLruProcesses.get(i);
if (rec.thread != null
&& rec.setProcState >= ActivityManager.PROCESS_STATE_CACHED_ACTIVITY) {
haveBg = true;
break;
}
}
if (!haveBg) {
boolean doReport = "1".equals(SystemProperties.get(SYSTEM_DEBUGGABLE, "0"));
if (doReport) {
long now = SystemClock.uptimeMillis();
if (now < (mLastMemUsageReportTime+5*60*1000)) {
doReport = false;
} else {
mLastMemUsageReportTime = now;
}
}
final ArrayList<ProcessMemInfo> memInfos
= doReport ? new ArrayList<ProcessMemInfo>(mLruProcesses.size()) : null;
EventLog.writeEvent(EventLogTags.AM_LOW_MEMORY, mLruProcesses.size());
long now = SystemClock.uptimeMillis();
for (int i=mLruProcesses.size()-1; i>=0; i--) {
ProcessRecord rec = mLruProcesses.get(i);
if (rec == dyingProc || rec.thread == null) {
continue;
}
if (doReport) {
memInfos.add(new ProcessMemInfo(rec.processName, rec.pid, rec.setAdj,
rec.setProcState, rec.adjType, rec.makeAdjReason()));
}
if ((rec.lastLowMemory+mConstants.GC_MIN_INTERVAL) <= now) {
// The low memory report is overriding any current
// state for a GC request. Make sure to do
// heavy/important/visible/foreground processes first.
if (rec.setAdj <= ProcessList.HEAVY_WEIGHT_APP_ADJ) {
rec.lastRequestedGc = 0;
} else {
rec.lastRequestedGc = rec.lastLowMemory;
}
rec.reportLowMemory = true;
rec.lastLowMemory = now;
mProcessesToGc.remove(rec);
addProcessToGcListLocked(rec);
}
}
if (doReport) {
Message msg = mHandler.obtainMessage(REPORT_MEM_USAGE_MSG, memInfos);
mHandler.sendMessage(msg);
}
scheduleAppGcsLocked();
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: doLowMemReportIfNeededLocked
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
|
doLowMemReportIfNeededLocked
|
services/core/java/com/android/server/am/ActivityManagerService.java
|
962fb40991f15be4f688d960aa00073683ebdd20
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public void overridePendingAppTransitionAspectScaledThumb(Bitmap srcThumb, int startX,
int startY, int targetWidth, int targetHeight, IRemoteCallback startedCallback,
boolean scaleUp) {
synchronized(mWindowMap) {
mAppTransition.overridePendingAppTransitionAspectScaledThumb(srcThumb, startX,
startY, targetWidth, targetHeight, startedCallback, scaleUp);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: overridePendingAppTransitionAspectScaledThumb
File: services/core/java/com/android/server/wm/WindowManagerService.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-264"
] |
CVE-2016-3875
|
HIGH
| 7.2
|
android
|
overridePendingAppTransitionAspectScaledThumb
|
services/core/java/com/android/server/wm/WindowManagerService.java
|
69729fa8b13cadbf3173fe1f389fe4f3b7bd0f9c
| 0
|
Analyze the following code function for security vulnerabilities
|
protected final boolean _isNegInf(String text) {
return "-Infinity".equals(text) || "-INF".equals(text);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: _isNegInf
File: src/main/java/com/fasterxml/jackson/databind/deser/std/StdDeserializer.java
Repository: FasterXML/jackson-databind
The code follows secure coding practices.
|
[
"CWE-502"
] |
CVE-2022-42003
|
HIGH
| 7.5
|
FasterXML/jackson-databind
|
_isNegInf
|
src/main/java/com/fasterxml/jackson/databind/deser/std/StdDeserializer.java
|
d78d00ee7b5245b93103fef3187f70543d67ca33
| 0
|
Analyze the following code function for security vulnerabilities
|
private static boolean isDisableOnlyDTDValidation(DOMDocument document) {
// When XML declares a DOCTYPE only to define entities like
// <!DOCTYPE root [
// <!ENTITY foo "Bar">
// ]>
// Xerces try to validate the XML and report an error on each XML elements
// because they are not declared in the DOCTYPE.
// In this case, DTD validation must be disabled.
if (!document.hasDTD()) {
return false;
}
DOMDocumentType docType = document.getDoctype();
if (docType.getKindNode() != null) {
return false;
}
// Disable the DTD validation only if there are not <!ELEMENT or an <!ATTRLIST
return !docType.getChildren().stream().anyMatch(node -> node.isDTDElementDecl() || node.isDTDAttListDecl());
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isDisableOnlyDTDValidation
File: org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/participants/diagnostics/XMLValidator.java
Repository: eclipse/lemminx
The code follows secure coding practices.
|
[
"CWE-611"
] |
CVE-2019-18213
|
MEDIUM
| 6.5
|
eclipse/lemminx
|
isDisableOnlyDTDValidation
|
org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/participants/diagnostics/XMLValidator.java
|
c8bf3245a72cace50ee2aae5eee69538c58ce056
| 0
|
Analyze the following code function for security vulnerabilities
|
public boolean isDetailsVisible(Object itemId) {
return detailComponentManager.isDetailsVisible(itemId);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isDetailsVisible
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
|
isDetailsVisible
|
server/src/main/java/com/vaadin/ui/Grid.java
|
b9ba10adaa06a0977c531f878c3f0046b67f9cc0
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
protected void onExpandingStarted() {
super.onExpandingStarted();
mNotificationStackScroller.onExpansionStarted();
mIsExpanding = true;
mQsExpandedWhenExpandingStarted = mQsFullyExpanded;
if (mQsExpanded) {
onQsExpansionStarted();
}
// Since there are QS tiles in the header now, we need to make sure we start listening
// immediately so they can be up to date.
if (mQs == null) return;
mQs.setHeaderListening(true);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: onExpandingStarted
File: packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2017-0822
|
HIGH
| 7.5
|
android
|
onExpandingStarted
|
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
|
c574568aaede7f652432deb7707f20ae54bbdf9a
| 0
|
Analyze the following code function for security vulnerabilities
|
public ApiClient setBearerToken(String bearerToken) {
for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBearerAuth) {
((HttpBearerAuth) auth).setBearerToken(bearerToken);
return this;
}
}
throw new RuntimeException("No Bearer authentication configured!");
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setBearerToken
File: samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java
Repository: OpenAPITools/openapi-generator
The code follows secure coding practices.
|
[
"CWE-668"
] |
CVE-2021-21430
|
LOW
| 2.1
|
OpenAPITools/openapi-generator
|
setBearerToken
|
samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java
|
2c576483f26f85b3979c6948a131f585c237109a
| 0
|
Analyze the following code function for security vulnerabilities
|
@Nonnull
@MustNotContainNull
public static String[] breakToLines(@Nonnull final String text) {
final int lineNum = numberOfLines(text);
final String[] result = new String[lineNum];
final StringBuilder line = new StringBuilder();
int index = 0;
for (int i = 0; i < text.length(); i++) {
if (text.charAt(i) == '\n') {
result[index++] = line.toString();
line.setLength(0);
} else {
line.append(text.charAt(i));
}
}
result[index] = line.toString();
return result;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: breakToLines
File: mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/utils/Utils.java
Repository: raydac/netbeans-mmd-plugin
The code follows secure coding practices.
|
[
"CWE-611"
] |
CVE-2018-1000542
|
MEDIUM
| 6.8
|
raydac/netbeans-mmd-plugin
|
breakToLines
|
mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/utils/Utils.java
|
9fba652bf06e649186b8f9e612d60e9cc15097e9
| 0
|
Analyze the following code function for security vulnerabilities
|
public byte[] verifyPattern(List<LockPatternView.Cell> pattern, long challenge, int userId)
throws RequestThrottledException {
throwIfCalledOnMainThread();
try {
VerifyCredentialResponse response =
getLockSettings().verifyPattern(patternToString(pattern), challenge, userId);
if (response == null) {
// Shouldn't happen
return null;
}
if (response.getResponseCode() == VerifyCredentialResponse.RESPONSE_OK) {
return response.getPayload();
} else if (response.getResponseCode() == VerifyCredentialResponse.RESPONSE_RETRY) {
throw new RequestThrottledException(response.getTimeout());
} else {
return null;
}
} catch (RemoteException re) {
return null;
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: verifyPattern
File: core/java/com/android/internal/widget/LockPatternUtils.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-264"
] |
CVE-2016-3908
|
MEDIUM
| 4.3
|
android
|
verifyPattern
|
core/java/com/android/internal/widget/LockPatternUtils.java
|
96daf7d4893f614714761af2d53dfb93214a32e4
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public View getRightPreview() {
return getLayoutDirection() == LAYOUT_DIRECTION_RTL
? mKeyguardBottomArea.getLeftPreview()
: mKeyguardBottomArea.getRightPreview();
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getRightPreview
File: packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2017-0822
|
HIGH
| 7.5
|
android
|
getRightPreview
|
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
|
c574568aaede7f652432deb7707f20ae54bbdf9a
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public void sendNonza(Nonza element) throws NotConnectedException, InterruptedException {
packetWriter.sendStreamElement(element);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: sendNonza
File: smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java
Repository: igniterealtime/Smack
The code follows secure coding practices.
|
[
"CWE-362"
] |
CVE-2016-10027
|
MEDIUM
| 4.3
|
igniterealtime/Smack
|
sendNonza
|
smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java
|
a9d5cd4a611f47123f9561bc5a81a4555fe7cb04
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
@SuppressFBWarnings("EI_EXPOSE_REP")
public DomNode getLastChild() {
if (firstChild_ != null) {
// last child is stored as the previous sibling of first child
return firstChild_.previousSibling_;
}
return null;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getLastChild
File: src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java
Repository: HtmlUnit/htmlunit
The code follows secure coding practices.
|
[
"CWE-787"
] |
CVE-2023-2798
|
HIGH
| 7.5
|
HtmlUnit/htmlunit
|
getLastChild
|
src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java
|
940dc7fd
| 0
|
Analyze the following code function for security vulnerabilities
|
protected void timeout() {
Orient.instance().getProfiler()
.updateCounter("server.http." + listeningAddress + ".timeout", "Timeout of HTTP connection", +1, "server.http.*.timeout");
sendShutdown();
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: timeout
File: server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/ONetworkProtocolHttpAbstract.java
Repository: orientechnologies/orientdb
The code follows secure coding practices.
|
[
"CWE-352"
] |
CVE-2015-2912
|
MEDIUM
| 6.8
|
orientechnologies/orientdb
|
timeout
|
server/src/main/java/com/orientechnologies/orient/server/network/protocol/http/ONetworkProtocolHttpAbstract.java
|
d5a45e608ba8764fd817c1bdd7cf966564e828e9
| 0
|
Analyze the following code function for security vulnerabilities
|
public long getLastStanzaReceived() {
return lastStanzaReceived;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getLastStanzaReceived
File: smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
Repository: igniterealtime/Smack
The code follows secure coding practices.
|
[
"CWE-362"
] |
CVE-2016-10027
|
MEDIUM
| 4.3
|
igniterealtime/Smack
|
getLastStanzaReceived
|
smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java
|
a9d5cd4a611f47123f9561bc5a81a4555fe7cb04
| 0
|
Analyze the following code function for security vulnerabilities
|
public boolean canAccessSpace(Profile authUser, String targetSpaceId) {
if (authUser == null) {
return isDefaultSpacePublic() && isDefaultSpace(targetSpaceId);
}
if (isMod(authUser) || isAllSpaces(targetSpaceId)) {
return true;
}
if (StringUtils.isBlank(targetSpaceId) || targetSpaceId.length() < 2) {
return false;
}
// this is confusing - let admins control who is in the default space
//if (isDefaultSpace(targetSpaceId)) {
// // can user access the default space (blank)
// return isDefaultSpacePublic() || isMod(authUser) || !authUser.hasSpaces();
//}
boolean isMemberOfSpace = false;
for (String space : authUser.getSpaces()) {
String spaceId = getSpaceId(targetSpaceId);
if (StringUtils.startsWithIgnoreCase(space, spaceId + Para.getConfig().separator()) || space.equalsIgnoreCase(spaceId)) {
isMemberOfSpace = true;
break;
}
}
return isMemberOfSpace;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: canAccessSpace
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
|
canAccessSpace
|
src/main/java/com/erudika/scoold/utils/ScooldUtils.java
|
62a0e92e1486ddc17676a7ead2c07ff653d167ce
| 0
|
Analyze the following code function for security vulnerabilities
|
static void warnForInvalidTag(int depth, String tag) throws IOException {
Slog.w(TAG, String.format("Invalid tag '%s' found at depth %d", tag, depth));
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: warnForInvalidTag
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
|
warnForInvalidTag
|
services/core/java/com/android/server/pm/ShortcutService.java
|
96e0524c48c6e58af7d15a2caf35082186fc8de2
| 0
|
Analyze the following code function for security vulnerabilities
|
private Set<String> getMeteredDisabledPackages(int userId) {
synchronized (getLockObject()) {
final Set<String> restrictedPkgs = new ArraySet<>();
final ActiveAdmin admin = getDeviceOrProfileOwnerAdminLocked(userId);
if (admin != null && admin.meteredDisabledPackages != null) {
restrictedPkgs.addAll(admin.meteredDisabledPackages);
}
return restrictedPkgs;
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getMeteredDisabledPackages
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
|
getMeteredDisabledPackages
|
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
|
ed3f25b7222d4cff471f2b7d22d1150348146957
| 0
|
Analyze the following code function for security vulnerabilities
|
@GetMapping
@Authorize(action = Permission.ACTION_QUERY)
@ApiOperation("获取模型列表")
public ResponseMessage<PagerResult<Model>> getModelList(QueryParamEntity param) {
ModelQuery modelQuery = repositoryService.createModelQuery();
return ResponseMessage.ok(
QueryUtils.doQuery(modelQuery, param,
model -> FastBeanCopier.copy(model, new ModelEntity()),
(term, modelQuery1) -> {
if ("latestVersion".equals(term.getColumn())) {
modelQuery1.latestVersion();
}
}));
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getModelList
File: hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/src/main/java/org/hswebframework/web/workflow/web/FlowableModelManagerController.java
Repository: hs-web/hsweb-framework
The code follows secure coding practices.
|
[
"CWE-79"
] |
CVE-2018-20594
|
MEDIUM
| 4.3
|
hs-web/hsweb-framework
|
getModelList
|
hsweb-system/hsweb-system-workflow/hsweb-system-workflow-local/src/main/java/org/hswebframework/web/workflow/web/FlowableModelManagerController.java
|
b72a2275ed21240296c6539bae1049c56abb542f
| 0
|
Analyze the following code function for security vulnerabilities
|
public void doResources(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
String path = req.getRestOfPath();
// cut off the "..." portion of /resources/.../path/to/file
// as this is only used to make path unique (which in turn
// allows us to set a long expiration date
path = path.substring(path.indexOf('/',1)+1);
int idx = path.lastIndexOf('.');
String extension = path.substring(idx+1);
if(ALLOWED_RESOURCE_EXTENSIONS.contains(extension)) {
URL url = pluginManager.uberClassLoader.getResource(path);
if(url!=null) {
long expires = MetaClass.NO_CACHE ? 0 : 365L * 24 * 60 * 60 * 1000; /*1 year*/
rsp.serveFile(req,url,expires);
return;
}
}
rsp.sendError(HttpServletResponse.SC_NOT_FOUND);
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: doResources
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
|
doResources
|
core/src/main/java/jenkins/model/Jenkins.java
|
a0b00508eeb74d7033dc4100eb382df4e8fa72e7
| 0
|
Analyze the following code function for security vulnerabilities
|
private void runOnFutureComplete(ApplicationConfiguration config) {
try {
doStartDevModeServer(config);
} catch (ExecutionFailedException exception) {
getLogger().error(null, exception);
throw new CompletionException(exception);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: runOnFutureComplete
File: vaadin-dev-server/src/main/java/com/vaadin/base/devserver/DevModeHandlerImpl.java
Repository: vaadin/flow
The code follows secure coding practices.
|
[
"CWE-172"
] |
CVE-2021-33604
|
LOW
| 1.2
|
vaadin/flow
|
runOnFutureComplete
|
vaadin-dev-server/src/main/java/com/vaadin/base/devserver/DevModeHandlerImpl.java
|
2a801c42b406a00c44f4a85b4b4e4a4c5bf89adc
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public boolean shouldControlIme() {
return !inMultiWindowMode();
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: shouldControlIme
File: services/core/java/com/android/server/wm/WindowState.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-Other"
] |
CVE-2023-35674
|
HIGH
| 7.8
|
android
|
shouldControlIme
|
services/core/java/com/android/server/wm/WindowState.java
|
7428962d3b064ce1122809d87af65099d1129c9e
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public Route.Collection put(final String path1, final String path2,
final Route.ZeroArgHandler handler) {
return new Route.Collection(
new Route.Definition[]{put(path1, handler), put(path2, handler)});
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: put
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
|
put
|
jooby/src/main/java/org/jooby/Jooby.java
|
34f526028e6cd0652125baa33936ffb6a8a4a009
| 0
|
Analyze the following code function for security vulnerabilities
|
public void setPreExpandValueSetsDefaultCount(int thePreExpandValueSetsDefaultCount) {
myPreExpandValueSetsDefaultCount = Math.min(thePreExpandValueSetsDefaultCount, getPreExpandValueSetsMaxCount());
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setPreExpandValueSetsDefaultCount
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
|
setPreExpandValueSetsDefaultCount
|
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
|
@Override
public ParceledListSlice<ShortcutInfo> getShortcuts(String packageName,
@ShortcutManager.ShortcutMatchFlags int matchFlags, @UserIdInt int userId) {
verifyCaller(packageName, userId);
synchronized (mLock) {
throwIfUserLockedL(userId);
final boolean matchDynamic = (matchFlags & ShortcutManager.FLAG_MATCH_DYNAMIC) != 0;
final boolean matchPinned = (matchFlags & ShortcutManager.FLAG_MATCH_PINNED) != 0;
final boolean matchManifest = (matchFlags & ShortcutManager.FLAG_MATCH_MANIFEST) != 0;
final boolean matchCached = (matchFlags & ShortcutManager.FLAG_MATCH_CACHED) != 0;
final int shortcutFlags = (matchDynamic ? ShortcutInfo.FLAG_DYNAMIC : 0)
| (matchPinned ? ShortcutInfo.FLAG_PINNED : 0)
| (matchManifest ? ShortcutInfo.FLAG_MANIFEST : 0)
| (matchCached ? ShortcutInfo.FLAG_CACHED_ALL : 0);
return getShortcutsWithQueryLocked(
packageName, userId, ShortcutInfo.CLONE_REMOVE_FOR_CREATOR,
(ShortcutInfo si) ->
si.isVisibleToPublisher()
&& (si.getFlags() & shortcutFlags) != 0);
}
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getShortcuts
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
|
getShortcuts
|
services/core/java/com/android/server/pm/ShortcutService.java
|
96e0524c48c6e58af7d15a2caf35082186fc8de2
| 0
|
Analyze the following code function for security vulnerabilities
|
@Override
public void getShortcutIconUriAsync(int launcherUserId, @NonNull String launcherPackage,
@NonNull String packageName, @NonNull String shortcutId, int userId,
@NonNull AndroidFuture<String> cb) {
Objects.requireNonNull(launcherPackage, "launcherPackage");
Objects.requireNonNull(packageName, "packageName");
Objects.requireNonNull(shortcutId, "shortcutId");
// Checks shortcuts in memory first
synchronized (mLock) {
throwIfUserLockedL(userId);
throwIfUserLockedL(launcherUserId);
getLauncherShortcutsLocked(launcherPackage, userId, launcherUserId)
.attemptToRestoreIfNeededAndSave();
final ShortcutPackage p = getUserShortcutsLocked(userId)
.getPackageShortcutsIfExists(packageName);
if (p == null) {
cb.complete(null);
return;
}
final ShortcutInfo shortcutInfo = p.findShortcutById(shortcutId);
if (shortcutInfo != null) {
cb.complete(getShortcutIconUriInternal(launcherUserId, launcherPackage,
packageName, shortcutInfo, userId));
return;
}
}
// Otherwise check persisted shortcuts
getShortcutInfoAsync(launcherUserId, packageName, shortcutId, userId, si -> {
cb.complete(getShortcutIconUriInternal(launcherUserId, launcherPackage,
packageName, si, userId));
});
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getShortcutIconUriAsync
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
|
getShortcutIconUriAsync
|
services/core/java/com/android/server/pm/ShortcutService.java
|
96e0524c48c6e58af7d15a2caf35082186fc8de2
| 0
|
Analyze the following code function for security vulnerabilities
|
void testAuth();
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: testAuth
File: framework/sdk-parent/xpack-interface/src/main/java/io/metersphere/xpack/track/issue/IssuesPlatform.java
Repository: metersphere
The code follows secure coding practices.
|
[
"CWE-918"
] |
CVE-2022-23544
|
MEDIUM
| 6.1
|
metersphere
|
testAuth
|
framework/sdk-parent/xpack-interface/src/main/java/io/metersphere/xpack/track/issue/IssuesPlatform.java
|
d0f95b50737c941b29d507a4cc3545f2dc6ab121
| 0
|
Analyze the following code function for security vulnerabilities
|
ActivityStarter setIntentGrants(NeededUriGrants intentGrants) {
mRequest.intentGrants = intentGrants;
return this;
}
|
No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setIntentGrants
File: services/core/java/com/android/server/wm/ActivityStarter.java
Repository: android
The code follows secure coding practices.
|
[
"CWE-269"
] |
CVE-2023-21269
|
HIGH
| 7.8
|
android
|
setIntentGrants
|
services/core/java/com/android/server/wm/ActivityStarter.java
|
70ec64dc5a2a816d6aa324190a726a85fd749b30
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.