Skip to content

Decode binary in GET requests. Closes #98. #114

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

Merged
merged 2 commits into from
Sep 25, 2020

Conversation

snar
Copy link
Contributor

@snar snar commented Sep 16, 2020

This patch add decoding of base64-encoded messages in PKIOperation queries.
Tested against juniper (junos 20.1) client and found working. Juniper behaviour slightly
differs from already proposed idea:
a) it does not encodes all messages with base64, only PKIOperation. For example,
with GetCACert query looks like path="/scep?operation=GetCACert&message=CA-CERT-NAME"
(not encoded), and attempt to decode such string will lead to decoding failure (may be
GetCACert is not considered as binary, and only binary data shall be encoded per rfc).
b) before decoding, messages are unescaped.

@jessepeterson
Copy link
Member

This looks fine and in line with § 5.2.2 in scep-23. I'd be inclined to accept this, however I'd love a test if you can add one. Perhaps a TestPKIOperationGET() along side this test:

func TestPKIOperation(t *testing.T) {
server, _, teardown := newServer(t)
defer teardown()
pkcsreq := loadTestFile(t, "../scep/testdata/PKCSReq.der")
body := bytes.NewReader(pkcsreq)
url := server.URL + "/scep?operation=PKIOperation"
resp, err := http.Post(url, "", body)
if err != nil {
t.Fatal(err)
}
if resp.StatusCode != http.StatusOK {
t.Error("expected", http.StatusOK, "got", resp.StatusCode)
}
}

Can even use the same data I'd think (just URL encode it and use a .Get() instead of .Post(). Also, tagging #98.

@jessepeterson jessepeterson merged commit c7e7a9d into micromdm:master Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants