• Publicity: Public Only All

security-procs.tcl

Provides methods for authorizing and identifying ACS users (both logged-in and not) and tracking their sessions.

Location:
packages/acs-tcl/tcl/security-procs.tcl
Created:
16 Feb 2000
Authors:
Jon Salz <jsalz@arsdigita.com>
Richard Li <richardl@arsdigita.com>
Archit Shah <ashah@arsdigita.com>
CVS Identification:
$Id: security-procs.tcl,v 1.126.2.57 2021/10/04 09:35:27 gustafn Exp $

Procedures in this file

Detailed information

ad_change_password (public)

 ad_change_password \
    [ -password_hash_algorithm password_hash_algorithm ] user_id \
    new_password

Change the user's password

Switches:
-password_hash_algorithm (defaults to "salted-sha1") (optional)
Parameters:
user_id
new_password

Partial Call Graph (max 5 caller/called nodes):
%3 acs::test::auth::registration::Register acs::test::auth::registration::Register (private) ad_change_password ad_change_password acs::test::auth::registration::Register->ad_change_password ad_check_password ad_check_password (public) ad_check_password->ad_change_password auth::local::password::ChangePassword auth::local::password::ChangePassword (private) auth::local::password::ChangePassword->ad_change_password auth::local::password::ResetPassword auth::local::password::ResetPassword (private) auth::local::password::ResetPassword->ad_change_password auth::local::registration::Register auth::local::registration::Register (private) auth::local::registration::Register->ad_change_password

Testcases:
No testcase defined.

ad_check_password (public)

 ad_check_password user_id password_from_form

Check if the provided password is correct. OpenACS never stores password, but uses salted hashes for identification. Different algorithm can be used. When the stored hash is from another hash algorithm, which is preferred, this function updates the password hash automatically, but only, when the password is correct.

Parameters:
user_id
password_from_form
Returns:
Returns 1 if the password is correct for the given user ID.

Partial Call Graph (max 5 caller/called nodes):
%3 test_auth_password_change auth_password_change (test acs-authentication) ad_check_password ad_check_password test_auth_password_change->ad_check_password auth::local::authentication::Authenticate auth::local::authentication::Authenticate (private) auth::local::authentication::Authenticate->ad_check_password auth::local::password::ChangePassword auth::local::password::ChangePassword (private) auth::local::password::ChangePassword->ad_check_password

Testcases:
auth_password_change

ad_get_client_property (public)

 ad_get_client_property [ -cache cache ] [ -cache_only cache_only ] \
    [ -default default ] [ -session_id session_id ] module name

Looks up a property for a session. If -cache is true, will use the cached value if available. If -cache_only is true, will never incur a database hit (i.e., will only return a value if cached). If the property is secure, we must be on a validated session over HTTPS.

Switches:
-cache (defaults to "t") (optional)
-cache_only (defaults to "f") (optional)
-default (optional)
-session_id (optional)
controls which session is used
Parameters:
module - typically the name of the package to which the property belongs (serves as a namespace)
name - name of the property
Returns:
value of the property or default

See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_client_properties client_properties (test acs-tcl) ad_get_client_property ad_get_client_property test_client_properties->ad_get_client_property Class ::xowiki::Mode Class ::xowiki::Mode (public) Class ::xowiki::Mode->ad_get_client_property ad_cache_returnredirect ad_cache_returnredirect (public) ad_cache_returnredirect->ad_get_client_property ad_page_contract ad_page_contract (public) ad_page_contract->ad_get_client_property apidoc::set_public apidoc::set_public (private) apidoc::set_public->ad_get_client_property apm_get_package_repository apm_get_package_repository (public) apm_get_package_repository->ad_get_client_property

Testcases:
client_properties

ad_get_login_url (public)

 ad_get_login_url [ -authority_id authority_id ] [ -username username ] \
    [ -return ]

Returns a URL to the login page of the closest subsite, or the main site, if there's no current connection.

Switches:
-authority_id (optional)
-username (optional)
-return (boolean) (optional)
Options:
-return
If set, will export the current form, so when the registration is complete, the user will be returned to the current location. All variables in ns_getform (both posts and gets) will be maintained.
Authors:
Lars Pind <lars@collaboraid.biz>
Gustaf Neumann

Partial Call Graph (max 5 caller/called nodes):
%3 ad_redirect_for_registration ad_redirect_for_registration (public) ad_get_login_url ad_get_login_url ad_redirect_for_registration->ad_get_login_url auth::refresh_login auth::refresh_login (public) auth::refresh_login->ad_get_login_url auth::require_login auth::require_login (public) auth::require_login->ad_get_login_url packages/acs-subsite/lib/home.tcl packages/acs-subsite/ lib/home.tcl packages/acs-subsite/lib/home.tcl->ad_get_login_url packages/acs-subsite/www/group-master.tcl packages/acs-subsite/ www/group-master.tcl packages/acs-subsite/www/group-master.tcl->ad_get_login_url

Testcases:
No testcase defined.

ad_get_logout_url (public)

 ad_get_logout_url [ -return ] [ -return_url return_url ]

Returns a URL to the logout page of the closest subsite, or the main site, if there's no current connection.

Switches:
-return (boolean) (optional)
-return_url (optional)
Options:
-return
If set, will export the current form, so when the logout is complete the user will be returned to the current location. All variables in ns_getform (both posts and gets) will be maintained.
Author:
Lars Pind <lars@collaboraid.biz>

Partial Call Graph (max 5 caller/called nodes):
%3 packages/acs-subsite/www/group-master.tcl packages/acs-subsite/ www/group-master.tcl ad_get_logout_url ad_get_logout_url packages/acs-subsite/www/group-master.tcl->ad_get_logout_url packages/openacs-default-theme/lib/plain-master.tcl packages/openacs-default-theme/ lib/plain-master.tcl packages/openacs-default-theme/lib/plain-master.tcl->ad_get_logout_url

Testcases:
No testcase defined.

ad_get_signed_cookie (public)

 ad_get_signed_cookie [ -include_set_cookies include_set_cookies ] \
    [ -secret secret ] name

Retrieves a signed cookie. Validates a cookie against its cryptographic signature and ensures that the cookie has not expired. Throws an exception if cookie does not exists or validation fails (maybe due to expiration).

Switches:
-include_set_cookies (defaults to "t") (optional)
-secret (optional)
Parameters:
name
Returns:
cookie value

See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_set_cookie_procs test_set_cookie_procs (test acs-tcl) ad_get_signed_cookie ad_get_signed_cookie test_test_set_cookie_procs->ad_get_signed_cookie Class ::xowiki::includelet::kibana Class ::xowiki::includelet::kibana (public) Class ::xowiki::includelet::kibana->ad_get_signed_cookie sec_handler sec_handler (private) sec_handler->ad_get_signed_cookie sec_login_read_cookie sec_login_read_cookie (private) sec_login_read_cookie->ad_get_signed_cookie

Testcases:
test_set_cookie_procs

ad_get_signed_cookie_with_expr (public)

 ad_get_signed_cookie_with_expr \
    [ -include_set_cookies include_set_cookies ] [ -secret secret ] \
    name

Retrieves a signed cookie. Validates a cookie against its cryptographic signature and ensures that the cookie has not expired. Throws an exception when cookie does not exist or validation fails.

Switches:
-include_set_cookies (defaults to "t") (optional)
-secret (optional)
Parameters:
name
Returns:
Two-element list containing cookie data and expiration time

See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_sync_http_get_document sync_http_get_document (test acs-authentication) ad_get_signed_cookie_with_expr ad_get_signed_cookie_with_expr test_sync_http_get_document->ad_get_signed_cookie_with_expr

Testcases:
sync_http_get_document

ad_redirect_for_registration (public)

 ad_redirect_for_registration

Redirects user to [subsite]/register/index to require the user to register. When registration is complete, the user will be returned to the current location. All variables in ns_getform (both posts and gets) will be maintained.

It's up to the caller to issue an ad_script_abort, if that's what you want.


See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 forum::security::do_abort forum::security::do_abort (private) ad_redirect_for_registration ad_redirect_for_registration forum::security::do_abort->ad_redirect_for_registration

Testcases:
No testcase defined.

ad_restrict_entire_server_to_registered_users (public)

 ad_restrict_entire_server_to_registered_users conn args why

A preauth filter that will halt service of any page if the user is unregistered, except the site index page and stuff underneath [subsite]/register. Use permissions on the site node map to control access.

Parameters:
conn
args
why

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.

ad_set_client_property (public)

 ad_set_client_property [ -clob clob ] [ -secure secure ] \
    [ -persistent persistent ] [ -session_id session_id ] module name \
    value

