Closed Dyrkon closed 2 weeks ago
The change involves modifying the jwt_parse
function in the src/jwt/jwt.c
file by initializing the variable sig
to NULL
. This adjustment ensures that sig
has a defined state when the function is entered, enhancing variable management within the code.
Files | Change Summary |
---|---|
src/jwt/jwt.c |
Changed char *sig; to char *sig = NULL; in jwt_parse function. |
sequenceDiagram
participant Caller
participant jwt_parse
participant sig
Caller->>jwt_parse: Call jwt_parse()
jwt_parse->>sig: Initialize sig to NULL
jwt_parse->>Caller: Return from jwt_parse()
In the code where rabbits hop,
A variable found its stop.
Initialized with care, oh so bright,
Now it’s ready, pure delight!
Hopping through functions, all is well,
Withsig
set to NULL, we surely excel! 🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
I don't think there is any problem with the modification, but the code doesn't seem to have any possibility of being used without being initialized.
Can you provide a build environment and instructions?
Can you provide a build environment and instructions?
Upon further research, this error pops up when building the repo as a Nix package on MacOS which adds hardening flags.
For reference, the packaging looks something like this:
nginx-auth-jwt = with pkgs; stdenv.mkDerivation rec {
name = "nginx-auth-jwt";
src = pkgs.fetchFromGitHub {
name = "nginx-auth-jwt";
owner = "kjdev";
repo = "nginx-auth-jwt";
rev = "0.7.0";
sha256 = "sha256-zOqCZsKC3EmbZS9HtUsuwgT+sgiSJvQCCTmp85jnPEw=";
};
meta = with pkgs.lib; {
description = "This nginx module implements client authorization by validating the provided JSON Web Token (JWT) using the specified keys.";
homepage = "https://github.com/kjdev/nginx-auth-jwt";
license = [ licenses.mit ];
maintainers = with maintainers; [ kjdev ];
};
};
nginx-with-jwt = (pkgs.nginx.overrideAttrs rec {
version = "1.26.0";
src = pkgs.fetchurl {
url = "https://nginx.org/download/nginx-${version}.tar.gz";
hash = "sha256-0ubIQ51sbbUBXY6qskcKtSrvhae/NjGCh5l34IQ3BJc=";
};
buildInputs = with pkgs; [
pcre
zlib
openssl
jansson
msgpack
libxslt
libxml2
gd
geoip
libxcrypt
];
}).override {
modules = [
nginx-auth-jwt
];
};
https://github.com/kjdev/nginx-auth-jwt/commit/335c849b366d2a2514b54d9df3aecef70cb44b61
Fixed with the update of the built-in libjwt source code. https://github.com/kjdev/nginx-auth-jwt/blob/main/src/jwt/jwt.c#L595
There is a initialization warning preventing build by nix package manager.
Summary by CodeRabbit