Skip to content

Add restricted_shell allowed_paths for rshell#48127

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 8 commits intomainfrom
dd/par-rshell-restricted-shell-allowed-paths
Mar 20, 2026
Merged

Add restricted_shell allowed_paths for rshell#48127
gh-worker-dd-mergequeue-cf854d[bot] merged 8 commits intomainfrom
dd/par-rshell-restricted-shell-allowed-paths

Conversation

@AlexandreYang
Copy link
Copy Markdown
Member

@AlexandreYang AlexandreYang commented Mar 20, 2026

What does this PR do?

Add restricted shell allowed path config

Motivation

The rshell runner currently hardcodes allowed paths (/var/log) in code, which makes policy changes require code changes and deploys. This change moves path policy into configuration so operators can manage rshell filesystem access through datadog.yaml and environment variables.

Describe how you validated your changes

  • go test ./pkg/privateactionrunner/bundles/remoteaction/rshell
  • go test -tags test ./pkg/config/setup -run 'TestPrivateActionRunner|TestRestrictedShell'
  • go test -tags test ./pkg/privateactionrunner/adapters/config -run 'TestFromDDConfig|TestFromDDConfigRestrictedShellAllowedPaths'
  • Format tool run (goimports/gofmt on changed Go files)
  • Lint tool run (golangci-lint execution attempted, but failed due to local toolchain mismatch: golangci-lint built with go1.24 while repo targets go1.25.7)

Additional Notes

This preserves existing rshell default behavior by defaulting restricted_shell.allowed_paths to /var/log.


PR by Bits - View session in Datadog

Comment @DataDog to request changes

@datadog-prod-us1-6
Copy link
Copy Markdown

datadog-prod-us1-6 Bot commented Mar 20, 2026

View session in Datadog

Bits Dev status: ❌ Error

Comment @DataDog to request changes

@datadog-datadog-prod-us1
Copy link
Copy Markdown
Contributor

I can only run on private repositories.

@github-actions github-actions Bot added the medium review PR review might take time label Mar 20, 2026
@AlexandreYang AlexandreYang marked this pull request as draft March 20, 2026 15:38
Comment thread pkg/config/setup/privateactionrunner.go Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f20b449601

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkg/config/setup/privateactionrunner.go Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 20, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@agent-platform-auto-pr
Copy link
Copy Markdown
Contributor

agent-platform-auto-pr Bot commented Mar 20, 2026

Files inventory check summary

File checks results against ancestor ec07bee7:

Results for datadog-agent_7.79.0~devel.git.40.7dd7937.pipeline.103805615-1_amd64.deb:

Detected file changes:

1 Added files:

  • opt/datadog-agent/LICENSES/cacerts-MPL-2.0.txt (16.33 KiB)

1 Removed files:

  • opt/datadog-agent/LICENSES/cacerts-index.815ca599c9df.txt (16.33 KiB)

@AlexandreYang AlexandreYang added the changelog/no-changelog No changelog entry needed label Mar 20, 2026
@AlexandreYang AlexandreYang marked this pull request as ready for review March 20, 2026 16:16
@AlexandreYang
Copy link
Copy Markdown
Member Author

@codex review

@AlexandreYang AlexandreYang force-pushed the dd/par-rshell-restricted-shell-allowed-paths branch from e84e2c2 to b8e6072 Compare March 20, 2026 16:24
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b7ba0d5c2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkg/privateactionrunner/bundles/remoteaction/rshell/run_command.go
Comment thread pkg/config/setup/privateactionrunner.go
@AlexandreYang AlexandreYang added the qa/done QA done before merge and regressions are covered by tests label Mar 20, 2026
AlexandreYang and others added 2 commits March 20, 2026 17:52
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@agent-platform-auto-pr
Copy link
Copy Markdown
Contributor

agent-platform-auto-pr Bot commented Mar 20, 2026

Static quality checks

✅ Please find below the results from static quality gates
Comparison made with ancestor 20aa50f
📊 Static Quality Gates Dashboard
🔗 SQG Job

Successful checks

Info

Quality gate Change Size (prev → curr → max)
agent_deb_amd64 +3.97 KiB (0.00% increase) 751.451 → 751.454 → 753.380
agent_deb_amd64_fips +4.0 KiB (0.00% increase) 708.421 → 708.425 → 713.900
agent_heroku_amd64 +4.0 KiB (0.00% increase) 313.041 → 313.045 → 320.580
agent_rpm_amd64 +3.97 KiB (0.00% increase) 751.434 → 751.438 → 753.350
agent_rpm_amd64_fips +4.0 KiB (0.00% increase) 708.405 → 708.409 → 713.880
agent_rpm_arm64 +7.97 KiB (0.00% increase) 729.793 → 729.801 → 735.290
agent_rpm_arm64_fips +8.0 KiB (0.00% increase) 689.769 → 689.777 → 696.840
agent_suse_amd64 +3.97 KiB (0.00% increase) 751.434 → 751.438 → 753.350
agent_suse_amd64_fips +4.0 KiB (0.00% increase) 708.405 → 708.409 → 713.880
agent_suse_arm64 +7.97 KiB (0.00% increase) 729.793 → 729.801 → 735.290
agent_suse_arm64_fips +8.0 KiB (0.00% increase) 689.769 → 689.777 → 696.840
docker_agent_amd64 +3.96 KiB (0.00% increase) 811.758 → 811.761 → 815.700
docker_agent_arm64 +7.97 KiB (0.00% increase) 814.879 → 814.886 → 821.970
docker_agent_jmx_amd64 +3.97 KiB (0.00% increase) 1002.673 → 1002.677 → 1006.580
docker_agent_jmx_arm64 +7.97 KiB (0.00% increase) 994.573 → 994.580 → 1001.570
15 successful checks with minimal change (< 2 KiB)
Quality gate Current Size
docker_cluster_agent_amd64 205.316 MiB
docker_cluster_agent_arm64 219.677 MiB
docker_cws_instrumentation_amd64 7.142 MiB
docker_cws_instrumentation_arm64 6.689 MiB
docker_dogstatsd_amd64 39.227 MiB
docker_dogstatsd_arm64 37.445 MiB
dogstatsd_deb_amd64 29.874 MiB
dogstatsd_deb_arm64 28.022 MiB
dogstatsd_rpm_amd64 29.874 MiB
dogstatsd_suse_amd64 29.874 MiB
iot_agent_deb_amd64 43.254 MiB
iot_agent_deb_arm64 40.305 MiB
iot_agent_deb_armhf 41.048 MiB
iot_agent_rpm_amd64 43.255 MiB
iot_agent_suse_amd64 43.255 MiB
On-wire sizes (compressed)
Quality gate Change Size (prev → curr → max)
agent_deb_amd64 -64.54 KiB (0.04% reduction) 174.768 → 174.704 → 178.360
agent_deb_amd64_fips -4.44 KiB (0.00% reduction) 165.344 → 165.340 → 172.790
agent_heroku_amd64 neutral 74.960 MiB → 79.970
agent_rpm_amd64 +24.73 KiB (0.01% increase) 177.593 → 177.617 → 181.830
agent_rpm_amd64_fips +66.56 KiB (0.04% increase) 167.536 → 167.601 → 173.370
agent_rpm_arm64 -13.39 KiB (0.01% reduction) 159.533 → 159.520 → 163.060
agent_rpm_arm64_fips +41.11 KiB (0.03% increase) 151.368 → 151.408 → 156.170
agent_suse_amd64 +24.73 KiB (0.01% increase) 177.593 → 177.617 → 181.830
agent_suse_amd64_fips +66.56 KiB (0.04% increase) 167.536 → 167.601 → 173.370
agent_suse_arm64 -13.39 KiB (0.01% reduction) 159.533 → 159.520 → 163.060
agent_suse_arm64_fips +41.11 KiB (0.03% increase) 151.368 → 151.408 → 156.170
docker_agent_amd64 neutral 268.085 MiB → 272.480
docker_agent_arm64 -17.83 KiB (0.01% reduction) 255.295 → 255.277 → 261.060
docker_agent_jmx_amd64 -6.54 KiB (0.00% reduction) 336.741 → 336.735 → 341.100
docker_agent_jmx_arm64 -3.46 KiB (0.00% reduction) 319.923 → 319.920 → 325.620
docker_cluster_agent_amd64 neutral 71.931 MiB → 72.920
docker_cluster_agent_arm64 +4.51 KiB (0.01% increase) 67.502 → 67.507 → 68.220
docker_cws_instrumentation_amd64 neutral 2.999 MiB → 3.330
docker_cws_instrumentation_arm64 neutral 2.729 MiB → 3.090
docker_dogstatsd_amd64 neutral 15.168 MiB → 15.820
docker_dogstatsd_arm64 neutral 14.484 MiB → 14.830
dogstatsd_deb_amd64 +2.11 KiB (0.03% increase) 7.887 → 7.889 → 8.790
dogstatsd_deb_arm64 neutral 6.774 MiB → 7.710
dogstatsd_rpm_amd64 neutral 7.900 MiB → 8.800
dogstatsd_suse_amd64 neutral 7.900 MiB → 8.800
iot_agent_deb_amd64 neutral 11.393 MiB → 12.040
iot_agent_deb_arm64 neutral 9.698 MiB → 10.450
iot_agent_deb_armhf -2.58 KiB (0.03% reduction) 9.934 → 9.932 → 10.620
iot_agent_rpm_amd64 -3.14 KiB (0.03% reduction) 11.413 → 11.410 → 12.060
iot_agent_suse_amd64 -3.14 KiB (0.03% reduction) 11.413 → 11.410 → 12.060

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f319c236e2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkg/config/setup/privateactionrunner.go Outdated
PARHttpAllowImdsEndpoint = "private_action_runner.http_allow_imds_endpoint"

