oss-fuzz: Add fuzzer for auth response#4858
Open
arthurscchan wants to merge 1 commit intopjsip:masterfrom
Open
oss-fuzz: Add fuzzer for auth response#4858arthurscchan wants to merge 1 commit intopjsip:masterfrom
arthurscchan wants to merge 1 commit intopjsip:masterfrom
Conversation
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an OSS-Fuzz-style target to exercise PJSIP server-side authentication parsing/verification and challenge generation paths.
Changes:
- Introduces a new fuzzer (
fuzz-auth.c) that parses SIP requests and callspjsip_auth_srv_verify()andpjsip_auth_srv_challenge(). - Updates
tests/fuzz/Makefileto build and clean the newfuzz-authbinary.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
tests/fuzz/fuzz-auth.c |
New fuzzer harness for auth verify/challenge using parsed SIP messages. |
tests/fuzz/Makefile |
Adds fuzz-auth to compile/link and clean targets. |
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+107
to
+109
| /* Test verification */ | ||
| pjsip_auth_srv_verify(&auth_srv, &rdata, NULL); | ||
| } |
Comment on lines
+118
to
+126
| /* Setup minimal rdata */ | ||
| pj_bzero(&rdata, sizeof(rdata)); | ||
| rdata.msg_info.msg = msg; | ||
| rdata.tp_info.pool = pool; | ||
|
|
||
| /* Create 401 response */ | ||
| status = pjsip_endpt_create_response(endpt, &rdata, 401, NULL, &tdata); | ||
| if (status != PJ_SUCCESS || !tdata) | ||
| return; |
Comment on lines
+39
to
+47
| static pj_status_t lookup_cred(pj_pool_t *pool, const pj_str_t *realm, | ||
| const pj_str_t *acc_name, pjsip_cred_info *cred) | ||
| { | ||
| pj_bzero(cred, sizeof(*cred)); | ||
| cred->realm = *realm; | ||
| cred->username = *acc_name; | ||
| cred->data_type = PJSIP_CRED_DATA_PLAIN_PASSWD; | ||
| cred->data = pj_str("secret"); | ||
| return PJ_SUCCESS; |
Comment on lines
+58
to
+68
| if (size < 10) | ||
| return NULL; | ||
|
|
||
| /* Copy to null-terminated buffer */ | ||
| msg_buf = (char*)pj_pool_alloc(pool, size + 1); | ||
| pj_memcpy(msg_buf, data, size); | ||
| msg_buf[size] = '\0'; | ||
|
|
||
| /* Parse SIP message */ | ||
| pj_list_init(&err_list); | ||
| msg = pjsip_parse_msg(pool, msg_buf, size, &err_list); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR creates a fuzzer for auth response handling.