code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
public void setValidation(boolean validation) { this.validating = validation; }
CWE-611
13
public Media createMedia(String title, String description, Object mediaObject, String businessPath, Identity author) { Media media = null; if (mediaObject instanceof EfficiencyStatement) { EfficiencyStatement statement = (EfficiencyStatement) mediaObject; String xml = myXStream.toXML(statement); media = ...
CWE-91
78
public int decryptWithAd(byte[] ad, byte[] ciphertext, int ciphertextOffset, byte[] plaintext, int plaintextOffset, int length) throws ShortBufferException, BadPaddingException { int space; if (ciphertextOffset > ciphertext.length) space = 0; else space = ciphertext.length - ciphertextOffset; if (l...
CWE-787
24
void testDecodePath() throws Exception { // Fast path final String pathThatDoesNotNeedDecode = "/foo_bar_baz"; assertThat(decodePath(pathThatDoesNotNeedDecode)).isSameAs(pathThatDoesNotNeedDecode); // Slow path assertThat(decodePath("/foo%20bar\u007fbaz")).isEqualTo("/foo ba...
CWE-22
2
protected StyleSignatureBasic getStyleSignature() { return StyleSignatureBasic.of(SName.root, SName.element, SName.timingDiagram, SName.binary); }
CWE-918
16
public void export(Media media, ManifestBuilder manifest, File mediaArchiveDirectory, Locale locale) { EfficiencyStatement statement = null; if(StringHelper.containsNonWhitespace(media.getContent())) { try { statement = (EfficiencyStatement)myXStream.fromXML(media.getContent()); } catch (Exception e) { ...
CWE-91
78
public static void execute(String url, String proxyHost, int proxyPort, String proxyUsername, String proxyPassword, String accessToken, String orgName, String moduleName, String version, Path baloPath) { initializeSsl(); HttpURLConnection conn = createHttpUrlConnection(convertToUrl(url),...
CWE-306
79
public void addHandler(String path, ElementHandler handler) { getDispatchHandler().addHandler(path, handler); }
CWE-611
13
DefaultResetPasswordRequestResponse(UserReference reference, InternetAddress userEmail, String verificationCode) { this.userReference = reference; this.userEmail = userEmail; this.verificationCode = verificationCode; }
CWE-640
20
public int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset, byte[] ciphertext, int ciphertextOffset, int length) throws ShortBufferException { int space; if (ciphertextOffset > ciphertext.length) space = 0; else space = ciphertext.length - ciphertextOffset; if (keySpec == null) { ...
CWE-125
47
public boolean archiveNodeData(Locale locale, ICourse course, ArchiveOptions options, ZipOutputStream exportStream, String archivePath, String charset) { String filename = "checklist_" + StringHelper.transformDisplayNameToFileSystemName(getShortName()) + "_" + Formatter.formatDatetimeFilesystemSave(new Da...
CWE-91
78
public boolean isMetadataFileValid(OLATResource videoResource) { VFSContainer baseContainer = FileResourceManager.getInstance().getFileResourceRootImpl(videoResource); VFSLeaf metaDataFile = (VFSLeaf) baseContainer.resolve(FILENAME_VIDEO_METADATA_XML); try { VideoMetadata meta = (VideoMetadata) XStreamHelper....
CWE-91
78
public int decryptWithAd(byte[] ad, byte[] ciphertext, int ciphertextOffset, byte[] plaintext, int plaintextOffset, int length) throws ShortBufferException, BadPaddingException { int space; if (ciphertextOffset > ciphertext.length) space = 0; else space = ciphertext.length - ciphertextOffset; if (l...
CWE-787
24
public static String getAttachedFilePath(String inputStudyOid) { // Using a standard library to validate/Sanitize user inputs which will be used in path expression to prevent from path traversal String studyOid = FilenameUtils.getName(inputStudyOid); String attachedFilePath = CoreResources.getFie...
CWE-22
2
public Controller execute(FolderComponent fc, UserRequest ureq, WindowControl windowControl, Translator trans) { this.folderComponent = fc; this.translator = trans; this.fileSelection = new FileSelection(ureq, fc.getCurrentContainerPath()); VelocityContainer main = new VelocityContainer("mc", VELOCITY_ROO...
CWE-22
2
private void handle(ServletRequestHandler pReqHandler,HttpServletRequest pReq, HttpServletResponse pResp) throws IOException { JSONAware json = null; try { // Check access policy requestHandler.checkAccess(allowDnsReverseLookup ? pReq.getRemoteHost() : null, ...
CWE-79
1
public void testSelectByOperations() { JWKSelector selector = new JWKSelector(new JWKMatcher.Builder().keyOperations(KeyOperation.SIGN, KeyOperation.VERIFY).build()); List<JWK> keyList = new ArrayList<>(); keyList.add(new RSAKey.Builder(new Base64URL("n"), new Base64URL("e")).keyID("1") .keyOperations(new H...
CWE-347
25
static void setProperty(SchemaFactory schemaFactory, String propertyName) throws SAXException { try { schemaFactory.setProperty(propertyName, ""); } catch (SAXException e) { if (Boolean.getBoolean(SYSTEM_PROPERTY_IGNORE_XXE_PROTECTION_FAILURES)) { LOGGER.warni...
CWE-611
13
public Document read(String systemId) throws DocumentException { InputSource source = new InputSource(systemId); if (this.encoding != null) { source.setEncoding(this.encoding); } return read(source); }
CWE-611
13
private void onopen() { logger.fine("open"); this.cleanup(); this.readyState = ReadyState.OPEN; this.emit(EVENT_OPEN); final io.socket.engineio.client.Socket socket = this.engine; this.subs.add(On.on(socket, Engine.EVENT_DATA, new Listener() { @Override...
CWE-476
46
public static DomainSocketAddress newSocketAddress() { try { File file; do { file = File.createTempFile("NETTY", "UDS"); if (!file.delete()) { throw new IOException("failed to delete: " + file); } } while...
CWE-378
80
private boolean processStyleTag(Element ele, Node parentNode) { /* * Invoke the css parser on this element. */ CssScanner styleScanner = new CssScanner(policy, messages, policy.isEmbedStyleSheets()); try { Node firstChild = ele.getFirstChild(); if (...
CWE-79
1
protected Map<String, Serializable> getPrincipal(Jwt jwt) { Map<String, Serializable> principal = new HashMap<>(); principal.put("jwt", (Serializable) jwt.getBody()); return principal; }
CWE-347
25
private ByteArrayOutputStream initRequestResponseMocks(String callback,Runnable requestSetup,Runnable responseSetup) throws IOException { request = createMock(HttpServletRequest.class); response = createMock(HttpServletResponse.class); setNoCacheHeaders(response); expect(request.get...
CWE-79
1
private String clean(String svg) { svg = svg.toLowerCase().replaceAll("\\s", ""); if (svg.contains("<script>")) return EMPTY_SVG; if (svg.contains("</script>")) return EMPTY_SVG; if (svg.contains("<foreignobject")) return EMPTY_SVG; if (svg.contains("</foreignobject>")) return EMPTY_SVG; return...
CWE-79
1
public URL createURL(String spaces, String name, String queryString, String anchor, String wikiId, XWikiContext context, FilesystemExportContext exportContext) throws Exception { // Check if the current user has the right to view the SX file. We do this since this is what would happen //...
CWE-22
2
private static File newFile() throws IOException { File file = File.createTempFile("netty-", ".tmp"); file.deleteOnExit(); final FileOutputStream out = new FileOutputStream(file); out.write(data); out.close(); return file; }
CWE-379
83
public int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset, byte[] ciphertext, int ciphertextOffset, int length) throws ShortBufferException { int space; if (ciphertextOffset > ciphertext.length) space = 0; else space = ciphertext.length - ciphertextOffset; if (!haskey) { // The key ...
CWE-125
47
private static void testInvalidHeaders0(String requestStr) { EmbeddedChannel channel = new EmbeddedChannel(new HttpRequestDecoder()); assertTrue(channel.writeInbound(Unpooled.copiedBuffer(requestStr, CharsetUtil.US_ASCII))); HttpRequest request = channel.readInbound(); assertTrue(req...
CWE-444
41
public static Object readObject(XStream xStream, String xml) { try(InputStream is = new ByteArrayInputStream(xml.getBytes(ENCODING))) { return readObject(xStream, is); } catch (Exception e) { throw new OLATRuntimeException(XStreamHelper.class, "could not read Object from string: " + xml, e); } }
CWE-91
78
protected XMLReader installXMLFilter(XMLReader reader) { XMLFilter filter = getXMLFilter(); if (filter != null) { // find the root XMLFilter XMLFilter root = filter; while (true) { XMLReader parent = root.getParent(); if (parent ...
CWE-611
13
public PropertiesRequest getRequestedFields( InputStream in ) { final Set<QName> set = new LinkedHashSet<QName>(); try { ByteArrayOutputStream bout = new ByteArrayOutputStream(); StreamUtils.readTo( in, bout, false, true ); byte[] arr = bout.toByteArray...
CWE-611
13
public void setEncoding(String encoding) { this.encoding = encoding; }
CWE-611
13
private boolean extract(ArrayList<String> errors, URL source, File target) { FileOutputStream os = null; InputStream is = null; boolean extracting = false; try { if (!target.exists() || isStale(source, target) ) { is = source.openStream(); ...
CWE-94
14
private Optional<Map<String, Object>> readPropertiesFromLoader(String fileName, String filePath, PropertySourceLoader propertySourceLoader) throws ConfigurationException { ResourceResolver resourceResolver = new ResourceResolver(); Optional<ResourceLoader> resourceLoader = resourceResolver.getSuppor...
CWE-22
2
public void testGetShellCommandLineBash_WithSingleQuotedArg() throws Exception { Commandline cmd = new Commandline( new BourneShell() ); cmd.setExecutable( "/bin/echo" ); cmd.addArguments( new String[] { "\'hello world\'" } ); String[] shellCommandlin...
CWE-78
6
public String list(Model model, // TODO model should no longer be injected @RequestParam(required = false, defaultValue = "FILENAME") SortBy sortBy, @RequestParam(required = false, defaultValue = "false") boolean desc, @RequestParam(required = fal...
CWE-22
2
protected static String unifyQuotes( String path ) { if ( path == null ) { return null; } if ( path.indexOf( " " ) == -1 && path.indexOf( "'" ) != -1 && path.indexOf( "\"" ) == -1 ) { return StringUtils.escape( path ); } return St...
CWE-78
6
public int getPosition() { if ( realPos == -1 ) { realPos = ( getExecutable() == null ? 0 : 1 ); for ( int i = 0; i < position; i++ ) { Arg arg = (Arg) arguments.elementAt( i ); realPos += arg...
CWE-78
6
public void testWrapMemoryMapped() throws Exception { File file = File.createTempFile("netty-test", "tmp"); FileChannel output = null; FileChannel input = null; ByteBuf b1 = null; ByteBuf b2 = null; try { output = new RandomAccessFile(file, "rw").getChann...
CWE-378
80
void sharp() { final PathAndQuery res = PathAndQuery.parse("/#?a=b#1"); assertThat(res).isNotNull(); assertThat(res.path()).isEqualTo("/#"); assertThat(res.query()).isEqualTo("a=b#1"); // '%23' in a query string should never be decoded into '#'. final PathAndQuery re...
CWE-22
2
public int decryptWithAd(byte[] ad, byte[] ciphertext, int ciphertextOffset, byte[] plaintext, int plaintextOffset, int length) throws ShortBufferException, BadPaddingException { int space; if (ciphertextOffset > ciphertext.length) space = 0; else space = ciphertext.length - ciphertextOffset; if (l...
CWE-787
24
public List<String> getShellCommandLine( String[] arguments ) { List<String> commandLine = new ArrayList<String>(); if ( getShellCommand() != null ) { commandLine.add( getShellCommand() ); } if ( getShellArgs() != null ) { commandLine.ad...
CWE-78
6
public void testWhitespaceBeforeTransferEncoding02() { String requestStr = "POST / HTTP/1.1" + " Transfer-Encoding : chunked\r\n" + "Host: target.com" + "Content-Length: 65\r\n\r\n" + "0\r\n\r\n" + "GET /maliciousRequest HTTP/1....
CWE-444
41
public AbstractXmlConfigRootTagRecognizer(String expectedRootNode) throws Exception { this.expectedRootNode = expectedRootNode; SAXParserFactory factory = SAXParserFactory.newInstance(); saxParser = factory.newSAXParser(); }
CWE-611
13
public String getEncoding() { return encoding; }
CWE-611
13
public void setUp() throws Exception { super.setUp(); TestUtil.createTempTable(con, "xmltab","x xml"); }
CWE-611
13
private final void servlet31(HttpServletRequest request) { try { for(Part part:request.getParts()) { if(part.getContentType() != null && (StringHelper.containsNonWhitespace(part.getSubmittedFileName()) || !part.getContentType().startsWith("text/plain"))) { contentType = part.getContentType(); filena...
CWE-22
2
public void testMatchOperation() { JWKMatcher matcher = new JWKMatcher.Builder().keyOperation(KeyOperation.DECRYPT).build(); assertTrue(matcher.matches(new RSAKey.Builder(new Base64URL("n"), new Base64URL("e")).keyID("1") .keyOperations(new HashSet<>(Collections.singletonList(KeyOperation.DECRYPT))).build()))...
CWE-347
25
private static String bytesToHex(byte[] bytes, int length) { String out = ""; for (int j = 0; j < length; j++) { int v = bytes[j] & 0xFF; out += hexArray[v >>> 4]; out += hexArray[v & 0x0F]; out += " "; } return out; }
CWE-770
37
public JiffleRuntime getRuntimeInstance(Jiffle.RuntimeModel model) throws it.geosolutions.jaiext.jiffle.JiffleException { return createRuntimeInstance(model, getRuntimeBaseClass(model), false); }
CWE-94
14
void percent() { final PathAndQuery res = PathAndQuery.parse("/%25"); assertThat(res).isNotNull(); assertThat(res.path()).isEqualTo("/%25"); assertThat(res.query()).isNull(); }
CWE-22
2
public void todo_oldTasks() { String taskName = UUID.randomUUID().toString(); PersistentTask ctask = persistentTaskDao.createTask(taskName, new DummyTask()); //simulate a task from a previous boot PersistentTask ptask = new PersistentTask(); ptask.setCreationDate(new Date()); ptask.setLastModified(new D...
CWE-91
78
public int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset, byte[] ciphertext, int ciphertextOffset, int length) throws ShortBufferException { int space; if (ciphertextOffset > ciphertext.length) space = 0; else space = ciphertext.length - ciphertextOffset; if (!haskey) { // The key ...
CWE-787
24
public String displayCategoryWithReference(@PathVariable final String friendlyUrl, @PathVariable final String ref, Model model, HttpServletRequest request, HttpServletResponse response, Locale locale) throws Exception { return this.displayCategory(friendlyUrl,ref,model,request,response,locale); }
CWE-79
1
public void testMatchType() { JWKMatcher matcher = new JWKMatcher.Builder().keyType(KeyType.RSA).build(); assertTrue(matcher.matches(new RSAKey.Builder(new Base64URL("n"), new Base64URL("e")).keyID("1").build())); assertFalse(matcher.matches(new ECKey.Builder(ECKey.Curve.P_256, new Base64URL("x"), new Base64UR...
CWE-347
25
List<String> cleanForKeySlow(String key) { key = StringUtils.trin(StringUtils.goLowerCase(key)); key = key.replaceAll("_|\\.|\\s", ""); // key = replaceSmart(key, "partition", "package"); key = replaceSmart(key, "sequenceparticipant", "participant"); key = replaceSmart(key, "sequenceactor", "actor"); key =...
CWE-918
16
private void checkParams() throws Exception { if (vi == null) { throw new Exception("no layers defined."); } if (vi.length > 1) { for (int i = 0; i < vi.length - 1; i++) { if (vi[i] >= vi[i + 1]) ...
CWE-502
15
protected TestPolicy(Policy.ParseContext parseContext) throws PolicyException { super(parseContext); }
CWE-79
1
public static void setRequestMethod(HttpURLConnection conn, RequestMethod method) { try { conn.setRequestMethod(getRequestMethodAsString(method)); } catch (ProtocolException e) { throw ErrorUtil.createCommandException(e.getMessage()); } }
CWE-306
79
public int decryptWithAd(byte[] ad, byte[] ciphertext, int ciphertextOffset, byte[] plaintext, int plaintextOffset, int length) throws ShortBufferException, BadPaddingException { int space; if (ciphertextOffset > ciphertext.length) space = 0; else space = ciphertext.length - ciphertextOffset; if (l...
CWE-125
47
public static HttpURLConnection createHttpUrlConnection(URL url, String proxyHost, int proxyPort, String proxyUsername, String proxyPassword) { try { Proxy proxy = getProxy(proxyHost, proxyPort, proxyUsername, proxyPassword); // set proxy if exists. if (proxy ...
CWE-306
79
public EfficiencyStatement getUserEfficiencyStatementByResourceKey(Long resourceKey, Identity identity){ StringBuilder sb = new StringBuilder(256); sb.append("select statement from effstatementstandalone as statement") .append(" where statement.identity.key=:identityKey and statement.resourceKey=:resourceKey")...
CWE-91
78
private void verifyHostname(X509Certificate cert) throws CertificateParsingException { try { Collection sans = cert.getSubjectAlternativeNames(); if (sans == null) { String dn = cert.getSubjectX500Principal().getName(); LdapName ln = new LdapName(dn); fo...
CWE-295
52
public VFSContainer createChildContainer(String name) { File fNewFile = new File(getBasefile(), name); if (!fNewFile.mkdir()) return null; LocalFolderImpl locFI = new LocalFolderImpl(fNewFile, this); locFI.setDefaultItemFilter(defaultFilter); return locFI; }
CWE-22
2
public SAXReader(DocumentFactory factory) { this.factory = factory; }
CWE-611
13
private static IRegex getRegexConcat() { return RegexConcat.build(CommandBinary.class.getName(), RegexLeaf.start(), // new RegexOptional( // new RegexConcat( // new RegexLeaf("COMPACT", "(compact)"), // RegexLeaf.spaceOneOrMore())), // new RegexLeaf("binary"), // RegexLeaf.spaceOneO...
CWE-918
16
public int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset, byte[] ciphertext, int ciphertextOffset, int length) throws ShortBufferException { int space; if (ciphertextOffset > ciphertext.length) space = 0; else space = ciphertext.length - ciphertextOffset; if (!haskey) { // The k...
CWE-125
47
public int decryptWithAd(byte[] ad, byte[] ciphertext, int ciphertextOffset, byte[] plaintext, int plaintextOffset, int length) throws ShortBufferException, BadPaddingException { int space; if (ciphertextOffset > ciphertext.length) space = 0; else space = ciphertext.length - ciphertextOffset; if (l...
CWE-787
24
public Optional<InputStream> getResourceAsStream(String path) { Path filePath = getFilePath(normalize(path)); try { return Optional.of(Files.newInputStream(filePath)); } catch (IOException e) { return Optional.empty(); } }
CWE-22
2
private Document parseFromBytes(byte[] bytes) throws SAMLException { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); try { DocumentBuilder builder = documentBuilderFactory.newDocumentBuilder(); return builder...
CWE-611
13
public TList readListBegin() throws TException { return new TList(readByte(), readI32()); }
CWE-770
37
public BourneShell() { this( false ); }
CWE-78
6
private ModelAndView renameGroup(HttpServletRequest request, HttpServletResponse response) throws Exception { String oldName = request.getParameter("groupName"); String newName = request.getParameter("newName"); if (StringUtils.hasText(oldName) && StringUtils.hasText(newNam...
CWE-79
1
private byte[] decodeAndInflate(String encodedRequest) throws SAMLException { byte[] bytes = Base64.getMimeDecoder().decode(encodedRequest); Inflater inflater = new Inflater(true); inflater.setInput(bytes); inflater.finished(); try { ByteArrayOutputStream baos = new ByteArrayOutputStream();...
CWE-611
13
private void sendResponse(HttpServletResponse pResp, HttpServletRequest pReq, JSONAware pJson) throws IOException { String callback = pReq.getParameter(ConfigKey.CALLBACK.getKeyValue()); setContentType(pResp, callback != null ? "text/javascript" : getMimeType(pReq)); pResp.setStatus(HttpSer...
CWE-79
1
protected String getCorsDomain(String referer, String userAgent) { String dom = null; if (referer != null && referer.toLowerCase() .matches("https?://([a-z0-9,-]+[.])*draw[.]io/.*")) { dom = referer.toLowerCase().substring(0, referer.indexOf(".draw.io/") + 8); } else if (referer != null && refe...
CWE-918
16
public PlayerAnalog(String code, ISkinParam skinParam, TimingRuler ruler, boolean compact) { super(code, skinParam, ruler, compact); this.suggestedHeight = 100; }
CWE-918
16
public PersistentTask createTask(String name, Serializable task) { PersistentTask ptask = new PersistentTask(); Date currentDate = new Date(); ptask.setCreationDate(currentDate); ptask.setLastModified(currentDate); ptask.setName(name); ptask.setStatus(TaskStatus.newTask); ptask.setTask(xstream.toXML(task...
CWE-91
78
public synchronized <T extends Source> T getSource(Class<T> sourceClass) throws SQLException { checkFreed(); ensureInitialized(); if (data == null) { return null; } try { if (sourceClass == null || DOMSource.class.equals(sourceClass)) { DocumentBuilderFactory factory = Docume...
CWE-611
13
public static void ensurePointOnCurve(final ECPublicKey ephemeralPublicKey, final ECPrivateKey privateKey) throws JOSEException { // Ensure the following is met: // (y^2) mod p = (x^3 + ax + b) mod p ECParameterSpec ecParameterSpec = privateKey.getParams(); EllipticCurve curve = ecParameterSpec.getCurve()...
CWE-347
25
protected SymbolContext getContextLegacy() { return new SymbolContext(HColorUtils.COL_D7E0F2, HColorUtils.COL_038048).withStroke(new UStroke(1.5)); }
CWE-918
16
protected void configureReader(XMLReader reader, DefaultHandler handler) throws DocumentException { // configure lexical handling SAXHelper.setParserProperty(reader, SAX_LEXICALHANDLER, handler); // try alternate property just in case SAXHelper.setParserProperty(reader, ...
CWE-611
13
public TMap readMapBegin() throws TException { return new TMap(readByte(), readByte(), readI32()); }
CWE-770
37
public static ResourceEvaluation evaluate(File file, String filename) { ResourceEvaluation eval = new ResourceEvaluation(); try { ImsManifestFileFilter visitor = new ImsManifestFileFilter(); Path fPath = PathUtils.visit(file, filename, visitor); if(visitor.hasManifest()) { Path realManifestPath = visi...
CWE-22
2
public void fatalError(SAXParseException e) { }
CWE-611
13
public BourneShell( boolean isLoginShell ) { setShellCommand( "/bin/sh" ); setArgumentQuoteDelimiter( '\'' ); setExecutableQuoteDelimiter( '\"' ); setSingleQuotedArgumentEscaped( true ); setSingleQuotedExecutableEscaped( false ); setQuotedExecutableEnabled( true )...
CWE-78
6
public void testQuoteWorkingDirectoryAndExecutable_WDPathWithSingleQuotes() { Shell sh = newShell(); sh.setWorkingDirectory( "/usr/local/'something else'" ); sh.setExecutable( "chmod" ); String executable = StringUtils.join( sh.getShellCommandLine( new String[]{} ).iterator(), ...
CWE-78
6
public void testQuoteWorkingDirectoryAndExecutable() { Shell sh = newShell(); sh.setWorkingDirectory( "/usr/local/bin" ); sh.setExecutable( "chmod" ); String executable = StringUtils.join( sh.getShellCommandLine( new String[]{} ).iterator(), " " ); assertEquals( "/bin/...
CWE-78
6
private void checkUserReference(UserReference userReference) throws ResetPasswordException { if (!this.userManager.exists(userReference)) { String exceptionMessage = this.localizationManager.getTranslationPlain("xe.admin.passwordReset.error.noUser", userRe...
CWE-640
20
public int hashCode() { return new HashCodeBuilder(17, 37) .append(userReference) .append(userEmail) .append(verificationCode) .toHashCode(); }
CWE-640
20
private ModelAndView renameGroup(HttpServletRequest request, HttpServletResponse response) throws Exception { String oldName = request.getParameter("groupName"); String newName = request.getParameter("newName"); if (StringUtils.hasText(oldName) && StringUtils.hasText(newNam...
CWE-79
1
public static byte[] transcodeSignatureToConcat(final byte[] derSignature, int outputLength) throws JOSEException { if (derSignature.length < 8 || derSignature[0] != 48) { throw new JOSEException("Invalid ECDSA signature format"); } int offset; if (derSignature[1] > 0) { offset = 2; } else if (der...
CWE-347
25
public int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset, byte[] ciphertext, int ciphertextOffset, int length) throws ShortBufferException { int space; if (ciphertextOffset > ciphertext.length) space = 0; else space = ciphertext.length - ciphertextOffset; if (keySpec == null) { ...
CWE-787
24
private JsonNode yamlStreamToJson(InputStream yamlStream) { Yaml reader = new Yaml(); ObjectMapper mapper = new ObjectMapper(); return mapper.valueToTree(reader.load(yamlStream)); }
CWE-502
15
private static ECPublicKey generateECPublicKey(final ECKey.Curve curve) throws Exception { final ECParameterSpec ecParameterSpec = curve.toECParameterSpec(); KeyPairGenerator generator = KeyPairGenerator.getInstance("EC"); generator.initialize(ecParameterSpec); KeyPair keyPair = generator.generateKeyPa...
CWE-347
25
protected Object extractPrincipalFromWebToken(Jwt jwt) { Map body = (Map) jwt.getBody(); String base64Principal = (String) body.get("serialized-principal"); byte[] serializedPrincipal = Base64.decode(base64Principal); Object principal; ClassLoader loader = Thread.currentThrea...
CWE-347
25
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { String filename = file.getFileName().toString(); if(filename.endsWith(WikiManager.WIKI_PROPERTIES_SUFFIX)) { String f = convertAlternativeFilename(file.toString()); final Path destF...
CWE-22
2
public Player(String title, ISkinParam skinParam, TimingRuler ruler, boolean compact) { this.skinParam = skinParam; this.compact = compact; this.ruler = ruler; this.title = Display.getWithNewlines(title); }
CWE-918
16
public Controller execute(FolderComponent folderComponent, UserRequest ureq, WindowControl wControl, Translator translator) { VFSContainer currentContainer = folderComponent.getCurrentContainer(); VFSContainer rootContainer = folderComponent.getRootContainer(); if (!VFSManager.exists(currentContainer)) { sta...
CWE-22
2