Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 93901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:25:02+00:00 2026-05-10T23:25:02+00:00

I just installed the FindBugs plugin for Eclipse, with the hope that it will

  • 0

I just installed the FindBugs plugin for Eclipse, with the hope that it will help me find SQL injection vulnerabilities in my code. However, it doesn’t seem to be finding anything, even when I deliberately put some in.

In the following examples, assume staticFinalBaseQuery is declared as follows:

public static final String staticFinalBaseQuery = ‘SELECT foo FROM table where id = ”;

and assume userInputfilterString is an argument to the method wrapping the example snippets. It comes direct from user input, and is not sanitized.

For example, the following snippet will not trigger a warning:

String query = staticFinalBaseQuery + userInputfilterString; pstmt = dbConnection.prepareStatement(query); 

Where staticFinalBaseQuery is a static final string, and userInputfilterString is a string direct from user input, available only at runtime, not scrubbed at all. Clearly, this is a vulnerability.

I expect the ‘A prepared statement is generated from a nonconstant String‘ warning to be triggered.

The following snippet also does not cause a warning (not surprising, since the compiled forms of these are probably identical):

pstmt = dbConnection.prepareStatement(staticFinalBaseQuery + userInputfilterString); 

However, this will cause a warning:

pstmt = dbConnection.prepareStatement(staticFinalBaseQuery + userInputfilterString + '''); 

If I append an empty string, or a space, no warning is triggered.

So, my question is, how can I get FindBugs to trigger on my first example? I am also curious why the first doesn’t cause a warning, but the last does?

Thanks in advance!

EDIT: I submitted a bug to FindBugs’s bug tracking system, as it seems this might be a bug. However, if anyone has any tips, I’d love to hear them.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:25:02+00:00Added an answer on May 10, 2026 at 11:25 pm

    It is hard to distinguish between safe code and unsafe code here. Sure, userInputfilterString may be unsafe, but it is impossible to determine this at compile time. However, the single-quote character in a string concatenation is a tell-tale sign of using inject-able code. That’s why FindBugs is triggering on the line containing this character, but not on the line with mere string concatenation.

    Basically, this isn’t a bug, but a limitation of how much can be done by software to check for SQL injection. Since the string may contain anything (i.e. it could have the vulnerable concatenation in another function) it is impossible to have the tool determine with any certainty that a problem exists.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 94k
  • Answers 94k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I used VB.NET Express Edition to test this. In the… May 11, 2026 at 6:46 pm
  • Editorial Team
    Editorial Team added an answer Yes - there are ways to do this - many… May 11, 2026 at 6:46 pm
  • Editorial Team
    Editorial Team added an answer Three approaches come to mind. Use regular expressions. This is… May 11, 2026 at 6:46 pm

Related Questions

I just installed the first release candidate of Python 3.0 and got this error
I just installed the SharePoint SDK on my machine, but I can't seem to
I'm using the GL class from JOGL, which basically contains all OpenGL functions. Now
Note: I've tried posting on the coderush/devexpress forums and as is usual for that

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.