-
Notifications
You must be signed in to change notification settings - Fork 7
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
[report] Initial commit of /report and /validate endpoints #31
base: sandbox/joshlf/emulator-unit-test
Are you sure you want to change the base?
Conversation
55c872a
to
878204e
Compare
878204e
to
dcd7acc
Compare
app/internal/report/report.go
Outdated
|
||
pendingReportsCollection = "pending_reports" | ||
|
||
// 3 days - the period of during which a token is valid and may be verified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these constants inherent to the protocol? Perhaps they should live in a config that can be changed without recompiling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I definitely want to do that eventually, but for prototyping's sake, it's not a priority. If you want to tackle that, though, feel free! #32
2874bab
to
5cac050
Compare
dcd7acc
to
1f0c26e
Compare
4ffa562
to
9af83f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Are you squashing and force pushing? I guess that would be more clear if I saw this PR earlier.
Yeah, I've been spoiled by Gerrit, so I'm trying to figure out how to adapt my workflows to GH. |
9af83f4
to
747f99a
Compare
582a7c9
to
4bb9f77
Compare
747f99a
to
08ee308
Compare
4bb9f77
to
f829cc5
Compare
08ee308
to
684c7e7
Compare
684c7e7
to
ac4e181
Compare
3ee3327
to
f7b6c8f
Compare
cde3e4e
to
a9e97a6
Compare
1591bd8
to
90664ea
Compare
4652316
to
97f0dff
Compare
762c9dc
to
49fc05f
Compare
8af8831
to
ed574c6
Compare
49fc05f
to
36b3d63
Compare
ed574c6
to
7d5ba5c
Compare
7216342
to
5f1cced
Compare
5f1cced
to
5e18ac8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 7 files reviewed, 4 unresolved discussions (waiting on @madhavajay)
API.md, line 55 at r1 (raw file):
Previously, madhavajay (Madhava Jay) wrote…
This data payload returns:
responding with error code 500 and message "internal server error" (error: illegal base64 data at input byte 36)
Changing to this works:
"data" : "9USO+Z30bvZWIKPwZmee0TvkGXBQi7+DqAjtdYZ="
Done.
API.md, line 94 at r1 (raw file):
Previously, madhavajay (Madhava Jay) wrote…
See above:
"data" : "9USO+Z30bvZWIKPwZmee0TvkGXBQi7+DqAjtdYZ="
Done.
functions/internal/report/report.go, line 85 at r1 (raw file):
Previously, madhavajay (Madhava Jay) wrote…
spelling: remvoed -> removed
Done.
functions/internal/report/report_test.go, line 43 at r1 (raw file):
Previously, madhavajay (Madhava Jay) wrote…
number?
Done.
563a290
to
c0ba7cb
Compare
9e6e48b
to
55b3b56
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 11 of 11 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @joshlf)
functions/report.go, line 77 at r2 (raw file):
if req.Challenge != nil { var emptyChallgeSolution pow.ChallengeSolution if !allowEmptyChallengeSolution || *req.Challenge != emptyChallgeSolution {
Maybe here we can have an extra if allowEmptyChallengeSolution log: "Warning challenge bypassed do not do this in production"?
functions/internal/report/report.go, line 107 at r2 (raw file):
func StorePendingReport(ctx *util.Context, reportData []byte) (UploadToken, UploadKey, util.StatusError) { validityExp := ctx.Now().Add(validityPeriod) allocationExp := validityExp.Add(allocationPeriod)
Any benefit to adding a random amount of time to this during run time so they cant be accurately predicted eg:
allocationExp := validityExp.Add(allocationPeriod + rand)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @joshlf and @madhavajay)
functions/internal/report/report.go, line 107 at r2 (raw file):
Previously, madhavajay (Madhava Jay) wrote…
Any benefit to adding a random amount of time to this during run time so they cant be accurately predicted eg:
allocationExp := validityExp.Add(allocationPeriod + rand)
I'm not aware of any security risk to the allocation period being known. Do you have one in mind?
55b3b56
to
2b8055e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 9 of 11 files reviewed, 2 unresolved discussions (waiting on @madhavajay)
functions/report.go, line 77 at r2 (raw file):
Previously, madhavajay (Madhava Jay) wrote…
Maybe here we can have an extra if allowEmptyChallengeSolution log: "Warning challenge bypassed do not do this in production"?
Done.
2b8055e
to
ec1c6bc
Compare
c0ba7cb
to
8f01486
Compare
ec1c6bc
to
46c0425
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r3.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @madhavajay)
46c0425
to
f1d173b
Compare
6e5cb8d
to
fc14cca
Compare
01cf583
to
b8c87a3
Compare
- Split the `util.Context` type into `Context` and `RequestContext`. `Context` stores a Firestore client and implements a fake clock for testing. `RequestContext` wraps `Context`, and adds HTTP request-specific utilities. All code should use a `Context` unless it needs HTTP request-specific utilities. - Implement a fake clock for testing in `util.Context` - Add utilities to `util.Context` to help run Firestore transactions
b8c87a3
to
53f7ed5
Compare
This change is