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

[infra] use $SWITCH_UID if it is defined (fixes #30) #211

Merged
merged 3 commits into from
Dec 21, 2016
Merged

[infra] use $SWITCH_UID if it is defined (fixes #30) #211

merged 3 commits into from
Dec 21, 2016

Conversation

mikea
Copy link
Contributor

@mikea mikea commented Dec 20, 2016

If #SWITCH_UID is defined, then compile script will create a user
with a given UID and switch to it prior to calling project's build.sh.

@mikea
Copy link
Contributor Author

mikea commented Dec 20, 2016

BTW I'm not 100 happy with variable name. Suggestions are welcome.

Copy link
Contributor

@Dor1s Dor1s left a comment

Choose a reason for hiding this comment

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

LGTM with a comment.

I don't have good ideas for a better name... May be BUILD_UID or UID_FOR_BUILD, BUILDING_UID, BUILDER_UID... My fantasy doesn't work today :)

@@ -148,6 +148,7 @@ def build_fuzzers(build_args):

command = [
'docker', 'run', '--rm', '-i',
'-e', 'SWITCH_UID=' + os.getuid(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't os.getuid() return an integer? If yes, let's do 'SWITCH_UID=%d' % os.getuid() + let's use format string on line 154 instead of concatenation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Collaborator

@inferno-chromium inferno-chromium left a comment

Choose a reason for hiding this comment

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

LGTM with nits.

@@ -41,6 +41,7 @@ Build configuration is performed through following environment variables:
| `$SANITIZER ("address")` | Specifies sanitizer configuration to use. `address` or `undefined`.
| `$SANITIZER_FLAGS` | Specify compiler sanitizer flags directly. Overrides `$SANITIZER`.
| `$COVERAGE_FLAGS` | Specify compiler flags to use for fuzzer feedback coverage.
| `$SWITCH_UID` | User id to use while building fuzzers.
Copy link
Collaborator

Choose a reason for hiding this comment

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

BUILD_UID is a better name i think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

BUILD_CMD="bash -x $SRC/build.sh"
if [ -z "${SWITCH_UID+}" ]; then
adduser -u $SWITCH_UID --disabled-password --no-create-home --gecos '' ossfuzz
chown -R ossfuzz /src
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we use $SRC.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

if [ -z "${SWITCH_UID+}" ]; then
adduser -u $SWITCH_UID --disabled-password --no-create-home --gecos '' ossfuzz
chown -R ossfuzz /src
chown ossfuzz /out
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we use $OUT.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

bash -x $SRC/build.sh
BUILD_CMD="bash -x $SRC/build.sh"
if [ -z "${SWITCH_UID+}" ]; then
adduser -u $SWITCH_UID --disabled-password --no-create-home --gecos '' ossfuzz
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: s/ossfuzz/build-user or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

If #SWITCH_UID is defined, then compile script will create a user
with a given UID and switch to it prior to calling project's build.sh.
Copy link
Contributor Author

@mikea mikea left a comment

Choose a reason for hiding this comment

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

All done. ptal.

@@ -41,6 +41,7 @@ Build configuration is performed through following environment variables:
| `$SANITIZER ("address")` | Specifies sanitizer configuration to use. `address` or `undefined`.
| `$SANITIZER_FLAGS` | Specify compiler sanitizer flags directly. Overrides `$SANITIZER`.
| `$COVERAGE_FLAGS` | Specify compiler flags to use for fuzzer feedback coverage.
| `$SWITCH_UID` | User id to use while building fuzzers.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

bash -x $SRC/build.sh
BUILD_CMD="bash -x $SRC/build.sh"
if [ -z "${SWITCH_UID+}" ]; then
adduser -u $SWITCH_UID --disabled-password --no-create-home --gecos '' ossfuzz
Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

BUILD_CMD="bash -x $SRC/build.sh"
if [ -z "${SWITCH_UID+}" ]; then
adduser -u $SWITCH_UID --disabled-password --no-create-home --gecos '' ossfuzz
chown -R ossfuzz /src
Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

if [ -z "${SWITCH_UID+}" ]; then
adduser -u $SWITCH_UID --disabled-password --no-create-home --gecos '' ossfuzz
chown -R ossfuzz /src
chown ossfuzz /out
Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -148,6 +148,7 @@ def build_fuzzers(build_args):

command = [
'docker', 'run', '--rm', '-i',
'-e', 'SWITCH_UID=' + os.getuid(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@inferno-chromium
Copy link
Collaborator

LGTM

@mikea mikea merged commit 5a4daf8 into master Dec 21, 2016
@mikea mikea deleted the uid branch December 22, 2016 01:31
DavidKorczynski pushed a commit that referenced this pull request Jul 9, 2024
Hi, I upgraded the oss-fuzz-gen project’s OpenAI SDK dependency from
version 0.27.8 to version >=1.0.0, in line with OpenAI's official
recommendations. This move is motivated by the significant enhancements
introduced in version 1.0.0, which OpenAI details
[here](openai/openai-python#742).

Key improvements include:
- A complete rewrite of the library for robustness and error resilience.
- Introduction of explicit client instantiation, replacing the global
default and offering more flexible SDK interaction.

After upgrading to v1.16.2 (the latest available), I tested the
integration with my API key and confirmed full functionality. This
upgrade aligns oss-fuzz-gen with current best practices and ensures
compatibility with future developments in AI technologies.

Hope it helps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants