security::csrf::validate (public)

 security::csrf::validate [ -tokenname tokenname ] \
    [ -allowempty allowempty ]

Defined in packages/acs-tcl/tcl/security-procs.tcl

Validate a CSRF token and call security::csrf::fail the request if invalid.

Switches:
-tokenname
(defaults to "__csrf_token") (optional)
-allowempty
(defaults to "false") (optional)
Returns:
nothing

Partial Call Graph (max 5 caller/called nodes):
%3 test_create_workflow_with_instance create_workflow_with_instance (test xowf) security::csrf::validate security::csrf::validate test_create_workflow_with_instance->security::csrf::validate security::csrf::fail security::csrf::fail (private) security::csrf::validate->security::csrf::fail security::csrf::token security::csrf::token (private) security::csrf::validate->security::csrf::token ad_form ad_form (public) ad_form->security::csrf::validate template::csrf::validate template::csrf::validate (public) template::csrf::validate->security::csrf::validate xowiki::FormPage instproc www-edit xowiki::FormPage instproc www-edit (public) xowiki::FormPage instproc www-edit->security::csrf::validate xowiki::FormPage instproc www-file-upload xowiki::FormPage instproc www-file-upload (public) xowiki::FormPage instproc www-file-upload->security::csrf::validate xowiki::Page instproc www-bulk-delete xowiki::Page instproc www-bulk-delete (public) xowiki::Page instproc www-bulk-delete->security::csrf::validate

Testcases:
create_workflow_with_instance
Source code:
        if {![info exists ::$tokenname] || ![ns_conn isconnected]} {
            #
            # If there is no global CSRF token, or we are not in a
            # connection thread, we accept everything.  If there is
            # no CSRF token, we assume, that its generation is
            # deactivated,
            #
            return
        }

        set oldToken [ns_queryget $tokenname]
        if {$oldToken eq ""} {
            #
            # There is not token in the query/form parameters, we
            # can't validate, since there is no token.
            #
            if {$allowempty} {
                return
            }
            fail
        }

        set token [token -tokenname $tokenname]
        if {$oldToken ne $token} {
            fail
        }
Generic XQL file:
packages/acs-tcl/tcl/security-procs.xql

PostgreSQL XQL file:
packages/acs-tcl/tcl/security-procs-postgresql.xql

Oracle XQL file:
packages/acs-tcl/tcl/security-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: