Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Przemyslaw Kaminski
haskell-gargantext
Commits
44d898e8
Commit
44d898e8
authored
Mar 04, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API] disable xsrf for cookie GET requests
Also, list API works now. Only the file isn't downloaded yet.
parent
03d73fca
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
8 deletions
+6
-8
API.hs
src/Gargantext/API.hs
+1
-1
List.hs
src/Gargantext/API/Ngrams/List.hs
+1
-5
Settings.hs
src/Gargantext/API/Settings.hs
+4
-2
No files found.
src/Gargantext/API.hs
View file @
44d898e8
...
...
@@ -208,7 +208,7 @@ type GargAPI' =
-- auth and capabilities.
:<|>
GargPrivateAPI
type
GargPrivateAPI
=
SA
.
Auth
'[
S
A
.
JWT
]
AuthenticatedUser
:>
GargPrivateAPI'
type
GargPrivateAPI
=
SA
.
Auth
'[
S
A
.
JWT
,
SA
.
Cookie
]
AuthenticatedUser
:>
GargPrivateAPI'
type
GargAdminAPI
-- Roots endpoint
...
...
src/Gargantext/API/Ngrams/List.hs
View file @
44d898e8
...
...
@@ -24,11 +24,8 @@ module Gargantext.API.Ngrams.List
where
import
Data.Aeson
-- import qualified Data.ByteString.Lazy as BSL
import
Data.List
(
zip
)
import
Data.Map
(
Map
,
toList
,
fromList
)
-- import qualified Data.Text as T
-- import qualified Data.Text.Encoding as TE
import
Network.HTTP.Media
((
//
),
(
/:
))
import
Servant
...
...
@@ -52,7 +49,7 @@ type API = Get '[JSON] NgramsList
:<|>
Get
'[
H
TML
]
NgramsList
api
::
ListId
->
GargServer
API
api
l
=
get
l
:<|>
put
l
:<|>
get
l
api
l
=
get
l
:<|>
put
l
:<|>
get
Html
l
get
::
RepoCmdM
env
err
m
=>
ListId
->
m
NgramsList
...
...
@@ -65,7 +62,6 @@ getHtml :: RepoCmdM env err m
getHtml
lId
=
do
lst
<-
get
lId
return
lst
--return $ TE.decodeUtf8 $ BSL.toStrict $ encode lst
-- TODO : purge list
...
...
src/Gargantext/API/Settings.hs
View file @
44d898e8
...
...
@@ -48,7 +48,7 @@ import Data.ByteString (ByteString)
import
qualified
Data.ByteString.Lazy
as
L
import
Servant
import
Servant.Auth.Server
(
defaultJWTSettings
,
JWTSettings
,
CookieSettings
,
default
CookieSettings
,
readKey
,
writeKey
)
import
Servant.Auth.Server
(
defaultJWTSettings
,
JWTSettings
,
CookieSettings
(
..
),
XsrfCookieSettings
(
..
),
defaultCookieSettings
,
defaultXsrf
CookieSettings
,
readKey
,
writeKey
)
import
Servant.Client
(
BaseUrl
,
parseBaseUrl
)
import
qualified
Servant.Job.Core
import
Servant.Job.Async
(
newJobEnv
,
defaultSettings
,
HasJobEnv
(
..
),
Job
)
...
...
@@ -106,9 +106,11 @@ devSettings jwkFile = do
,
_sendLoginEmails
=
LogEmailToConsole
,
_scrapydUrl
=
fromMaybe
(
panic
"Invalid scrapy URL"
)
$
parseBaseUrl
"http://localhost:6800"
,
_fileFolder
=
"data"
,
_cookieSettings
=
defaultCookieSettings
-- TODO-SECURITY tune
,
_cookieSettings
=
defaultCookieSettings
{
cookieXsrfSetting
=
Just
xsrfCookieSetting
}
-- TODO-SECURITY tune
,
_jwtSettings
=
defaultJWTSettings
jwk
-- TODO-SECURITY tune
}
where
xsrfCookieSetting
=
defaultXsrfCookieSettings
{
xsrfExcludeGet
=
True
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment