code
stringlengths
14
2.05k
label
int64
0
1
programming_language
stringclasses
7 values
cwe_id
stringlengths
6
14
cwe_name
stringlengths
5
98
description
stringlengths
36
379
url
stringlengths
36
48
label_name
stringclasses
2 values
public void writeData(LPDataOutput output) { output.writeLPPosition(pos); for (PipeRoutingConnectionType type : filters.keySet()) { output.writeShort(type.ordinal()); for (List<IFilter> linkedFilter : filters.get(type)) { output.writeShort(linkedFilter.size()); for (IFilter filter : linkedFilter) { output.writeLPPosition(filter.getLPPosition()); } } output.writeShort(-1); } output.writeShort(-1); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void writeData(LPDataOutput output) {}
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void readData(LPDataInput input) {}
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void writeData(LPDataOutput output) {}
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void readData(LPDataInput input) {}
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void writeData(LPDataOutput output) { output.writeExitRoute(exitRoute); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void readData(LPDataInput input) { exitRoute = input.readExitRoute(MainProxy.getClientMainWorld()); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public RoutingUpdateTargetResponse(int id) { super(id); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void processPacket(final EntityPlayer player) { if (mode == TargetMode.None) { player.addChatMessage(new ChatComponentText(ChatColor.RED + "No Target Found")); } else if (mode == TargetMode.Block) { int x = additions[0]; int y = additions[1]; int z = additions[2]; player.addChatMessage(new ChatComponentText("Checking Block at: x:" + x + " y:" + y + " z:" + z)); Block id = player.worldObj.getBlock(x, y, z); player.addChatMessage(new ChatComponentText("Found Block with Id: " + Block.getIdFromBlock(id))); final TileEntity tile = player.worldObj.getTileEntity(x, y, z); if (tile == null) { player.addChatMessage(new ChatComponentText(ChatColor.RED + "No TileEntity found")); } else if (!(tile instanceof LogisticsTileGenericPipe)) { player.addChatMessage(new ChatComponentText(ChatColor.RED + "No LogisticsTileGenericPipe found")); } else if (!(((LogisticsTileGenericPipe) tile).pipe instanceof CoreRoutedPipe)) { player.addChatMessage(new ChatComponentText(ChatColor.RED + "No CoreRoutedPipe found")); } else { LPChatListener.addTask(() -> { player.addChatMessage(new ChatComponentText(ChatColor.GREEN + "Starting RoutingTable debug update.")); DebugController.instance(player).debug(((ServerRouter) ((CoreRoutedPipe) ((LogisticsTileGenericPipe) tile).pipe).getRouter())); MainProxy.sendPacketToPlayer(PacketHandler.getPacket(OpenChatGui.class), player); return true; }, player); player.addChatMessage(new ChatComponentText( ChatColor.AQUA + "Start RoutingTable debug update ? " + ChatColor.RESET + "<" + ChatColor.GREEN + "yes" + ChatColor.RESET + "/" + ChatColor.RED + "no" + ChatColor.RESET + ">")); MainProxy.sendPacketToPlayer(PacketHandler.getPacket(OpenChatGui.class), player); } } else if (mode == TargetMode.Entity) { player.addChatMessage(new ChatComponentText(ChatColor.RED + "Entity not allowed")); } }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void readData(LPDataInput input) { mode = TargetMode.values()[input.readByte()]; additions = input.readIntArray(); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void writeData(LPDataOutput output) { output.writeByte(mode.ordinal()); output.writeIntArray(additions); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void writeData(LPDataOutput output) { output.writeInt(satID); super.writeData(output); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void readData(LPDataInput input) { satID = input.readInt(); super.readData(input); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void readData(LPDataInput input) { super.readData(input); side = input.readForgeDirection(); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void writeData(LPDataOutput output) { super.writeData(output); output.writeForgeDirection(side); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void writeData(LPDataOutput output) { super.writeData(output); output.writeForgeDirection(side); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void readData(LPDataInput input) { super.readData(input); side = input.readForgeDirection(); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public boolean getTurtleConnect() { if (container instanceof LogisticsTileGenericPipe) { return container.getTurtleConnect(); } return false; }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void readData(LPDataInput input) { isOpaqueClientSide = input.readBoolean(); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void setTurtleConnect(Boolean flag) { if (container instanceof LogisticsTileGenericPipe) { container.setTurtleConnect(flag); } }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void writeData(LPDataOutput output) { output.writeBoolean(isOpaque()); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void readData(LPDataInput input) { pipeId = input.readInt(); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void setTurtleConnect(boolean flag) { SimpleServiceLocator.ccProxy.setTurtleConnect(flag, this); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void writeData(LPDataOutput output) { output.writeInt(pipeId); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void writeData(LPDataOutput output) { if (orientation == null) { output.writeBoolean(false); } else { output.writeBoolean(true); output.writeEnum(orientation); } }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void rotatePositions(IPositionRotateble set) { renderOrientation.rotatePositions(set); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void setOnPipe(CoreMultiBlockPipe pipe) { ((HSTubeCurve) pipe).orientation = this; }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void readData(LPDataInput input) { if (input.readBoolean()) { orientation = input.readEnum(CurveOrientation.class); } }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void writeData(LPDataOutput output) { if (orientation == null) { output.writeBoolean(false); } else { output.writeBoolean(true); output.writeEnum(orientation); } }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
TubeGainRenderOrientation(ForgeDirection dir) { this.dir = dir; }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void rotatePositions(IPositionRotateble set) { renderOrientation.rotateOrientation(set); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void setOnPipe(CoreMultiBlockPipe pipe) { ((HSTubeGain) pipe).orientation = this; }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void rotateOrientation(IPositionRotateble set) { if (this == EAST) { set.rotateRight(); } else if (this == WEST) { set.rotateLeft(); } else if (this == SOUTH) { set.rotateLeft(); set.rotateLeft(); } }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void readData(LPDataInput input) { if (input.readBoolean()) { orientation = input.readEnum(TubeGainOrientation.class); } }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
TubeGainOrientation(TubeGainRenderOrientation render, DoubleCoordinates off, ForgeDirection dir) { renderOrientation = render; offset = off; this.dir = dir; }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void rotatePositions(IPositionRotateble set) { renderOrientation.rotateOrientation(set); }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void writeData(LPDataOutput output) { if (orientation == null) { output.writeBoolean(false); } else { output.writeBoolean(true); output.writeEnum(orientation); } }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
public void readData(LPDataInput input) { if (input.readBoolean()) { orientation = input.readEnum(TubeLineOrientation.class); } }
1
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
safe
Group createNew(String name, String description, int organizationId) { AffectedRowCountAndKey<Integer> insert = groupRepository.insert(name, description, organizationId); return groupRepository.getById(insert.getKey()); }
0
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public Optional<GroupModification> update(int listId, GroupModification modification) { if(groupRepository.getOptionalById(listId).isEmpty() || CollectionUtils.isEmpty(modification.getItems())) { return Optional.empty(); } List<String> existingValues = groupRepository.getAllValuesIncludingNotActive(listId); List<GroupMemberModification> notPresent = modification.getItems().stream() .filter(i -> i.getId() == null && !existingValues.contains(i.getValue().strip().toLowerCase())) .distinct() .collect(Collectors.toList()); if(!notPresent.isEmpty()) { var insertResult = insertMembers(listId, notPresent); if(!insertResult.isSuccess()) { var error = Objects.requireNonNull(insertResult.getFirstErrorOrNull()); throw new DuplicateGroupItemException(error.getDescription()); } } groupRepository.update(listId, modification.getName(), modification.getDescription()); return loadComplete(listId); }
0
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
default int[] insert(int groupId, List<GroupMemberModification> members) { MapSqlParameterSource[] params = members.stream() .map(i -> new MapSqlParameterSource("groupId", groupId).addValue("value", i.getValue().toLowerCase()).addValue("description", i.getDescription())) .toArray(MapSqlParameterSource[]::new); return getNamedParameterJdbcTemplate().batchUpdate("insert into group_member(a_group_id_fk, value, description) values(:groupId, :value, :description)", params); }
0
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public static String pathOffset(String path, RoutingContext context) { final Route route = context.currentRoute(); // cannot make any assumptions if (route == null) { return path; } if (!route.isExactPath()) { final String rest = context.pathParam("*"); if (rest != null) { // normalize if (rest.length() > 0) { if (rest.charAt(0) == '/') { return rest; } else { return "/" + rest; } } else { return "/"; } } } int prefixLen = 0; String mountPoint = context.mountPoint(); if (mountPoint != null) { prefixLen = mountPoint.length(); // special case we need to verify if a trailing slash is present and exclude if (mountPoint.charAt(mountPoint.length() - 1) == '/') { prefixLen--; } } // we can only safely skip the route path if there are no variables or regex if (!route.isRegexPath()) { String routePath = route.getPath(); if (routePath != null) { prefixLen += routePath.length(); // special case we need to verify if a trailing slash is present and exclude if (routePath.charAt(routePath.length() - 1) == '/') { prefixLen--; } } } return prefixLen != 0 ? path.substring(prefixLen) : path; }
0
Java
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
https://cwe.mitre.org/data/definitions/22.html
vulnerable
protected void onInitialize() { super.onInitialize(); IModel<String> valueModel = new AbstractReadOnlyModel<String>() { @Override public String getObject() { return getUser().getAccessToken(); } }; add(new TextField<String>("value", valueModel) { @Override protected String[] getInputTypes() { return new String[] {"password"}; } }); add(new CopyToClipboardLink("copy", valueModel)); add(new Link<Void>("regenerate") { @Override public void onClick() { getUser().setAccessToken(RandomStringUtils.randomAlphanumeric(User.ACCESS_TOKEN_LEN)); OneDev.getInstance(UserManager.class).save(getUser()); Session.get().success("Access token regenerated"); setResponsePage(getPage()); } }.add(new ConfirmClickModifier("This will invalidate current token and generate a new one, do you want to continue?"))); }
0
Java
CWE-338
Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)
The product uses a Pseudo-Random Number Generator (PRNG) in a security context, but the PRNG's algorithm is not cryptographically strong.
https://cwe.mitre.org/data/definitions/338.html
vulnerable
public ConfigDatabase(final DataSource dataSource, final XStreamInfoSerialBinding binding) { this(dataSource, binding, null); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
private Dialect dialect() { if (dialect == null) { this.dialect = Dialect.detect(dataSource); } return dialect; }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public ConfigDatabase( final DataSource dataSource, final XStreamInfoSerialBinding binding, CacheProvider cacheProvider) { this.binding = binding; this.template = new NamedParameterJdbcTemplate(dataSource); // cannot use dataSource at this point due to spring context config hack // in place to support tx during testing this.dataSource = dataSource; this.catalogRowMapper = new InfoRowMapper<CatalogInfo>(CatalogInfo.class, binding); this.configRowMapper = new InfoRowMapper<Info>(Info.class, binding); if (cacheProvider == null) { cacheProvider = DefaultCacheProvider.findProvider(); } cache = cacheProvider.getCache("catalog"); identityCache = cacheProvider.getCache("catalogNames"); serviceCache = cacheProvider.getCache("services"); locks = new ConcurrentHashMap<>(); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public <T extends CatalogInfo> int count(final Class<T> of, final Filter filter) { QueryBuilder<T> sqlBuilder = QueryBuilder.forCount(dialect, of, dbMappings).filter(filter); final StringBuilder sql = sqlBuilder.build(); final Filter unsupportedFilter = sqlBuilder.getUnsupportedFilter(); final boolean fullySupported = Filter.INCLUDE.equals(unsupportedFilter); if (LOGGER.isLoggable(Level.FINER)) { LOGGER.finer("Original filter: " + filter); LOGGER.finer("Supported filter: " + sqlBuilder.getSupportedFilter()); LOGGER.finer("Unsupported filter: " + sqlBuilder.getUnsupportedFilter()); } final int count; if (fullySupported) { final Map<String, Object> namedParameters = sqlBuilder.getNamedParameters(); logStatement(sql, namedParameters); count = template.queryForObject(sql.toString(), namedParameters, Integer.class); } else { LOGGER.fine( "Filter is not fully supported, doing scan of supported part to return the number of matches"); // going the expensive route, filtering as much as possible CloseableIterator<T> iterator = query(of, filter, null, null, (SortBy) null); try { return Iterators.size(iterator); } finally { iterator.close(); } } return count; }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public static Dialect detect(DataSource dataSource) { Dialect dialect; try { Connection conn = dataSource.getConnection(); String driver = conn.getMetaData().getDriverName(); if (driver.contains("Oracle")) { dialect = new OracleDialect(); } else { dialect = new Dialect(); } conn.close(); } catch (SQLException ex) { throw new RuntimeException(ex); } return dialect; }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public Object visit(PropertyIsNil filter, Object extraData) { final PropertyName propertyName = (PropertyName) filter.getExpression(); final String propertyTypesParam = propertyTypesParam(propertyName); StringBuilder builder = append( extraData, "oid IN (SELECT oid FROM object_property WHERE property_type IN (:", propertyTypesParam, ") AND value IS NULL) /* ", filter.toString(), " */\n"); return builder; }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public Object visit(IncludeFilter filter, Object extraData) { append(extraData, "1 = 1 /* INCLUDE */\n"); return extraData; }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public Object visit(And filter, Object extraData) { StringBuilder sql = (StringBuilder) extraData; List<Filter> children = filter.getChildren(); checkArgument(children.size() > 0); sql.append("(\n "); for (Iterator<Filter> it = children.iterator(); it.hasNext(); ) { Filter child = it.next(); sql = (StringBuilder) child.accept(this, sql); if (it.hasNext()) { sql = append(extraData, " AND\n "); } } sql.append(")"); return sql; }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public FilterToCatalogSQL(Class<?> queryType, DbMappings dbMappings) { this.queryType = queryType; this.dbMappings = dbMappings; List<Integer> concreteQueryTypes = dbMappings.getConcreteQueryTypes(queryType); namedParams.put("types", concreteQueryTypes); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public Object visit(Not filter, Object extraData) { filter.getFilter().accept(this, append(extraData, "NOT (")); return append(extraData, ")"); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public Object visit(ExcludeFilter filter, Object extraData) { append(extraData, "0 = 1 /* EXCLUDE */\n"); return extraData; }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public Object visit(Or filter, Object extraData) { StringBuilder sql = (StringBuilder) extraData; List<Filter> children = filter.getChildren(); checkArgument(children.size() > 0); sql.append("("); for (Iterator<Filter> it = children.iterator(); it.hasNext(); ) { Filter child = it.next(); sql = (StringBuilder) child.accept(this, sql); if (it.hasNext()) { sql = append(extraData, " OR\n "); } } sql.append(")"); return sql; }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
private String handleInstanceOf(IsInstanceOf instanceOf) { Expression expression1 = instanceOf.getParameters().get(0); Class<?> clazz = expression1.evaluate(null, Class.class); if (clazz == null || dbMappings.getTypeId(clazz) == null) { return "0 = 1 /* EXCLUDE */\n"; } Integer typeId = dbMappings.getTypeId(clazz); return "type_id = " + typeId + " /* isInstanceOf " + clazz.getName() + " */\n"; }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public Object visit(PropertyIsNull filter, Object extraData) { final PropertyName propertyName = (PropertyName) filter.getExpression(); final String propertyTypesParam = propertyTypesParam(propertyName); StringBuilder builder = append( extraData, "(oid IN (SELECT oid FROM object_property WHERE property_type IN (:", propertyTypesParam, ") AND value IS NULL) OR oid NOT IN (SELECT oid FROM object_property WHERE property_type IN (:" + propertyTypesParam + "))) /* ", filter.toString(), " */\n"); return builder; }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public void applyOffsetLimit( StringBuilder sql, @Nullable Integer offset, @Nullable Integer limit) { // some db's require limit to be present of offset is if (offset != null && limit == null) { limit = Integer.MAX_VALUE; // ensure we don't wrap around } if (limit != null && offset == null) { offset = 0; limit += 1; // not zero-based } if (offset != null && limit != null) { sql.insert(0, "SELECT * FROM (SELECT query.*, rownum rnum FROM (\n"); sql.append(") query\n"); if (limit != Integer.MAX_VALUE) { limit = offset + limit; } sql.append("WHERE rownum <= ").append(limit).append(")\n"); sql.append("WHERE rnum > ").append(offset); } }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public StringBuilder build() { StringBuilder whereClause = buildWhereClause(); StringBuilder query = new StringBuilder(); if (isCountQuery) { if (Filter.INCLUDE.equals(this.originalFilter)) { query.append("SELECT COUNT(oid) FROM object WHERE type_id IN (:types)"); } else { query.append("SELECT COUNT(oid) FROM object WHERE type_id IN (:types) AND (\n"); query.append(whereClause).append(")"); } } else { SortBy[] orders = this.sortOrder; if (orders == null) { query.append("SELECT id FROM object WHERE type_id IN (:types) AND (\n"); query.append(whereClause).append(")"); query.append(" ORDER BY oid"); } else { querySortBy(query, whereClause, orders); } applyOffsetLimit(query); } return query; }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public ConfigDatabase configDatabase() { return new ConfigDatabase( dataSource(), new XStreamInfoSerialBinding(new XStreamPersisterFactory())); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public void testSort3() { Filter filter = Predicates.acceptAll(); StringBuilder build = QueryBuilder.forIds(dialect, WorkspaceInfo.class, dbMappings) .filter(filter) .sortOrder( Predicates.asc("foo"), Predicates.desc("bar"), Predicates.asc("baz")) .build(); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public void testIsNil() { // Create the filter Filter filter = Predicates.isNull("name"); // Build it StringBuilder build = QueryBuilder.forIds(dialect, WorkspaceInfo.class, dbMappings) .filter(filter) .build(); String sql = build.toString(); String sqlNil = "oid IN (SELECT oid FROM object_property WHERE property_type IN (:" + "ptype0) AND value IS NULL)"; // Ensure the following sql is present assertThat(sql, containsString(sqlNil)); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public void testSort1() { Filter filter = Predicates.acceptAll(); StringBuilder build = QueryBuilder.forIds(dialect, WorkspaceInfo.class, dbMappings) .filter(filter) .sortOrder(Predicates.asc("foo")) .build(); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public void testSort3WithFilter() { Filter filter = Predicates.equal("name", "quux"); StringBuilder build = QueryBuilder.forIds(dialect, WorkspaceInfo.class, dbMappings) .filter(filter) .sortOrder( Predicates.asc("foo"), Predicates.desc("bar"), Predicates.asc("baz")) .build(); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public void testSort2() { Filter filter = Predicates.acceptAll(); StringBuilder build = QueryBuilder.forIds(dialect, WorkspaceInfo.class, dbMappings) .filter(filter) .sortOrder(Predicates.asc("foo"), Predicates.desc("bar")) .build(); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public void testIsInstanceOf() { // Create the filter Filter filter = Predicates.isInstanceOf(LayerInfo.class); // Build it StringBuilder build = QueryBuilder.forIds(dialect, WorkspaceInfo.class, dbMappings) .filter(filter) .build(); String sql = build.toString(); // Ensure the following sql is present assertThat(sql, containsString("type_id = " + dbMappings.getTypeId(LayerInfo.class))); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public void setUp() throws Exception { dialect = new Dialect(); dbMappings = new DbMappings(dialect); testSupport = new JDBCConfigTestSupport( (JDBCConfigTestSupport.DBConfig) JDBCConfigTestSupport.parameterizedDBConfigs().get(0)[0]); testSupport.setUp(); dbMappings = testSupport.getDbMappings(); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public void testNotEquals() { // Create the filter Filter filter = Predicates.notEqual("name", "quux"); // Build it StringBuilder build = QueryBuilder.forIds(dialect, WorkspaceInfo.class, dbMappings) .filter(filter) .build(); String sql = build.toString(); // Ensure the following sql is present assertThat( sql, containsString( "NOT (oid IN (SELECT oid FROM object_property WHERE property_type IN (:ptype0) AND UPPER(value) = :value0)")); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public void testQueryAll() { Filter filter = Predicates.equal("name", "ws1"); StringBuilder build = QueryBuilder.forIds(dialect, WorkspaceInfo.class, dbMappings) .filter(filter) .build(); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public void testIsNull() { // Create the filter Filter filter = Predicates.isNull("name"); // Build it StringBuilder build = QueryBuilder.forIds(dialect, WorkspaceInfo.class, dbMappings) .filter(filter) .build(); String sql = build.toString(); String sqlNull = "oid IN (SELECT oid FROM object_property WHERE property_type IN (:" + "ptype0) AND value IS NULL) OR oid NOT IN (SELECT oid FROM object_property WHERE property_type IN (:" + "ptype0))"; // Ensure the following sql is present assertThat(sql, containsString(sqlNull)); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public Object visit(PropertyIsLike filter, Object extraData) { char esc = filter.getEscape().charAt(0); char multi = filter.getWildCard().charAt(0); char single = filter.getSingleChar().charAt(0); boolean matchCase = filter.isMatchingCase(); String literal = filter.getLiteral(); Expression att = filter.getExpression(); // JD: hack for date values, we append some additional padding to handle // the matching of time/timezone/etc... Class attributeType = getExpressionType(att); // null check if returnType of expression is Object, null is returned // from getExpressionType if (attributeType != null && Date.class.isAssignableFrom(attributeType)) { literal += multi; } String pattern = LikeFilterImpl.convertToSQL92(esc, multi, single, matchCase, literal); try { if (!matchCase) { out.write(" UPPER("); } att.accept(this, extraData); if (!matchCase) { out.write(") LIKE '"); } else { out.write(" LIKE '"); } out.write(pattern); out.write("' "); } catch (java.io.IOException ioe) { throw new RuntimeException(IO_ERROR, ioe); } return extraData; }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
protected void writeLiteral(Object literal) throws IOException { if (literal == null) { out.write("NULL"); } else if (literal instanceof Number || literal instanceof Boolean) { out.write(String.valueOf(literal)); } else if (literal instanceof java.sql.Date || literal instanceof java.sql.Timestamp) { // java.sql.date toString declares to always format to yyyy-mm-dd // (and TimeStamp uses a similar approach) out.write("'" + literal + "'"); } else if (literal instanceof java.util.Date) { // get back to the previous case Timestamp ts = new java.sql.Timestamp(((Date) literal).getTime()); out.write("'" + ts + "'"); } else if (literal instanceof Instant) { java.util.Date date = ((Instant) literal).getPosition().getDate(); Timestamp ts = new java.sql.Timestamp(date.getTime()); out.write("'" + ts + "'"); } else if (literal.getClass().isArray()) { // write as a SQL99 array out.write("ARRAY["); int length = Array.getLength(literal); for (int i = 0; i < length; i++) { writeLiteral(Array.get(literal, i)); if (i < length - 1) { out.write(", "); } } out.write("]"); } else { // we don't know the type...just convert back to a string String encoding = Converters.convert(literal, String.class, null); if (encoding == null) { // could not convert back to string, use original l value encoding = literal.toString(); } // sigle quotes must be escaped to have a valid sql string String escaped = encoding.replaceAll("'", "''"); out.write("'" + escaped + "'"); } }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public Object visit(Id filter, Object extraData) { if (primaryKey == null) { throw new RuntimeException("Must set primary key before trying to encode FIDFilters"); } Set ids = filter.getIdentifiers(); LOGGER.finer("Exporting FID=" + ids); try { if (ids.size() > 1) { out.write("("); } List<PrimaryKeyColumn> columns = primaryKey.getColumns(); for (Iterator i = ids.iterator(); i.hasNext(); ) { Identifier id = (Identifier) i.next(); List<Object> attValues = JDBCDataStore.decodeFID(primaryKey, id.toString(), false); out.write("("); for (int j = 0; j < attValues.size(); j++) { // in case of join the pk columns need to be qualified with alias if (filter instanceof JoinId) { out.write(escapeName(((JoinId) filter).getAlias())); out.write("."); } out.write(escapeName(columns.get(j).getName())); out.write(" = '"); out.write( attValues.get(j).toString()); // DJB: changed this to attValues[j] from // attValues[i]. out.write("'"); if (j < (attValues.size() - 1)) { out.write(" AND "); } } out.write(")"); if (i.hasNext()) { out.write(" OR "); } } if (ids.size() > 1) { out.write(")"); } } catch (java.io.IOException e) { throw new RuntimeException(IO_ERROR, e); } return extraData; }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public static String convertToSQL92( char escape, char multi, char single, boolean matchCase, String pattern) throws IllegalArgumentException { if ((escape == '\'') || (multi == '\'') || (single == '\'')) throw new IllegalArgumentException("do not use single quote (') as special char!"); StringBuffer result = new StringBuffer(pattern.length() + 5); for (int i = 0; i < pattern.length(); i++) { char chr = pattern.charAt(i); if (chr == escape) { // emit the next char and skip it if (i != (pattern.length() - 1)) result.append(pattern.charAt(i + 1)); // i++; // skip next char } else if (chr == single) { result.append('_'); } else if (chr == multi) { result.append('%'); } else if (chr == '\'') { result.append('\''); result.append('\''); } else { result.append(matchCase ? chr : Character.toUpperCase(chr)); } } return result.toString(); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public String getSQL92LikePattern() throws IllegalArgumentException { if (escape.length() != 1) { throw new IllegalArgumentException( "Like Pattern --> escape char should be of length exactly 1"); } if (wildcardSingle.length() != 1) { throw new IllegalArgumentException( "Like Pattern --> wildcardSingle char should be of length exactly 1"); } if (wildcardMulti.length() != 1) { throw new IllegalArgumentException( "Like Pattern --> wildcardMulti char should be of length exactly 1"); } return LikeFilterImpl.convertToSQL92( escape.charAt(0), wildcardMulti.charAt(0), wildcardSingle.charAt(0), matchingCase, pattern); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public void testLikeToSQL() { Assert.assertEquals( "BroadWay%", LikeFilterImpl.convertToSQL92('!', '*', '.', true, "BroadWay*")); Assert.assertEquals( "broad#ay", LikeFilterImpl.convertToSQL92('!', '*', '.', true, "broad#ay")); Assert.assertEquals( "broadway", LikeFilterImpl.convertToSQL92('!', '*', '.', true, "broadway")); Assert.assertEquals( "broad_ay", LikeFilterImpl.convertToSQL92('!', '*', '.', true, "broad.ay")); Assert.assertEquals( "broad.ay", LikeFilterImpl.convertToSQL92('!', '*', '.', true, "broad!.ay")); Assert.assertEquals( "broa''dway", LikeFilterImpl.convertToSQL92('!', '*', '.', true, "broa'dway")); Assert.assertEquals( "broa''''dway", LikeFilterImpl.convertToSQL92('!', '*', '.', true, "broa" + "''dway")); Assert.assertEquals( "broadway_", LikeFilterImpl.convertToSQL92('!', '*', '.', true, "broadway.")); Assert.assertEquals( "broadway", LikeFilterImpl.convertToSQL92('!', '*', '.', true, "broadway!")); Assert.assertEquals( "broadway!", LikeFilterImpl.convertToSQL92('!', '*', '.', true, "broadway!!")); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public FilterToSQL createFilterToSQL() { return new MySQLFilterToSQL(delegate.getUsePreciseSpatialOps()); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
new UnWrapper() { @Override public Statement unwrap(Statement statement) { throw new UnsupportedOperationException(); } @Override public Connection unwrap(Connection conn) { throw new UnsupportedOperationException(); } @Override public boolean canUnwrap(Statement st) { return false; } @Override public boolean canUnwrap(Connection conn) { return false; } };
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public String jsonExists(Function function) { PropertyName columnName = (PropertyName) getParameter(function, 0, true); Literal jsonPath = (Literal) getParameter(function, 1, true); Expression expected = getParameter(function, 2, true); String[] pointers = jsonPath.getValue().toString().split("/"); if (pointers.length > 0) { String strJsonPath = String.join(".", pointers); return String.format( "json_exists(%s, '$%s?(@ == \"%s\")')", columnName, strJsonPath, expected.evaluate(null)); } else { throw new IllegalArgumentException( "Cannot encode filter Invalid pointer " + jsonPath.getValue()); } }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
protected void doSDODistance( BinarySpatialOperator filter, Expression e1, Expression e2, Object extraData) throws IOException { double distance = ((DistanceBufferOperator) filter).getDistance(); String unit = getSDOUnitFromOGCUnit(((DistanceBufferOperator) filter).getDistanceUnits()); String within = filter instanceof DWithin ? "TRUE" : "FALSE"; out.write("SDO_WITHIN_DISTANCE("); e1.accept(this, extraData); out.write(","); e2.accept(this, extraData); // encode the unit verbatim when available if (unit != null && !"".equals(unit.trim())) out.write(",'distance=" + distance + " unit=" + unit + "') = '" + within + "' "); else out.write(",'distance=" + distance + "') = '" + within + "' "); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public String buildJsonFromStrPointer(String[] pointers, Expression expectedExp) { if (!"".equals(pointers[0])) { if (pointers.length == 1) { final String expected = getBaseType(expectedExp).isAssignableFrom(String.class) ? String.format( "\"%s\"", ((Literal) expectedExp).getValue().toString()) : ((Literal) expectedExp).getValue().toString(); return String.format("\"%s\": [%s]", pointers[0], expected); } else { return String.format( "\"%s\": { %s }", pointers[0], buildJsonFromStrPointer( Arrays.copyOfRange(pointers, 1, pointers.length), expectedExp)); } } else return buildJsonFromStrPointer( Arrays.copyOfRange(pointers, 1, pointers.length), expectedExp); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
private void encodeJsonArrayContains(Function jsonArrayContains) throws IOException { PropertyName column = (PropertyName) getParameter(jsonArrayContains, 0, true); Literal jsonPath = (Literal) getParameter(jsonArrayContains, 1, true); Expression expected = getParameter(jsonArrayContains, 2, true); String[] strJsonPath = jsonPath.getValue().toString().split("/"); if (strJsonPath.length > 0) { String jsonFilter = String.format("{ %s }", buildJsonFromStrPointer(strJsonPath, expected)); out.write( String.format( "\"%s\"::jsonb @> '%s'::jsonb", column.getPropertyName(), jsonFilter)); } else { throw new IllegalArgumentException( "Cannot encode filter Invalid pointer " + jsonPath.getValue()); } }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public void testFunctionJsonArrayContains() throws Exception { filterToSql.setFeatureType(testSchema); Function pointer = ff.function( "jsonArrayContains", ff.property("OPERATIONS"), ff.literal("/operations"), ff.literal("OP1")); filterToSql.encode(pointer); String sql = writer.toString().trim(); assertEquals("\"OPERATIONS\"::jsonb @> '{ \"operations\": [\"OP1\"] }'::jsonb", sql); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public void testNestedObjectJsonArrayContains() throws Exception { filterToSql.setFeatureType(testSchema); Function pointer = ff.function( "jsonArrayContains", ff.property("OPERATIONS"), ff.literal("/operations/parameters"), ff.literal("P1")); filterToSql.encode(pointer); String sql = writer.toString().trim(); assertEquals( "\"OPERATIONS\"::jsonb @> '{ \"operations\": { \"parameters\": [\"P1\"] } }'::jsonb", sql); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public void testFunctionJsonArrayContainsNumber() throws Exception { filterToSql.setFeatureType(testSchema); Function pointer = ff.function( "jsonArrayContains", ff.property("OPERATIONS"), ff.literal("/operations"), ff.literal(1)); filterToSql.encode(pointer); String sql = writer.toString().trim(); assertEquals("\"OPERATIONS\"::jsonb @> '{ \"operations\": [1] }'::jsonb", sql); }
0
Java
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.
https://cwe.mitre.org/data/definitions/89.html
vulnerable
public void validate(final OidcCredentials credentials, final WebContext context) { final AuthorizationCode code = credentials.getCode(); // if we have a code if (code != null) { try { final String computedCallbackUrl = client.computeFinalCallbackUrl(context); // Token request final TokenRequest request = createTokenRequest(new AuthorizationCodeGrant(code, new URI(computedCallbackUrl))); HTTPRequest tokenHttpRequest = request.toHTTPRequest(); tokenHttpRequest.setConnectTimeout(configuration.getConnectTimeout()); tokenHttpRequest.setReadTimeout(configuration.getReadTimeout()); final HTTPResponse httpResponse = tokenHttpRequest.send(); logger.debug("Token response: status={}, content={}", httpResponse.getStatusCode(), httpResponse.getContent()); final TokenResponse response = OIDCTokenResponseParser.parse(httpResponse); if (response instanceof TokenErrorResponse) { throw new TechnicalException("Bad token response, error=" + ((TokenErrorResponse) response).getErrorObject()); } logger.debug("Token response successful"); final OIDCTokenResponse tokenSuccessResponse = (OIDCTokenResponse) response; // save tokens in credentials final OIDCTokens oidcTokens = tokenSuccessResponse.getOIDCTokens(); credentials.setAccessToken(oidcTokens.getAccessToken()); credentials.setRefreshToken(oidcTokens.getRefreshToken()); credentials.setIdToken(oidcTokens.getIDToken()); } catch (final URISyntaxException | IOException | ParseException e) { throw new TechnicalException(e); } } }
0
Java
CWE-502
Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.
https://cwe.mitre.org/data/definitions/502.html
vulnerable
private boolean isImage(MultipartFile file) { BufferedImage image = null; try (InputStream input = file.getInputStream()) { image = ImageIO.read(input); } catch (IOException e) { LogUtil.error(e.getMessage(), e); return false; } if (image == null || image.getWidth() <= 0 || image.getHeight() <= 0) { return false; } return true; }
0
Java
CWE-434
Unrestricted Upload of File with Dangerous Type
The product allows the attacker to upload or transfer files of dangerous types that can be automatically processed within the product's environment.
https://cwe.mitre.org/data/definitions/434.html
vulnerable
public void backup(File targetDir, DataSource dataSource, DbProperties dbProperties) throws InterruptedException, TimeoutException, IOException { ProcessResult processResult = createProcessExecutor(targetDir, dbProperties).execute(); if (processResult.getExitValue() == 0) { log.info("MySQL backup finished successfully."); } else { log.warn("There was an error backing up the database using `mysqldump`. The `mysqldump` process exited with status code {}.", processResult.getExitValue()); throw new RuntimeException("There was an error backing up the database using `mysqldump`. The `mysqldump` process exited with status code " + processResult.getExitValue() + ". Please see the server logs for more errors"); } }
0
Java
CWE-532
Insertion of Sensitive Information into Log File
Information written to log files can be of a sensitive nature and give valuable guidance to an attacker or expose sensitive user information.
https://cwe.mitre.org/data/definitions/532.html
vulnerable
private ProcessExecutor createProcessExecutor(File targetDir, DbProperties dbProperties) { ConnectionUrl connectionUrlInstance = ConnectionUrl.getConnectionUrlInstance(dbProperties.url(), dbProperties.connectionProperties()); LinkedHashMap<String, String> env = new LinkedHashMap<>(); if (isNotBlank(dbProperties.password())) { env.put("MYSQL_PWD", dbProperties.password()); } // override with any user specified environment env.putAll(dbProperties.extraBackupEnv()); ArrayList<String> argv = new ArrayList<>(); argv.add("mysqldump"); String dbName = connectionUrlInstance.getDatabase(); HostInfo mainHost = connectionUrlInstance.getMainHost(); if (mainHost != null) { argv.add("--host=" + mainHost.getHost()); argv.add("--port=" + mainHost.getPort()); } if (isNotBlank(dbProperties.user())) { argv.add("--user=" + dbProperties.user()); } // append any user specified args for mysqldump if (isNotBlank(dbProperties.extraBackupCommandArgs())) { Collections.addAll(argv, Commandline.translateCommandline(dbProperties.extraBackupCommandArgs())); } argv.add("--result-file=" + new File(targetDir, "db." + dbName).toString()); argv.add(connectionUrlInstance.getDatabase()); ProcessExecutor processExecutor = new ProcessExecutor(); processExecutor.redirectOutputAlsoTo(Slf4jStream.of(getClass()).asDebug()); processExecutor.redirectErrorAlsoTo(Slf4jStream.of(getClass()).asDebug()); processExecutor.environment(env); processExecutor.command(argv); return processExecutor; }
0
Java
CWE-532
Insertion of Sensitive Information into Log File
Information written to log files can be of a sensitive nature and give valuable guidance to an attacker or expose sensitive user information.
https://cwe.mitre.org/data/definitions/532.html
vulnerable
public void backup(File targetDir, DataSource dataSource, DbProperties dbProperties) throws Exception { ProcessResult processResult = createProcessExecutor(targetDir, dbProperties).execute(); if (processResult.getExitValue() == 0) { log.info("PostgreSQL backup finished successfully."); } else { log.warn("There was an error backing up the database using `pg_dump`. The `pg_dump` process exited with status code {}.", processResult.getExitValue()); throw new RuntimeException("There was an error backing up the database using `pg_dump`. The `pg_dump` process exited with status code " + processResult.getExitValue() + ". Please see the server logs for more errors."); } }
0
Java
CWE-532
Insertion of Sensitive Information into Log File
Information written to log files can be of a sensitive nature and give valuable guidance to an attacker or expose sensitive user information.
https://cwe.mitre.org/data/definitions/532.html
vulnerable
ProcessExecutor createProcessExecutor(File targetDir, DbProperties dbProperties) { Properties connectionProperties = dbProperties.connectionProperties(); Properties pgProperties = Driver.parseURL(dbProperties.url(), connectionProperties); ArrayList<String> argv = new ArrayList<>(); LinkedHashMap<String, String> env = new LinkedHashMap<>(); if (isNotBlank(dbProperties.password())) { env.put("PGPASSWORD", dbProperties.password()); } // override with any user specified environment env.putAll(dbProperties.extraBackupEnv()); String dbName = pgProperties.getProperty("PGDBNAME"); argv.add("pg_dump"); argv.add("--host=" + pgProperties.getProperty("PGHOST")); argv.add("--port=" + pgProperties.getProperty("PGPORT")); argv.add("--dbname=" + dbName); if (isNotBlank(dbProperties.user())) { argv.add("--username=" + dbProperties.user()); } argv.add("--no-password"); // append any user specified args for pg_dump if (isNotBlank(dbProperties.extraBackupCommandArgs())) { Collections.addAll(argv, Commandline.translateCommandline(dbProperties.extraBackupCommandArgs())); } argv.add("--file=" + new File(targetDir, "db." + dbName)); ProcessExecutor processExecutor = new ProcessExecutor(); processExecutor.redirectOutputAlsoTo(Slf4jStream.of(getClass()).asDebug()); processExecutor.redirectErrorAlsoTo(Slf4jStream.of(getClass()).asDebug()); processExecutor.environment(env); processExecutor.command(argv); return processExecutor; }
0
Java
CWE-532
Insertion of Sensitive Information into Log File
Information written to log files can be of a sensitive nature and give valuable guidance to an attacker or expose sensitive user information.
https://cwe.mitre.org/data/definitions/532.html
vulnerable
public void visit(Modification modification) { modifiedFilesJson = new ArrayList(); Map<String, Object> jsonMap = new LinkedHashMap<>(); jsonMap.put("user", modification.getUserDisplayName()); jsonMap.put("revision", modification.getRevision()); jsonMap.put("date", formatISO8601(modification.getModifiedTime())); String comment = modification.getComment(); if (!revision.getMaterial().getMaterialType().equals(TYPE)) { comment = commentRenderer.render(comment); } jsonMap.put("comment", comment); jsonMap.put("modifiedFiles", modifiedFilesJson); modificationsJson.add(jsonMap); }
0
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public void visit(MaterialRevision revision) { this.revision = revision; modificationsJson = new ArrayList(); materialJson = new LinkedHashMap(); materialJson.put("revision", revision.getRevision().getRevision()); materialJson.put("revision_href", revision.getRevision().getRevisionUrl()); materialJson.put("user", revision.buildCausedBy()); materialJson.put("date", formatISO8601(revision.getDateOfLatestModification())); materialJson.put("changed", valueOf(revision.isChanged())); materialJson.put("modifications", modificationsJson); materials.add(materialJson); }
0
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public List json() { return materials; }
0
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
private Map<String, Object> createJobDetailModel() { GitMaterialConfig gitMaterialConfig = gitMaterialConfig(); MaterialRevisions materialRevisions = new MaterialRevisions(); materialRevisions.addRevision(new GitMaterial(gitMaterialConfig), new Modification("Ernest Hemingway <[email protected]>", "comment", "email", new Date(), "12", "")); Pipeline pipeline = schedule(pipelineConfig("pipeline", new MaterialConfigs(gitMaterialConfig)), createWithModifications(materialRevisions, "")); JobDetailPresentationModel model = new JobDetailPresentationModel(building("job"), new JobInstances(), null, pipeline, new Tabs(), new TrackingTool(), mock(ArtifactsService.class), StageMother.custom("stage")); return minimalModelFrom(model); }
0
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public void setUp() throws Exception { super.setUp("build_detail/build_detail_page.ftl"); }
0
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public void shouldRenderIframeSandboxForTestsTab() { JobDetailPresentationModel jobDetailPresentationModel = mock(JobDetailPresentationModel.class, RETURNS_SMART_NULLS); when(jobDetailPresentationModel.hasTests()).thenReturn(true); when(jobDetailPresentationModel.getCustomizedTabs()).thenReturn(new Tabs()); Document actualDoc = Jsoup.parse(view.render(minimalModelFrom(jobDetailPresentationModel))); assertThat(actualDoc.select("#tab-content-of-tests").last().html(), containsString("<iframe sandbox=\"allow-scripts\"")); }
0
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public void shouldEscapeBuildCauseInTrimPathTemplate() { Document actualDoc = Jsoup.parse(view.render(createJobDetailModel())); assertThat(actualDoc.select("#build-summary-template").last().html(), containsString("modified by Ernest Hemingway &amp;lt;[email protected]&amp;gt;")); }
0
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public void shouldEscapeBuildCauseOnVelocityTemplate() { Document actualDoc = Jsoup.parse(view.render(createJobDetailModel())); assertThat(actualDoc.select("#build-detail-summary").last().html(), containsString("modified by Ernest Hemingway &lt;[email protected]&gt;")); }
0
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable
public void shouldHaveErrorMessageAlongWithCustomMessageInOutputOfTemplate() { Map<String, Object> data = new HashMap<>(); data.put("errorMessage", "ERROR MESSAGE"); String output = view.render(data); assertThat(output, containsString("$('trans_content').update(\"Sorry, an unexpected error occurred [ERROR MESSAGE]. :( Please check the server logs for more information.\");")); }
0
Java
CWE-79
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
https://cwe.mitre.org/data/definitions/79.html
vulnerable