Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions netbox/core/data_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def _wrapper(cls):

class DataBackend:
parameters = {}
sensitive_parameters = []

def __init__(self, url, **kwargs):
self.url = url
Expand Down Expand Up @@ -86,6 +87,7 @@ class GitBackend(DataBackend):
widget=forms.TextInput(attrs={'class': 'form-control'})
)
}
sensitive_parameters = ['password']

@contextmanager
def fetch(self):
Expand Down Expand Up @@ -135,6 +137,7 @@ class S3Backend(DataBackend):
widget=forms.TextInput(attrs={'class': 'form-control'})
),
}
sensitive_parameters = ['aws_secret_access_key']

REGION_REGEX = r's3\.([a-z0-9-]+)\.amazonaws\.com'

Expand Down
6 changes: 5 additions & 1 deletion netbox/templates/core/datasource.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ <h5 class="card-header">Backend</h5>
{% for name, field in object.get_backend.parameters.items %}
<tr>
<th scope="row">{{ field.label }}</th>
<td>{{ object.parameters|get_key:name|placeholder }}</td>
{% if name in object.get_backend.sensitive_parameters and not perms.core.change_datasource %}
<td>********</td>
{% else %}
<td>{{ object.parameters|get_key:name|placeholder }}</td>
{% endif %}
</tr>
{% empty %}
<tr>
Expand Down