Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Octavia CLI uses Basic Auth #17982

Merged
merged 11 commits into from
Oct 18, 2022
Merged

Conversation

evantahler
Copy link
Contributor

@evantahler evantahler commented Oct 13, 2022

Closes #17971

This PR (merged into #17694, not master) Updates the Octavia CLI to use HTTP Basic Auth by default. Without this PR, the CLI couldn't connect to any server which was using Basic Auth.

@evantahler evantahler changed the base branch from master to evan/nginx-auth October 13, 2022 23:58
@evantahler evantahler temporarily deployed to more-secrets October 13, 2022 23:59 Inactive
@evantahler evantahler changed the title Evan/octavia for basic auth [WIP] Octavia CLI uses Basic Auth Oct 14, 2022
@evantahler evantahler temporarily deployed to more-secrets October 14, 2022 00:01 Inactive
@alafanechere alafanechere temporarily deployed to more-secrets October 14, 2022 12:53 Inactive
@evantahler evantahler marked this pull request as ready for review October 14, 2022 18:15
@evantahler evantahler changed the title [WIP] Octavia CLI uses Basic Auth Octavia CLI uses Basic Auth Oct 14, 2022
@evantahler evantahler temporarily deployed to more-secrets October 14, 2022 18:15 Inactive
@evantahler evantahler temporarily deployed to more-secrets October 14, 2022 18:30 Inactive
@evantahler evantahler temporarily deployed to more-secrets October 17, 2022 17:55 Inactive
@evantahler evantahler temporarily deployed to more-secrets October 17, 2022 19:49 Inactive
try:
assert isinstance(self.name, str) and self.name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how come the isinstance check was removedf?

Copy link
Contributor Author

@evantahler evantahler Oct 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because above we forced everything to be a string.... so it's a string. This was needed to get around some test/mock issues. Logically, what we cared about anyway was the string's length... so let's check that specifically.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checks out

Comment on lines 26 to 30
self.name = str(self.name)
self.value = str(self.value)
try:
assert isinstance(self.name, str) and self.name
assert isinstance(self.value, str) and self.value
assert len(self.name) > 0
assert len(self.value) > 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern with this is that most python types can be casted to string without error.
e.g passing a dict as name or value will result in a non-empty casted string...

@alafanechere alafanechere temporarily deployed to more-secrets October 18, 2022 07:52 Inactive
Copy link
Contributor

@alafanechere alafanechere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem was that in test_get_api_client the airbyte_api_client is patched to a mock object, its attributes and calls to its methods return Mock objects: Configuration is a mock, calling Configuration.get_basic_auth_token returns a Mock too. So when calling ApiHttpHeader("Authorization", basic_auth_token) the basic auth token is a mock and its failing __post_init__.
The solution to this testing problem is to patch the return_value of get_basic_auth_token to return a string.
This is what I did in 4ad020f

@evantahler evantahler merged commit feae6b1 into evan/nginx-auth Oct 18, 2022
@evantahler evantahler deleted the evan/octavia-for-basic-auth branch October 18, 2022 18:34
@evantahler evantahler temporarily deployed to more-secrets October 18, 2022 18:36 Inactive
evantahler added a commit that referenced this pull request Oct 19, 2022
* Use Nginx + Basic Auth to secure OSS Airbyte

* use local passwords

* Use gradle builds

* K8s setup and source values from ENV

* note about disabling

* add back defaults

* custom 401 page

* update http message

* update docs

* remove kube files

* additional doc updates

* Add a test suite

* fix failure exit codes

* doc updates

* Add docs

* bump to re-test

* add more sleep in tests for CI

* better sleep in test

* Update docs/operator-guides/security.md

Co-authored-by: Davin Chia <davinchia@gmail.com>

* PR updates

* test comment

* change test host on CI

* update tests and nginx to boot without backend

* proxy updates for docker DNS

* simpler test for uptime

* acceptance test skips PWs

* remove resolver madness

* fixup tests

* more proxy_pass revert

* update acceptance test exit codes

* relax test expectations

* add temporal mount back for testing

* Update docs/operator-guides/security.md

Co-authored-by: swyx <shawnthe1@gmail.com>

* Update airbyte-proxy/401.html

Co-authored-by: swyx <shawnthe1@gmail.com>

* more doc updates

* Octavia CLI uses Basic Auth  (#17982)

* [WIP] Octavia CLI uses Basic Auth

* readme

* augustin: add basic auth headers to clien

* augustin: add basic auth headers to client

* tests passing

* lint

* docs

* Move monkey patch to test

* coerce headers into strings

* monkey patch get_basic_auth_token

Co-authored-by: alafanechere <augustin.lafanechere@gmail.com>

* fix launch permissions

* Keep worker port internal

* more readme

Co-authored-by: Davin Chia <davinchia@gmail.com>
Co-authored-by: swyx <shawnthe1@gmail.com>
Co-authored-by: alafanechere <augustin.lafanechere@gmail.com>
jhammarstedt pushed a commit to jhammarstedt/airbyte that referenced this pull request Oct 31, 2022
* Use Nginx + Basic Auth to secure OSS Airbyte

* use local passwords

* Use gradle builds

* K8s setup and source values from ENV

* note about disabling

* add back defaults

* custom 401 page

* update http message

* update docs

* remove kube files

* additional doc updates

* Add a test suite

* fix failure exit codes

* doc updates

* Add docs

* bump to re-test

* add more sleep in tests for CI

* better sleep in test

* Update docs/operator-guides/security.md

Co-authored-by: Davin Chia <davinchia@gmail.com>

* PR updates

* test comment

* change test host on CI

* update tests and nginx to boot without backend

* proxy updates for docker DNS

* simpler test for uptime

* acceptance test skips PWs

* remove resolver madness

* fixup tests

* more proxy_pass revert

* update acceptance test exit codes

* relax test expectations

* add temporal mount back for testing

* Update docs/operator-guides/security.md

Co-authored-by: swyx <shawnthe1@gmail.com>

* Update airbyte-proxy/401.html

Co-authored-by: swyx <shawnthe1@gmail.com>

* more doc updates

* Octavia CLI uses Basic Auth  (airbytehq#17982)

* [WIP] Octavia CLI uses Basic Auth

* readme

* augustin: add basic auth headers to clien

* augustin: add basic auth headers to client

* tests passing

* lint

* docs

* Move monkey patch to test

* coerce headers into strings

* monkey patch get_basic_auth_token

Co-authored-by: alafanechere <augustin.lafanechere@gmail.com>

* fix launch permissions

* Keep worker port internal

* more readme

Co-authored-by: Davin Chia <davinchia@gmail.com>
Co-authored-by: swyx <shawnthe1@gmail.com>
Co-authored-by: alafanechere <augustin.lafanechere@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Octavia CLI needs to be updated work work with Basic Auth
3 participants