Skip to content

Mark parameters in bundled extensions as sensitive #8352

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 12 commits into from
Jun 13, 2022

Conversation

TimWolla
Copy link
Member

No description provided.

@TimWolla TimWolla requested a review from iluuu1994 April 12, 2022 15:15
@TimWolla TimWolla force-pushed the sensitive-parameter-add branch from 82c5570 to 02fa773 Compare April 12, 2022 18:15
@TimWolla
Copy link
Member Author

Anyone has an idea why this fails the one job on AppVeyor?

========DIFF========
001+ Fatal error: Uncaught Error: Call to undefined function zend_test_sensitive_parameter() in C:\projects\php-src\ext\zend_test\tests\sensitive_parameter.php:2
001- Fatal error: Uncaught Error: Dummy in %ssensitive_parameter.php:2
     Stack trace:
003- #0 %ssensitive_parameter.php(2): zend_test_sensitive_parameter(Object(SensitiveParameterValue))
004- #1 {main}
003+ #0 {main}
       thrown in %ssensitive_parameter.php on line 2
========DONE========
FAIL Test that zend_mark_function_parameter_as_sensitive works. [C:\projects\php-src\ext\zend_test\tests\sensitive_parameter.phpt] 

The output matches the one of sensitive_parameter_disable_functions.phpt, it looks like as if disable_functions= "leaked" to an unrelated test.

@TimWolla TimWolla force-pushed the sensitive-parameter-add branch 2 times, most recently from 20873d0 to 3ebbf0e Compare April 13, 2022 07:31
@bwoebi
Copy link
Member

bwoebi commented Apr 13, 2022

May I suggest that we add the #[SensitiveParameter] in the stub files instead and generate it from there?
This seems like an unncessary disconnect between definition and setting the attribute.

Ideally by generally introducing attributes to stub file processing, without hard dependency on zend_ce_sensitive_parameter.

@TimWolla
Copy link
Member Author

@bwoebi Apparently supporting full-blown attributes is hard:
https://chat.stackoverflow.com/transcript/11?m=54325171#54325171

And even just supported “sensitive parameters” from the stubs is non-trivial: https://chat.stackoverflow.com/transcript/message/54346688#54346688

I've intentionally requested Ilija's review, because he was looking into adding stub support.

@iluuu1994
Copy link
Member

@TimWolla FWIW @kocsismate agrees that this should be in the stubs and he'll have a look when he has time.

@TimWolla TimWolla marked this pull request as draft April 13, 2022 12:34
@TimWolla
Copy link
Member Author

Yeah, I agreed initially and I agree even more after creating this PR. I've marked the PR as a draft for the time being, until the stub support is ready.

@NattyNarwhal
Copy link
Member

There are cases where only a subset of the string is sensitive (ODBC and Postgres connection strings). How would this be able to handle that?

@TimWolla
Copy link
Member Author

There are cases where only a subset of the string is sensitive (ODBC and Postgres connection strings). How would this be able to handle that?

A parameter can only be marked as sensitive in full. If those connection strings include passwords, then they should likely be marked as sensitive (especially since a username or hostname might also be considered sensitive by some users).

@ramsey
Copy link
Member

ramsey commented May 23, 2022

Looks like the stub support was merged.

@kocsismate
Copy link
Member

Looks like the stub support was merged.

No, not yet :) But now that I merged my huge stub related PR, I can work on the stub support of attributes without having conflicts. I'll start it early June.

@ramsey
Copy link
Member

ramsey commented May 23, 2022

Sounds good. Feature freeze for 8.2 is 19 July. ;-)

@TimWolla TimWolla force-pushed the sensitive-parameter-add branch 6 times, most recently from 49af7f0 to ab63945 Compare June 6, 2022 19:37
@TimWolla TimWolla marked this pull request as ready for review June 6, 2022 19:38
@TimWolla TimWolla requested a review from kocsismate June 6, 2022 19:38
@TimWolla TimWolla force-pushed the sensitive-parameter-add branch 2 times, most recently from 5d1dfc7 to 6960dd1 Compare June 10, 2022 12:58
@TimWolla
Copy link
Member Author

Copy link
Member

@bukka bukka left a comment

Choose a reason for hiding this comment

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

The selected params look good to me.

@TimWolla TimWolla requested a review from kocsismate June 12, 2022 17:51
@TimWolla TimWolla force-pushed the sensitive-parameter-add branch from 6534d1f to 67dad58 Compare June 12, 2022 18:30
@TimWolla
Copy link
Member Author

Thanks for the reviews. Rebased on the latest master to fix the merge conflict. Once CI passes: How would this PR be appropriately merged? Is the "Rebase and merge" button on GitHub fine for this?

@kocsismate
Copy link
Member

How would this PR be appropriately merged? Is the "Rebase and merge" button on GitHub fine for this?

I'd be fine with just squashing all the commits into one. But if you liked a more fine-grained commit history, then feel free to "rebase and merge".

@TimWolla TimWolla merged commit 1a4401d into php:master Jun 13, 2022
@TimWolla
Copy link
Member Author

But if you liked a more fine-grained commit history, then feel free to "rebase and merge".

Yes, I believe it is useful to have this split per extension, similarly to your other Stub changes for the constants.

Merged now, thanks again!

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.

8 participants