Skip to content

[DEV-IMP] Add error logging and hide sensitive configs from individual jobs#98

Open
moda20 wants to merge 3 commits into
devfrom
improvement/add-a-log-for-errors-loading-jobs
Open

[DEV-IMP] Add error logging and hide sensitive configs from individual jobs#98
moda20 wants to merge 3 commits into
devfrom
improvement/add-a-log-for-errors-loading-jobs

Conversation

@moda20
Copy link
Copy Markdown
Owner

@moda20 moda20 commented May 25, 2026

Improvements:

  • [Error handling] : Added sysLog error logging when job initialization fails to improve debugging visibility
  • [security] : Introduced job_hidden property to use when passing configuration to jobs, without the sensitive data being decrypted
  • [refactoring] : Added proxies to system categories map for better config organization

Notes

  • [impact] : The job_hidden property ensures that sensitive configuration like MASTER_ENCRYPTION_KEY is not passed to job execution contexts, improving security isolation

How Has This Been Tested?

Related Issues

Screenshots (if applicable)

Additional Context

Summary by CodeRabbit

  • New Features

    • Added support for marking sensitive configuration properties as job-hidden, preventing them from being passed to job processes.
  • Bug Fixes

    • Improved error logging when job startup fails by capturing and recording detailed error context.
  • Chores

    • Minor code formatting improvements.

Review Change Stack

moda20 added 2 commits May 25, 2026 15:45
…nd-handing

[MAIN-Feat] Automated proxy testing system with intelligent selection strategies
Update config shared with jobs to have no sensitive data (explicitly hidden from jobs, encrypted values)

small improvement for config categorization for the frontend
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d8e22b8a-9108-4fe1-9074-f71f66ce6169

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improvement/add-a-log-for-errors-loading-jobs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@moda20 moda20 changed the title [DEV-IMP] Add error logging and improve config security for jobs [DEV-IMP] Add error logging and hide sensitive configs from individual jobs May 25, 2026
… when converting schema to job accessible version
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/config/config.service.ts`:
- Around line 110-116: The filter using withJobHiddenProperties is ineffective
because propertiesValues[pvk].job_hidden is never set from schema metadata;
update the code that builds propertiesValues (or the schema parsing path) to
populate the job_hidden flag from the schema's metadata (e.g., copy
schemaField.metadata.job_hidden or schemaField.jobHidden into
propertiesValues[pvk].job_hidden) so the conditional in the block referencing
withJobHiddenProperties, propertiesValues, pvk, and job_hidden can correctly
detect and delete job-hidden entries; ensure the property name matches the
schema source and add a unit test for the removal behavior when
withJobHiddenProperties is false.

In `@src/initialization/jobsManager.ts`:
- Line 63: The error log builds a message using JSON.stringify(d, null, 4) which
can throw on circular structures; update the logging in the job start/failure
path (the code that calls job.getName() and uses variable d) to never call
JSON.stringify directly on untrusted objects — wrap serialization in a safe
helper (e.g., try/catch around JSON.stringify with a fallback like util.inspect
or a JSON-safe serializer, or add a safeStringify(d) utility that returns a
non-throwing string), and use that helper when composing the message so the
logger cannot fail due to circular data.

In `@src/jobConsumer/jobConsumer.ts`:
- Around line 247-252: The job-facing options.config currently passes full
flattened property objects via
ObjectifyFlattenedProperties(getConvictSchemaProperties(...)), causing leaves to
be { value, ... } instead of primitives; change the construction so
options.config contains raw values (the previous shape) by extracting each
property's primitive value (e.g., use config.getProperties() or map the output
of getConvictSchemaProperties(...) to its .value for each leaf) before calling
ObjectifyFlattenedProperties or replace ObjectifyFlattenedProperties input with
the flattened values, updating references to ObjectifyFlattenedProperties,
getConvictSchemaProperties, and options.config accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 46e10f03-b16a-400e-bd67-36b05a037db0

📥 Commits

Reviewing files that changed from the base of the PR and between 289aee3 and 51c7017.

📒 Files selected for processing (6)
  • src/config/config.service.ts
  • src/config/config.ts
  • src/initialization/jobsManager.ts
  • src/jobConsumer/jobConsumer.ts
  • src/types/models/config.ts
  • src/utils/convictUtils.ts

Comment thread src/config/config.service.ts
Comment thread src/initialization/jobsManager.ts
Comment on lines +247 to +252
config: ObjectifyFlattenedProperties(
getConvictSchemaProperties({
encryptedValues: false,
withJobHiddenProperties: false,
}),
),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Job-facing options.config shape changed from values to metadata objects.

At Line 247, ObjectifyFlattenedProperties receives full flattened property objects, so leaves become { value, ... } instead of raw values (previously from config.getProperties()). This can break existing jobs that read primitives.

Suggested fix
-        config: ObjectifyFlattenedProperties(
-          getConvictSchemaProperties({
-            encryptedValues: false,
-            withJobHiddenProperties: false,
-          }),
-        ),
+        config: ObjectifyFlattenedProperties(
+          Object.fromEntries(
+            Object.entries(
+              getConvictSchemaProperties({
+                encryptedValues: false,
+                withJobHiddenProperties: false,
+              }),
+            ).map(([k, v]) => [k, { value: v.value }]),
+          ),
+        ),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/jobConsumer/jobConsumer.ts` around lines 247 - 252, The job-facing
options.config currently passes full flattened property objects via
ObjectifyFlattenedProperties(getConvictSchemaProperties(...)), causing leaves to
be { value, ... } instead of primitives; change the construction so
options.config contains raw values (the previous shape) by extracting each
property's primitive value (e.g., use config.getProperties() or map the output
of getConvictSchemaProperties(...) to its .value for each leaf) before calling
ObjectifyFlattenedProperties or replace ObjectifyFlattenedProperties input with
the flattened values, updating references to ObjectifyFlattenedProperties,
getConvictSchemaProperties, and options.config accordingly.

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.

1 participant