Sets a client (session-level) property. If -persistent is true, the new value will be written through to the database (it will survive a server restart, bit it will be slower). If -secure is true, the property will not be retrievable except via a validated, secure (HTTPS) connection.

Switches:
-clob (defaults to "f") (optional)
tells us to use a large object to store the value
-secure (defaults to "f") (optional)
-persistent (defaults to "t") (optional)
-session_id (optional)
controls which session is used
Parameters:
module - typically the name of the package to which the property belongs (serves as a namespace)
name - name of the property
value - value if the property

See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_client_properties client_properties (test acs-tcl) ad_set_client_property ad_set_client_property test_client_properties->ad_set_client_property Class ::xowiki::Mode Class ::xowiki::Mode (public) Class ::xowiki::Mode->ad_set_client_property ad_cache_returnredirect ad_cache_returnredirect (public) ad_cache_returnredirect->ad_set_client_property apidoc::set_public apidoc::set_public (private) apidoc::set_public->ad_set_client_property apm_get_package_repository apm_get_package_repository (public) apm_get_package_repository->ad_set_client_property ds_replace_get_user_procs ds_replace_get_user_procs (private) ds_replace_get_user_procs->ad_set_client_property

Testcases:
client_properties

ad_set_signed_cookie (public)

 ad_set_signed_cookie [ -replace replace ] [ -secure secure ] \
    [ -expire expire ] [ -discard discard ] [ -scriptable scriptable ] \
    [ -max_age max_age ] [ -signature_max_age signature_max_age ] \
    [ -domain domain ] [ -path path ] [ -secret secret ] \
    [ -token_id token_id ] [ -samesite samesite ] name value

Sets a signed cookie. Negative token_ids are reserved for secrets external to the signed cookie mechanism. If a token_id is specified, a secret must be specified.

Switches:
-replace (defaults to "f") (optional)
-secure (defaults to "f") (optional)
-expire (defaults to "f") (optional)
-discard (defaults to "f") (optional)
-scriptable (defaults to "f") (optional)
allow access to the cookie from JavaScript
-max_age (optional)
specifies the maximum age of the cookies in seconds (consistent with RFC 2109). max_age inf specifies cookies that never expire. (see ad_set_cookie). The default is session cookies.
-signature_max_age (optional)
-domain (optional)
-path (defaults to "/") (optional)
-secret (optional)
allows the caller to specify a known secret external to the random secret management mechanism.
-token_id (optional)
allows the caller to specify a token_id.
-samesite (defaults to "lax") (optional)
Parameters:
name
value - the value for the cookie. This is automatically url-encoded.
Author:
Richard Li <richardl@arsdigita.com>
Created:
18 October 2000

See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_test_set_cookie_procs test_set_cookie_procs (test acs-tcl) ad_set_signed_cookie ad_set_signed_cookie test_test_set_cookie_procs->ad_set_signed_cookie Class ::xowiki::includelet::kibana Class ::xowiki::includelet::kibana (public) Class ::xowiki::includelet::kibana->ad_set_signed_cookie ad_user_login ad_user_login (public) ad_user_login->ad_set_signed_cookie sec_generate_secure_token_cookie sec_generate_secure_token_cookie (private) sec_generate_secure_token_cookie->ad_set_signed_cookie sec_generate_session_id_cookie sec_generate_session_id_cookie (private) sec_generate_session_id_cookie->ad_set_signed_cookie

Testcases:
test_set_cookie_procs

ad_sign (public)

 ad_sign [ -secret secret ] [ -token_id token_id ] [ -max_age max_age ] \
    [ -binding binding ] value

Returns a digital signature of the value. Negative token_ids are reserved for secrets external to the ACS digital signature mechanism. If a token_id is specified, a secret must also be specified.

Switches:
-secret (optional)
allows the caller to specify a known secret external to the random secret management mechanism.
-token_id (optional)
allows the caller to specify a token_id which is then ignored so don't use it.
-max_age (optional)
specifies the length of time the signature is valid in seconds. The default is forever.
-binding (defaults to "0") (optional)
allows the caller to bind a signature to a user/session. A value of 0 (default) means no additional binding. When the value is "-1" only the user who created the signature can obtain the value again. When the value is "-2" only the user with the same csrf token can obtain the value again. The permissible values might be extended in the future.
Parameters:
value - the value to be signed.

