<commit_before>-- -*- coding: utf-8 -*-
-- (c) 2014 <NAME>, Elmyra UG <<EMAIL>>
--[[

(c) 2013, <NAME>
http://www.stavros.io/posts/writing-an-nginx-authentication-module-in-lua/

(c) 2013, phear
https://github.com/phaer/nginx-lua-auth

]]

local cjson = require('cjson')
local isis = require('lib/isis')
local util = require('lib/util')

local request_uri = ngx.var.request_uri
local static_resource = request_uri:find("^/fanstatic/.*$") or request_uri:find("^/static.*$")


-- ------------------------------------------
--  route firewall (whitelist)
-- ------------------------------------------

-- always permit access to ...

-- the authentication endpoint
if request_uri == "/auth" then
    return
end

-- the login form
if request_uri:find("^/login.*$") then
    return
end

-- all static resources
if static_resource and not request_uri:find("^/static/js/app.*$") then
    return
end

-- some api endpoints
if request_uri:find("^/api/identity/pwhash.*$") then
    return
end

-- "patentview" domains
if ngx.var.host:find("^patentview.*$") then
    return
end


-- ------------------------------------------<commit_msg>api: temporarily allow (whitelist) kindcode inquiry<commit_after>-- -*- coding: utf-8 -*-
-- (c) 2014 <NAME>, Elmyra UG <<EMAIL>>
--[[

(c) 2013, <NAME>
http://www.stavros.io/posts/writing-an-nginx-authentication-module-in-lua/

(c) 2013, phear
https://github.com/phaer/nginx-lua-auth

]]

local cjson = require('cjson')
local isis = require('lib/isis')
local util = require('lib/util')

local request_uri = ngx.var.request_uri
local static_resource = request_uri:find("^/fanstatic/.*$") or request_uri:find("^/static.*$")


-- ------------------------------------------
--  route firewall (whitelist)
-- ------------------------------------------

-- always permit access to ...

-- the authentication endpoint
if request_uri == "/auth" then
    return
end

-- the login form
if request_uri:find("^/login.*$") then
    return
end

-- all static resources
if static_resource and not request_uri:find("^/static/js/app.*$") then
    return
end

-- some api endpoints
if request_uri:find("^/api/identity/pwhash.*$") then
    return
end

-- temporarily allow kindcode inquiry
if request_uri:find("^/api/ops/.+/kindcodes$") then
    return
end

-- "patentview" domains
if ngx.var.host:find("^patentview.*$") then
    return
end


-- ------------------------------------------
{'fraction_non_alphanumeric': 0.2621035058430718, 'fraction_numerical': 0.010851419031719533, 'mean_word_length': 2.3199445983379503, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1328105', 'n_tokens_mistral': 804, 'n_tokens_neox': 755, 'n_words': 182}