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

BaseApp Security Improvements #3801

Merged
merged 12 commits into from
Mar 8, 2019
Merged

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Mar 4, 2019

A series of small BaseApp security improvements spawned by a lovely review by @ValarDragon.

closes: #3791
closes: #3790


  • Targeted PR against correct branch (see CONTRIBUTING.md)

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.

  • Wrote tests

  • Updated relevant documentation (docs/)

  • Added entries in PENDING.md with issue #

  • rereviewed Files changed in the github PR explorer


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

baseapp/baseapp.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Mar 4, 2019

Codecov Report

❗ No coverage uploaded for pull request base (develop@fbd79d0). Click here to learn what that means.
The diff coverage is 70%.

@@            Coverage Diff             @@
##             develop    #3801   +/-   ##
==========================================
  Coverage           ?   60.94%           
==========================================
  Files              ?      192           
  Lines              ?    14323           
  Branches           ?        0           
==========================================
  Hits               ?     8729           
  Misses             ?     5025           
  Partials           ?      569

@alexanderbez
Copy link
Contributor Author

@jackzampolin @cwgoes I think we should get this in for the 0.33 release. Thoughts?

Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions.

baseapp/baseapp.go Outdated Show resolved Hide resolved
baseapp/baseapp.go Outdated Show resolved Hide resolved
@@ -510,6 +513,19 @@ func handleQueryCustom(app *BaseApp, path []string, req abci.RequestQuery) (res
}
}

func (app *BaseApp) validateHeight(req abci.RequestBeginBlock) error {
if req.Header.Height < 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Tendermint starts at height 1 now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but can the same be said for other consensus engines?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily, but I think we should panic otherwise, because elsewhere in the SDK we assume that the first block height is 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point -- updated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can a comment be made somewhere or we amend ABCI to stipulate that the first block is at height 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ValarDragon yes, I'll follow up on this.

@alexanderbez
Copy link
Contributor Author

@cwgoes addressed your comments

@cwgoes
Copy link
Contributor

cwgoes commented Mar 6, 2019

@cwgoes addressed your comments

#3801 (comment)

Copy link
Contributor

@rigelrozanski rigelrozanski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good check!

baseapp/baseapp_test.go Outdated Show resolved Hide resolved
x/bank/app_test.go Show resolved Hide resolved
Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK - thanks @alexanderbez

@jackzampolin jackzampolin merged commit e236607 into develop Mar 8, 2019
@jackzampolin jackzampolin deleted the bez/baseapp-safety-improvements branch March 8, 2019 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When max gas = -1, the SDK doesn't allow for infinite gas baseapp does not check block ordering
6 participants