Partial Call Graph (max 5 caller/called nodes):
%3 test_auth_password_recover auth_password_recover (test acs-authentication) ad_sign ad_sign test_auth_password_recover->ad_sign test_sync_http_get_document sync_http_get_document (test acs-authentication) test_sync_http_get_document->ad_sign acs_mail_lite::unique_id_create acs_mail_lite::unique_id_create (private) acs_mail_lite::unique_id_create->ad_sign ad_form ad_form (public) ad_form->ad_sign ad_set_signed_cookie ad_set_signed_cookie (public) ad_set_signed_cookie->ad_sign export_vars_sign export_vars_sign (private) export_vars_sign->ad_sign template::element::create template::element::create (public) template::element::create->ad_sign

Testcases:
auth_password_recover, sync_http_get_document

ad_user_login (public)

 ad_user_login [ -account_status account_status ] \
    [ -cookie_domain cookie_domain ] [ -forever ] user_id

Logs the user in, forever (via the user_login cookie) if -forever is true. This procedure assumes that the user identity has been validated.

Switches:
-account_status (defaults to "ok") (optional)
-cookie_domain (optional)
-forever (boolean) (optional)
Parameters:
user_id

Partial Call Graph (max 5 caller/called nodes):
%3 test_logout_from_everywhere logout_from_everywhere (test acs-tcl) ad_user_login ad_user_login test_logout_from_everywhere->ad_user_login acs::test::set_user acs::test::set_user (private) acs::test::set_user->ad_user_login auth::authenticate auth::authenticate (public) auth::authenticate->ad_user_login auth::create_user auth::create_user (public) auth::create_user->ad_user_login auth::issue_login auth::issue_login (public, deprecated) auth::issue_login->ad_user_login auth::password::change auth::password::change (public) auth::password::change->ad_user_login

Testcases:
logout_from_everywhere

ad_user_logout (public)

 ad_user_logout [ -cookie_domain cookie_domain ]

Logs the user out.

