Skip to content
This repository has been archived by the owner. It is now read-only.

[minor] Create an API endpoint for agents to retrieve PGP public keys… #266

Merged
merged 1 commit into from Sep 12, 2016

Conversation

@sunnygkp10
Copy link
Contributor

commented Sep 9, 2016

[minor] Create an API endpoint for agent to retrieve PGP public Key fixes #240


// retrieve the publickey
var inv mig.Investigator
if len(fp) > 0 {

This comment has been minimized.

Copy link
@ameihm0912

ameihm0912 Sep 9, 2016

Contributor

Should we just error out here if fp isn't valid? Right now in this case it looks like we would still call pgp.ArmorPubKey() later with the uninitialized investigator value, since that part of the function will still run.

This comment has been minimized.

Copy link
@sunnygkp10

sunnygkp10 Sep 9, 2016

Author Contributor

actually i was not sure that what to do at this point so i need your suggestion. Although if fp isn't valid then it returns nothing but we can also add error message here.

This comment has been minimized.

Copy link
@ameihm0912

ameihm0912 Sep 9, 2016

Contributor

You can probably just wrap something like https://github.com/mozilla/mig/blob/master/mig-api/investigator_endpoints.go#L59-L64 inside if fp == "" { }, and reply with No fingerprint specified in the error message.

This comment has been minimized.

Copy link
@ameihm0912

ameihm0912 Sep 12, 2016

Contributor

We could probably just do if (fp != "") { grabFP(); } else { respond(400 error) } but otherwise looks good, r+

This comment has been minimized.

Copy link
@sunnygkp10

sunnygkp10 Sep 12, 2016

Author Contributor

So may i update that or its okay ?

@ameihm0912

This comment has been minimized.

Copy link
Contributor

commented Sep 9, 2016

@sunnygkp10 any chance you could update https://github.com/mozilla/mig/blob/master/doc/api.rst as well as part of this so we document the new API endpoint ?

@sunnygkp10

This comment has been minimized.

Copy link
Contributor Author

commented Sep 9, 2016

@ameihm0912 sure sir i can update .

@sunnygkp10 sunnygkp10 force-pushed the sunnygkp10:master branch 3 times, most recently from 8805bbc to 9516283 Sep 9, 2016

if len(fp) > 0 {
inv, err = ctx.DB.InvestigatorByFingerprint(fp)
if err != nil {
panic(err)

This comment has been minimized.

Copy link
@jvehent

jvehent Sep 9, 2016

Contributor

If the error is not found, the API should return a 404, not a 503.

@sunnygkp10 sunnygkp10 force-pushed the sunnygkp10:master branch from a64d56f to 0624393 Sep 9, 2016

@sunnygkp10

This comment has been minimized.

Copy link
Contributor Author

commented Sep 9, 2016

@jvehent Sir, Please review the validation of responses.

@ameihm0912

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2016

other then one noted nit which we can fix up after looks good, r+.

[minor] Create an API endpoint for agents to retrieve PGP public keys…
… and update the documentation for api endpoints fixes #240

@sunnygkp10 sunnygkp10 force-pushed the sunnygkp10:master branch from 0624393 to 12cc994 Sep 12, 2016

@sunnygkp10

This comment has been minimized.

Copy link
Contributor Author

commented Sep 12, 2016

@ameihm0912 mentioned change is done, please have a look. :)

@ameihm0912 ameihm0912 merged commit 1eafd1c into mozilla:master Sep 12, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants
You can’t perform that action at this time.