Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad sonar security rating #14949

Closed
1 task done
atomfrede opened this issue May 11, 2021 · 20 comments · Fixed by #19324
Closed
1 task done

Bad sonar security rating #14949

atomfrede opened this issue May 11, 2021 · 20 comments · Fixed by #19324
Labels
area: enhancement 🔧 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ theme: java theme: sonar $200 https://www.jhipster.tech/bug-bounties/
Milestone

Comments

@atomfrede
Copy link
Member

Overview of the issue

Because of a change in the sonar rulesets we have now just a B in terms of security in our sample application.
The issue is imho not severe (maybe we can also exclude/ignore it), but we should do something about the red quality gate.

image

image

  • Checking this box is mandatory (this is just to show you read everything)
@atomfrede
Copy link
Member Author

I tried to forge some logs and succeeded. Running locally you can easily see the entry has been forged as it is not colored, but inside a log file or some other tool that would not be possible. So I tried OWASP easpi to encode it, but didn't have something working here.

@atomfrede
Copy link
Member Author

atomfrede commented Jun 7, 2021

I have managed to configured https://github.com/javabeanz/owasp-security-logging with the owasp filter documented here https://github.com/javabeanz/owasp-security-logging/wiki/Log-Forging

It looks like this. Maybe we should only enabled it in production as the nice "table like" log gets broken of course. You can see how the line break is replaced by the owasp clrf filter:

image

Basically this requires defining the clrf filter in logback-spring.xml and setting logging.pattern.console via regular properties using the clrf filter. With this I would say we are doing fine against log forging and could even ignore the sonar warnings regarding log forging. WDYT?

@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2021

This issue is stale because it has been open 30 days with no activity.
Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted.
We are accepting PRs 😃.
Comment or this will be closed in 7 days

@atomfrede
Copy link
Member Author

Keep it open

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity.
Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted.
We are accepting PRs 😃.
Comment or this will be closed in 7 days

@atomfrede
Copy link
Member Author

Keep it open

@nomuna
Copy link
Contributor

nomuna commented Sep 7, 2021

Just cloned the source code for the project and ran a sonar analysis with sonarqube-9.0.1.46107 for windows x64 with the defaults/ sonar quality gates. I don't see any security issues... Am I missing something? Is the project on sonar cloud? If it is could you provide the url?

@atomfrede
Copy link
Member Author

It's the generated sample app not the generator code itself. It is on sonar cloud here https://sonarcloud.io/dashboard?id=jhipster-sample-application

@nomuna
Copy link
Contributor

nomuna commented Sep 7, 2021

It's the generated sample app not the generator code itself. It is on sonar cloud here https://sonarcloud.io/dashboard?id=jhipster-sample-application

So it has nothing to do with the code under https://github.com/jhipster/jhipster-sample-app ?

@atomfrede
Copy link
Member Author

It is exactly that project, you are right.

@atomfrede
Copy link
Member Author

But in fact the rating has changed from F to B compared to the screenshots. The log forging is now minor as it seems

@nomuna
Copy link
Contributor

nomuna commented Sep 7, 2021

Screenshot 2021-09-07 083703

But in fact the rating has changed from F to B compared to the screenshots. The log forging is now minor as it seems

It is seriously weird... The scan I performed is a couple of hrs old and the code was checked out may be at the same time.
I don't see those log forging vulnerabilities. Was there a version change and may be they changed their quality gates? Is it possible?

@nomuna
Copy link
Contributor

nomuna commented Sep 7, 2021

BankAccountQueryService class is neither in master nor in main branch. I think the code comes from a different repository.
Or very old and the class in question was deleted long time ago...

@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2021

This issue is stale because it has been open 30 days with no activity.
Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted.
We are accepting PRs 😃.
Comment or this will be closed in 7 days

@atomfrede
Copy link
Member Author

Keep it open

@RobertBurrellDonkin
Copy link

I think that https://sonarcloud.io/dashboard?id=jhipster-sample-application is failing now just on code coverage.

What am I missing...?

@nomuna
Copy link
Contributor

nomuna commented Oct 29, 2021

I think that https://sonarcloud.io/dashboard?id=jhipster-sample-application is failing now just on code coverage.

What am I missing...?

As I have pointed out in my last message the project has moved on, some classes were deleted and refactored so that the screenshot used as info for the issue is no longer relevant. The devs refuse to accept it apparently... :D IMHO the issue should be closed.

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity.
Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted.
We are accepting PRs 😃.
Comment or this will be closed in 7 days

@pascalgrimaud
Copy link
Member

Probably it's because the Sonar analysis is broken since June:

image

@atomfrede
Copy link
Member Author

Coming back to this. The issue still exists, but the vulnerabilities are now minor (B). Nevertheless log forging is still possible, while I suppose a lot of people are using json based/structured logging instead of plain pattern layouts, not sure we must do something about it. We could document it more clearly in "going to production" and ignore the sonar issues.
In addition we may also provide json log configuration (by default) for production?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: enhancement 🔧 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ theme: java theme: sonar $200 https://www.jhipster.tech/bug-bounties/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants