Commit Graph

3412 Commits

Author SHA1 Message Date
Benjamin Dauvergne 49e0ea80c8 Fix undefined macro in #if conditional (#85339)
gitea/lasso/pipeline/head This commit looks good Details
2024-04-16 16:32:57 +02:00
Benjamin Dauvergne 3768f1bedf xmlsec: re-enable KeyValue nodes when reading KeyInfo descriptors (#85339)
KeyValue has been disabled in libxmlsec >= 1.3.3, as it can be a security
liability in other settings than SAML:

   (xmlsec-core) Disabled KeyValue and DEREncodedKeyValue XML nodes by default. Use the '--enabled-key-data' option for the xmlsec command line utility or update the 'keyInfoCtx->enabledKeyData' parameter if you need to re-enable these nodes (also see question 3.5 in the FAQ).
2024-04-16 11:02:13 +02:00
Benjamin Dauvergne 21c224cfef xmlsec: use XMLSEC_KEYINFO_FLAGS_LAX_KEY_SEARCH when writing encrypted keys (#85339)
For compatibility with libxmlsec1>=1.3.0, as we do not use KeyName to
reference the wrapping key:

  (API breaking change) Changed the key search to strict mode: only keys referenced by KeyInfo are used. To restore the old "lax" mode, set XMLSEC_KEYINFO_FLAGS_LAX_KEY_SEARCH flag on xmlSecKeyInfoCtx or use '--lax-key-search' option for XMLSec command line utility.
2024-04-16 11:02:13 +02:00
Benjamin Dauvergne 66c9f50f1f xmlsec: replace xmlSecCryptoAppKeyLoad by xmlSecCryptoAppKeyLoadEx (#85339)
xmlSecCryptoAppKeyLoad was removed from libxmlsec1 in version >= 1.3.3:

  (xmlsec-core) Removed previously deprecated functions, defines, etc.

xmlSecCryptoAppKeyLoadEx was introduced in libxmlsec in version 1.3.0.
2024-04-16 09:24:15 +02:00
Benjamin Dauvergne 1ca8e8699c misc: mute warning about implicit declaration of lasso_get_default_signature_method (#85339) 2024-04-16 09:24:15 +02:00
Benjamin Dauvergne 46caef8185 xml: fix uninitialized local variable (#85339) 2024-04-16 09:24:15 +02:00
Benjamin Dauvergne fe27e52da0 misc: check for signature parameter before sigalg (#89371)
gitea/lasso/pipeline/head This commit looks good Details
2024-04-15 15:38:16 +02:00
Benjamin Dauvergne 3e6f9076e1 misc: move declarations of signature method setters in private.h (#86867)
gitea/lasso/pipeline/head This commit looks good Details
2024-02-14 12:43:54 +01:00
Benjamin Dauvergne 625bf7d9c1 misc: move declaration of lasso_get_default_signature_method in xml.h (#86867) 2024-02-14 12:43:54 +01:00
Benjamin Dauvergne 534d2b9698 Do not free xmlDoc before unlinking its tree (#86472)
gitea/lasso/pipeline/head This commit looks good Details
2024-02-01 21:50:21 +01:00
Benjamin Dauvergne cbe2c45455 misc: adjust to structured error callback argument change in libxml2 2.12 (#86080)
gitea/lasso/pipeline/head This commit looks good Details
2024-01-24 15:19:10 +01:00
Benjamin Dauvergne 9767cdf764 misc: fix implicit function declaration errors (#85340)
gitea/lasso/pipeline/head This commit looks good Details
2024-01-24 15:17:33 +01:00
Benjamin Dauvergne 253e8abe7b xml: export lasso_get_min_signature method function (#86076)
gitea/lasso/pipeline/head This commit looks good Details
2024-01-24 14:43:58 +01:00
Benjamin Dauvergne ffaddeb015 xmlsec: fix removed symbol XMLSEC_CRYPTO in libxmlsec 1.3.0 (#78280)
gitea/lasso/pipeline/head This commit looks good Details
Thanks to Simo Sorce.
2024-01-24 14:03:42 +01:00
Benjamin Dauvergne 7ac76525be Compatibility with EVP API of openssl 1.x (#74996)
Thanks to Maxime Besson from Worteks.
2023-03-06 11:44:47 +01:00
Benjamin Dauvergne 16148102e5 In lasso_saml20_login_process_response_status_and_assertion does not overwirte signature_status with rc which is always at 0 (#54689)
We are losing information in this case, like if the response was not
signed.
2022-11-23 09:40:28 +01:00
Jakub Hrozek 2d78634827 In lasso_saml20_login_process_response_status_and_assertion remove dead switch (#54689)
In case VERIFY_HINT was set to IGNORE and the login signature was
incorrect, lasso_saml20_login_process_response_status_and_assertion
would have jumped straight to the cleanup label which just returns the
return code.

Related: https://dev.entrouvert.org/issues/54689
License: MIT
2022-11-23 09:40:28 +01:00
Benjamin Dauvergne d10c0f6693 Fix unused parameters warnings (#71400) 2022-11-21 13:28:10 +01:00
Benjamin Dauvergne 72b778e47e Fix all cast-function-type warnings (#71400) 2022-11-21 13:28:08 +01:00
Benjamin Dauvergne 69b1ea1c2f Fix warning about enum conversion (#71400) 2022-11-21 13:28:06 +01:00
Benjamin Dauvergne 0c4d3014a4 Fix use of wrong enumeration NULL value (#71400)
It produced a cast warning.
2022-11-21 13:27:53 +01:00
Benjamin Dauvergne 6389b2ca48 Fix warnings about type casts (#71400) 2022-11-21 13:27:47 +01:00
Benjamin Dauvergne 8a588a8acb Replace all use of xmlSecBase64Decode by lasso_base64_decode (#71399) 2022-11-21 13:27:15 +01:00
Benjamin Dauvergne 1aa6271f93 Adapt lasso_base64_decode to the deprecation of xmlSecBase64Decode (#71399)
We now use the non-deprecated new API (since xmlsec 1.2.35) xmlSecBase64Decode_ex.
2022-11-21 13:27:15 +01:00
Benjamin Dauvergne 228ac9470f Make lasso_inflate output the inflated buffer size (#71399) 2022-11-21 13:27:12 +01:00
Benjamin Dauvergne 66ebd11166 Use OpenSSL EVP API to work around deprecation of low level APIs in OpenSSL 3 (#71313)
OpenSSL API is used to sign query-string values in the SAML 2.0 Redirect binding.
Other binding only need the libxmlsec API as signature are XML DSIG signatures.
2022-11-21 13:22:04 +01:00
Benjamin Dauvergne 3a7ad3610f Fix parsing of Count attribute of saml:ProxyRestriction (#69673) 2022-09-28 18:18:36 +02:00
Benjamin Dauvergne d80357e226 Keep ABI stability (#56883)
The following functions where part of the experimental ID-WSF support
recently removed but where incorrectly included in the official ABI, so we
restore dummy versions of them (they do nothing or return NULL):
- lasso_get_prefix_for_dst_service_href
- lasso_get_prefix_for_idwsf2_dst_service_href
- lasso_register_dst_service
- lasso_register_idwsf2_dst_service
2021-09-13 12:13:11 +02:00
Benjamin Dauvergne 53b0bd3569 Change default key encryption padding algorithm to RSA-OAEP (#56023)
The key encryption padding algorithm is now configurable, the default
being changed to OAEP. It's possible to set the default through
./configure with:

    --with-default-key-encryption-method=[rsa-pkcs1|rsa-oaep]

at initialization time with an environment variable:

    LASSO_DEFAULT_KEY_ENCRYPTION_METHOD=[rsa-pkcs1|rsa-oaep]

or at runtime for a service provider:

    lasso_provider_set_key_encryption_method(LassoProvider *provider,
        LassoKeyEncryptionMethod key_encryption_method)

The setting is global for all encrypted nodes (Assertion or NameID).
2021-09-11 19:20:04 +02:00
Benjamin Dauvergne 4a880977d1 Remove ID-WSF 1.0, 2.0 and WS-* support (#56644)
It has been deprecated for a long time.
2021-09-11 18:54:41 +02:00
Benjamin Dauvergne d4ccf15902 Fix warning about int conversion
saml2_authn_context.c:77:3: warning: initialization of ‘unsigned int’ from ‘void *’
    makes integer from pointer without a cast [-Wint-conversion]
2021-09-03 10:14:24 +02:00
Benjamin Dauvergne 663c094ec7 Prevent multiple OneTimeUse elements (#52961)
"A SAML authority MUST NOT include more than one <OneTimeUse> element within a
<Conditions>element of an assertion"
2021-07-16 14:36:32 +02:00
Jakub Hrozek f9a3aca0cb Check if the signature method is allowed in addition to being valid (#54037)
Adds a new utility function lasso_allowed_signature_method() that checks
if the signature method is allowed. Previously, the code would only
check if the method was valid.

This new function is used whenever lasso_validate_signature_method was
previously used through lasso_ok_signature_method() which wraps both
validate and allowed.

lasso_allowed_signature_method() is also used on a couple of places,
notably lasso_query_verify_helper().

Related:
https://dev.entrouvert.org/issues/54037
2021-06-24 02:15:17 +02:00
Jakub Hrozek 0d34c97be1 Mass-replace LASSO_SIGNATURE_METHOD_RSA_SHA1 with lasso_get_default_signature_method() (#54037)
This should be backwards-compatible but at the same time use the
selected default instead of RSA-SHA1.

Related:
https://dev.entrouvert.org/issues/54037
2021-06-23 23:32:33 +02:00
Jakub Hrozek f095ac8f57 Make the default signature method and the minimal hash strength configurable (#54037)
Adds two new configure options:
    --with-default-sign-algo
    --min-hash-algo

--with-default-sign-algo sets the default signing algorithm and defaults
to rsa-sha1. At the moment, two algorithms are supported: rsa-sha1 and
rsa-sha256.

--min-hash-algo sets the minimum hash algorithm to be accepted. The
default is sha1 for backwards compatibility as well.

Related:
https://dev.entrouvert.org/issues/54037
2021-06-23 23:32:29 +02:00
Jakub Hrozek 8b8fd22a16 Fix lasso_query_sign HMAC other than SHA1 (#54037)
The switch clause was using SHA1 digests for all digest types when
signing. This obviously breaks verifying the signatures if HMAC-SHAXXX
is used and XXX is something else than 1.
2021-06-23 23:32:12 +02:00
Benjamin Dauvergne ea7e5efe97 Fix signature checking on unsigned response with multiple assertions
CVE-2021-28091 : when AuthnResponse messages are not signed (which is
permitted by the specifiation), all assertion's signatures should be
checked, but currently after the first signed assertion is checked all
following assertions are accepted without checking their signature, and
the last one is considered the main assertion.

This patch :
* check signatures from all assertions if the message is not signed,
* refuse messages with assertion from different issuers than the one on
  the message, to prevent assertion bundling event if they are signed.
2021-06-01 11:50:53 +02:00
Benjamin Dauvergne f912e8d1ef replace deprecated index() by strchr() (#51385) 2021-02-26 16:31:53 +01:00
Benjamin Dauvergne cbbea83e3f Fix: new provider reference count is incremented one time too many (#51420) 2021-02-25 10:10:03 +01:00
Benjamin Dauvergne 0b742b1f6d tools: reimplement xmlURIEscapeStr to respect RFC3986 (#45581)
Bugfix by Emmanuel Dreyfus.

License: MIT
2020-08-14 10:58:06 +02:00
Benjamin Dauvergne 4bae1c8b7c Release 2.6.1 2020-04-22 15:04:46 +02:00
Benjamin Dauvergne 92d12b9954 Keep order of SessionIndexes 2020-04-22 04:45:52 +02:00
Benjamin Dauvergne 55feba5762 Clear SessionIndex when private SessionIndexes is empty (#41950) 2020-04-22 04:30:27 +02:00
Benjamin Dauvergne e5ad4b1702 misc: clear warnings about class_init signature using coccinelle
$ spatch --in-place --sp-file add-second-arg-to-class-init.cocci `git grep -l -C1 ^class_init \*.c`
	$ sed -i 's/\*unused\>/*unused G_GNUC_UNUSED/' `git grep -l 'void \*unused'`
2020-03-26 22:52:49 +01:00
Bernhard M. Wiedemann 1b51873ccf Sort input file lists (#40454)
so that lasso.py, lasso/types.c and liblasso.so.3.13.0
build reproducibly
in spite of indeterministic filesystem readdir order.
For some reason, lasso/extract_sections.py lasso/extract_symbols.py
do not need such patches to get a reproducible openSUSE package.

See https://reproducible-builds.org/ for why this is good.

This patch was done while working on reproducible builds for openSUSE.

License: MIT
Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
2020-03-05 12:51:17 +01:00
Benjamin Dauvergne db7e25287a Improve error logging during node parsing (#12829) 2019-09-06 15:32:51 +02:00
Benjamin Dauvergne 84bc5b48d3 Improve compatibility with Solaris (#32425) 2019-09-06 14:42:44 +02:00
Benjamin Dauvergne 6c852f8c0b Fix reference count in lasso_server_add_provider2 (fixes #35061)
As implemented lasso_server_add_provider2 could not be used as a publik
API as it dit not increase the reference count of the LassoProvider
object before adding it to the providers hashtable.

lasso_server_add_provider_helper had to be modified to decrement the
reference count of the new LassoProvider object after using
lasso_server_add_provider2.
2019-09-05 12:42:01 +02:00
Dmitrii Shcherbakov 1e85f1b2bd PAOS: Do not populate "Destination" attribute
When ECP profile (saml-ecp-v2.0-cs01) is used with PAOS binding Lasso
populates an AuthnRequest with the "Destination" attribute set to
AssertionConsumerURL of an SP - this leads to IdP-side errors because
the destination attribute in the request does not match the IdP URL.

The "Destination" attribute is mandatory only for HTTP Redirect and HTTP
Post bindings when AuthRequests are signed per saml-bindings-2.0-os
(sections 3.4.5.2 and 3.5.5.2). Specifically for PAOS it makes sense to
avoid setting that optional attribute because an ECP decides which IdP
to use, not the SP.

Fixes Bug: 34409
License: MIT
Signed-off-by: Dmitrii Shcherbakov <dmitrii.shcherbakov@canonical.com>
2019-07-03 23:54:57 +02:00
Benjamin Dauvergne 5853fbc150 export symbol lasso_log (#33784)
The symbol lasso_log has to be exported, otherwise Solaris run-time linker
fails due to an unresolved symbol dependency.
2019-07-02 11:57:08 +02:00