// Restricted Shell
PARRestrictedShellAllowedPaths = "restricted_shell.allowed_paths"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep rshell path setting in private_action_runner namespace

This key is registered as restricted_shell.allowed_paths, so env binding resolves to DD_RESTRICTED_SHELL_ALLOWED_PATHS instead of the DD_PRIVATE_ACTION_RUNNER_* pattern used by the rest of this component. In environments that configure PAR settings uniformly (or place values under private_action_runner: in datadog.yaml), this override is silently ignored and rshell continues with the default /var/log policy. Namespace the key under private_action_runner (or bind both env names) to avoid hard-to-diagnose misconfiguration.

Useful? React with 👍 / 👎.

@cit-pr-commenter-54b7da
Copy link
Copy Markdown

cit-pr-commenter-54b7da Bot commented Mar 20, 2026

Regression Detector

Regression Detector Results

Metrics dashboard
Target profiles
Run ID: e264b618-0c30-486c-a486-97d9d01d4088

Baseline: a5b6d12
Comparison: 8507a46
Diff

Optimization Goals: ✅ No significant changes detected

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI trials links
docker_containers_cpu % cpu utilization +0.38 [-2.65, +3.41] 1 Logs

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
quality_gate_metrics_logs memory utilization +0.93 [+0.69, +1.17] 1 Logs bounds checks dashboard
docker_containers_memory memory utilization +0.70 [+0.62, +0.77] 1 Logs
file_tree memory utilization +0.43 [+0.38, +0.49] 1 Logs
docker_containers_cpu % cpu utilization +0.38 [-2.65, +3.41] 1 Logs
uds_dogstatsd_20mb_12k_contexts_20_senders memory utilization +0.32 [+0.26, +0.38] 1 Logs
ddot_metrics_sum_cumulative memory utilization +0.07 [-0.07, +0.22] 1 Logs
file_to_blackhole_100ms_latency egress throughput +0.05 [-0.04, +0.15] 1 Logs
uds_dogstatsd_to_api_v3 ingress throughput +0.01 [-0.20, +0.22] 1 Logs
file_to_blackhole_0ms_latency egress throughput +0.01 [-0.52, +0.54] 1 Logs
otlp_ingest_metrics memory utilization +0.01 [-0.15, +0.17] 1 Logs
ddot_metrics_sum_delta memory utilization +0.00 [-0.17, +0.17] 1 Logs
tcp_dd_logs_filter_exclude ingress throughput -0.00 [-0.11, +0.11] 1 Logs
uds_dogstatsd_to_api ingress throughput -0.01 [-0.20, +0.19] 1 Logs
file_to_blackhole_500ms_latency egress throughput -0.01 [-0.40, +0.38] 1 Logs
quality_gate_idle memory utilization -0.03 [-0.08, +0.02] 1 Logs bounds checks dashboard
quality_gate_idle_all_features memory utilization -0.09 [-0.13, -0.06] 1 Logs bounds checks dashboard
ddot_metrics memory utilization -0.11 [-0.29, +0.06] 1 Logs
file_to_blackhole_1000ms_latency egress throughput -0.13 [-0.56, +0.30] 1 Logs
otlp_ingest_logs memory utilization -0.30 [-0.41, -0.19] 1 Logs
ddot_metrics_sum_cumulativetodelta_exporter memory utilization -0.34 [-0.56, -0.12] 1 Logs
ddot_logs memory utilization -0.44 [-0.49, -0.38] 1 Logs
tcp_syslog_to_blackhole ingress throughput -0.74 [-0.91, -0.58] 1 Logs
quality_gate_logs % cpu utilization -2.46 [-4.04, -0.88] 1 Logs bounds checks dashboard

Bounds Checks: ❌ Failed

perf experiment bounds_check_name replicates_passed observed_value links
docker_containers_cpu simple_check_run 10/10 690 ≥ 26
docker_containers_memory memory_usage 10/10 273.62MiB ≤ 370MiB
docker_containers_memory simple_check_run 10/10 701 ≥ 26
file_to_blackhole_0ms_latency memory_usage 10/10 0.19GiB ≤ 1.20GiB
file_to_blackhole_0ms_latency missed_bytes 10/10 0B = 0B
file_to_blackhole_1000ms_latency memory_usage 10/10 0.23GiB ≤ 1.20GiB
file_to_blackhole_1000ms_latency missed_bytes 10/10 0B = 0B
file_to_blackhole_100ms_latency memory_usage 10/10 0.20GiB ≤ 1.20GiB
file_to_blackhole_100ms_latency missed_bytes 10/10 0B = 0B
file_to_blackhole_500ms_latency memory_usage 10/10 0.22GiB ≤ 1.20GiB
file_to_blackhole_500ms_latency missed_bytes 10/10 0B = 0B
quality_gate_idle intake_connections 10/10 3 = 3 bounds checks dashboard
quality_gate_idle memory_usage 9/10 175.43MiB > 175MiB bounds checks dashboard
quality_gate_idle_all_features intake_connections 10/10 2 ≤ 3 bounds checks dashboard
quality_gate_idle_all_features memory_usage 10/10 504.52MiB ≤ 550MiB bounds checks dashboard
quality_gate_logs intake_connections 10/10 4 ≤ 6 bounds checks dashboard
quality_gate_logs memory_usage 10/10 205.75MiB ≤ 220MiB bounds checks dashboard
quality_gate_logs missed_bytes 10/10 0B = 0B bounds checks dashboard
quality_gate_metrics_logs cpu_usage 10/10 380.92 ≤ 2000 bounds checks dashboard
quality_gate_metrics_logs intake_connections 10/10 4 ≤ 6 bounds checks dashboard
quality_gate_metrics_logs memory_usage 10/10 406.21MiB ≤ 475MiB bounds checks dashboard
quality_gate_metrics_logs missed_bytes 10/10 0B = 0B bounds checks dashboard

Explanation

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

CI Pass/Fail Decision

Failed. Some Quality Gates were violated.

  • quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_idle, bounds check memory_usage: 9/10 replicas passed. Failed 1 which is > 0. Gate FAILED.
  • quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.

@AlexandreYang
Copy link
Copy Markdown
Member Author

/merge

@gh-worker-devflow-routing-ef8351
Copy link
Copy Markdown

gh-worker-devflow-routing-ef8351 Bot commented Mar 20, 2026

View all feedbacks in Devflow UI.

2026-03-20 17:13:24 UTC ℹ️ Start processing command /merge


2026-03-20 17:13:30 UTC ℹ️ MergeQueue: waiting for PR to be ready

This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
It will be added to the queue as soon as checks pass and/or get approvals. View in MergeQueue UI.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2026-03-20 17:54:05 UTC ℹ️ MergeQueue: merge request added to the queue

The expected merge time in main is approximately 2h (p90).


2026-03-20 18:35:10 UTCMergeQueue: The build pipeline failed for this merge request

Build pipeline has failing jobs for 1b74f75:

⚠️ Do NOT retry failed jobs directly (why?).

What to do next?

  • Investigate the failures and when ready, re-add your pull request to the queue!
  • If your PR checks are green, try to rebase/merge. It might be because the CI run is a bit old.
  • Any question, go check the FAQ.

@AlexandreYang
Copy link
Copy Markdown
Member Author

/merge

@gh-worker-devflow-routing-ef8351
Copy link
Copy Markdown

gh-worker-devflow-routing-ef8351 Bot commented Mar 20, 2026

View all feedbacks in Devflow UI.

2026-03-20 19:15:18 UTC ℹ️ Start processing command /merge


2026-03-20 19:15:24 UTC ℹ️ MergeQueue: waiting for PR to be ready

This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
It will be added to the queue as soon as checks pass and/or get approvals. View in MergeQueue UI.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2026-03-20 20:00:06 UTC ℹ️ MergeQueue: merge request added to the queue

The expected merge time in main is approximately 2h (p90).


2026-03-20 20:39:03 UTC ℹ️ MergeQueue: This merge request was merged

