Skip to content

Fix editing connection with sensitive extra field #52403

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

Merged
merged 5 commits into from
Jun 29, 2025

Conversation

shubhamraj-git
Copy link
Contributor

closes: #52301

  1. This will disable the button when there is no changes to save.
  2. Would update the conf, only when there is a change.

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Jun 28, 2025
@shubhamraj-git shubhamraj-git changed the title Handle unchanges json Fix editing connection with sensitive extra field Jun 28, 2025
@shubhamraj-git shubhamraj-git added the backport-to-v3-0-test Mark PR with this label to backport to v3-0-test branch label Jun 28, 2025
@amoghrajesh
Copy link
Contributor

Not a critical fix, maybe land it for 3.1?

@shubhamraj-git
Copy link
Contributor Author

@amoghrajesh Updating the connection with sensitive value is a problem and result in failures since it will change the values. Would be good to have fix.

@jscheffl
Copy link
Contributor

Not a critical fix, maybe land it for 3.1?

I'd propose to back-port, else in 3.0.x it messes-up the secrets if you edit and save via connections form.

@jscheffl jscheffl added this to the Airflow 3.0.3 milestone Jun 28, 2025
@jscheffl
Copy link
Contributor

jscheffl commented Jun 28, 2025

I tested locally and the standard fields are still published redacted... and then when savong three stars are stored as password.
image
...and same for a SAS token password:
image

UPDATE: Uuups had an issue to switch to correct branch - after making the review "right" all is working as expected...

Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

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

I think it is OK but static checks need to be fixed

@shubhamraj-git shubhamraj-git requested a review from jscheffl June 29, 2025 07:50
@shubhamraj-git
Copy link
Contributor Author

Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

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

Looks good - tests are testing the right think but I can't comment too much on the javascript code :)

Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

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

Good for me now if CI is green

@jscheffl jscheffl added the type:bug-fix Changelog: Bug Fixes label Jun 29, 2025
@jscheffl jscheffl merged commit 8ef792d into apache:main Jun 29, 2025
100 checks passed
Copy link

Backport failed to create: v3-0-test. View the failure log Run details

Status Branch Result
v3-0-test Commit Link

You can attempt to backport this manually by running:

cherry_picker 8ef792d v3-0-test

This should apply the commit to the v3-0-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

jscheffl pushed a commit to jscheffl/airflow that referenced this pull request Jun 29, 2025
…#52403)

* Handle unchanges json

* Remove the redact from connections

* Fix the static checks
(cherry picked from commit 8ef792d)

Co-authored-by: Shubham Raj <[email protected]>
potiuk pushed a commit that referenced this pull request Jun 29, 2025
#52445)

* Handle unchanges json

* Remove the redact from connections

* Fix the static checks
(cherry picked from commit 8ef792d)

Co-authored-by: Shubham Raj <[email protected]>
@amoghrajesh
Copy link
Contributor

Thanks! Yeah I think it should be ok with show unredacted value for people to edit, it is a really bad experience (atleast for me) to find that in the "airflow connections export", change it in the UI, if im experimenting especially. If someone is changing stuff from the UI, they are authenticated at the very least.

@@ -94,6 +94,14 @@ const ConnectionForm = ({
mutateConnection(data);
};

const hasChanges = () => {
Copy link
Contributor

@bbovenzi bbovenzi Jun 30, 2025

Choose a reason for hiding this comment

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

Nit. functions should start with a verb.

But we don't even need a function here.

const hasChanges = isDirty || (JSON.stringify(JSON.parse(extra)) !== JSON.stringify(JSON.parse(initialConnection.extra)))

Copy link
Contributor

Choose a reason for hiding this comment

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

And whats the point of parsing first?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually yes, in current state func shouldn't be, In starting I was doing multiple things and debugging, later should have changed it.
Reason for parsing, A user can add something from cli which would not be in UI formatted way, it should not be treated as different value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:UI Related to UI/UX. For Frontend Developers. backport-to-v3-0-test Mark PR with this label to backport to v3-0-test branch type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Editing connection with sensitive extra field saves literal asterisks
5 participants