Switches:
-cookie_domain (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 test_fs_create_folder fs_create_folder (test file-storage) ad_user_logout ad_user_logout test_fs_create_folder->ad_user_logout packages/acs-subsite/lib/user-new.tcl packages/acs-subsite/ lib/user-new.tcl packages/acs-subsite/lib/user-new.tcl->ad_user_logout packages/acs-subsite/www/register/logout.tcl packages/acs-subsite/ www/register/logout.tcl packages/acs-subsite/www/register/logout.tcl->ad_user_logout sec_handler sec_handler (private) sec_handler->ad_user_logout

Testcases:
fs_create_folder

ad_verify_signature (public)

 ad_verify_signature [ -secret secret ] value signature

Verifies a digital signature. Returns 1 for success, and 0 for failed validation. Validation can fail due to tampering or expiration of signature.

Switches:
-secret (optional)
specifies an external secret to use instead of the one provided by the ACS signature mechanism.
Parameters:
value
signature

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::unique_id_parse acs_mail_lite::unique_id_parse (private) ad_verify_signature ad_verify_signature acs_mail_lite::unique_id_parse->ad_verify_signature ad_form ad_form (public) ad_form->ad_verify_signature ad_get_signed_cookie ad_get_signed_cookie (public) ad_get_signed_cookie->ad_verify_signature ad_page_contract ad_page_contract (public) ad_page_contract->ad_verify_signature

Testcases:
No testcase defined.

ad_verify_signature_with_expr (public)

 ad_verify_signature_with_expr [ -secret secret ] value signature

Verifies a digital signature. Returns either the expiration time or 0 if the validation fails.

Switches:
-secret (optional)
specifies an external secret to use instead of the one provided by the ACS signature mechanism.
Parameters:
value
signature

Partial Call Graph (max 5 caller/called nodes):
%3 test_sync_http_get_document sync_http_get_document (test acs-authentication) ad_verify_signature_with_expr ad_verify_signature_with_expr test_sync_http_get_document->ad_verify_signature_with_expr acs_mail_lite::unique_id_parse acs_mail_lite::unique_id_parse (private) acs_mail_lite::unique_id_parse->ad_verify_signature_with_expr ad_get_signed_cookie_with_expr ad_get_signed_cookie_with_expr (public) ad_get_signed_cookie_with_expr->ad_verify_signature_with_expr

Testcases:
sync_http_get_document

sec_change_user_auth_token (public)

 sec_change_user_auth_token user_id

Change the user's auth_token, which invalidates all existing login cookies, i.e. forces user logout at the server.

Parameters:
user_id

Partial Call Graph (max 5 caller/called nodes):
%3 test_logout_from_everywhere logout_from_everywhere (test acs-tcl) sec_change_user_auth_token sec_change_user_auth_token test_logout_from_everywhere->sec_change_user_auth_token auth::password::change auth::password::change (public) auth::password::change->sec_change_user_auth_token sec_get_user_auth_token sec_get_user_auth_token (public) sec_get_user_auth_token->sec_change_user_auth_token

Testcases:
logout_from_everywhere

sec_get_random_cached_token_id (public)

 sec_get_random_cached_token_id

Randomly returns a token_id from the token cache

Partial Call Graph (max 5 caller/called nodes):
%3 test_secret_tokens_get secret_tokens_get (test acs-tcl) sec_get_random_cached_token_id sec_get_random_cached_token_id test_secret_tokens_get->sec_get_random_cached_token_id ad_sign ad_sign (public) ad_sign->sec_get_random_cached_token_id packages/acs-subsite/lib/login.tcl packages/acs-subsite/ lib/login.tcl packages/acs-subsite/lib/login.tcl->sec_get_random_cached_token_id

Testcases:
secret_tokens_get

sec_get_token (public)

 sec_get_token token_id

Returns the token corresponding to the token_id. This first checks the thread-persistent Tcl cache, then checks the server size-limited cache before finally hitting the db in the worst case if the secret_token value is not in either cache. The procedure also updates the caches. Cache eviction is handled by the ns_cache API for the size-limited cache and is handled by AOLserver (via thread termination) for the thread-persistent Tcl cache.

Parameters:
token_id

Partial Call Graph (max 5 caller/called nodes):
%3 test_secret_tokens_get secret_tokens_get (test acs-tcl) sec_get_token sec_get_token test_secret_tokens_get->sec_get_token __ad_verify_signature __ad_verify_signature (private) __ad_verify_signature->sec_get_token ad_sign ad_sign (public) ad_sign->sec_get_token auth::get_user_secret_token auth::get_user_secret_token (public) auth::get_user_secret_token->sec_get_token packages/acs-subsite/lib/login.tcl packages/acs-subsite/ lib/login.tcl packages/acs-subsite/lib/login.tcl->sec_get_token

Testcases:
secret_tokens_get

sec_get_user_auth_token (public)

 sec_get_user_auth_token user_id

Get the user's auth token for verifying login cookies.

Parameters:
user_id

Partial Call Graph (max 5 caller/called nodes):
%3 ad_user_login ad_user_login (public) sec_get_user_auth_token sec_get_user_auth_token ad_user_login->sec_get_user_auth_token sec_handler sec_handler (private) sec_handler->sec_get_user_auth_token sec_login_handler sec_login_handler (public) sec_login_handler->sec_get_user_auth_token

Testcases:
No testcase defined.

sec_login_handler (public)

 sec_login_handler

If a login cookie exists, it is checked for expiration (depending on LoginTimeout) and the account status is validated. In every case, the session info including [ad_conn] and the session cookie is updated accordingly. Modified ad_conn variables: untrusted_user_id, session_id, auth_level, account_status, and user_id.

Partial Call Graph (max 5 caller/called nodes):
%3 auth::verify_account_status auth::verify_account_status (public) sec_login_handler sec_login_handler auth::verify_account_status->sec_login_handler sec_handler sec_handler (private) sec_handler->sec_login_handler

Testcases:
No testcase defined.

sec_random_token (public)

 sec_random_token

Generates a random token.

Partial Call Graph (max 5 caller/called nodes):
%3 acs_user::promote_person_to_user acs_user::promote_person_to_user (public) sec_random_token sec_random_token acs_user::promote_person_to_user->sec_random_token ad_change_password ad_change_password (public) ad_change_password->sec_random_token ad_generate_random_string ad_generate_random_string (public) ad_generate_random_string->sec_random_token auth::create_local_account_helper auth::create_local_account_helper (private) auth::create_local_account_helper->sec_random_token sec_populate_secret_tokens_db sec_populate_secret_tokens_db (private) sec_populate_secret_tokens_db->sec_random_token

Testcases:
No testcase defined.

security::RestrictLoginToSSLP (public)

 security::RestrictLoginToSSLP

Return 1 if login pages and other pages taking user password should be restricted to a secure (HTTPS) connection and 0 otherwise. Based on acs-kernel parameter with same name.

Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 ad_get_login_url ad_get_login_url (public) security::RestrictLoginToSSLP security::RestrictLoginToSSLP ad_get_login_url->security::RestrictLoginToSSLP fs::webdav_url fs::webdav_url (public) fs::webdav_url->security::RestrictLoginToSSLP oacs_dav::authorize oacs_dav::authorize (public) oacs_dav::authorize->security::RestrictLoginToSSLP packages/acs-admin/lib/password-update.tcl packages/acs-admin/ lib/password-update.tcl packages/acs-admin/lib/password-update.tcl->security::RestrictLoginToSSLP packages/acs-subsite/lib/login.tcl packages/acs-subsite/ lib/login.tcl packages/acs-subsite/lib/login.tcl->security::RestrictLoginToSSLP

Testcases:
No testcase defined.

security::configured_driver_info (public)

 security::configured_driver_info

Return a list of dicts containing type, driver, location and port of all configured drivers


See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 security::locations security::locations (public) security::configured_driver_info security::configured_driver_info security::locations->security::configured_driver_info security::validated_host_header security::validated_host_header (public) security::validated_host_header->security::configured_driver_info subsite::get_url subsite::get_url (public) subsite::get_url->security::configured_driver_info

Testcases:
No testcase defined.

security::csp::nonce (public)

 security::csp::nonce [ -tokenname tokenname ]

Generate a nonce token and return it. The nonce token can be used in content security policies (CSP2) for "script" and "style" elements. Desired Properties: generate a single unique value per request which is hard for a hacker to predict, it should only contain base64 characters (so hex is fine). For details, see https://www.w3.org/TR/CSP/

Switches:
-tokenname (defaults to "__csp_nonce") (optional)
Returns:
nonce token
Author:
Gustaf Neumann

Partial Call Graph (max 5 caller/called nodes):
%3 Class ::xo::MessageRelay Class ::xo::MessageRelay (public) security::csp::nonce security::csp::nonce Class ::xo::MessageRelay->security::csp::nonce Class ::xowiki::includelet::book Class ::xowiki::includelet::book (public) Class ::xowiki::includelet::book->security::csp::nonce Class ::xowiki::includelet::flowplayer Class ::xowiki::includelet::flowplayer (public) Class ::xowiki::includelet::flowplayer->security::csp::nonce Class ::xowiki::includelet::timeline Class ::xowiki::includelet::timeline (public) Class ::xowiki::includelet::timeline->security::csp::nonce ad_progress_bar_end ad_progress_bar_end (public) ad_progress_bar_end->security::csp::nonce

Testcases:
No testcase defined.

security::csp::render (public)

 security::csp::render

This is the CSP generator. Collect the specified directives and build from these directives the full CSP specification for the current page.

Author:
Gustaf Neumann

See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 packages/acs-bootstrap-installer/installer/www/blank-master.tcl packages/acs-bootstrap-installer/ installer/www/blank-master.tcl security::csp::render security::csp::render packages/acs-bootstrap-installer/installer/www/blank-master.tcl->security::csp::render

Testcases:
No testcase defined.

security::csp::require (public)

 security::csp::require [ -force ] directive value

Add a single value directive to the CSP rule-set. The directives are picked up, when the page is rendered, by the CSP generator.

Switches:
-force (boolean) (optional)
Parameters:
directive - name of the directive (such as e.g. style-src)
value - allowed source for this page (such as e.g. unsafe-inline)
Author:
Gustaf Neumann

See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 Class ::xo::lti::LTI Class ::xo::lti::LTI (public) security::csp::require security::csp::require Class ::xo::lti::LTI->security::csp::require Class ::xowiki::formfield::FormField Class ::xowiki::formfield::FormField (public) Class ::xowiki::formfield::FormField->security::csp::require Class ::xowiki::includelet::gravatar Class ::xowiki::includelet::gravatar (public) Class ::xowiki::includelet::gravatar->security::csp::require ad_html_text_convert ad_html_text_convert (public) ad_html_text_convert->security::csp::require cookieconsent::add_to_page cookieconsent::add_to_page (public) cookieconsent::add_to_page->security::csp::require

Testcases:
No testcase defined.

security::csrf::new (public)

 security::csrf::new [ -tokenname tokenname ] [ -user_id user_id ]

Create a security token to protect against CSRF (Cross-Site Request Forgery). The token is set (and cached) in a global per-thread variable and can be included in forms e.g. via the following command. The token is automatically cleared together with other global variables at the end of the processing of every request. The optional argument user_id is currently ignored, but it is there, since there are algorithms published to calculate the CSRF token based on a user_id. So far, i found no evidence that these should be used, but the argument is there as a reminder, such the interface does not have to be used, when we switch to such an algorithm.

Switches:
-tokenname (defaults to "__csrf_token") (optional)
-user_id (optional)
Returns:
CSRF token
Author:
Gustaf Neumann

Partial Call Graph (max 5 caller/called nodes):
%3 __ad_verify_signature __ad_verify_signature (private) security::csrf::new security::csrf::new __ad_verify_signature->security::csrf::new ad_sign ad_sign (public) ad_sign->security::csrf::new packages/search/lib/navbar.tcl packages/search/ lib/navbar.tcl packages/search/lib/navbar.tcl->security::csrf::new sec_handler sec_handler (private) sec_handler->security::csrf::new

Testcases:
No testcase defined.

security::csrf::validate (public)

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

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 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

security::driver (public)

 security::driver

Return the secure driver if available

Author:
Gustaf Neumann

Partial Call Graph (max 5 caller/called nodes):
%3 security::get_https_port security::get_https_port (private) security::driver security::driver security::get_https_port->security::driver

Testcases:
No testcase defined.

security::get_client_property_password (public)

 security::get_client_property_password password

Convenience function for retrieving user password from client property

Parameters:
password

See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 packages/acs-admin/www/users/user-add-2.tcl packages/acs-admin/ www/users/user-add-2.tcl security::get_client_property_password security::get_client_property_password packages/acs-admin/www/users/user-add-2.tcl->security::get_client_property_password

Testcases:
No testcase defined.

security::get_qualified_url (public)

 security::get_qualified_url url
Parameters:
url
Returns:
secure or insecure qualified url

Partial Call Graph (max 5 caller/called nodes):
%3 ad_return_url ad_return_url (public) security::get_qualified_url security::get_qualified_url ad_return_url->security::get_qualified_url auth::password::email_password auth::password::email_password (private) auth::password::email_password->security::get_qualified_url security::get_register_subsite security::get_register_subsite (public) security::get_register_subsite->security::get_qualified_url

Testcases:
No testcase defined.

security::get_register_subsite (public)

 security::get_register_subsite

Returns a URL pointing to the subsite, on which the register/unregister should be performed. If there is no current connection, the main site url is returned. TODO: util_current_location and security::get_register_subsite can be probably cached, when using the following parameters in the cache key: - host header field - [ns_conn location] - ... also [security::get_register_subsite] could/should be cached

Author:
Gustaf Neumann

Partial Call Graph (max 5 caller/called nodes):
%3 ad_get_login_url ad_get_login_url (public) security::get_register_subsite security::get_register_subsite ad_get_login_url->security::get_register_subsite ad_get_logout_url ad_get_logout_url (public) ad_get_logout_url->security::get_register_subsite auth::password::email_password auth::password::email_password (private) auth::password::email_password->security::get_register_subsite boomerang::get_relevant_subsite boomerang::get_relevant_subsite (private) boomerang::get_relevant_subsite->security::get_register_subsite cookieconsent::get_relevant_subsite cookieconsent::get_relevant_subsite (private) cookieconsent::get_relevant_subsite->security::get_register_subsite

Testcases:
No testcase defined.

security::get_secure_location (public)

 security::get_secure_location

Return the current location in secure (https) mode.

Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 test_get_insecure_location get_insecure_location (test acs-tcl) security::get_secure_location security::get_secure_location test_get_insecure_location->security::get_secure_location fs::webdav_url fs::webdav_url (public) fs::webdav_url->security::get_secure_location security::get_secure_qualified_url security::get_secure_qualified_url (private) security::get_secure_qualified_url->security::get_secure_location security::locations security::locations (public) security::locations->security::get_secure_location

Testcases:
get_insecure_location

security::https_available_p (public)

 security::https_available_p

Return 1 if server is configured to support HTTPS and 0 otherwise.

Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 auth::get_user_id auth::get_user_id (public) security::https_available_p security::https_available_p auth::get_user_id->security::https_available_p packages/acs-tcl/tcl/admin-init.tcl packages/acs-tcl/ tcl/admin-init.tcl packages/acs-tcl/tcl/admin-init.tcl->security::https_available_p security::RestrictLoginToSSLP security::RestrictLoginToSSLP (public) security::RestrictLoginToSSLP->security::https_available_p security::locations security::locations (public) security::locations->security::https_available_p security::redirect_to_secure security::redirect_to_secure (public) security::redirect_to_secure->security::https_available_p

Testcases:
No testcase defined.

security::locations (public)

 security::locations

This function returns the configured locations and the current location and the vhost locations, potentially in HTTP or in HTTPs variants. When the package parameter "SuppressHttpPort" of acs-tcl parameter is true, then an alternate location without a port is included. This proc also assumes hostnames from host_node_map table are accurate and legit. The term location refers to protocol://domain:port for website.

Returns:
insecure location and secure location followed possibly by alternate location(s) as a list.

Partial Call Graph (max 5 caller/called nodes):
%3 util::external_url_p util::external_url_p (public) security::locations security::locations util::external_url_p->security::locations

Testcases:
No testcase defined.

security::redirect_to_insecure (public)

 security::redirect_to_insecure url

Redirect to the given URL and enter insecure (HTTP) mode.

Parameters:
url
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.

security::redirect_to_secure (public)

 security::redirect_to_secure [ -script_abort ] url

Redirect to the given URL and enter secure (HTTPS) mode. Does nothing if the server is not configured for HTTPS support.

Switches:
-script_abort (boolean) (defaults to "true") (optional)
Parameters:
url
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 security::require_secure_conn security::require_secure_conn (public) security::redirect_to_secure security::redirect_to_secure security::require_secure_conn->security::redirect_to_secure

Testcases:
No testcase defined.

security::require_secure_conn (public)

 security::require_secure_conn

Redirect back to the current page in secure mode (HTTPS) if we are not already in secure mode. Does nothing if the server is not configured for HTTPS support.

Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 packages/acs-admin/lib/password-update.tcl packages/acs-admin/ lib/password-update.tcl security::require_secure_conn security::require_secure_conn packages/acs-admin/lib/password-update.tcl->security::require_secure_conn packages/acs-subsite/lib/login.tcl packages/acs-subsite/ lib/login.tcl packages/acs-subsite/lib/login.tcl->security::require_secure_conn packages/acs-subsite/lib/user-new.tcl packages/acs-subsite/ lib/user-new.tcl packages/acs-subsite/lib/user-new.tcl->security::require_secure_conn packages/acs-subsite/www/user/password-reset.tcl packages/acs-subsite/ www/user/password-reset.tcl packages/acs-subsite/www/user/password-reset.tcl->security::require_secure_conn packages/acs-subsite/www/user/password-update.tcl packages/acs-subsite/ www/user/password-update.tcl packages/acs-subsite/www/user/password-update.tcl->security::require_secure_conn

Testcases:
No testcase defined.

security::secure_conn_p (public)

 security::secure_conn_p

Returns true if the connection [ad_conn] is secure (HTTPS), or false otherwise.

Partial Call Graph (max 5 caller/called nodes):
%3 ad_get_client_property ad_get_client_property (public) security::secure_conn_p security::secure_conn_p ad_get_client_property->security::secure_conn_p ad_get_login_url ad_get_login_url (public) ad_get_login_url->security::secure_conn_p ad_restrict_to_https ad_restrict_to_https (public) ad_restrict_to_https->security::secure_conn_p ad_set_client_property ad_set_client_property (public) ad_set_client_property->security::secure_conn_p ad_user_login ad_user_login (public) ad_user_login->security::secure_conn_p

Testcases:
No testcase defined.

security::set_client_property_password (public)

 security::set_client_property_password password

Convenience function for remembering user password as client property rather than passing it as query parameter.

Parameters:
password

See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 packages/acs-subsite/lib/user-new.tcl packages/acs-subsite/ lib/user-new.tcl security::set_client_property_password security::set_client_property_password packages/acs-subsite/lib/user-new.tcl->security::set_client_property_password

Testcases:
No testcase defined.

security::validated_host_header (public)

 security::validated_host_header
Returns:
validated host header field or empty
Author:
Gustaf Neumann Protect against faked or invalid host header fields. Host header attacks can lead to web-cache poisoning and password reset attacks <for more details, see e.g. http://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html>

Partial Call Graph (max 5 caller/called nodes):
%3 util_current_location util_current_location (public) security::validated_host_header security::validated_host_header util_current_location->security::validated_host_header

Testcases:
No testcase defined.
[ show source ]