@AlexandreYang AlexandreYang removed the request for review from embeaken March 20, 2026 19:15
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot merged commit 8507a46 into main Mar 20, 2026
227 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot deleted the dd/par-rshell-restricted-shell-allowed-paths branch March 20, 2026 20:39
@github-actions github-actions Bot added this to the 7.79.0 milestone Mar 20, 2026
AlexandreYang added a commit that referenced this pull request Mar 27, 2026
<!-- dd-meta {"pullId":"c2960337-1304-4d38-b522-5285faa7a280","source":"chat","resourceId":"e1770736-c3aa-4752-a8c6-77212765f0c7","workflowId":"a58e22a0-26bb-4586-bcd6-bd4c67edd5e1","codeChangeId":"a58e22a0-26bb-4586-bcd6-bd4c67edd5e1","sourceType":"slack"} -->

Add restricted shell allowed path config

The rshell runner currently hardcodes allowed paths (`/var/log`) in code, which makes policy changes require code changes and deploys. This change moves path policy into configuration so operators can manage rshell filesystem access through `datadog.yaml` and environment variables.

- `go test ./pkg/privateactionrunner/bundles/remoteaction/rshell`
- `go test -tags test ./pkg/config/setup -run 'TestPrivateActionRunner|TestRestrictedShell'`
- `go test -tags test ./pkg/privateactionrunner/adapters/config -run 'TestFromDDConfig|TestFromDDConfigRestrictedShellAllowedPaths'`
- `Format` tool run (goimports/gofmt on changed Go files)
- `Lint` tool run (golangci-lint execution attempted, but failed due to local toolchain mismatch: golangci-lint built with go1.24 while repo targets go1.25.7)

This preserves existing rshell default behavior by defaulting `restricted_shell.allowed_paths` to `/var/log`.

---

PR by Bits - [View session in Datadog](https://app.datadoghq.com/code/e1770736-c3aa-4752-a8c6-77212765f0c7)

Comment @DataDog to request changes

Co-authored-by: datadog-datadog-prod-us1[bot] <88084959+datadog-datadog-prod-us1[bot]@users.noreply.github.com>
Co-authored-by: alexandre.yang <alexandre.yang@datadoghq.com>
@AlexandreYang AlexandreYang added the backport/7.78.x Automatically create a backport PR to the 7.78.x branch once the PR is merged label Mar 27, 2026
AlexandreYang added a commit that referenced this pull request Mar 27, 2026
<!-- dd-meta {"pullId":"c2960337-1304-4d38-b522-5285faa7a280","source":"chat","resourceId":"e1770736-c3aa-4752-a8c6-77212765f0c7","workflowId":"a58e22a0-26bb-4586-bcd6-bd4c67edd5e1","codeChangeId":"a58e22a0-26bb-4586-bcd6-bd4c67edd5e1","sourceType":"slack"} -->

Add restricted shell allowed path config

The rshell runner currently hardcodes allowed paths (`/var/log`) in code, which makes policy changes require code changes and deploys. This change moves path policy into configuration so operators can manage rshell filesystem access through `datadog.yaml` and environment variables.

- `go test ./pkg/privateactionrunner/bundles/remoteaction/rshell`
- `go test -tags test ./pkg/config/setup -run 'TestPrivateActionRunner|TestRestrictedShell'`
- `go test -tags test ./pkg/privateactionrunner/adapters/config -run 'TestFromDDConfig|TestFromDDConfigRestrictedShellAllowedPaths'`
- `Format` tool run (goimports/gofmt on changed Go files)
- `Lint` tool run (golangci-lint execution attempted, but failed due to local toolchain mismatch: golangci-lint built with go1.24 while repo targets go1.25.7)

This preserves existing rshell default behavior by defaulting `restricted_shell.allowed_paths` to `/var/log`.

---

PR by Bits - [View session in Datadog](https://app.datadoghq.com/code/e1770736-c3aa-4752-a8c6-77212765f0c7)

Comment @DataDog to request changes

Co-authored-by: datadog-datadog-prod-us1[bot] <88084959+datadog-datadog-prod-us1[bot]@users.noreply.github.com>
Co-authored-by: alexandre.yang <alexandre.yang@datadoghq.com>
gh-worker-dd-mergequeue-cf854d Bot pushed a commit that referenced this pull request Mar 27, 2026
## Backport:

#48127
#48462

## Motivation:

Need to start pentest for the Restricted Shell feature.

The backport is low risk since those PAR action are behind FF.

Co-authored-by: ali.benabdallah <ali.benabdallah@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/7.78.x Automatically create a backport PR to the 7.78.x branch once the PR is merged Bits AI changelog/no-changelog No changelog entry needed internal Identify a non-fork PR medium review PR review might take time qa/done QA done before merge and regressions are covered by tests team/action-platform team/agent-configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants