Skip to content

Commit

Permalink
Fix crash on invalid state and lower state size to fit as key
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilander committed Dec 14, 2018
1 parent d179a34 commit 58f9a4c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "github",
"name": "GitHub",
"description": "GitHub plugin for Mattermost.",
"version": "0.7.0",
"version": "0.7.1",
"server": {
"executables": {
"linux-amd64": "server/dist/plugin-linux-amd64",
Expand Down
3 changes: 1 addition & 2 deletions server/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (p *Plugin) connectUserToGitHub(w http.ResponseWriter, r *http.Request) {

conf := p.getOAuthConfig()

state := fmt.Sprintf("%v_%v", model.NewId(), userID)
state := fmt.Sprintf("%v_%v", model.NewId()[0:15], userID)

p.API.KVSet(state, []byte(state))

Expand All @@ -106,7 +106,6 @@ func (p *Plugin) completeConnectUserToGitHub(w http.ResponseWriter, r *http.Requ
http.Error(w, "missing stored state", http.StatusBadRequest)
return
} else if string(storedState) != state {
fmt.Println(err.Error())
http.Error(w, "invalid state", http.StatusBadRequest)
return
}
Expand Down
2 changes: 1 addition & 1 deletion server/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ var manifest = struct {
Version string
}{
Id: "github",
Version: "0.7.0",
Version: "0.7.1",
}
2 changes: 1 addition & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "github",
"version": "0.6.2",
"version": "0.7.1",
"description": "Github plugin for Mattermost",
"main": "src/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/manifest.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const id = 'github';
export const version = '0.7.0';
export const version = '0.7.1';

0 comments on commit 58f9a4c

Please sign in to comment.