fix(cli): fix allow_admin allows non-127.0.0.0/24 to access admin api with empty admin_key#9146
Merged
Merged
Conversation
127.0.0.0/24 to access admin api with empty admin_key
moonming
reviewed
Mar 22, 2023
moonming
left a comment
Member
There was a problem hiding this comment.
do we need to update doc for this?
moonming
previously approved these changes
Mar 22, 2023
spacewander
reviewed
Mar 23, 2023
| end | ||
| end | ||
| if yaml_conf.apisix.enable_admin and allow_admin | ||
| and table.getn(allow_admin) == 1 and allow_admin[1] == "127.0.0.0/24" then |
Member
There was a problem hiding this comment.
table.getn is deprecated, use # instead
|
|
||
| # missing admin key, only allow 127.0.0.0/24 to access admin api | ||
|
|
||
| git checkout conf/config.yaml |
Member
There was a problem hiding this comment.
We don't need to checkout the config and then override it
| make init > output.log 2>&1 | true | ||
|
|
||
| grep -E "ERROR: missing valid Admin API token." output.log > /dev/null | ||
| if [ ! $? -ne 0 ]; then |
Member
There was a problem hiding this comment.
The condition here is incorrect?
spacewander
reviewed
Mar 24, 2023
| make init > output.log 2>&1 | true | ||
|
|
||
| grep -E "ERROR: missing valid Admin API token." output.log > /dev/null | ||
| if [ $? -eq 0 ]; then |
Member
There was a problem hiding this comment.
The condition here is still incorrect, please think again what is going to check in this test.
Contributor
There was a problem hiding this comment.
I have checked with @spacewander, the condition is correct, but the shell syntax is incorrect
Member
There was a problem hiding this comment.
@monkeyDluffy6017
Yes, you are right. Sorry for the wrong suggestion.
juststillthinking
approved these changes
Mar 24, 2023
spacewander
approved these changes
Mar 24, 2023
soulbird
approved these changes
Mar 27, 2023
moonming
approved these changes
Mar 29, 2023
leslie-tsang
approved these changes
Mar 29, 2023
hongbinhsu
added a commit
to fitphp/apix
that referenced
this pull request
Apr 11, 2023
* upstream/master: (25 commits) fix: upgrade lua-resty-ldap to 0.2.2 (apache#9254) feat(cli): support bypassing Admin API Auth by configuration (apache#9147) fix(ci): write version into xds first (apache#9274) fix: skip warning log when apisix.data_encryption.enable is false (apache#9057) docs: add-api7-information (apache#9260) docs: Fixed typo (apache#9244) docs: clarify what is client.ca in client-to-apisix-mtls.md (apache#9221) docs: Corrected typos and grammatical errors (apache#9216) docs: updated ssl sni parameter requirement in admin-api.md (apache#9176) fix: check upstream reference in traffic-split plugin when delete upstream (apache#9044) docs: Update proxy-rewrite headers.add docs (apache#9220) feat: suppot header injection for fault-injection plugin (apache#9039) fix: upgrade lua-resty-etcd to 1.10.4 (apache#9235) docs: fix incorrect semantic.yml link (apache#9231) feat: Upstream status report (apache#9151) fix: host_hdr should not be false (apache#9150) docs: remove APISIX base instruction (apache#9117) fix(cli): prevent non-`127.0.0.0/24` to access admin api with empty admin_key (apache#9146) docs: fix 404 link (apache#9160) fix(cors): consider using `allow_origins_by_regex` only when it is not `nil` (apache#9028) ...
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.
Description
Fixes #9055
Checklist